3 # Tests for busybox applet itself.
4 # Copyright 2005 by Rob Landley <rob@landley.net>
5 # Licensed under GPL v2, see file LICENSE for details.
9 HELPDUMP=`true | busybox 2>&1 | cat`
11 # We need to test under calling the binary under other names.
14 testing "busybox --help busybox" "true | busybox --help busybox 2>&1 | cat" "$HELPDUMP\n\n" "" ""
17 ln -s `which busybox` busybox-suffix
18 for i in busybox ./busybox-suffix
20 # The gratuitous "\n"s are due to a shell idiosyncrasy:
21 # environment variables seem to strip trailing whitespace.
23 testing "" "$i" "$HELPDUMP\n\n" "" ""
25 testing "$i unknown" "$i unknown 2>&1" \
26 "unknown: applet not found\n" "" ""
28 testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n\n" "" ""
30 optional SHOW_USAGE CAT
31 testing "" "$i cat" "moo" "" "moo"
32 testing "$i --help cat" "$i --help cat 2>&1 | grep print" \
33 "Concatenate FILEs and print them to stdout\n" "" ""
36 testing "$i --help unknown" "$i --help unknown 2>&1" \
37 "unknown: applet not found\n" "" ""
41 ln -s `which busybox` unknown
43 testing "busybox as unknown name" "./unknown 2>&1" \
44 "unknown: applet not found\n" "" ""