blob: eeb07e00ac0b654bdff623b3b713a97668ef6847 [file] [log] [blame]
Timothy Elliott270366f2012-02-10 21:59:57 -08001#!/bin/bash
2
3[ -f testing.sh ] && . testing.sh
4
5#testing "name" "command" "result" "infile" "stdin"
6
7testing "head, stdin" "head -n 1 && echo yes" "one\nyes\n" "" "one\ntwo"
8testing "head, stdin via -" "head -n 1 - && echo yes" "one\nyes\n" "" "one\ntwo"
9testing "head, file" "head input -n 1 && echo yes" "one\nyes\n" "one\ntwo" ""
10testing "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"
11
12echo "foo
13bar
14baz" > file1
15testing "head, multiple files" "head -n 2 input file1" "==> input <==\none\ntwo\n\n==> file1 <==\nfoo\nbar\n" "one\ntwo\nthree\n" ""
16rm file1
17