mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
tests: fix date --version printing junk, update interactive.fish
This commit is contained in:
parent
53a3533285
commit
9486af8805
@ -42,14 +42,14 @@ end
|
|||||||
function test_file
|
function test_file
|
||||||
set -l file $argv[1]
|
set -l file $argv[1]
|
||||||
echo -n "Testing file $file ... "
|
echo -n "Testing file $file ... "
|
||||||
set starttime (date +%s)
|
set starttime (timestamp)
|
||||||
begin
|
begin
|
||||||
set -lx TERM dumb
|
set -lx TERM dumb
|
||||||
expect -n -c 'source interactive.expect.rc' -f $file >$file.tmp.out 2>$file.tmp.err
|
expect -n -c 'source interactive.expect.rc' -f $file >$file.tmp.out 2>$file.tmp.err
|
||||||
end
|
end
|
||||||
set -l exit_status $status
|
set -l exit_status $status
|
||||||
set -l res ok
|
set -l res ok
|
||||||
set test_duration (math (date +%s) - $starttime)
|
set test_duration (delta $starttime)
|
||||||
mv -f interactive.tmp.log $file.tmp.log
|
mv -f interactive.tmp.log $file.tmp.log
|
||||||
|
|
||||||
diff $file.tmp.out $file.out >/dev/null
|
diff $file.tmp.out $file.out >/dev/null
|
||||||
@ -58,7 +58,7 @@ function test_file
|
|||||||
set -l err_status $status
|
set -l err_status $status
|
||||||
|
|
||||||
if test $out_status -eq 0 -a $err_status -eq 0 -a $exit_status -eq 0
|
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
|
# clean up tmp files
|
||||||
rm -f $file.tmp.{err,out,log}
|
rm -f $file.tmp.{err,out,log}
|
||||||
return 0
|
return 0
|
||||||
|
@ -136,7 +136,7 @@ end
|
|||||||
|
|
||||||
# lame timer
|
# lame timer
|
||||||
for program in {g,}date
|
for program in {g,}date
|
||||||
if $program --version
|
if $program --version 1>/dev/null 2>/dev/null
|
||||||
set milli $program
|
set milli $program
|
||||||
set unit ms
|
set unit ms
|
||||||
break
|
break
|
||||||
@ -145,13 +145,13 @@ for program in {g,}date
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function timestamp -V milli
|
function timestamp
|
||||||
set -q milli[1]
|
set -q milli[1]
|
||||||
and $milli +%s%3N
|
and $milli +%s%3N
|
||||||
or date +%s
|
or date +%s
|
||||||
end
|
end
|
||||||
|
|
||||||
function delta -V milli
|
function delta
|
||||||
set -q milli[1]
|
set -q milli[1]
|
||||||
and math "( "($milli +%s%3N)" - $argv[1])"
|
and math "( "($milli +%s%3N)" - $argv[1])"
|
||||||
or math (date +%s) - $starttime
|
or math (date +%s) - $starttime
|
||||||
|
Loading…
x
Reference in New Issue
Block a user