oh-my-fish/pkg/fish-spec/spec/results_spec.fish
Kevin F. Konrad fb79486f9f
Some checks failed
Build / build (3, ubuntu-20.04) (push) Has been cancelled
Build / build (3, ubuntu-22.04) (push) Has been cancelled
Build / build (3, ubuntu-latest) (push) Has been cancelled
Build / build (4, ubuntu-22.04) (push) Has been cancelled
Build / build (brew, macos-13) (push) Has been cancelled
Build / build (brew, macos-14) (push) Has been cancelled
Build / build (brew, macos-latest) (push) Has been cancelled
Build / build (brew, ubuntu-20.04) (push) Has been cancelled
Build / build (brew, ubuntu-22.04) (push) Has been cancelled
Build / build (brew, ubuntu-latest) (push) Has been cancelled
Build / build (stock, ubuntu-20.04) (push) Has been cancelled
Build / build (stock, ubuntu-22.04) (push) Has been cancelled
Build / build (stock, ubuntu-latest) (push) Has been cancelled
reimplement fish-spec for nicer output (#955)
* replace implementation of fish-spec

provide a new implementation for fish-spec with more verbose and colored
output and more assertion functions

* fix indentation for fish-spec

* properly namespace color echo functions in fish-spec

* use line rewriting for fish-spec for more terse output

* use fish 3.0.0 compatible syntax

* fix assorted assertion bug

* ensure tests actually pass

* fix existing omf spec tests

* simplify assert_in_array and assert_not_in_array

---------

Co-authored-by: Kevin F. Konrad <kevin.konrad@skillbyte.de>
2025-03-04 09:10:40 -08:00

32 lines
1.1 KiB
Fish

function describe_results
function it_succeeds_when_single_assertion_succeeds
assert 1 = 1
assert 0 = $status
end
function it_succeeds_when_multiple_assertion_succeeds
assert 1 = 1
assert 2 = 2
end
function it_fails_when_single_assertion_fails
set previous_assertion_counter $__fish_spec_failed_assertions_in_file
assert 1 = 2
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
end
function it_fails_when_one_of_the_assertions_fails
set previous_assertion_counter $__fish_spec_failed_assertions_in_file
assert 1 = 2
assert_exit_code 1
assert 2 = 2
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
end
end