From 30a7a93c1a6dba8acdbb6434fc4214f9d7f5e54a Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 13 Apr 2019 12:26:02 +0100 Subject: [PATCH] Add tests for `quote` Refs https://github.com/sass/libsass/issues/2811 --- spec/string-functions/quote.hrx | 80 +++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 spec/string-functions/quote.hrx diff --git a/spec/string-functions/quote.hrx b/spec/string-functions/quote.hrx new file mode 100644 index 0000000000..cb82eec5bb --- /dev/null +++ b/spec/string-functions/quote.hrx @@ -0,0 +1,80 @@ +<===> unquoted/input.scss +a { + a: quote(a); +} + +<===> unquoted/output.css +a { + a: "a"; +} + +<===> +================================================================================ +<===> quoted-double/input.scss +a { + a: quote("a"); +} + +<===> quoted-double/output.css +a { + a: "a"; +} + +<===> +================================================================================ +<===> quoted-single/input.scss +a { + a: quote('a'); +} + +<===> quoted-single/output.css +a { + a: "a"; +} + +<===> +================================================================================ +<===> quote-mark-selection-single/input.scss +a { + a: quote(unquote('"')); +} + +<===> quote-mark-selection-single/output.css +a { + a: '"'; +} + +<===> +================================================================================ +<===> quote-mark-selection-double/input.scss +a { + a: quote(unquote('"') + unquote("'")); +} + +<===> quote-mark-selection-double/output.css +a { + a: "\"'"; +} + +<===> +================================================================================ +<===> error/argument-type/input.scss +a { + a: quote((1, 2, 3)); +} + +<===> error/argument-type/error +Error: $string: 1, 2, 3 is not a string. + , +2 | a: quote((1, 2, 3)); + | ^^^^^^^^^^^^^^^^ + ' + input.scss 2:6 root stylesheet + +<===> error/argument-type/error-libsass +Error: argument `$string` of `quote($string)` must be a string + on line 2:6 of input.scss, in function `quote` + from line 2:6 of input.scss +>> a: quote((1, 2, 3)); + + -----^