diff options
Diffstat (limited to 'tests/custom/03_stdlib/20_time')
-rw-r--r-- | tests/custom/03_stdlib/20_time | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/custom/03_stdlib/20_time b/tests/custom/03_stdlib/20_time new file mode 100644 index 0000000..173ae09 --- /dev/null +++ b/tests/custom/03_stdlib/20_time @@ -0,0 +1,18 @@ +The `time()` function returns the current UNIX epoch time. + + +-- Testcase -- +{% + let timestamp = time(); + let testcmd = sprintf('t=$(date +%%s); [ $t -gt %d -a $t -lt %d ]', timestamp - 3, timestamp + 3); + + if (system(testcmd) == 0) + print("time() works\n"); + else + print("time() and `date +%s` yield different results!\n"); +%} +-- End -- + +-- Expect stdout -- +time() works +-- End -- |