]>
diplodocus.org Git - nmh/blob - test/format/test-functions
3 # Test of various (well, start with one) function escapes.
7 if test -z "${MH_OBJ_DIR}"; then
8 srcdir
=`dirname "$0"`/..
/..
9 MH_OBJ_DIR
=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
12 .
"$MH_OBJ_DIR/test/common.sh"
15 expected
="$MH_TEST_DIR/test-functions$$.expected"
16 actual
="$MH_TEST_DIR/test-functions$$.actual"
18 # check sday when day of week is specified
19 start_test
"sday when day of week is specified"
20 printf '1\n' >"$expected"
21 fmttest
-raw -format '%(sday{text})' 'Fri Sep 12 20:02 2014' >"$actual"
22 check
"$expected" "$actual"
24 # check sday when day of week is not specified
25 start_test
"sday when day of week is not specified"
26 printf '0\n' >"$expected"
27 fmttest
-raw -format '%(sday{text})' 'Sep 12 20:02 2014' >"$actual"
28 check
"$expected" "$actual"
30 # check negative number, without padding
31 start_test
"negative number, without padding"
32 printf '%s\n' ' -42' >"$expected"
33 fmttest
-raw -format '%4(minus -42)' 0 >"$actual"
34 check
"$expected" "$actual"
36 # check negative number, with padding
37 start_test
"negative number, with padding"
38 # Output was "0-42" with nmh 1.6 and earlier.
39 printf '%s\n' -042 >"$expected"
40 fmttest
-raw -format '%04(minus -42)' 0 >"$actual"
41 check
"$expected" "$actual"
45 printf '%s\n' 42 >"$expected"
46 fmttest
-raw -format '%(void(num 7))%(multiply 6)' 0 >"$actual"
47 check
"$expected" "$actual"