oh-my-fish/pkg/fish-spec/functions/assert.error_message.fish

32 lines
1.0 KiB
Fish
Raw Normal View History

2015-12-08 05:39:10 +08:00
function assert.error_message
set -l number_of_arguments (count $argv)
switch $argv[1]
case !
switch $number_of_arguments
case 3
set operator (assert.expand_operator $argv[2])
2015-12-19 21:29:45 +08:00
set actual $argv[3]
echo "Expected result to not be $operator but it was $actual"
2015-12-08 05:39:10 +08:00
case 4
set expected $argv[2]
set operator "not" (assert.expand_operator $argv[3])
set actual $argv[4]
2015-12-19 21:29:45 +08:00
echo "Expected result to $operator $expected but it was $actual"
2015-12-08 05:39:10 +08:00
case \*
return 1
end
case \-\*
test $number_of_arguments != 2; and return 1
set operator (assert.expand_operator $argv[1])
2015-12-19 21:29:45 +08:00
set actual $argv[2]
echo "Expected result to be $operator but it was $actual"
2015-12-08 05:39:10 +08:00
case \*
test $number_of_arguments != 3; and return 1
set expected $argv[1]
set operator (assert.expand_operator $argv[2])
set actual $argv[3]
2015-12-19 21:29:45 +08:00
echo "Expected result to $operator $expected but it was $actual"
2015-12-08 05:39:10 +08:00
end
end