diff options
author | Rob Landley <rob@landley.net> | 2012-03-12 00:25:40 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2012-03-12 00:25:40 -0500 |
commit | 2c48247a01a19c709f693d649d8158bccb5fbf70 (patch) | |
tree | 53297abe89d56a745d1d9a9ddec161fc1adbae24 /scripts | |
parent | 9f4c1fd2de1b525b7638a79a8294f8d5b865bcc5 (diff) | |
download | toybox-2c48247a01a19c709f693d649d8158bccb5fbf70.tar.gz |
Redo tail to use optargs and optionally support lseek. Add support to optargs and llist.c, plus add a test suite entry. Still no -f support though.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/test/tail.test | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/test/tail.test b/scripts/test/tail.test new file mode 100755 index 00000000..2c8f3c2d --- /dev/null +++ b/scripts/test/tail.test @@ -0,0 +1,38 @@ +#!/bin/bash + +[ -f testing.sh ] && . testing.sh + +#testing "name" "command" "result" "infile" "stdin" + +BIGTEST="one\ntwo\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten\neleven\n" +echo -ne "$BIGTEST" > file1 +testing "tail" "tail && echo yes" "oneyes\n" "" "one" +testing "tail file" "tail file1" \ + "two\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten\neleven\n" "" "" +testing "tail -n in bounds" "tail -n 3 file1" "nine\nten\neleven\n" "" "" +testing "tail -n out of bounds" "tail -n 999 file1" "$BIGTEST" "" "" +testing "tail -n+ in bounds" "tail -n +3 file1" \ + "three\nfour\nfive\nsix\nseven\neight\nnine\nten\neleven\n" "" "" +testing "tail -n+ outof bounds" "tail -n +999 file1" "" "" "" +testing "tail -c in bounds" "tail -c 27 file1" \ + "even\neight\nnine\nten\neleven\n" "" "" +testing "tail -c out of bounds" "tail -c 999 file1" "$BIGTEST" "" "" +testing "tail -c+ in bounds" "tail -c +27 file1" \ + "x\nseven\neight\nnine\nten\neleven\n" "" "" +testing "tail -c+ out of bonds" "tail -c +999 file1" "" "" "" +rm file1 + +optional TAIL_SEEK +testing "tail noseek -n in bounds" "tail -n 3" "nine\nten\neleven\n" \ + "" "$BIGTEST" +testing "tail noseek -n out of bounds" "tail -n 999" "$BIGTEST" "" "$BIGTEST" +testing "tail noseek -n+ in bounds" "tail -n +3" \ + "three\nfour\nfive\nsix\nseven\neight\nnine\nten\neleven\n" "" \ + "$BIGTEST" +testing "tail noseek -n+ outof bounds" "tail -n +999" "" "" "$BIGTEST" +testing "tail noseek -c in bounds" "tail -c 27" \ + "even\neight\nnine\nten\neleven\n" "" "$BIGTEST" +testing "tail noseek -c out of bounds" "tail -c 999" "$BIGTEST" "" "$BIGTEST" +testing "tail noseek -c+ in bounds" "tail -c +27" \ + "x\nseven\neight\nnine\nten\neleven\n" "" "$BIGTEST" +testing "tail noseek -c+ out of bonds" "tail -c +999" "" "" "$BIGTEST" |