aboutsummaryrefslogtreecommitdiff
path: root/testsuite/time.tests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/time.tests')
-rwxr-xr-xtestsuite/time.tests37
1 files changed, 37 insertions, 0 deletions
diff --git a/testsuite/time.tests b/testsuite/time.tests
new file mode 100755
index 000000000..4e31b3868
--- /dev/null
+++ b/testsuite/time.tests
@@ -0,0 +1,37 @@
1#!/bin/sh
2
3# Copyright 2024 by Denys Vlasenko <vda.linux@googlemail.com>
4# Licensed under GPLv2, see file LICENSE in this source tree.
5
6. ./testing.sh
7
8# testing "description" "arguments" "result" "infile" "stdin"
9
10testing "time -f trailing backslash" \
11 "time -f 'abc\' sleep 0 2>&1" \
12 'abc?\sleep\n' '' ''
13# ^^^^^^^^^^^^^^ this is what GNU time version 1.9 prints
14
15testing "time -f trailing percent" \
16 "time -f 'abc%' sleep 0 2>&1" \
17 'abc?' '' ''
18
19testing "time -f undefined backslash" \
20 "time -f 'abc\^def' sleep 0 2>&1" \
21 'abc?\^def\n' '' ''
22
23testing "time -f undefined percent" \
24 "time -f 'abc%^def' sleep 0 2>&1" \
25 'abc?^def\n' '' ''
26
27testing "time -f backslash tab and newline" \
28 "time -f 'abc\ndef\txyz' sleep 0 2>&1" \
29 'abc
30def xyz
31' '' ''
32
33testing "time -f percent percent" \
34 "time -f 'abc%%def' sleep 0 2>&1" \
35 'abc%def\n' '' ''
36
37exit $FAILCOUNT