mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2025-03-07 02:45:11 +08:00

+ Add fish eval fix See #fish-shell/pull/1892 + New and improved output system with colors, etc. + Support for multiple non-nested describe blocks. + Remove spec.log and favor `msg` plugin and standard echo. + `spec.eval` no longer evaluates multiple functions, acting now as a simplified router between the view `spec.view` and the controller `spec.run`. + Add new `spec.view` to act as a hub for all test output. + Add report with passed/failed tests to `spec.view` + Now test descriptions are used directly from the function name. Description fields are now optional.
72 lines
2.0 KiB
Fish
72 lines
2.0 KiB
Fish
import plugins/fish-spec
|
|
|
|
function describe_list.erase
|
|
function before_each
|
|
set -g nums_until_10 1 2 3 4 5 6 7 8 9 10
|
|
set -g odds_until_10 1 3 5 7 9
|
|
end
|
|
|
|
function it_erases_one_element
|
|
list.erase 1 nums_until_10
|
|
expect $nums_until_10 --to-not-contain 1
|
|
end
|
|
|
|
function it_erases_one_element_without_from_option
|
|
list.erase 1 --from nums_until_10
|
|
expect $nums_until_10 --to-not-contain 1
|
|
end
|
|
|
|
function it_erases_one_element_from_multiple_lists
|
|
list.erase 1 --from nums_until_10 odds_until_10
|
|
expect $nums_until_10 --to-not-contain 1
|
|
and expect $odds_until_10 --to-not-contain 1
|
|
end
|
|
|
|
function it_erases_one_element_from_multiple_lists_when_only_one_has_the_element
|
|
list.erase 2 --from nums_until_10 odds_until_10
|
|
expect $nums_until_10 --to-not-contain 2
|
|
end
|
|
|
|
function it_erases_multiple_elements
|
|
list.erase 1 2 nums_until_10
|
|
expect $nums_until_10 --to-not-contain 1
|
|
and expect $nums_until_10 --to-not-contain 2
|
|
end
|
|
|
|
function it_erases_multiple_elements_with_from_syntax
|
|
list.erase 1 2 --from nums_until_10
|
|
expect $nums_until_10 --to-not-contain 1
|
|
and expect $nums_until_10 --to-not-contain 2
|
|
end
|
|
|
|
function it_erases_multiple_elements_from_multiple_lists
|
|
list.erase 1 2 --from nums_until_10 odds_until_10
|
|
expect $nums_until_10 --to-not-contain 1
|
|
and expect $nums_until_10 --to-not-contain 2
|
|
and expect $odds_until_10 --to-not-contain 1
|
|
end
|
|
|
|
function it_returns_0_if_any_items_are_erased
|
|
list.erase 10 --from nums_until_10
|
|
expect $status --to-equal 0
|
|
end
|
|
|
|
function it_returns_1_if_no_items_are_erased
|
|
list.erase 100 200 300 --from nums_until_10
|
|
expect $status --to-equal 1
|
|
end
|
|
|
|
function it_returns_1_if_no_items_are_erased_from_any_lists
|
|
list.erase 100 200 300 --from nums_until_10 odds_until_10
|
|
expect $status --to-equal 1
|
|
end
|
|
|
|
function it_returns_0_if_items_are_erased_from_some_but_not_all_lists
|
|
list.erase 1 2 3 --from nums_until_10 odds_until_10
|
|
expect $status --to-equal 0
|
|
end
|
|
|
|
end
|
|
|
|
spec.run $argv
|