Mercurial > hg > toybox
annotate scripts/test/tail.test @ 908:24ee3b04af3b
Tests for losetup.
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 27 May 2013 13:38:09 -0500 |
parents | 47edfc1a4983 |
children | ef72a16f4b3a |
rev | line source |
---|---|
540
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 #!/bin/bash |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 [ -f testing.sh ] && . testing.sh |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 #testing "name" "command" "result" "infile" "stdin" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 BIGTEST="one\ntwo\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten\neleven\n" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
8 echo -ne "$BIGTEST" > file1 |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
9 testing "tail" "tail && echo yes" "oneyes\n" "" "one" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
10 testing "tail file" "tail file1" \ |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
11 "two\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten\neleven\n" "" "" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
12 testing "tail -n in bounds" "tail -n 3 file1" "nine\nten\neleven\n" "" "" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 testing "tail -n out of bounds" "tail -n 999 file1" "$BIGTEST" "" "" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
14 testing "tail -n+ in bounds" "tail -n +3 file1" \ |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
15 "three\nfour\nfive\nsix\nseven\neight\nnine\nten\neleven\n" "" "" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
16 testing "tail -n+ outof bounds" "tail -n +999 file1" "" "" "" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
17 testing "tail -c in bounds" "tail -c 27 file1" \ |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
18 "even\neight\nnine\nten\neleven\n" "" "" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
19 testing "tail -c out of bounds" "tail -c 999 file1" "$BIGTEST" "" "" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
20 testing "tail -c+ in bounds" "tail -c +27 file1" \ |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
21 "x\nseven\neight\nnine\nten\neleven\n" "" "" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
22 testing "tail -c+ out of bonds" "tail -c +999 file1" "" "" "" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
23 rm file1 |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
24 |
619
47edfc1a4983
- Do not abort testing after running the sort tests
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
540
diff
changeset
|
25 testing "tail stdin no trailing newline" "tail -n 1 - " "c" "" "a\nb\nc" |
47edfc1a4983
- Do not abort testing after running the sort tests
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
540
diff
changeset
|
26 testing "tail file no trailing newline" "tail -n 1 input" "c" "a\nb\nc" "" |
47edfc1a4983
- Do not abort testing after running the sort tests
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
540
diff
changeset
|
27 |
540
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
28 optional TAIL_SEEK |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
29 testing "tail noseek -n in bounds" "tail -n 3" "nine\nten\neleven\n" \ |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
30 "" "$BIGTEST" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
31 testing "tail noseek -n out of bounds" "tail -n 999" "$BIGTEST" "" "$BIGTEST" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
32 testing "tail noseek -n+ in bounds" "tail -n +3" \ |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
33 "three\nfour\nfive\nsix\nseven\neight\nnine\nten\neleven\n" "" \ |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
34 "$BIGTEST" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
35 testing "tail noseek -n+ outof bounds" "tail -n +999" "" "" "$BIGTEST" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
36 testing "tail noseek -c in bounds" "tail -c 27" \ |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
37 "even\neight\nnine\nten\neleven\n" "" "$BIGTEST" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
38 testing "tail noseek -c out of bounds" "tail -c 999" "$BIGTEST" "" "$BIGTEST" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
39 testing "tail noseek -c+ in bounds" "tail -c +27" \ |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
40 "x\nseven\neight\nnine\nten\neleven\n" "" "$BIGTEST" |
c2f39708a4c4
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.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
41 testing "tail noseek -c+ out of bonds" "tail -c +999" "" "" "$BIGTEST" |