view tests/head.test @ 1700:3b62d24bfa27 draft

Separate 'userdel' from testing syntax. When I test toybox with toybox/tests/*.test scripts, I got many false FAILs from it. So, I tried to fix useradd.test file.
author Yeongdeok Suh <skyducks111@gmail.com>
date Wed, 18 Feb 2015 13:06:26 -0600
parents 8700cbe1cb29
children ebc947f27ef3
line wrap: on
line source

#!/bin/bash

[ -f testing.sh ] && . testing.sh

#testing "name" "command" "result" "infile" "stdin"

testing "head, stdin" "head -n 1 && echo yes" "one\nyes\n" "" "one\ntwo"
testing "head, stdin via -" "head -n 1 - && echo yes" "one\nyes\n" "" "one\ntwo"
testing "head, file" "head input -n 1 && echo yes" "one\nyes\n" "one\ntwo" ""
testing "head, default lines" "head" "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" "" "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12"

echo "foo
bar
baz" > file1
testing "head, multiple files" "head -n 2 input file1" "==> input <==\none\ntwo\n\n==> file1 <==\nfoo\nbar\n" "one\ntwo\nthree\n" ""
rm file1