From 9486af88050062e59ca2e93d5c51f605737feac3 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Thu, 19 Sep 2019 15:06:51 -0700 Subject: [PATCH] tests: fix date --version printing junk, update interactive.fish --- tests/interactive.fish | 6 +++--- tests/test_util.fish | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/interactive.fish b/tests/interactive.fish index 63af32f41..3cac395f9 100644 --- a/tests/interactive.fish +++ b/tests/interactive.fish @@ -42,14 +42,14 @@ end function test_file set -l file $argv[1] echo -n "Testing file $file ... " - set starttime (date +%s) + set starttime (timestamp) begin set -lx TERM dumb expect -n -c 'source interactive.expect.rc' -f $file >$file.tmp.out 2>$file.tmp.err end set -l exit_status $status set -l res ok - set test_duration (math (date +%s) - $starttime) + set test_duration (delta $starttime) mv -f interactive.tmp.log $file.tmp.log diff $file.tmp.out $file.out >/dev/null @@ -58,7 +58,7 @@ function test_file set -l err_status $status if test $out_status -eq 0 -a $err_status -eq 0 -a $exit_status -eq 0 - say green "ok ($test_duration sec)" + say green "ok ($test_duration $unit)" # clean up tmp files rm -f $file.tmp.{err,out,log} return 0 diff --git a/tests/test_util.fish b/tests/test_util.fish index a4a2e400f..c49a9a38e 100644 --- a/tests/test_util.fish +++ b/tests/test_util.fish @@ -136,7 +136,7 @@ end # lame timer for program in {g,}date - if $program --version + if $program --version 1>/dev/null 2>/dev/null set milli $program set unit ms break @@ -145,13 +145,13 @@ for program in {g,}date end end -function timestamp -V milli +function timestamp set -q milli[1] and $milli +%s%3N or date +%s end -function delta -V milli +function delta set -q milli[1] and math "( "($milli +%s%3N)" - $argv[1])" or math (date +%s) - $starttime