X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/337b4e616e8f53ba06285b1645e1df9918ed5c16..4d5d51e903a42c23800540930244448c4aacae16:/test/format/test-functions?ds=inline diff --git a/test/format/test-functions b/test/format/test-functions index 9cfaeeeb..337da408 100755 --- a/test/format/test-functions +++ b/test/format/test-functions @@ -12,18 +12,39 @@ fi . "$MH_OBJ_DIR/test/common.sh" setup_test -expected="$MH_TEST_DIR/$$.expected" -actual="$MH_TEST_DIR/$$.actual" +expected="$MH_TEST_DIR/test-functions$$.expected" +actual="$MH_TEST_DIR/test-functions$$.actual" # check sday when day of week is specified -echo 1 >"$expected" +start_test "sday when day of week is specified" +printf '1\n' >"$expected" fmttest -raw -format '%(sday{text})' 'Fri Sep 12 20:02 2014' >"$actual" check "$expected" "$actual" # check sday when day of week is not specified -echo 0 >"$expected" +start_test "sday when day of week is not specified" +printf '0\n' >"$expected" fmttest -raw -format '%(sday{text})' 'Sep 12 20:02 2014' >"$actual" check "$expected" "$actual" +# check negative number, without padding +start_test "negative number, without padding" +printf '%s\n' ' -42' >"$expected" +fmttest -raw -format '%4(minus -42)' 0 >"$actual" +check "$expected" "$actual" + +# check negative number, with padding +start_test "negative number, with padding" +# Output was "0-42" with nmh 1.6 and earlier. +printf '%s\n' -042 >"$expected" +fmttest -raw -format '%04(minus -42)' 0 >"$actual" +check "$expected" "$actual" + +# check multiply +start_test "multiply" +printf '%s\n' 42 >"$expected" +fmttest -raw -format '%(void(num 7))%(multiply 6)' 0 >"$actual" +check "$expected" "$actual" +finish_test exit $failed