2008-02-09 11:18:42 +05:30
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
|
2010-08-16 23:44:46 +05:30
|
|
|
# Licensed under GPLv2, see file LICENSE in this source tree.
|
2008-02-09 11:18:42 +05:30
|
|
|
|
2009-11-05 05:11:22 +05:30
|
|
|
. ./testing.sh
|
2008-02-09 11:18:42 +05:30
|
|
|
|
2008-07-19 13:45:13 +05:30
|
|
|
# testing "test name" "command" "expected result" "file input" "stdin"
|
2008-02-09 11:18:42 +05:30
|
|
|
# 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
|
|
|
|
|
2008-07-19 13:45:13 +05:30
|
|
|
testing "test: should be false (1)" \
|
|
|
|
"busybox test; echo \$?" \
|
|
|
|
"1\n" \
|
|
|
|
"" ""
|
|
|
|
|
|
|
|
testing "test '': should be false (1)" \
|
|
|
|
"busybox test ''; echo \$?" \
|
|
|
|
"1\n" \
|
|
|
|
"" ""
|
|
|
|
|
2009-07-17 04:29:26 +05:30
|
|
|
testing "test !: should be true (0)" \
|
|
|
|
"busybox test !; echo \$?" \
|
|
|
|
"0\n" \
|
|
|
|
"" ""
|
|
|
|
|
2008-07-19 13:45:13 +05:30
|
|
|
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" \
|
|
|
|
"" ""
|
|
|
|
|
2009-07-17 04:29:26 +05:30
|
|
|
testing "test a -a !: should be true (0)" \
|
|
|
|
"busybox test a -a !; echo \$?" \
|
|
|
|
"0\n" \
|
|
|
|
"" ""
|
|
|
|
|
2008-07-19 13:45:13 +05:30
|
|
|
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)" \
|
2008-02-09 11:18:42 +05:30
|
|
|
"busybox test ! a = b -a ! c = c; echo \$?" \
|
|
|
|
"1\n" \
|
2008-07-19 13:45:13 +05:30
|
|
|
"" ""
|
2008-02-09 11:18:42 +05:30
|
|
|
|
2008-07-19 13:45:13 +05:30
|
|
|
testing "test ! a = b -a ! c = d: should be true (0)" \
|
2008-02-09 11:18:42 +05:30
|
|
|
"busybox test ! a = b -a ! c = d; echo \$?" \
|
|
|
|
"0\n" \
|
2008-07-19 13:45:13 +05:30
|
|
|
"" ""
|
2008-02-09 11:18:42 +05:30
|
|
|
|
2014-07-01 17:46:28 +05:30
|
|
|
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" \
|
|
|
|
"" ""
|
|
|
|
|
2008-02-09 11:18:42 +05:30
|
|
|
exit $FAILCOUNT
|