From 4b93c3795960518c98f97ac4a35efb5cd957797c Mon Sep 17 00:00:00 2001 From: Bruno Pinto Date: Wed, 14 Jan 2015 21:56:46 -0200 Subject: [PATCH] expect --to-equal tests --- .../fish-spec/spec/expect.to_equal.spec.fish | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 plugins/fish-spec/spec/expect.to_equal.spec.fish diff --git a/plugins/fish-spec/spec/expect.to_equal.spec.fish b/plugins/fish-spec/spec/expect.to_equal.spec.fish new file mode 100644 index 0000000..70c8b44 --- /dev/null +++ b/plugins/fish-spec/spec/expect.to_equal.spec.fish @@ -0,0 +1,37 @@ +import plugins/fish-spec + +function describe_to_equal -d 'expect --to-equal' + function before_each + set -e result + end + + function it_returns_0_when_compared_values_are_the_same + set -l equal "equal" + + echo (expect $equal --to-equal $equal; set result $status) >/dev/null + expect $result --to-equal 0 + end + + function it_returns_1_when_compared_values_are_different + set -l equal "equal" + + echo (expect $equal --to-equal 'different'; set result $status) >/dev/null + expect $result --to-equal 1 + end + + function it_returns_0_when_array_elements_are_in_the_same_order + set -l array 1 2 + + echo (expect $array --to-equal 1 2; set result $status) >/dev/null + expect $result --to-equal 0 + end + + function it_returns_1_when_array_elements_are_in_different_order + set -l array 1 2 + + echo (expect $array --to-equal 2 1; set result $status) >/dev/null + expect $result --to-equal 1 + end +end + +spec.run $argv