summaryrefslogtreecommitdiff
path: root/testsuite/printf.tests
blob: d6b60fb8c9da665355faa4878b9c57d46b2fbb2b (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
#!/bin/sh

set -e

. testing.sh

# Need this in order to not execute shell builtin
bb="busybox "

# testing "test name" "command" "expected result" "file input" "stdin"

testing "printf produce no further output 1" \
	"${bb}printf '\c' foo" \
	"" \
	"" ""

testing "printf produce no further output 2" \
	"${bb}printf '%s\c' foo \$HOME" \
	"foo" \
	"" ""

testing "printf repeatedly use pattern for each argv" \
	"${bb}printf '%s\n' foo \$HOME" \
	"foo\n$HOME\n" \
	"" ""

# Why ()s are necessary I have no idea...
testing "printf aborts on bare %" \
	"(${bb}printf '%' a b c) 2>&1; echo \$?" \
	"printf: invalid directive '%'\n""1\n" \
	"" ""

exit $FAILCOUNT