Mercurial > hg > toybox
annotate tests/printf.test @ 1648:d27136a0811b draft
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 06 Jan 2015 15:06:51 -0600 |
parents | 35c035b7e3e0 |
children | 66bb2847993d |
rev | line source |
---|---|
1364
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
1 #!/bin/bash |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
2 |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
3 # Copyright 2013 Robin Mittal <robinmittal.it@gmail.com> |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
4 # Copyright 2013 Divya Kothari <divya.s.kothari@gmail.com> |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
5 |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
6 [ -f testing.sh ] && . testing.sh |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
7 |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
8 #testing "name" "command" "result" "infile" "stdin" |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
9 |
1648
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
10 # Disable shell builtin |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
11 PRINTF="$(which printf)" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
12 |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
13 testing "printf text" "$PRINTF TEXT" "TEXT" "" "" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
14 testing "printf escapes" "$PRINTF 'one\ntwo\n\v\t\r\f\e\b\athree'" \ |
1647
35c035b7e3e0
More printf cleanup, and test suite entries.
Rob Landley <rob@landley.net>
parents:
1485
diff
changeset
|
15 "one\ntwo\n\v\t\r\f\e\b\athree" "" "" |
1648
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
16 testing "printf %b escapes" "$PRINTF %b 'one\ntwo\n\v\t\r\f\e\b\athree'" \ |
1647
35c035b7e3e0
More printf cleanup, and test suite entries.
Rob Landley <rob@landley.net>
parents:
1485
diff
changeset
|
17 "one\ntwo\n\v\t\r\f\e\b\athree" "" "" |
1648
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
18 testing "printf null" "$PRINTF 'x\0y' | od -An -tx1" ' 78 00 79\n' "" "" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
19 testing "printf trailing slash" "$PRINTF 'abc\'" 'abc\' "" "" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
20 testing "printf octal" "$PRINTF ' \1\002\429\045x'" ' \001\002"9%x' "" "" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
21 testing "printf not octal" "$PRINTF '\9'" '\9' "" "" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
22 testing "printf hex" "$PRINTF 'A\x1b\x2B\x3Q\xa' | od -An -tx1" \ |
1647
35c035b7e3e0
More printf cleanup, and test suite entries.
Rob Landley <rob@landley.net>
parents:
1485
diff
changeset
|
23 ' 41 1b 2b 03 51 0a\n' "" "" |
1648
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
24 testing "printf " "$PRINTF '%x\n' 0x2a" "2a\n" "" "" |
1647
35c035b7e3e0
More printf cleanup, and test suite entries.
Rob Landley <rob@landley.net>
parents:
1485
diff
changeset
|
25 |
1648
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
26 testing "printf %d 42" "$PRINTF %d 42" "42" "" "" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
27 testing "printf %d 0x2a" "$PRINTF %d 0x2a" "42" "" "" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
28 testing "printf %d 052" "$PRINTF %d 052" "42" "" "" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
29 |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
30 testing "printf %s width precision" \ |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
31 "$PRINTF '%3s,%.3s,%10s,%10.3s' abcde fghij klmno pqrst" \ |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
32 "abcde,fgh, klmno, pqr" "" "" |
1647
35c035b7e3e0
More printf cleanup, and test suite entries.
Rob Landley <rob@landley.net>
parents:
1485
diff
changeset
|
33 |
1364
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
34 testing "printf '%5d%4d' 1 21 321 4321 54321" \ |
1648
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
35 "$PRINTF '%5d%4d' 1 21 321 4321 54321" " 1 21 321432154321 0" "" "" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
36 testing "printf '%c %c' 78 79" "$PRINTF '%c %c' 78 79" "7 7" "" "" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
37 testing "printf '%d %d' 78 79" "$PRINTF '%d %d' 78 79" "78 79" "" "" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
38 testing "printf '%f %f' 78 79" "$PRINTF '%f %f' 78 79" \ |
1364
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
39 "78.000000 79.000000" "" "" |
1648
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
40 testing "printf 'f f' 78 79" "$PRINTF 'f f' 78 79" "f f" "" "" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
41 testing "printf '%i %i' 78 79" "$PRINTF '%i %i' 78 79" "78 79" "" "" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
42 testing "printf '%o %o' 78 79" "$PRINTF '%o %o' 78 79" "116 117" "" "" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
43 testing "printf '%u %u' 78 79" "$PRINTF '%u %u' 78 79" "78 79" "" "" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
44 testing "printf '%u %u' -1 -2" "$PRINTF '%u %u' -1 -2" \ |
1364
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
45 "18446744073709551615 18446744073709551614" "" "" |
1648
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
46 testing "printf '%x %X' 78 79" "$PRINTF '%x %X' 78 79" "4e 4F" "" "" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
47 testing "printf '%g %G' 78 79" "$PRINTF '%g %G' 78 79" "78 79" "" "" |
d27136a0811b
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley <rob@landley.net>
parents:
1647
diff
changeset
|
48 testing "printf '%s %s' 78 79" "$PRINTF '%s %s' 78 79" "78 79" "" "" |