From ce32a7e5ac0a6b19e0578da1f46bdcfc1040dc0e Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sun, 26 Apr 2020 23:21:18 -0400 Subject: [PATCH] explicitly test for equality --- tests/equality.rs | 50 +++++++++++++++++++++++++++++++++++++++++++++++ tests/values.rs | 25 ------------------------ 2 files changed, 50 insertions(+), 25 deletions(-) create mode 100644 tests/equality.rs diff --git a/tests/equality.rs b/tests/equality.rs new file mode 100644 index 0000000..8bce6c3 --- /dev/null +++ b/tests/equality.rs @@ -0,0 +1,50 @@ +#![cfg(test)] + +#[macro_use] +mod macros; + +test!( + color_equals_color, + "a {\n color: red == red;\n}\n", + "a {\n color: true;\n}\n" +); +test!( + color_does_not_equal_color, + "a {\n color: red != red;\n}\n", + "a {\n color: false;\n}\n" +); +test!( + unquoted_ident_eq_unquoted_ident, + "a {\n color: foo == foo;\n}\n", + "a {\n color: true;\n}\n" +); +test!( + dblquoted_ident_eq_unquoted_ident, + "a {\n color: \"foo\" == foo;\n}\n", + "a {\n color: true;\n}\n" +); +test!( + dblquoted_ident_eq_sglquoted_ident, + "a {\n color: \"foo\" == 'foo';\n}\n", + "a {\n color: true;\n}\n" +); +test!( + dblquoted_eq_number, + "a {\n color: \"foo\" == 1;\n}\n", + "a {\n color: false;\n}\n" +); +test!( + uncomparable_units, + "a {\n color: 1rem==1px;\n}\n", + "a {\n color: false;\n}\n" +); +test!( + first_unit_none, + "a {\n color: 1==1px;\n}\n", + "a {\n color: false;\n}\n" +); +test!( + second_unit_none, + "a {\n color: 1rem==1;\n}\n", + "a {\n color: false;\n}\n" +); diff --git a/tests/values.rs b/tests/values.rs index 2dfec0b..3973314 100644 --- a/tests/values.rs +++ b/tests/values.rs @@ -70,31 +70,6 @@ test!( "a {\n color: \"f\"foo;\n}\n", "a {\n color: \"f\" foo;\n}\n" ); -test!( - color_equals_color, - "a {\n color: red == red;\n}\n", - "a {\n color: true;\n}\n" -); -test!( - color_does_not_equal_color, - "a {\n color: red != red;\n}\n", - "a {\n color: false;\n}\n" -); -test!( - unquoted_ident_eq_unquoted_ident, - "a {\n color: foo == foo;\n}\n", - "a {\n color: true;\n}\n" -); -test!( - dblquoted_ident_eq_unquoted_ident, - "a {\n color: \"foo\" == foo;\n}\n", - "a {\n color: true;\n}\n" -); -test!( - dblquoted_ident_eq_sglquoted_ident, - "a {\n color: \"foo\" == 'foo';\n}\n", - "a {\n color: true;\n}\n" -); test!( many_parens, "a {\n color: (((((red)))));\n}\n",