2015-12-07 21:39:10 +00:00
|
|
|
function describe_results
|
|
|
|
function it_succeeds_when_single_assertion_succeeds
|
|
|
|
assert 1 = 1
|
|
|
|
|
2025-03-04 18:10:40 +01:00
|
|
|
assert 0 = $status
|
2015-12-07 21:39:10 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function it_succeeds_when_multiple_assertion_succeeds
|
|
|
|
assert 1 = 1
|
|
|
|
assert 2 = 2
|
|
|
|
end
|
|
|
|
|
|
|
|
function it_fails_when_single_assertion_fails
|
2025-03-04 18:10:40 +01:00
|
|
|
set previous_assertion_counter $__fish_spec_failed_assertions_in_file
|
2015-12-07 21:39:10 +00:00
|
|
|
assert 1 = 2
|
2025-03-04 18:10:40 +01:00
|
|
|
assert_exit_code 1
|
|
|
|
echo decrement failed assertion counter so tests pass as expected
|
|
|
|
set __fish_spec_failed_assertions_in_file (math $__fish_spec_failed_assertions_in_file - 1)
|
|
|
|
assert_equal $previous_assertion_counter $__fish_spec_failed_assertions_in_file
|
2015-12-07 21:39:10 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function it_fails_when_one_of_the_assertions_fails
|
2025-03-04 18:10:40 +01:00
|
|
|
set previous_assertion_counter $__fish_spec_failed_assertions_in_file
|
2015-12-07 21:39:10 +00:00
|
|
|
assert 1 = 2
|
2025-03-04 18:10:40 +01:00
|
|
|
assert_exit_code 1
|
2015-12-07 21:39:10 +00:00
|
|
|
assert 2 = 2
|
2025-03-04 18:10:40 +01:00
|
|
|
echo decrement failed assertion counter so tests pass as expected
|
|
|
|
set __fish_spec_failed_assertions_in_file (math $__fish_spec_failed_assertions_in_file - 1)
|
|
|
|
assert_equal $previous_assertion_counter $__fish_spec_failed_assertions_in_file
|
2015-12-07 21:39:10 +00:00
|
|
|
end
|
|
|
|
end
|