aboutsummaryrefslogtreecommitdiff
path: root/testsuite/test.tests
blob: 1c2edaf627cb3a66fa602fb1d2183ec5f6fa9190 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/sh

# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
# Licensed under GPLv2, see file LICENSE in this source tree.

. ./testing.sh

# testing "test name" "command" "expected result" "file input" "stdin"
#   file input will be file called "input"
#   test can create a file "actual" instead of writing to stdout

# Need to call 'busybox test', otherwise shell builtin is used

testing "test: should be false (1)" \
	"busybox test; echo \$?" \
	"1\n" \
	"" ""

testing "test '': should be false (1)" \
	"busybox test ''; echo \$?" \
	"1\n" \
	"" ""

testing "test !: should be true (0)" \
	"busybox test !; echo \$?" \
	"0\n" \
	"" ""

testing "test a: should be true (0)" \
	"busybox test a; echo \$?" \
	"0\n" \
	"" ""

testing "test --help: should be true (0)" \
	"busybox test --help; echo \$?" \
	"0\n" \
	"" ""

testing "test -f: should be true (0)" \
	"busybox test -f; echo \$?" \
	"0\n" \
	"" ""

testing "test ! -f: should be false (1)" \
	"busybox test ! -f; echo \$?" \
	"1\n" \
	"" ""

testing "test a = a: should be true (0)" \
	"busybox test a = a; echo \$?" \
	"0\n" \
	"" ""

testing "test -lt = -gt: should be false (1)" \
	"busybox test -lt = -gt; echo \$?" \
	"1\n" \
	"" ""

testing "test a -a !: should be true (0)" \
	"busybox test a -a !; echo \$?" \
	"0\n" \
	"" ""

testing "test -f = a -o b: should be true (0)" \
	"busybox test -f = a -o b; echo \$?" \
	"0\n" \
	"" ""

testing "test ! a = b -a ! c = c: should be false (1)" \
	"busybox test ! a = b -a ! c = c; echo \$?" \
	"1\n" \
	"" ""

testing "test ! a = b -a ! c = d: should be true (0)" \
	"busybox test ! a = b -a ! c = d; echo \$?" \
	"0\n" \
	"" ""

testing "test '!' = '!': should be true (0)" \
	"busybox test '!' = '!'; echo \$?" \
	"0\n" \
	"" ""

testing "test '(' = '(': should be true (0)" \
	"busybox test '(' = '('; echo \$?" \
	"0\n" \
	"" ""

testing "test '!' '!' = '!': should be false (1)" \
	"busybox test '!' '!' = '!'; echo \$?" \
	"1\n" \
	"" ""

testing "test '!' '(' = '(': should be false (1)" \
	"busybox test '!' '(' = '('; echo \$?" \
	"1\n" \
	"" ""

exit $FAILCOUNT