diff --git a/CHANGELOG.md b/CHANGELOG.md index 8087757bb..5f7b9d682 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,11 @@ project adheres to Most of the api to those types are private. Some will probably be made public after some stabilization period. +### Other changes: + +* Updated sass-spec test suite to 2024-09-13. + + ## Release 0.28.10 Released 2024-05-19. diff --git a/rsass/tests/spec/core_functions/color/adjust/a98_rgb.rs b/rsass/tests/spec/core_functions/color/adjust/a98_rgb.rs new file mode 100644 index 000000000..c9b740d27 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/a98_rgb.rs @@ -0,0 +1,289 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $red: 0.3, $green: 0.2, $blue: 0.1)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.5 0.7 0.8);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $red: 0.5, $alpha: -0.1)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.7 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7 / 0.9), $red: 0.5)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.7 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $blue: 0.7)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.5 1.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $blue: 1.7)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.5 2.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $blue: -1.8)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.5 -1.1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $blue: -0.8)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.5 -0.1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $blue: 20%)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.5 0.9);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $blue: -0.3)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.5 0.4);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $green: 0.7)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 1.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $green: 1.7)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 2.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $green: -1.8)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 -1.3 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $green: -0.8)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 -0.3 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $green: 40%)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.9 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $green: -0.3)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.2 0.7);\ + \n}\n" + ); + } +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $red: 0.9)}\n"), + "a {\ + \n b: color(a98-rgb 1.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $red: 1.9)}\n"), + "a {\ + \n b: color(a98-rgb 2.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $red: -1.3)}\n" + ), + "a {\ + \n b: color(a98-rgb -1.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $red: -0.3)}\n" + ), + "a {\ + \n b: color(a98-rgb -0.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $red: -10%)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $red: 0.5)}\n"), + "a {\ + \n b: color(a98-rgb 0.7 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/adjust/display_p3.rs b/rsass/tests/spec/core_functions/color/adjust/display_p3.rs new file mode 100644 index 000000000..f1fa759ad --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/display_p3.rs @@ -0,0 +1,295 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $red: 0.3, $green: 0.2, $blue: 0.1)}\n" + ), + "a {\ + \n b: color(display-p3 0.5 0.7 0.8);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $red: 0.5, $alpha: -0.1)}\n" + ), + "a {\ + \n b: color(display-p3 0.7 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7 / 0.9), $red: 0.5)}\n" + ), + "a {\ + \n b: color(display-p3 0.7 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $blue: 0.7)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 1.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $blue: 1.7)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 2.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $blue: -1.8)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 -1.1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $blue: -0.8)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 -0.1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $blue: 20%)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 0.9);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $blue: -0.3)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 0.4);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $green: 0.7)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 1.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $green: 1.7)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 2.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $green: -1.8)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 -1.3 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $green: -0.8)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 -0.3 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $green: 40%)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.9 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $green: -0.3)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.2 0.7);\ + \n}\n" + ); + } +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $red: 0.9)}\n" + ), + "a {\ + \n b: color(display-p3 1.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $red: 1.9)}\n" + ), + "a {\ + \n b: color(display-p3 2.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $red: -1.3)}\n" + ), + "a {\ + \n b: color(display-p3 -1.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $red: -0.3)}\n" + ), + "a {\ + \n b: color(display-p3 -0.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $red: -10%)}\n" + ), + "a {\ + \n b: color(display-p3 0.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $red: 0.5)}\n" + ), + "a {\ + \n b: color(display-p3 0.7 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/adjust_color/error/args.rs b/rsass/tests/spec/core_functions/color/adjust/error/args.rs similarity index 55% rename from rsass/tests/spec/core_functions/color/adjust_color/error/args.rs rename to rsass/tests/spec/core_functions/color/adjust/error/args.rs index 0cbcaaab9..304718dc2 100644 --- a/rsass/tests/spec/core_functions/color/adjust_color/error/args.rs +++ b/rsass/tests/spec/core_functions/color/adjust/error/args.rs @@ -1,4 +1,4 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust_color/error/args.hrx" +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/args.hrx" #[allow(unused)] fn runner() -> crate::TestRunner { @@ -8,42 +8,50 @@ fn runner() -> crate::TestRunner { #[test] fn too_few() { assert_eq!( - runner().err("a {b: adjust-color()}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust()}\n" + ), "Error: Missing argument $color.\ \n ,--> input.scss\ - \n1 | a {b: adjust-color()}\ + \n2 | a {b: color.adjust()}\ \n | ^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ \n1 | @function adjust($color, $kwargs...) {\ \n | ========================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many() { assert_eq!( runner().err( - "a {b: adjust-color(red, 1)}\n" + "@use \"sass:color\";\ + \na {b: color.adjust(red, 1)}\n" ), "Error: Only one positional argument is allowed. All other arguments must be passed by name.\ \n ,\ - \n1 | a {b: adjust-color(red, 1)}\ + \n2 | a {b: color.adjust(red, 1)}\ \n | ^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] +#[ignore] // wrong error fn unknown() { assert_eq!( - runner().err("a {b: adjust-color(red, $ambience: 10%)}\n"), - "Error: No argument named $ambience.\ + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $ambience: 10%)}\n" + ), + "Error: $ambience: Color space rgb doesn\'t have a channel with this name.\ \n ,\ - \n1 | a {b: adjust-color(red, $ambience: 10%)}\ + \n2 | a {b: color.adjust(red, $ambience: 10%)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } diff --git a/rsass/tests/spec/core_functions/color/adjust/error/incompatible_channel.rs b/rsass/tests/spec/core_functions/color/adjust/error/incompatible_channel.rs new file mode 100644 index 000000000..008fcf170 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/incompatible_channel.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/incompatible_channel.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("incompatible_channel") +} + +#[test] +#[ignore] // wrong error +fn legacy_channel() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $whiteness: 50%)}\n" + ), + "Error: $whiteness: Color space srgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.adjust(color(srgb 0.2 0.5 0.7), $whiteness: 50%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn legacy_space() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $chroma: 50%)}\n" + ), + "Error: $chroma: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.adjust(red, $chroma: 50%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn modern_both() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $chroma: 50%)}\n" + ), + "Error: $chroma: Color space srgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.adjust(color(srgb 0.2 0.5 0.7), $chroma: 50%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust/error/missing.rs b/rsass/tests/spec/core_functions/color/adjust/error/missing.rs new file mode 100644 index 000000000..f84cd677e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/missing.rs @@ -0,0 +1,92 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/missing.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("missing") +} + +#[test] +#[ignore] // wrong error +fn alpha() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(rgb(0 0 0 / none), $alpha: 0.1)}\n" + ), + "Error: $alpha: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: rgb(0 0 0 / none)).\ + \n ,\ + \n2 | a {b: color.adjust(rgb(0 0 0 / none), $alpha: 0.1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn legacy() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(rgb(none 0 0), $red: 10)}\n" + ), + "Error: $red: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: rgb(none 0 0)).\ + \n ,\ + \n2 | a {b: color.adjust(rgb(none 0 0), $red: 10)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn modern() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(lab(none 0 0), $lightness: 10%)}\n" + ), + "Error: $lightness: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: lab(none 0 0)).\ + \n ,\ + \n2 | a {b: color.adjust(lab(none 0 0), $lightness: 10%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +mod powerless { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn legacy() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(grey, $hue: 10deg, $space: hsl)}\n" + ), + "Error: $hue: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: hsl(none 0% 50.1960784314%)).\ + \n ,\ + \n2 | a {b: color.adjust(grey, $hue: 10deg, $space: hsl)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn modern() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(grey, $hue: 10deg, $space: lch)}\n" + ), + "Error: $hue: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: lch(53.5850134522% 0 none)).\ + \n ,\ + \n2 | a {b: color.adjust(grey, $hue: 10deg, $space: lch)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/adjust/error/mixed_formats.rs b/rsass/tests/spec/core_functions/color/adjust/error/mixed_formats.rs new file mode 100644 index 000000000..18987dd6a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/mixed_formats.rs @@ -0,0 +1,119 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/mixed_formats.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("mixed_formats") +} + +#[test] +#[ignore] // wrong error +fn blue_and_lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $blue: 1, $lightness: 1%)}\n" + ), + "Error: $lightness: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.adjust(red, $blue: 1, $lightness: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green_and_saturation() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $green: 1, $saturation: 1%)}\n" + ), + "Error: $saturation: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.adjust(red, $green: 1, $saturation: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green_and_whiteness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $green: 1, $whiteness: 1%)}\n" + ), + "Error: $whiteness: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.adjust(red, $green: 1, $whiteness: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn lightness_and_whiteness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $lightness: 1%, $whiteness: 1%)}\n" + ), + "Error: $whiteness: Color space hsl doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.adjust(red, $lightness: 1%, $whiteness: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red_and_blackness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $red: 1, $blackness: 1%)}\n" + ), + "Error: $blackness: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.adjust(red, $red: 1, $blackness: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red_and_hue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $red: 1, $hue: 1)}\n" + ), + "Error: $hue: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.adjust(red, $red: 1, $hue: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn saturation_and_blackness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $saturation: 1%, $blackness: 1%)}\n" + ), + "Error: $blackness: Color space hsl doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.adjust(red, $saturation: 1%, $blackness: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/scale_color/error/mod.rs b/rsass/tests/spec/core_functions/color/adjust/error/mod.rs similarity index 75% rename from rsass/tests/spec/core_functions/color/scale_color/error/mod.rs rename to rsass/tests/spec/core_functions/color/adjust/error/mod.rs index 1618a9cee..a7a74db3a 100644 --- a/rsass/tests/spec/core_functions/color/scale_color/error/mod.rs +++ b/rsass/tests/spec/core_functions/color/adjust/error/mod.rs @@ -1,4 +1,4 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale_color/error" +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error" #[allow(unused)] fn runner() -> crate::TestRunner { @@ -7,10 +7,14 @@ fn runner() -> crate::TestRunner { mod args; -mod bounds; +mod incompatible_channel; + +mod missing; mod mixed_formats; +mod space; + mod test_type; mod units; diff --git a/rsass/tests/spec/core_functions/color/adjust/error/space.rs b/rsass/tests/spec/core_functions/color/adjust/error/space.rs new file mode 100644 index 000000000..57daa73d6 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/space.rs @@ -0,0 +1,39 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/space.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("space") +} + +#[test] +#[ignore] // wrong error +fn quoted() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $space: \"lab\")}\n" + ), + "Error: $space: Expected \"lab\" to be an unquoted string.\ + \n ,\ + \n2 | a {b: color.adjust(red, $space: \"lab\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn unknown() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $space: c)}\n" + ), + "Error: $space: Unknown color space \"c\".\ + \n ,\ + \n2 | a {b: color.adjust(red, $space: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust/error/test_type.rs b/rsass/tests/spec/core_functions/color/adjust/error/test_type.rs new file mode 100644 index 000000000..0e26a8634 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/test_type.rs @@ -0,0 +1,188 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/type.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("type") +} + +#[test] +fn alpha() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $alpha: c)}\n" + ), + "Error: $alpha: c is not a number.\ + \n ,\ + \n2 | a {b: color.adjust(red, $alpha: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn blackness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $blackness: c)}\n" + ), + "Error: $blackness: c is not a number.\ + \n ,\ + \n2 | a {b: color.adjust(red, $blackness: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $blue: c)}\n" + ), + "Error: $blue: c is not a number.\ + \n ,\ + \n2 | a {b: color.adjust(red, $blue: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn color() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(1)}\n" + ), + "Error: $color: 1 is not a color.\ + \n ,\ + \n2 | a {b: color.adjust(1)}\ + \n | ^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $green: c)}\n" + ), + "Error: $green: c is not a number.\ + \n ,\ + \n2 | a {b: color.adjust(red, $green: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn hue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $hue: c)}\n" + ), + "Error: $hue: c is not a number.\ + \n ,\ + \n2 | a {b: color.adjust(red, $hue: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $lightness: c)}\n" + ), + "Error: $lightness: c is not a number.\ + \n ,\ + \n2 | a {b: color.adjust(red, $lightness: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn none() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $alpha: none)}\n" + ), + "Error: $alpha: none is not a number.\ + \n ,\ + \n2 | a {b: color.adjust(red, $alpha: none)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $red: c)}\n" + ), + "Error: $red: c is not a number.\ + \n ,\ + \n2 | a {b: color.adjust(red, $red: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn saturation() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $saturation: c)}\n" + ), + "Error: $saturation: c is not a number.\ + \n ,\ + \n2 | a {b: color.adjust(red, $saturation: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn space() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $space: 1)}\n" + ), + "Error: $space: 1 is not a string.\ + \n ,\ + \n2 | a {b: color.adjust(red, $space: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn whiteness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $whiteness: c)}\n" + ), + "Error: $whiteness: c is not a number.\ + \n ,\ + \n2 | a {b: color.adjust(red, $whiteness: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust/error/units/a98_rgb.rs b/rsass/tests/spec/core_functions/color/adjust/error/units/a98_rgb.rs new file mode 100644 index 000000000..b75123739 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/units/a98_rgb.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/units/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +#[test] +#[ignore] // wrong error +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $blue: 0.5px)}\n" + ), + "Error: $blue: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $blue: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $green: 0.5px)}\n" + ), + "Error: $green: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $green: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $red: 0.5px)}\n" + ), + "Error: $red: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(a98-rgb 0.2 0.5 0.7), $red: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust/error/units/display_p3.rs b/rsass/tests/spec/core_functions/color/adjust/error/units/display_p3.rs new file mode 100644 index 000000000..19fdd5cd7 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/units/display_p3.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/units/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +#[test] +#[ignore] // wrong error +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $blue: 0.5px)}\n" + ), + "Error: $blue: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(display-p3 0.2 0.5 0.7), $blue: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $green: 0.5px)}\n" + ), + "Error: $green: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(display-p3 0.2 0.5 0.7), $green: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(display-p3 0.2 0.5 0.7), $red: 0.5px)}\n" + ), + "Error: $red: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(display-p3 0.2 0.5 0.7), $red: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/change_color/error/units.rs b/rsass/tests/spec/core_functions/color/adjust/error/units/hwb.rs similarity index 51% rename from rsass/tests/spec/core_functions/color/change_color/error/units.rs rename to rsass/tests/spec/core_functions/color/adjust/error/units/hwb.rs index 9455029b5..7765e2ae8 100644 --- a/rsass/tests/spec/core_functions/color/change_color/error/units.rs +++ b/rsass/tests/spec/core_functions/color/adjust/error/units/hwb.rs @@ -1,8 +1,8 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/change_color/error/units.hrx" +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/units/hwb.hrx" #[allow(unused)] fn runner() -> crate::TestRunner { - super::runner().with_cwd("units") + super::runner().with_cwd("hwb") } mod none { @@ -12,25 +12,31 @@ mod none { #[test] fn blackness() { assert_eq!( - runner().err("a {b: change-color(black, $blackness: 1)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(black, $blackness: 1)}\n" + ), "Error: $blackness: Expected 1 to have unit \"%\".\ \n ,\ - \n1 | a {b: change-color(black, $blackness: 1)}\ + \n2 | a {b: color.adjust(black, $blackness: 1)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn whiteness() { assert_eq!( - runner().err("a {b: change-color(white, $whiteness: 1)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(white, $whiteness: 1)}\n" + ), "Error: $whiteness: Expected 1 to have unit \"%\".\ \n ,\ - \n1 | a {b: change-color(white, $whiteness: 1)}\ + \n2 | a {b: color.adjust(white, $whiteness: 1)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -41,25 +47,31 @@ mod wrong { #[test] fn blackness() { assert_eq!( - runner().err("a {b: change-color(black, $blackness: 1px)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(black, $blackness: 1px)}\n" + ), "Error: $blackness: Expected 1px to have unit \"%\".\ \n ,\ - \n1 | a {b: change-color(black, $blackness: 1px)}\ + \n2 | a {b: color.adjust(black, $blackness: 1px)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn whiteness() { assert_eq!( - runner().err("a {b: change-color(white, $whiteness: 1px)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(white, $whiteness: 1px)}\n" + ), "Error: $whiteness: Expected 1px to have unit \"%\".\ \n ,\ - \n1 | a {b: change-color(white, $whiteness: 1px)}\ + \n2 | a {b: color.adjust(white, $whiteness: 1px)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } diff --git a/rsass/tests/spec/core_functions/color/adjust/error/units/lab.rs b/rsass/tests/spec/core_functions/color/adjust/error/units/lab.rs new file mode 100644 index 000000000..9b0b6563d --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/units/lab.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/units/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +#[test] +#[ignore] // wrong error +fn a() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(lab(50% 30 -50), $a: 20px)}\n" + ), + "Error: $a: Expected 20px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(lab(50% 30 -50), $a: 20px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn b() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(lab(50% 30 -50), $b: 20px)}\n" + ), + "Error: $b: Expected 20px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(lab(50% 30 -50), $b: 20px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(lab(50% 30 -50), $lightness: 30px)}\n" + ), + "Error: $lightness: Expected 30px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(lab(50% 30 -50), $lightness: 30px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust/error/units/lch.rs b/rsass/tests/spec/core_functions/color/adjust/error/units/lch.rs new file mode 100644 index 000000000..55f8b5947 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/units/lch.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/units/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +#[test] +#[ignore] // wrong error +fn chroma() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(lch(50% 30 50deg), $chroma: 20px)}\n" + ), + "Error: $chroma: Expected 20px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(lch(50% 30 50deg), $chroma: 20px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn hue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(lch(50% 30 50deg), $hue: 20%)}\n" + ), + "Error: $hue: Expected 20% to have an angle unit (deg, grad, rad, turn).\ + \n ,\ + \n2 | a {b: color.adjust(lch(50% 30 50deg), $hue: 20%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(lch(50% 30 50deg), $lightness: 30px)}\n" + ), + "Error: $lightness: Expected 30px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(lch(50% 30 50deg), $lightness: 30px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust/error/units/mod.rs b/rsass/tests/spec/core_functions/color/adjust/error/units/mod.rs new file mode 100644 index 000000000..55540f41b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/units/mod.rs @@ -0,0 +1,32 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/units" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("units") +} + +mod a98_rgb; + +mod display_p3; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/adjust/error/units/oklab.rs b/rsass/tests/spec/core_functions/color/adjust/error/units/oklab.rs new file mode 100644 index 000000000..064c2f42a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/units/oklab.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/units/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +#[test] +#[ignore] // wrong error +fn a() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(oklab(50% 0.2 -0.3), $a: 0.2px)}\n" + ), + "Error: $a: Expected 0.2px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(oklab(50% 0.2 -0.3), $a: 0.2px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn b() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(oklab(50% 0.2 -0.3), $b: 0.2px)}\n" + ), + "Error: $b: Expected 0.2px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(oklab(50% 0.2 -0.3), $b: 0.2px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(oklab(50% 0.2 -0.3), $lightness: 0.3px)}\n" + ), + "Error: $lightness: Expected 0.3px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(oklab(50% 0.2 -0.3), $lightness: 0.3px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust/error/units/oklch.rs b/rsass/tests/spec/core_functions/color/adjust/error/units/oklch.rs new file mode 100644 index 000000000..ad20176d9 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/units/oklch.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/units/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +#[test] +#[ignore] // wrong error +fn chroma() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(oklch(50% 0.3 50deg), $chroma: 0.2px)}\n" + ), + "Error: $chroma: Expected 0.2px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(oklch(50% 0.3 50deg), $chroma: 0.2px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn hue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(oklch(50% 0.3 50deg), $hue: 20%)}\n" + ), + "Error: $hue: Expected 20% to have an angle unit (deg, grad, rad, turn).\ + \n ,\ + \n2 | a {b: color.adjust(oklch(50% 0.3 50deg), $hue: 20%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(oklch(50% 0.3 50deg), $lightness: 30px)}\n" + ), + "Error: $lightness: Expected 30px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(oklch(50% 0.3 50deg), $lightness: 30px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust/error/units/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/adjust/error/units/prophoto_rgb.rs new file mode 100644 index 000000000..23dc9dc76 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/units/prophoto_rgb.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/units/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +#[test] +#[ignore] // wrong error +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $blue: 0.5px)}\n" + ), + "Error: $blue: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $blue: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $green: 0.5px)}\n" + ), + "Error: $green: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $green: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $red: 0.5px)}\n" + ), + "Error: $red: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $red: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust/error/units/rec2020.rs b/rsass/tests/spec/core_functions/color/adjust/error/units/rec2020.rs new file mode 100644 index 000000000..00cdc73fc --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/units/rec2020.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/units/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +#[test] +#[ignore] // wrong error +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $blue: 0.5px)}\n" + ), + "Error: $blue: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(rec2020 0.2 0.5 0.7), $blue: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $green: 0.5px)}\n" + ), + "Error: $green: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(rec2020 0.2 0.5 0.7), $green: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $red: 0.5px)}\n" + ), + "Error: $red: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(rec2020 0.2 0.5 0.7), $red: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust/error/units/srgb.rs b/rsass/tests/spec/core_functions/color/adjust/error/units/srgb.rs new file mode 100644 index 000000000..6d218bdfd --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/units/srgb.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/units/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +#[test] +#[ignore] // wrong error +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $blue: 0.5px)}\n" + ), + "Error: $blue: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(srgb 0.2 0.5 0.7), $blue: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $green: 0.5px)}\n" + ), + "Error: $green: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(srgb 0.2 0.5 0.7), $green: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $red: 0.5px)}\n" + ), + "Error: $red: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(srgb 0.2 0.5 0.7), $red: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust/error/units/srgb_linear.rs b/rsass/tests/spec/core_functions/color/adjust/error/units/srgb_linear.rs new file mode 100644 index 000000000..3e153760a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/units/srgb_linear.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/units/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +#[test] +#[ignore] // wrong error +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $blue: 0.5px)}\n" + ), + "Error: $blue: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $blue: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $green: 0.5px)}\n" + ), + "Error: $green: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $green: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $red: 0.5px)}\n" + ), + "Error: $red: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $red: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust/error/units/xyz.rs b/rsass/tests/spec/core_functions/color/adjust/error/units/xyz.rs new file mode 100644 index 000000000..37f88be26 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/units/xyz.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/units/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +#[test] +#[ignore] // wrong error +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(xyz 0.2 0.5 0.7), $z: 0.5px)}\n" + ), + "Error: $z: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(xyz 0.2 0.5 0.7), $z: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(xyz 0.2 0.5 0.7), $y: 0.5px)}\n" + ), + "Error: $y: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(xyz 0.2 0.5 0.7), $y: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(xyz 0.2 0.5 0.7), $x: 0.5px)}\n" + ), + "Error: $x: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(xyz 0.2 0.5 0.7), $x: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust/error/units/xyz_d50.rs b/rsass/tests/spec/core_functions/color/adjust/error/units/xyz_d50.rs new file mode 100644 index 000000000..be15e35d8 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/error/units/xyz_d50.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/error/units/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +#[test] +#[ignore] // wrong error +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $z: 0.5px)}\n" + ), + "Error: $z: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $z: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $y: 0.5px)}\n" + ), + "Error: $y: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $y: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $x: 0.5px)}\n" + ), + "Error: $x: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $x: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust/global.rs b/rsass/tests/spec/core_functions/color/adjust/global.rs new file mode 100644 index 000000000..54b165b5e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/global.rs @@ -0,0 +1,27 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/global.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("global") +} + +#[test] +fn legacy() { + assert_eq!( + runner().ok("a {b: adjust-color(red, $red: -50)}\n"), + "a {\ + \n b: #cd0000;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn non_legacy() { + assert_eq!( + runner() + .ok("a {b: change-color(pink, $chroma: 0.01, $space: oklch)}\n"), + "a {\ + \n b: rgb(217.7587670223, 208.8497864408, 210.1600909257);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust/hsl.rs b/rsass/tests/spec/core_functions/color/adjust/hsl.rs new file mode 100644 index 000000000..c6c9af296 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/hsl.rs @@ -0,0 +1,395 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +#[test] +#[ignore] // wrong result +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(black, $hue: 12, $saturation: 24%, $lightness: 48%)}\n" + ), + "a {\ + \n b: rgb(151.776, 104.7744, 93.024);\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn alpha_arg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.adjust(\ + \n black,\ + \n $hue: 12,\ + \n $saturation: 24%,\ + \n $lightness: 48%,\ + \n $alpha: -0.7\ + \n );\ + \n}\n"), + "a {\ + \n b: rgba(151.776, 104.7744, 93.024, 0.3);\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn alpha_arg_above_max() { + assert_eq!( + runner().ok("// Regression test for sass/dart-sass#708.\ + \n@use \"sass:color\";\ + \na {\ + \n b: color.adjust(\ + \n black,\ + \n $hue: 12,\ + \n $saturation: 24%,\ + \n $lightness: 48%,\ + \n $alpha: 0.7\ + \n );\ + \n}\n"), + "a {\ + \n b: rgb(151.776, 104.7744, 93.024);\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn alpha_input() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.adjust(\ + \n rgba(black, 0.7),\ + \n $hue: 12,\ + \n $saturation: 24%,\ + \n $lightness: 48%\ + \n );\ + \n}\n"), + "a {\ + \n b: rgba(151.776, 104.7744, 93.024, 0.7);\ + \n}\n" + ); +} +mod hue { + #[allow(unused)] + use super::runner; + + #[test] + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $hue: 540)}\n"), + "a {\ + \n b: aqua;\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn fraction() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $hue: 0.5)}\n"), + "a {\ + \n b: rgb(255, 2.125, 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $hue: 359)}\n"), + "a {\ + \n b: rgb(255, 0, 4.25);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $hue: 123)}\n"), + "a {\ + \n b: rgb(0, 255, 12.75);\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(blue, $hue: 0)}\n"), + "a {\ + \n b: blue;\ + \n}\n" + ); + } + #[test] + fn negative() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $hue: -180)}\n"), + "a {\ + \n b: aqua;\ + \n}\n" + ); + } +} +mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $lightness: 100%)}\n"), + "a {\ + \n b: hsl(0, 100%, 150%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $lightness: 200%)}\n"), + "a {\ + \n b: hsl(0, 100%, 250%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(plum, $lightness: -200%)}\n"), + "a {\ + \n b: hsl(300, 47.2868217054%, -125.2941176471%);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(plum, $lightness: -100%)}\n"), + "a {\ + \n b: hsl(300, 47.2868217054%, -25.2941176471%);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn fraction() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $lightness: 0.5%)}\n"), + "a {\ + \n b: rgb(255, 2.55, 2.55);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $lightness: 14%)}\n"), + "a {\ + \n b: rgb(255, 71.4, 71.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $lightness: -14%)}\n"), + "a {\ + \n b: rgb(183.6, 0, 0);\ + \n}\n" + ); + } + #[test] + fn max_remaining() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $lightness: 50%)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $lightness: -100%)}\n"), + "a {\ + \n b: hsl(0, 100%, -50%);\ + \n}\n" + ); + } + #[test] + fn min_remaining() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $lightness: -50%)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } + #[test] + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $lightness: 0%)}\n"), + "a {\ + \n b: red;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // wrong result +fn named() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust($color: black, $hue: 12, $saturation: 24%, $lightness: 48%)}\n" + ), + "a {\ + \n b: rgb(151.776, 104.7744, 93.024);\ + \n}\n" + ); +} +mod saturation { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(plum, $saturation: 100%)}\n"), + "a {\ + \n b: hsl(300, 147.2868217054%, 74.7058823529%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(plum, $saturation: 200%)}\n"), + "a {\ + \n b: hsl(300, 247.2868217054%, 74.7058823529%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(plum, $saturation: -200%)}\n"), + "a {\ + \n b: rgb(190.5, 190.5, 190.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(plum, $saturation: -100%)}\n"), + "a {\ + \n b: rgb(190.5, 190.5, 190.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(plum, $saturation: 14%)}\n"), + "a {\ + \n b: rgb(230.03, 150.97, 230.03);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(plum, $saturation: -14%)}\n"), + "a {\ + \n b: rgb(211.97, 169.03, 211.97);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn max_remaining() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(plum, $saturation: 53%)}\n"), + "a {\ + \n b: hsl(300, 100.2868217054%, 74.7058823529%);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(plum, $saturation: -100%)}\n"), + "a {\ + \n b: rgb(190.5, 190.5, 190.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn min_remaining() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(plum, $saturation: -48%)}\n"), + "a {\ + \n b: rgb(190.5, 190.5, 190.5);\ + \n}\n" + ); + } + #[test] + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(plum, $saturation: 0%)}\n"), + "a {\ + \n b: plum;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/adjust/hwb.rs b/rsass/tests/spec/core_functions/color/adjust/hwb.rs new file mode 100644 index 000000000..e2b2cd99e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/hwb.rs @@ -0,0 +1,235 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +#[test] +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(red, $hue: 150, $whiteness: 20%, $blackness: 40%)}\n" + ), + "a {\ + \n b: #339966;\ + \n}\n" + ); +} +#[test] +fn alpha_arg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.adjust(\ + \n red,\ + \n $hue: 150,\ + \n $whiteness: 20%,\ + \n $blackness: 40%,\ + \n $alpha: -0.7\ + \n );\ + \n}\n"), + "a {\ + \n b: rgba(51, 153, 102, 0.3);\ + \n}\n" + ); +} +#[test] +fn alpha_arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.adjust(\ + \n red,\ + \n $hue: 150,\ + \n $whiteness: 20%,\ + \n $blackness: 40%,\ + \n $alpha: 0.7\ + \n );\ + \n}\n"), + "a {\ + \n b: #339966;\ + \n}\n" + ); +} +#[test] +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(rgba(red, 0.7), $hue: 150, $whiteness: 20%, $blackness: 40%)}\n" + ), + "a {\ + \n b: rgba(51, 153, 102, 0.7);\ + \n}\n" + ); +} +mod blackness { + #[allow(unused)] + use super::runner; + + #[test] + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#993333, $blackness: 40%)}\n"), + "a {\ + \n b: #333333;\ + \n}\n" + ); + } + #[test] + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#993333, $blackness: -20%)}\n"), + "a {\ + \n b: #cc3333;\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#993333, $blackness: 100%)}\n"), + "a {\ + \n b: rgb(31.875, 31.875, 31.875);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn max_remaining() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#993333, $blackness: 60%)}\n"), + "a {\ + \n b: rgb(42.5, 42.5, 42.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#993333, $blackness: -100%)}\n"), + "a {\ + \n b: hsl(0, 700%, 90%);\ + \n}\n" + ); + } + #[test] + fn min_remaining() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#993333, $blackness: -40%)}\n"), + "a {\ + \n b: #ff3333;\ + \n}\n" + ); + } + #[test] + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#993333, $blackness: 0%)}\n"), + "a {\ + \n b: #993333;\ + \n}\n" + ); + } +} +#[test] +fn named() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust($color: red, $hue: 150, $whiteness: 20%, $blackness: 40%)}\n" + ), + "a {\ + \n b: #339966;\ + \n}\n" + ); +} +mod whiteness { + #[allow(unused)] + use super::runner; + + #[test] + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#cc6666, $whiteness: 40%)}\n"), + "a {\ + \n b: #cccccc;\ + \n}\n" + ); + } + #[test] + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#cc6666, $whiteness: -20%)}\n"), + "a {\ + \n b: #cc3333;\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#cc6666, $whiteness: 100%)}\n"), + "a {\ + \n b: rgb(223.125, 223.125, 223.125);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn max_remaining() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#cc6666, $whiteness: 60%)}\n"), + "a {\ + \n b: rgb(212.5, 212.5, 212.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#cc6666, $whiteness: -100%)}\n"), + "a {\ + \n b: hsl(0, 700%, 10%);\ + \n}\n" + ); + } + #[test] + fn min_remaining() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#cc6666, $whiteness: -40%)}\n"), + "a {\ + \n b: #cc0000;\ + \n}\n" + ); + } + #[test] + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#cc6666, $whiteness: 0%)}\n"), + "a {\ + \n b: #cc6666;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/adjust/lab.rs b/rsass/tests/spec/core_functions/color/adjust/lab.rs new file mode 100644 index 000000000..f5e0a0a09 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/lab.rs @@ -0,0 +1,259 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod a { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $a: 70)}\n"), + "a {\ + \n b: lab(30% 130 -100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $a: 130)}\n"), + "a {\ + \n b: lab(30% 190 -100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $a: -500)}\n"), + "a {\ + \n b: lab(30% -440 -100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $a: -200)}\n"), + "a {\ + \n b: lab(30% -140 -100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $a: 40%)}\n"), + "a {\ + \n b: lab(30% 110 -100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $a: -30)}\n"), + "a {\ + \n b: lab(30% 30 -100);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $lightness: 40%, $a: 50, $b: 60)}\n" + ), + "a {\ + \n b: lab(70% 110 -40);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $lightness: 50%, $alpha: -0.1)}\n" + ), + "a {\ + \n b: lab(80% 60 -100 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100 / 0.9), $lightness: 50%)}\n" + ), + "a {\ + \n b: lab(80% 60 -100 / 0.9);\ + \n}\n" + ); +} +mod b { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $b: 70)}\n"), + "a {\ + \n b: lab(30% 60 -30);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $b: 500)}\n"), + "a {\ + \n b: lab(30% 60 400);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $b: -500)}\n"), + "a {\ + \n b: lab(30% 60 -600);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $b: -80)}\n"), + "a {\ + \n b: lab(30% 60 -180);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $b: 20%)}\n"), + "a {\ + \n b: lab(30% 60 -75);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $b: -30)}\n"), + "a {\ + \n b: lab(30% 60 -130);\ + \n}\n" + ); + } +} +mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $lightness: 90)}\n"), + "a {\ + \n b: lab(100% 60 -100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $lightness: 120%)}\n"), + "a {\ + \n b: lab(100% 60 -100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $lightness: -130%)}\n"), + "a {\ + \n b: lab(0% 60 -100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $lightness: -40%)}\n"), + "a {\ + \n b: lab(0% 60 -100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $lightness: -10%)}\n"), + "a {\ + \n b: lab(20% 60 -100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lab(30% 60 -100), $lightness: 50)}\n"), + "a {\ + \n b: lab(80% 60 -100);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/adjust/lch.rs b/rsass/tests/spec/core_functions/color/adjust/lch.rs new file mode 100644 index 000000000..469b4ffc1 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/lch.rs @@ -0,0 +1,215 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(lch(30% 60 180deg), $lightness: 40%, $chroma: 50, $hue: 60)}\n" + ), + "a {\ + \n b: lch(70% 110 240deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(lch(30% 60 180deg), $lightness: 50%, $alpha: -0.1)}\n" + ), + "a {\ + \n b: lch(80% 60 180deg / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(lch(30% 60 180deg / 0.9), $lightness: 50%)}\n" + ), + "a {\ + \n b: lch(80% 60 180deg / 0.9);\ + \n}\n" + ); +} +mod chroma { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lch(30% 60 180deg), $chroma: 100)}\n"), + "a {\ + \n b: lch(30% 160 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lch(30% 60 180deg), $chroma: 200)}\n"), + "a {\ + \n b: lch(30% 260 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lch(30% 60 180deg), $chroma: -200)}\n"), + "a {\ + \n b: lch(30% 0 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lch(30% 60 180deg), $chroma: -100)}\n"), + "a {\ + \n b: lch(30% 0 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lch(30% 60 180deg), $chroma: 40%)}\n"), + "a {\ + \n b: lch(30% 120 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lch(30% 60 180deg), $chroma: -30)}\n"), + "a {\ + \n b: lch(30% 30 180deg);\ + \n}\n" + ); + } +} +mod hue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn turn() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lch(30% 60 180deg), $hue: 0.5turn)}\n"), + "a {\ + \n b: lch(30% 60 0deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lch(30% 60 180deg), $hue: -30)}\n"), + "a {\ + \n b: lch(30% 60 150deg);\ + \n}\n" + ); + } +} +mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lch(30% 60 180deg), $lightness: 90)}\n"), + "a {\ + \n b: lch(100% 60 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lch(30% 60 180deg), $lightness: 120%)}\n"), + "a {\ + \n b: lch(100% 60 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lch(30% 60 180deg), $lightness: -130%)}\n"), + "a {\ + \n b: lch(0% 60 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lch(30% 60 180deg), $lightness: -40%)}\n"), + "a {\ + \n b: lch(0% 60 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lch(30% 60 180deg), $lightness: -10%)}\n"), + "a {\ + \n b: lch(20% 60 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lch(30% 60 180deg), $lightness: 50)}\n"), + "a {\ + \n b: lch(80% 60 180deg);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/adjust/mod.rs b/rsass/tests/spec/core_functions/color/adjust/mod.rs new file mode 100644 index 000000000..7fd5b2c56 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/mod.rs @@ -0,0 +1,46 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("adjust") +} + +mod a98_rgb; + +mod display_p3; + +mod error; + +mod global; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod no_channels; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod space; + +mod srgb; + +mod srgb_linear; + +mod units; + +mod xyz_d50; + +mod xyz_d65; diff --git a/rsass/tests/spec/core_functions/color/adjust/no_channels.rs b/rsass/tests/spec/core_functions/color/adjust/no_channels.rs new file mode 100644 index 000000000..69146f3cc --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/no_channels.rs @@ -0,0 +1,124 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/no_channels.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("no_channels") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(rgba(red, 0.5), $alpha: 1)}\n"), + "a {\ + \n b: red;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(rgba(red, 0.5), $alpha: 2)}\n"), + "a {\ + \n b: red;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(rgba(red, 0.5), $alpha: -2)}\n"), + "a {\ + \n b: rgba(255, 0, 0, 0);\ + \n}\n" + ); + } + #[test] + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(rgba(red, 0.5), $alpha: -1)}\n"), + "a {\ + \n b: rgba(255, 0, 0, 0);\ + \n}\n" + ); + } + #[test] + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(rgba(red, 0.5), $alpha: 0.14)}\n"), + "a {\ + \n b: rgba(255, 0, 0, 0.64);\ + \n}\n" + ); + } + #[test] + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(rgba(red, 0.5), $alpha: -0.14)}\n"), + "a {\ + \n b: rgba(255, 0, 0, 0.36);\ + \n}\n" + ); + } + #[test] + fn max_remaining() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(rgba(red, 0.5), $alpha: 0.5)}\n"), + "a {\ + \n b: red;\ + \n}\n" + ); + } + #[test] + fn min_remaining() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(rgba(red, 0.5), $alpha: -0.5)}\n"), + "a {\ + \n b: rgba(255, 0, 0, 0);\ + \n}\n" + ); + } + #[test] + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(rgba(red, 0.5), $alpha: 0)}\n"), + "a {\ + \n b: rgba(255, 0, 0, 0.5);\ + \n}\n" + ); + } +} +#[test] +fn named() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust($color: red)}\n"), + "a {\ + \n b: red;\ + \n}\n" + ); +} +#[test] +fn positional() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red)}\n"), + "a {\ + \n b: red;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust/oklab.rs b/rsass/tests/spec/core_functions/color/adjust/oklab.rs new file mode 100644 index 000000000..ea013ab69 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/oklab.rs @@ -0,0 +1,261 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod a { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $a: 0.7)}\n"), + "a {\ + \n b: oklab(30% 0.8 -0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $a: 1)}\n"), + "a {\ + \n b: oklab(30% 1.1 -0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $a: -1)}\n"), + "a {\ + \n b: oklab(30% -0.9 -0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $a: -0.6)}\n"), + "a {\ + \n b: oklab(30% -0.5 -0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $a: 40%)}\n"), + "a {\ + \n b: oklab(30% 0.26 -0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $a: -0.2)}\n"), + "a {\ + \n b: oklab(30% -0.1 -0.3);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $lightness: 40%, $a: 0.2, $b: 0.3)}\n" + ), + "a {\ + \n b: oklab(70% 0.3 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $lightness: 50%, $alpha: -0.1)}\n" + ), + "a {\ + \n b: oklab(80% 0.1 -0.3 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3 / 0.9), $lightness: 50%)}\n" + ), + "a {\ + \n b: oklab(80% 0.1 -0.3 / 0.9);\ + \n}\n" + ); +} +mod b { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $b: 0.8)}\n"), + "a {\ + \n b: oklab(30% 0.1 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $b: 1)}\n"), + "a {\ + \n b: oklab(30% 0.1 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $b: -1)}\n"), + "a {\ + \n b: oklab(30% 0.1 -1.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $b: -0.2)}\n"), + "a {\ + \n b: oklab(30% 0.1 -0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $b: 20%)}\n"), + "a {\ + \n b: oklab(30% 0.1 -0.22);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $b: -0.05)}\n"), + "a {\ + \n b: oklab(30% 0.1 -0.35);\ + \n}\n" + ); + } +} +mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $lightness: 0.9)}\n"), + "a {\ + \n b: oklab(100% 0.1 -0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $lightness: 120%)}\n"), + "a {\ + \n b: oklab(100% 0.1 -0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $lightness: -130%)}\n" + ), + "a {\ + \n b: oklab(0% 0.1 -0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $lightness: -40%)}\n"), + "a {\ + \n b: oklab(0% 0.1 -0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $lightness: -10%)}\n"), + "a {\ + \n b: oklab(20% 0.1 -0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklab(30% 0.1 -0.3), $lightness: 0.5)}\n"), + "a {\ + \n b: oklab(80% 0.1 -0.3);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/adjust/oklch.rs b/rsass/tests/spec/core_functions/color/adjust/oklch.rs new file mode 100644 index 000000000..40deaba5b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/oklch.rs @@ -0,0 +1,227 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(oklch(30% 0.15 180deg), $lightness: 40%, $chroma: 0.2, $hue: 60)}\n" + ), + "a {\ + \n b: oklch(70% 0.35 240deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(oklch(30% 0.15 180deg), $lightness: 50%, $alpha: -0.1)}\n" + ), + "a {\ + \n b: oklch(80% 0.15 180deg / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(oklch(30% 0.15 180deg / 0.9), $lightness: 50%)}\n" + ), + "a {\ + \n b: oklch(80% 0.15 180deg / 0.9);\ + \n}\n" + ); +} +mod chroma { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklch(30% 0.15 180deg), $chroma: 0.3)}\n"), + "a {\ + \n b: oklch(30% 0.45 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklch(30% 0.15 180deg), $chroma: 1)}\n"), + "a {\ + \n b: oklch(30% 1.15 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklch(30% 0.15 180deg), $chroma: -1)}\n"), + "a {\ + \n b: oklch(30% 0 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklch(30% 0.15 180deg), $chroma: -0.2)}\n"), + "a {\ + \n b: oklch(30% 0 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklch(30% 0.15 180deg), $chroma: 40%)}\n"), + "a {\ + \n b: oklch(30% 0.31 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklch(30% 0.15 180deg), $chroma: -0.1)}\n"), + "a {\ + \n b: oklch(30% 0.05 180deg);\ + \n}\n" + ); + } +} +mod hue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn turn() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklch(30% 0.15 180deg), $hue: 0.5turn)}\n"), + "a {\ + \n b: oklch(30% 0.15 0deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklch(30% 0.15 180deg), $hue: -30)}\n"), + "a {\ + \n b: oklch(30% 0.15 150deg);\ + \n}\n" + ); + } +} +mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(oklch(30% 0.15 180deg), $lightness: 0.9)}\n" + ), + "a {\ + \n b: oklch(100% 0.15 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(oklch(30% 0.15 180deg), $lightness: 120%)}\n" + ), + "a {\ + \n b: oklch(100% 0.15 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(oklch(30% 0.15 180deg), $lightness: -130%)}\n" + ), + "a {\ + \n b: oklch(0% 0.15 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(oklch(30% 0.15 180deg), $lightness: -40%)}\n" + ), + "a {\ + \n b: oklch(0% 0.15 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(oklch(30% 0.15 180deg), $lightness: -10%)}\n" + ), + "a {\ + \n b: oklch(20% 0.15 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(oklch(30% 0.15 180deg), $lightness: 0.5)}\n" + ), + "a {\ + \n b: oklch(80% 0.15 180deg);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/adjust/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/adjust/prophoto_rgb.rs new file mode 100644 index 000000000..2e01f4af3 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/prophoto_rgb.rs @@ -0,0 +1,295 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $red: 0.3, $green: 0.2, $blue: 0.1)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.5 0.7 0.8);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $red: 0.5, $alpha: -0.1)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.7 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7 / 0.9), $red: 0.5)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.7 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $blue: 0.7)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 1.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $blue: 1.7)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 2.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $blue: -1.8)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 -1.1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $blue: -0.8)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 -0.1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $blue: 20%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 0.9);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $blue: -0.3)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 0.4);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $green: 0.7)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 1.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $green: 1.7)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 2.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $green: -1.8)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 -1.3 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $green: -0.8)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 -0.3 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $green: 40%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.9 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $green: -0.3)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.2 0.7);\ + \n}\n" + ); + } +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $red: 0.9)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 1.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $red: 1.9)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 2.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $red: -1.3)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -1.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $red: -0.3)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -0.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $red: -10%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(prophoto-rgb 0.2 0.5 0.7), $red: 0.5)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.7 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/adjust/rec2020.rs b/rsass/tests/spec/core_functions/color/adjust/rec2020.rs new file mode 100644 index 000000000..dcf2853b9 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/rec2020.rs @@ -0,0 +1,289 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $red: 0.3, $green: 0.2, $blue: 0.1)}\n" + ), + "a {\ + \n b: color(rec2020 0.5 0.7 0.8);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $red: 0.5, $alpha: -0.1)}\n" + ), + "a {\ + \n b: color(rec2020 0.7 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7 / 0.9), $red: 0.5)}\n" + ), + "a {\ + \n b: color(rec2020 0.7 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $blue: 0.7)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.5 1.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $blue: 1.7)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.5 2.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $blue: -1.8)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.5 -1.1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $blue: -0.8)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.5 -0.1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $blue: 20%)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.5 0.9);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $blue: -0.3)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.5 0.4);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $green: 0.7)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 1.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $green: 1.7)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 2.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $green: -1.8)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 -1.3 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $green: -0.8)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 -0.3 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $green: 40%)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.9 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $green: -0.3)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.2 0.7);\ + \n}\n" + ); + } +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $red: 0.9)}\n"), + "a {\ + \n b: color(rec2020 1.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $red: 1.9)}\n"), + "a {\ + \n b: color(rec2020 2.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $red: -1.3)}\n" + ), + "a {\ + \n b: color(rec2020 -1.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $red: -0.3)}\n" + ), + "a {\ + \n b: color(rec2020 -0.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $red: -10%)}\n" + ), + "a {\ + \n b: color(rec2020 0.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(rec2020 0.2 0.5 0.7), $red: 0.5)}\n"), + "a {\ + \n b: color(rec2020 0.7 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/adjust/rgb.rs b/rsass/tests/spec/core_functions/color/adjust/rgb.rs new file mode 100644 index 000000000..032e76084 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/rgb.rs @@ -0,0 +1,346 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +#[test] +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(black, $red: 12, $green: 24, $blue: 48)}\n" + ), + "a {\ + \n b: #0c1830;\ + \n}\n" + ); +} +#[test] +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(black, $red: 12, $green: 24, $blue: 48, $alpha: -0.3)}\n" + ), + "a {\ + \n b: rgba(12, 24, 48, 0.7);\ + \n}\n" + ); +} +#[test] +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(rgba(black, 0.3), $red: 12, $green: 24, $blue: 48)}\n" + ), + "a {\ + \n b: rgba(12, 24, 48, 0.3);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#fedcba, $blue: 200)}\n"), + "a {\ + \n b: #fedcff;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#fedcba, $blue: 500)}\n"), + "a {\ + \n b: #fedcff;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#fedcba, $blue: -500)}\n"), + "a {\ + \n b: #fedc00;\ + \n}\n" + ); + } + #[test] + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#fedcba, $blue: -200)}\n"), + "a {\ + \n b: #fedc00;\ + \n}\n" + ); + } + #[test] + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(black, $blue: 200)}\n"), + "a {\ + \n b: #0000c8;\ + \n}\n" + ); + } + #[test] + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(blue, $blue: -100)}\n"), + "a {\ + \n b: #00009b;\ + \n}\n" + ); + } + #[test] + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(black, $blue: 255)}\n"), + "a {\ + \n b: blue;\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(blue, $blue: -255)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } + #[test] + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(black, $blue: 0)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#abcdef, $green: 200)}\n"), + "a {\ + \n b: #abffef;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#abcdef, $green: 500)}\n"), + "a {\ + \n b: #abffef;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#abcdef, $green: -500)}\n"), + "a {\ + \n b: #ab00ef;\ + \n}\n" + ); + } + #[test] + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#abcdef, $green: -210)}\n"), + "a {\ + \n b: #ab00ef;\ + \n}\n" + ); + } + #[test] + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(black, $green: 200)}\n"), + "a {\ + \n b: #00c800;\ + \n}\n" + ); + } + #[test] + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lime, $green: -100)}\n"), + "a {\ + \n b: #009b00;\ + \n}\n" + ); + } + #[test] + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(black, $green: 255)}\n"), + "a {\ + \n b: lime;\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(lime, $green: -255)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } + #[test] + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(black, $green: 0)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } +} +#[test] +fn named() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust($color: black, $red: 12, $green: 24, $blue: 48)}\n" + ), + "a {\ + \n b: #0c1830;\ + \n}\n" + ); +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#abcdef, $red: 200)}\n"), + "a {\ + \n b: #ffcdef;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#abcdef, $red: 500)}\n"), + "a {\ + \n b: #ffcdef;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#abcdef, $red: -500)}\n"), + "a {\ + \n b: #00cdef;\ + \n}\n" + ); + } + #[test] + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#abcdef, $red: -200)}\n"), + "a {\ + \n b: #00cdef;\ + \n}\n" + ); + } + #[test] + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(black, $red: 200)}\n"), + "a {\ + \n b: #c80000;\ + \n}\n" + ); + } + #[test] + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $red: -100)}\n"), + "a {\ + \n b: #9b0000;\ + \n}\n" + ); + } + #[test] + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(black, $red: 255)}\n"), + "a {\ + \n b: red;\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $red: -255)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } + #[test] + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(black, $red: 0)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/adjust/space.rs b/rsass/tests/spec/core_functions/color/adjust/space.rs new file mode 100644 index 000000000..db8972e7c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/space.rs @@ -0,0 +1,216 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/space.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("space") +} + +#[test] +#[ignore] // unexepected error +fn identical() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklch(50% 0.2 0deg), $space: lab)}\n"), + "a {\ + \n b: oklch(50% 0.2 0deg);\ + \n}\n" + ); +} +mod legacy { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn to_legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(pink, $saturation: -5%, $space: hsl)}\n"), + "a {\ + \n b: rgb(253.425, 193.575, 204.025);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_modern() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(pink, $chroma: -0.01, $space: oklch)}\n"), + "a {\ + \n b: rgb(249.5073873455, 194.8272088475, 204.1290090118);\ + \n}\n" + ); + } +} +mod missing { + #[allow(unused)] + use super::runner; + + mod legacy { + #[allow(unused)] + use super::runner; + + mod analogous { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(hsl(none 50% 50%), $space: hwb)}\n"), + "a {\ + \n b: hsl(0, 50%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn modern() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(rgb(none none none), $space: display-p3)}\n" + ), + "a {\ + \n b: black;\ + \n}\n" + ); + } + } + mod same { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn explicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(rgb(none none none), $space: rgb)}\n"), + "a {\ + \n b: rgb(none none none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn implicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(rgb(none none none))}\n"), + "a {\ + \n b: rgb(none none none);\ + \n}\n" + ); + } + } + } + mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn analogous() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb none none none), $space: display-p3)}\n" + ), + "a {\ + \n b: color(srgb none none none);\ + \n}\n" + ); + } + mod same { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn explicit() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb none none none), $space: srgb)}\n" + ), + "a {\ + \n b: color(srgb none none none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn implicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb none none none))}\n"), + "a {\ + \n b: color(srgb none none none);\ + \n}\n" + ); + } + } + } +} +mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn to_legacy() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(lab(50% 10 -20), $saturation: 5%, $space: hsl)}\n" + ), + "a {\ + \n b: lab(48.2797960499% 13.4192461856 -26.2119638245);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_modern() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(lab(50% 10 -20), $chroma: 0.01, $space: oklch)}\n" + ), + "a {\ + \n b: lab(49.8635566117% 11.8934236813 -23.2342925555);\ + \n}\n" + ); + } +} +mod powerless { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(hsl(0deg 0% 50%), $space: lab)}\n"), + "a {\ + \n b: hsl(0, 0%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn modern() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(oklch(50% 0 0deg), $space: lab)}\n"), + "a {\ + \n b: oklch(50% 0 none);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/adjust/srgb.rs b/rsass/tests/spec/core_functions/color/adjust/srgb.rs new file mode 100644 index 000000000..c0ec3ea36 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/srgb.rs @@ -0,0 +1,259 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $red: 0.3, $green: 0.2, $blue: 0.1)}\n" + ), + "a {\ + \n b: color(srgb 0.5 0.7 0.8);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $red: 0.5, $alpha: -0.1)}\n" + ), + "a {\ + \n b: color(srgb 0.7 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7 / 0.9), $red: 0.5)}\n" + ), + "a {\ + \n b: color(srgb 0.7 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $blue: 0.7)}\n"), + "a {\ + \n b: color(srgb 0.2 0.5 1.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $blue: 1.7)}\n"), + "a {\ + \n b: color(srgb 0.2 0.5 2.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $blue: -1.8)}\n"), + "a {\ + \n b: color(srgb 0.2 0.5 -1.1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $blue: -0.8)}\n"), + "a {\ + \n b: color(srgb 0.2 0.5 -0.1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $blue: 20%)}\n"), + "a {\ + \n b: color(srgb 0.2 0.5 0.9);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $blue: -0.3)}\n"), + "a {\ + \n b: color(srgb 0.2 0.5 0.4);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $green: 0.7)}\n"), + "a {\ + \n b: color(srgb 0.2 1.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $green: 1.7)}\n"), + "a {\ + \n b: color(srgb 0.2 2.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $green: -1.8)}\n"), + "a {\ + \n b: color(srgb 0.2 -1.3 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $green: -0.8)}\n"), + "a {\ + \n b: color(srgb 0.2 -0.3 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $green: 40%)}\n"), + "a {\ + \n b: color(srgb 0.2 0.9 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $green: -0.3)}\n"), + "a {\ + \n b: color(srgb 0.2 0.2 0.7);\ + \n}\n" + ); + } +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $red: 0.9)}\n"), + "a {\ + \n b: color(srgb 1.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $red: 1.9)}\n"), + "a {\ + \n b: color(srgb 2.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $red: -1.3)}\n"), + "a {\ + \n b: color(srgb -1.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $red: -0.3)}\n"), + "a {\ + \n b: color(srgb -0.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $red: -10%)}\n"), + "a {\ + \n b: color(srgb 0.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(srgb 0.2 0.5 0.7), $red: 0.5)}\n"), + "a {\ + \n b: color(srgb 0.7 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/adjust/srgb_linear.rs b/rsass/tests/spec/core_functions/color/adjust/srgb_linear.rs new file mode 100644 index 000000000..e0982172f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/srgb_linear.rs @@ -0,0 +1,295 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $red: 0.3, $green: 0.2, $blue: 0.1)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.5 0.7 0.8);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $red: 0.5, $alpha: -0.1)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.7 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7 / 0.9), $red: 0.5)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.7 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $blue: 0.7)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 1.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $blue: 1.7)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 2.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $blue: -1.8)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 -1.1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $blue: -0.8)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 -0.1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $blue: 20%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 0.9);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $blue: -0.3)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 0.4);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $green: 0.7)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 1.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $green: 1.7)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 2.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $green: -1.8)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 -1.3 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $green: -0.8)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 -0.3 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $green: 40%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.9 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $green: -0.3)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.2 0.7);\ + \n}\n" + ); + } +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $red: 0.9)}\n" + ), + "a {\ + \n b: color(srgb-linear 1.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $red: 1.9)}\n" + ), + "a {\ + \n b: color(srgb-linear 2.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $red: -1.3)}\n" + ), + "a {\ + \n b: color(srgb-linear -1.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $red: -0.3)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $red: -10%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(srgb-linear 0.2 0.5 0.7), $red: 0.5)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.7 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/adjust_color/units.rs b/rsass/tests/spec/core_functions/color/adjust/units.rs similarity index 53% rename from rsass/tests/spec/core_functions/color/adjust_color/units.rs rename to rsass/tests/spec/core_functions/color/adjust/units.rs index db11cbdb6..ee5dbae6a 100644 --- a/rsass/tests/spec/core_functions/color/adjust_color/units.rs +++ b/rsass/tests/spec/core_functions/color/adjust/units.rs @@ -1,4 +1,4 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust_color/units.hrx" +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/units.hrx" #[allow(unused)] fn runner() -> crate::TestRunner { @@ -12,7 +12,8 @@ mod alpha { #[test] fn percent() { assert_eq!( - runner().ok("a {b: adjust-color(red, $alpha: -0.3%)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $alpha: -0.3%)}\n"), "a {\ \n b: rgba(255, 0, 0, 0.7);\ \n}\n" @@ -21,7 +22,8 @@ mod alpha { #[test] fn unitless() { assert_eq!( - runner().ok("a {b: adjust-color(red, $alpha: -0.3)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $alpha: -0.3)}\n"), "a {\ \n b: rgba(255, 0, 0, 0.7);\ \n}\n" @@ -30,7 +32,8 @@ mod alpha { #[test] fn unknown() { assert_eq!( - runner().ok("a {b: adjust-color(red, $alpha: -0.3px)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $alpha: -0.3px)}\n"), "a {\ \n b: rgba(255, 0, 0, 0.7);\ \n}\n" @@ -42,18 +45,21 @@ mod hue { use super::runner; #[test] + #[ignore] // wrong result fn angle() { assert_eq!( - runner().ok("a {b: adjust-color(red, $hue: 60rad)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $hue: 60rad)}\n"), "a {\ - \n b: #00b4ff;\ + \n b: rgb(0, 179.576224164, 255);\ \n}\n" ); } #[test] fn deg() { assert_eq!( - runner().ok("a {b: adjust-color(red, $hue: 60deg)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $hue: 60deg)}\n"), "a {\ \n b: yellow;\ \n}\n" @@ -62,7 +68,8 @@ mod hue { #[test] fn unitless() { assert_eq!( - runner().ok("a {b: adjust-color(red, $hue: 60)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $hue: 60)}\n"), "a {\ \n b: yellow;\ \n}\n" @@ -71,7 +78,8 @@ mod hue { #[test] fn unknown() { assert_eq!( - runner().ok("a {b: adjust-color(red, $hue: 60in)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $hue: 60in)}\n"), "a {\ \n b: yellow;\ \n}\n" @@ -85,7 +93,8 @@ mod lightness { #[test] fn percent() { assert_eq!( - runner().ok("a {b: adjust-color(red, $lightness: 10%)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $lightness: 10%)}\n"), "a {\ \n b: #ff3333;\ \n}\n" @@ -94,7 +103,8 @@ mod lightness { #[test] fn unitless() { assert_eq!( - runner().ok("a {b: adjust-color(red, $lightness: 10)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $lightness: 10)}\n"), "a {\ \n b: #ff3333;\ \n}\n" @@ -103,7 +113,8 @@ mod lightness { #[test] fn unknown() { assert_eq!( - runner().ok("a {b: adjust-color(red, $lightness: 10in)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $lightness: 10in)}\n"), "a {\ \n b: #ff3333;\ \n}\n" @@ -115,29 +126,35 @@ mod saturation { use super::runner; #[test] + #[ignore] // wrong result fn percent() { assert_eq!( - runner().ok("a {b: adjust-color(red, $saturation: -10%)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $saturation: -10%)}\n"), "a {\ - \n b: #f20d0d;\ + \n b: rgb(242.25, 12.75, 12.75);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn unitless() { assert_eq!( - runner().ok("a {b: adjust-color(red, $saturation: -10)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $saturation: -10)}\n"), "a {\ - \n b: #f20d0d;\ + \n b: rgb(242.25, 12.75, 12.75);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn unknown() { assert_eq!( - runner().ok("a {b: adjust-color(red, $saturation: -10in)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(red, $saturation: -10in)}\n"), "a {\ - \n b: #f20d0d;\ + \n b: rgb(242.25, 12.75, 12.75);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/adjust/xyz_d50.rs b/rsass/tests/spec/core_functions/color/adjust/xyz_d50.rs new file mode 100644 index 000000000..e61e778e1 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/xyz_d50.rs @@ -0,0 +1,259 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $x: 0.3, $y: 0.2, $z: 0.1)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.5 0.7 0.8);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $x: 0.5, $alpha: -0.1)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.7 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7 / 0.9), $x: 0.5)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.7 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +mod x { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $x: 0.9)}\n"), + "a {\ + \n b: color(xyz-d50 1.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $x: 1.9)}\n"), + "a {\ + \n b: color(xyz-d50 2.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $x: -1.3)}\n"), + "a {\ + \n b: color(xyz-d50 -1.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $x: -0.3)}\n"), + "a {\ + \n b: color(xyz-d50 -0.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $x: -10%)}\n"), + "a {\ + \n b: color(xyz-d50 0.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $x: 0.5)}\n"), + "a {\ + \n b: color(xyz-d50 0.7 0.5 0.7);\ + \n}\n" + ); + } +} +mod y { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $y: 0.7)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 1.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $y: 1.7)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 2.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $y: -1.8)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 -1.3 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $y: -0.8)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 -0.3 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $y: 40%)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.9 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $y: -0.3)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.2 0.7);\ + \n}\n" + ); + } +} +mod z { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $z: 0.7)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.5 1.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $z: 1.7)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.5 2.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $z: -1.8)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.5 -1.1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $z: -0.8)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.5 -0.1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $z: 20%)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.5 0.9);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d50 0.2 0.5 0.7), $z: -0.3)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.5 0.4);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/adjust/xyz_d65.rs b/rsass/tests/spec/core_functions/color/adjust/xyz_d65.rs new file mode 100644 index 000000000..73c490a93 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust/xyz_d65.rs @@ -0,0 +1,259 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust/xyz_d65.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d65") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $x: 0.3, $y: 0.2, $z: 0.1)}\n" + ), + "a {\ + \n b: color(xyz 0.5 0.7 0.8);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $x: 0.5, $alpha: -0.1)}\n" + ), + "a {\ + \n b: color(xyz 0.7 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7 / 0.9), $x: 0.5)}\n" + ), + "a {\ + \n b: color(xyz 0.7 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +mod x { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $x: 0.9)}\n"), + "a {\ + \n b: color(xyz 1.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $x: 1.9)}\n"), + "a {\ + \n b: color(xyz 2.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $x: -1.3)}\n"), + "a {\ + \n b: color(xyz -1.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $x: -0.3)}\n"), + "a {\ + \n b: color(xyz -0.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $x: -10%)}\n"), + "a {\ + \n b: color(xyz 0.1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $x: 0.5)}\n"), + "a {\ + \n b: color(xyz 0.7 0.5 0.7);\ + \n}\n" + ); + } +} +mod y { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $y: 0.7)}\n"), + "a {\ + \n b: color(xyz 0.2 1.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $y: 1.7)}\n"), + "a {\ + \n b: color(xyz 0.2 2.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $y: -1.8)}\n"), + "a {\ + \n b: color(xyz 0.2 -1.3 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $y: -0.8)}\n"), + "a {\ + \n b: color(xyz 0.2 -0.3 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $y: 40%)}\n"), + "a {\ + \n b: color(xyz 0.2 0.9 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $y: -0.3)}\n"), + "a {\ + \n b: color(xyz 0.2 0.2 0.7);\ + \n}\n" + ); + } +} +mod z { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $z: 0.7)}\n"), + "a {\ + \n b: color(xyz 0.2 0.5 1.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $z: 1.7)}\n"), + "a {\ + \n b: color(xyz 0.2 0.5 2.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $z: -1.8)}\n"), + "a {\ + \n b: color(xyz 0.2 0.5 -1.1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $z: -0.8)}\n"), + "a {\ + \n b: color(xyz 0.2 0.5 -0.1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $z: 20%)}\n"), + "a {\ + \n b: color(xyz 0.2 0.5 0.9);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(color(xyz-d65 0.2 0.5 0.7), $z: -0.3)}\n"), + "a {\ + \n b: color(xyz 0.2 0.5 0.4);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/adjust_color/error/bounds.rs b/rsass/tests/spec/core_functions/color/adjust_color/error/bounds.rs deleted file mode 100644 index 7b04b998a..000000000 --- a/rsass/tests/spec/core_functions/color/adjust_color/error/bounds.rs +++ /dev/null @@ -1,378 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust_color/error/bounds.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("bounds") -} - -mod alpha { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: adjust-color(red, $alpha: 1.001)}\n"), - "Error: $alpha: Expected 1.001 to be within -1 and 1.\ - \n ,\ - \n1 | a {b: adjust-color(red, $alpha: 1.001)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: adjust-color(red, $alpha: -1.001)}\n"), - "Error: $alpha: Expected -1.001 to be within -1 and 1.\ - \n ,\ - \n1 | a {b: adjust-color(red, $alpha: -1.001)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - #[ignore] // wrong error - fn unit() { - assert_eq!( - runner().err( - "// This test covers sass/dart-sass#1745, but should be removed once units are\ - \n// fully forbidden (sass/sass#3374).\ - \na {b: adjust-color(red, $alpha: 50%)}\n" - ), - "DEPRECATION WARNING: $alpha: Passing a number with unit % is deprecated.\n\ - \nTo preserve current behavior: calc($alpha / 1%)\n\ - \nMore info: https://sass-lang.com/d/function-units\n\ - \n ,\ - \n3 | a {b: adjust-color(red, $alpha: 50%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet\n\ - \nError: $alpha: Expected 50% to be within -1 and 1.\ - \n ,\ - \n3 | a {b: adjust-color(red, $alpha: 50%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet", - ); - } -} -mod blackness { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err( - "a {b: adjust-color(red, $blackness: 100.001%)}\n" - ), - "Error: $blackness: Expected 100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: adjust-color(red, $blackness: 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err( - "a {b: adjust-color(red, $blackness: -100.001%)}\n" - ), - "Error: $blackness: Expected -100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: adjust-color(red, $blackness: -100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } -} -mod blue { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: adjust-color(blue, $blue: 256)}\n"), - "Error: $blue: Expected 256 to be within -255 and 255.\ - \n ,\ - \n1 | a {b: adjust-color(blue, $blue: 256)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: adjust-color(blue, $blue: -256)}\n"), - "Error: $blue: Expected -256 to be within -255 and 255.\ - \n ,\ - \n1 | a {b: adjust-color(blue, $blue: -256)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn unit() { - assert_eq!( - runner().err( - "// This test covers sass/dart-sass#1745, but should be removed once units are\ - \n// fully forbidden (sass/sass#3374).\ - \na {b: adjust-color(blue, $blue: 300px)}\n" - ), - "Error: $blue: Expected 300px to be within -255 and 255.\ - \n ,\ - \n3 | a {b: adjust-color(blue, $blue: 300px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet", - ); - } -} -mod green { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: adjust-color(green, $green: 256)}\n"), - "Error: $green: Expected 256 to be within -255 and 255.\ - \n ,\ - \n1 | a {b: adjust-color(green, $green: 256)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: adjust-color(green, $green: -256)}\n"), - "Error: $green: Expected -256 to be within -255 and 255.\ - \n ,\ - \n1 | a {b: adjust-color(green, $green: -256)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn unit() { - assert_eq!( - runner().err( - "// This test covers sass/dart-sass#1745, but should be removed once units are\ - \n// fully forbidden (sass/sass#3374).\ - \na {b: adjust-color(green, $green: 300px)}\n" - ), - "Error: $green: Expected 300px to be within -255 and 255.\ - \n ,\ - \n3 | a {b: adjust-color(green, $green: 300px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet", - ); - } -} -mod lightness { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err( - "a {b: adjust-color(red, $lightness: 100.001%)}\n" - ), - "Error: $lightness: Expected 100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: adjust-color(red, $lightness: 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err( - "a {b: adjust-color(red, $lightness: -100.001%)}\n" - ), - "Error: $lightness: Expected -100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: adjust-color(red, $lightness: -100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - #[ignore] // wrong error - fn unit() { - assert_eq!( - runner().err( - "// This test covers sass/dart-sass#1745, but should be removed once units are\ - \n// fully forbidden (sass/sass#3374).\ - \na {b: adjust-color(red, $lightness: 200px)}\n" - ), - "DEPRECATION WARNING: $lightness: Passing a number without unit % (200px) is deprecated.\n\ - \nTo preserve current behavior: calc($lightness / 1px * 1%)\n\ - \nMore info: https://sass-lang.com/d/function-units\n\ - \n ,\ - \n3 | a {b: adjust-color(red, $lightness: 200px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet\n\ - \nError: $lightness: Expected 200px to be within -100% and 100%.\ - \n ,\ - \n3 | a {b: adjust-color(red, $lightness: 200px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet", - ); - } -} -mod red { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: adjust-color(red, $red: 256)}\n"), - "Error: $red: Expected 256 to be within -255 and 255.\ - \n ,\ - \n1 | a {b: adjust-color(red, $red: 256)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: adjust-color(red, $red: -256)}\n"), - "Error: $red: Expected -256 to be within -255 and 255.\ - \n ,\ - \n1 | a {b: adjust-color(red, $red: -256)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn unit() { - assert_eq!( - runner().err( - "// This test covers sass/dart-sass#1745, but should be removed once units are\ - \n// fully forbidden (sass/sass#3374).\ - \na {b: adjust-color(red, $red: 300px)}\n" - ), - "Error: $red: Expected 300px to be within -255 and 255.\ - \n ,\ - \n3 | a {b: adjust-color(red, $red: 300px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet", - ); - } -} -mod saturation { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err( - "a {b: adjust-color(red, $saturation: 100.001%)}\n" - ), - "Error: $saturation: Expected 100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: adjust-color(red, $saturation: 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err( - "a {b: adjust-color(red, $saturation: -100.001%)}\n" - ), - "Error: $saturation: Expected -100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: adjust-color(red, $saturation: -100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - #[ignore] // wrong error - fn unit() { - assert_eq!( - runner().err( - "// This test covers sass/dart-sass#1745, but should be removed once units are\ - \n// fully forbidden (sass/sass#3374).\ - \na {b: adjust-color(red, $saturation: 200px)}\n" - ), - "DEPRECATION WARNING: $saturation: Passing a number without unit % (200px) is deprecated.\n\ - \nTo preserve current behavior: calc($saturation / 1px * 1%)\n\ - \nMore info: https://sass-lang.com/d/function-units\n\ - \n ,\ - \n3 | a {b: adjust-color(red, $saturation: 200px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet\n\ - \nError: $saturation: Expected 200px to be within -100% and 100%.\ - \n ,\ - \n3 | a {b: adjust-color(red, $saturation: 200px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet", - ); - } -} -mod whiteness { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err( - "a {b: adjust-color(red, $whiteness: 100.001%)}\n" - ), - "Error: $whiteness: Expected 100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: adjust-color(red, $whiteness: 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err( - "a {b: adjust-color(red, $whiteness: -100.001%)}\n" - ), - "Error: $whiteness: Expected -100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: adjust-color(red, $whiteness: -100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } -} diff --git a/rsass/tests/spec/core_functions/color/adjust_color/error/missing_globals.rs b/rsass/tests/spec/core_functions/color/adjust_color/error/missing_globals.rs new file mode 100644 index 000000000..000a82c2c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/adjust_color/error/missing_globals.rs @@ -0,0 +1,175 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust_color/error/missing_globals.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("missing_globals") +} + +#[test] +fn adjust_color() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust-color(#abcdef, $red: 10)}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: color.adjust-color(#abcdef, $red: 10)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn adjust_hue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.adjust-hue(#abcdef, 10)}\n" + ), + "Error: The function adjust-hue() isn\'t in the sass:color module.\n\ + \nRecommendation: color.adjust(#abcdef, $hue: 10)\n\ + \nMore info: https://sass-lang.com/documentation/functions/color#adjust-hue\ + \n ,\ + \n2 | a {b: color.adjust-hue(#abcdef, 10)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn darken() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.darken(#abcdef, 10%)}\n" + ), + "Error: The function darken() isn\'t in the sass:color module.\n\ + \nRecommendation: color.adjust(#abcdef, $lightness: -10%)\n\ + \nMore info: https://sass-lang.com/documentation/functions/color#darken\ + \n ,\ + \n2 | a {b: color.darken(#abcdef, 10%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn desaturate() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.desaturate(#abcdef, 10%)}\n" + ), + "Error: The function desaturate() isn\'t in the sass:color module.\n\ + \nRecommendation: color.adjust(#abcdef, $saturation: -10%)\n\ + \nMore info: https://sass-lang.com/documentation/functions/color#desaturate\ + \n ,\ + \n2 | a {b: color.desaturate(#abcdef, 10%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn fade_in() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.fade-in(#abcdef, 0.5)}\n" + ), + "Error: The function fade-in() isn\'t in the sass:color module.\n\ + \nRecommendation: color.adjust(#abcdef, $alpha: 0.5)\n\ + \nMore info: https://sass-lang.com/documentation/functions/color#fade-in\ + \n ,\ + \n2 | a {b: color.fade-in(#abcdef, 0.5)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn fade_out() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.fade-out(#abcdef, 0.5)}\n" + ), + "Error: The function fade-out() isn\'t in the sass:color module.\n\ + \nRecommendation: color.adjust(#abcdef, $alpha: -0.5)\n\ + \nMore info: https://sass-lang.com/documentation/functions/color#fade-out\ + \n ,\ + \n2 | a {b: color.fade-out(#abcdef, 0.5)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn lighten() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.lighten(#abcdef, 10%)}\n" + ), + "Error: The function lighten() isn\'t in the sass:color module.\n\ + \nRecommendation: color.adjust(#abcdef, $lightness: 10%)\n\ + \nMore info: https://sass-lang.com/documentation/functions/color#lighten\ + \n ,\ + \n2 | a {b: color.lighten(#abcdef, 10%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn opacify() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.opacify(#abcdef, 0.5)}\n" + ), + "Error: The function opacify() isn\'t in the sass:color module.\n\ + \nRecommendation: color.adjust(#abcdef, $alpha: 0.5)\n\ + \nMore info: https://sass-lang.com/documentation/functions/color#opacify\ + \n ,\ + \n2 | a {b: color.opacify(#abcdef, 0.5)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn saturate() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.saturate(#abcdef, 10%)}\n" + ), + "Error: The function saturate() isn\'t in the sass:color module.\n\ + \nRecommendation: color.adjust(#abcdef, $saturation: 10%)\n\ + \nMore info: https://sass-lang.com/documentation/functions/color#saturate\ + \n ,\ + \n2 | a {b: color.saturate(#abcdef, 10%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn transparentize() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.transparentize(#abcdef, 0.5)}\n" + ), + "Error: The function transparentize() isn\'t in the sass:color module.\n\ + \nRecommendation: color.adjust(#abcdef, $alpha: -0.5)\n\ + \nMore info: https://sass-lang.com/documentation/functions/color#transparentize\ + \n ,\ + \n2 | a {b: color.transparentize(#abcdef, 0.5)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust_color/error/mixed_formats.rs b/rsass/tests/spec/core_functions/color/adjust_color/error/mixed_formats.rs deleted file mode 100644 index c13e4abb9..000000000 --- a/rsass/tests/spec/core_functions/color/adjust_color/error/mixed_formats.rs +++ /dev/null @@ -1,96 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust_color/error/mixed_formats.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("mixed_formats") -} - -#[test] -fn blue_and_lightness() { - assert_eq!( - runner().err("a {b: adjust-color(red, $blue: 1, $lightness: 1%)}\n"), - "Error: RGB parameters may not be passed along with HSL parameters.\ - \n ,\ - \n1 | a {b: adjust-color(red, $blue: 1, $lightness: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn green_and_saturation() { - assert_eq!( - runner() - .err("a {b: adjust-color(red, $green: 1, $saturation: 1%)}\n"), - "Error: RGB parameters may not be passed along with HSL parameters.\ - \n ,\ - \n1 | a {b: adjust-color(red, $green: 1, $saturation: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn green_and_whiteness() { - assert_eq!( - runner().err("a {b: adjust-color(red, $green: 1, $whiteness: 1%)}\n"), - "Error: RGB parameters may not be passed along with HWB parameters.\ - \n ,\ - \n1 | a {b: adjust-color(red, $green: 1, $whiteness: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn lightness_and_whiteness() { - assert_eq!( - runner().err( - "a {b: adjust-color(red, $lightness: 1%, $whiteness: 1%)}\n" - ), - "Error: HSL parameters may not be passed along with HWB parameters.\ - \n ,\ - \n1 | a {b: adjust-color(red, $lightness: 1%, $whiteness: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn red_and_blackness() { - assert_eq!( - runner().err("a {b: adjust-color(red, $red: 1, $blackness: 1%)}\n"), - "Error: RGB parameters may not be passed along with HWB parameters.\ - \n ,\ - \n1 | a {b: adjust-color(red, $red: 1, $blackness: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn red_and_hue() { - assert_eq!( - runner().err("a {b: adjust-color(red, $red: 1, $hue: 1)}\n"), - "Error: RGB parameters may not be passed along with HSL parameters.\ - \n ,\ - \n1 | a {b: adjust-color(red, $red: 1, $hue: 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn saturation_and_blackness() { - assert_eq!( - runner().err( - "a {b: adjust-color(red, $saturation: 1%, $blackness: 1%)}\n" - ), - "Error: HSL parameters may not be passed along with HWB parameters.\ - \n ,\ - \n1 | a {b: adjust-color(red, $saturation: 1%, $blackness: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} diff --git a/rsass/tests/spec/core_functions/color/adjust_color/error/mod.rs b/rsass/tests/spec/core_functions/color/adjust_color/error/mod.rs index 46673aca8..37a3ef41c 100644 --- a/rsass/tests/spec/core_functions/color/adjust_color/error/mod.rs +++ b/rsass/tests/spec/core_functions/color/adjust_color/error/mod.rs @@ -5,12 +5,4 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("error") } -mod args; - -mod bounds; - -mod mixed_formats; - -mod test_type; - -mod units; +mod missing_globals; diff --git a/rsass/tests/spec/core_functions/color/adjust_color/error/test_type.rs b/rsass/tests/spec/core_functions/color/adjust_color/error/test_type.rs deleted file mode 100644 index cdb80ec28..000000000 --- a/rsass/tests/spec/core_functions/color/adjust_color/error/test_type.rs +++ /dev/null @@ -1,127 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust_color/error/type.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("type") -} - -#[test] -fn alpha() { - assert_eq!( - runner().err("a {b: adjust-color(red, $alpha: c)}\n"), - "Error: $alpha: c is not a number.\ - \n ,\ - \n1 | a {b: adjust-color(red, $alpha: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn blackness() { - assert_eq!( - runner().err("a {b: adjust-color(red, $blackness: c)}\n"), - "Error: $blackness: c is not a number.\ - \n ,\ - \n1 | a {b: adjust-color(red, $blackness: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn blue() { - assert_eq!( - runner().err("a {b: adjust-color(red, $blue: c)}\n"), - "Error: $blue: c is not a number.\ - \n ,\ - \n1 | a {b: adjust-color(red, $blue: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn color() { - assert_eq!( - runner().err("a {b: adjust-color(1)}\n"), - "Error: $color: 1 is not a color.\ - \n ,\ - \n1 | a {b: adjust-color(1)}\ - \n | ^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn green() { - assert_eq!( - runner().err("a {b: adjust-color(red, $green: c)}\n"), - "Error: $green: c is not a number.\ - \n ,\ - \n1 | a {b: adjust-color(red, $green: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn hue() { - assert_eq!( - runner().err("a {b: adjust-color(red, $hue: c)}\n"), - "Error: $hue: c is not a number.\ - \n ,\ - \n1 | a {b: adjust-color(red, $hue: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn lightness() { - assert_eq!( - runner().err("a {b: adjust-color(red, $lightness: c)}\n"), - "Error: $lightness: c is not a number.\ - \n ,\ - \n1 | a {b: adjust-color(red, $lightness: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn red() { - assert_eq!( - runner().err("a {b: adjust-color(red, $red: c)}\n"), - "Error: $red: c is not a number.\ - \n ,\ - \n1 | a {b: adjust-color(red, $red: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn saturation() { - assert_eq!( - runner().err("a {b: adjust-color(red, $saturation: c)}\n"), - "Error: $saturation: c is not a number.\ - \n ,\ - \n1 | a {b: adjust-color(red, $saturation: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn whiteness() { - assert_eq!( - runner().err("a {b: adjust-color(red, $whiteness: c)}\n"), - "Error: $whiteness: c is not a number.\ - \n ,\ - \n1 | a {b: adjust-color(red, $whiteness: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} diff --git a/rsass/tests/spec/core_functions/color/adjust_color/hsl.rs b/rsass/tests/spec/core_functions/color/adjust_color/hsl.rs deleted file mode 100644 index 12dfab7ab..000000000 --- a/rsass/tests/spec/core_functions/color/adjust_color/hsl.rs +++ /dev/null @@ -1,267 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust_color/hsl.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("hsl") -} - -#[test] -fn all() { - assert_eq!( - runner().ok( - "a {b: adjust-color(black, $hue: 12, $saturation: 24%, $lightness: 48%)}\n" - ), - "a {\ - \n b: #98695d;\ - \n}\n" - ); -} -#[test] -fn alpha_arg() { - assert_eq!( - runner().ok( - "a {b: adjust-color(black, $hue: 12, $saturation: 24%, $lightness: 48%, $alpha: -0.7)}\n" - ), - "a {\ - \n b: rgba(152, 105, 93, 0.3);\ - \n}\n" - ); -} -#[test] -fn alpha_arg_above_max() { - assert_eq!( - runner().ok( - "// Regression test for sass/dart-sass#708.\ - \na {b: adjust-color(black, $hue: 12, $saturation: 24%, $lightness: 48%, $alpha: 0.7)}\n" - ), - "a {\ - \n b: #98695d;\ - \n}\n" - ); -} -#[test] -fn alpha_input() { - assert_eq!( - runner().ok( - "a {b: adjust-color(rgba(black, 0.7), $hue: 12, $saturation: 24%, $lightness: 48%)}\n" - ), - "a {\ - \n b: rgba(152, 105, 93, 0.7);\ - \n}\n" - ); -} -mod hue { - #[allow(unused)] - use super::runner; - - #[test] - fn above_max() { - assert_eq!( - runner().ok("a {b: adjust-color(red, $hue: 540)}\n"), - "a {\ - \n b: aqua;\ - \n}\n" - ); - } - #[test] - fn fraction() { - assert_eq!( - runner().ok("a {b: adjust-color(red, $hue: 0.5)}\n"), - "a {\ - \n b: #ff0200;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: adjust-color(red, $hue: 359)}\n"), - "a {\ - \n b: #ff0004;\ - \n}\n" - ); - } - #[test] - fn middle() { - assert_eq!( - runner().ok("a {b: adjust-color(red, $hue: 123)}\n"), - "a {\ - \n b: #00ff0d;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: adjust-color(blue, $hue: 0)}\n"), - "a {\ - \n b: blue;\ - \n}\n" - ); - } - #[test] - fn negative() { - assert_eq!( - runner().ok("a {b: adjust-color(red, $hue: -180)}\n"), - "a {\ - \n b: aqua;\ - \n}\n" - ); - } -} -mod lightness { - #[allow(unused)] - use super::runner; - - #[test] - fn fraction() { - assert_eq!( - runner().ok("a {b: adjust-color(red, $lightness: 0.5%)}\n"), - "a {\ - \n b: #ff0303;\ - \n}\n" - ); - } - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: adjust-color(red, $lightness: 14%)}\n"), - "a {\ - \n b: #ff4747;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: adjust-color(red, $lightness: -14%)}\n"), - "a {\ - \n b: #b80000;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: adjust-color(red, $lightness: 100%)}\n"), - "a {\ - \n b: white;\ - \n}\n" - ); - } - #[test] - fn max_remaining() { - assert_eq!( - runner().ok("a {b: adjust-color(red, $lightness: 50%)}\n"), - "a {\ - \n b: white;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: adjust-color(red, $lightness: -100%)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } - #[test] - fn min_remaining() { - assert_eq!( - runner().ok("a {b: adjust-color(red, $lightness: -50%)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } - #[test] - fn zero() { - assert_eq!( - runner().ok("a {b: adjust-color(red, $lightness: 0%)}\n"), - "a {\ - \n b: red;\ - \n}\n" - ); - } -} -#[test] -fn named() { - assert_eq!( - runner().ok( - "a {b: adjust-color($color: black, $hue: 12, $saturation: 24%, $lightness: 48%)}\n" - ), - "a {\ - \n b: #98695d;\ - \n}\n" - ); -} -mod saturation { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: adjust-color(plum, $saturation: 14%)}\n"), - "a {\ - \n b: #e697e6;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: adjust-color(plum, $saturation: -14%)}\n"), - "a {\ - \n b: #d4a9d4;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: adjust-color(plum, $saturation: 100%)}\n"), - "a {\ - \n b: #ff7eff;\ - \n}\n" - ); - } - #[test] - fn max_remaining() { - assert_eq!( - runner().ok("a {b: adjust-color(plum, $saturation: 53%)}\n"), - "a {\ - \n b: #ff7eff;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: adjust-color(plum, $saturation: -100%)}\n"), - "a {\ - \n b: #bfbfbf;\ - \n}\n" - ); - } - #[test] - fn min_remaining() { - assert_eq!( - runner().ok("a {b: adjust-color(plum, $saturation: -48%)}\n"), - "a {\ - \n b: #bfbfbf;\ - \n}\n" - ); - } - #[test] - fn zero() { - assert_eq!( - runner().ok("a {b: adjust-color(plum, $saturation: 0%)}\n"), - "a {\ - \n b: plum;\ - \n}\n" - ); - } -} diff --git a/rsass/tests/spec/core_functions/color/adjust_color/hwb.rs b/rsass/tests/spec/core_functions/color/adjust_color/hwb.rs deleted file mode 100644 index 72f4a9dda..000000000 --- a/rsass/tests/spec/core_functions/color/adjust_color/hwb.rs +++ /dev/null @@ -1,198 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust_color/hwb.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("hwb") -} - -#[test] -fn all() { - assert_eq!( - runner().ok( - "a {b: adjust-color(red, $hue: 150, $whiteness: 20%, $blackness: 40%)}\n" - ), - "a {\ - \n b: #339966;\ - \n}\n" - ); -} -#[test] -fn alpha_arg() { - assert_eq!( - runner().ok( - "a {b: adjust-color(red, $hue: 150, $whiteness: 20%, $blackness: 40%, $alpha: -0.7)}\n" - ), - "a {\ - \n b: rgba(51, 153, 102, 0.3);\ - \n}\n" - ); -} -#[test] -fn alpha_arg_above_max() { - assert_eq!( - runner().ok( - "a {b: adjust-color(red, $hue: 150, $whiteness: 20%, $blackness: 40%, $alpha: 0.7)}\n" - ), - "a {\ - \n b: #339966;\ - \n}\n" - ); -} -#[test] -fn alpha_input() { - assert_eq!( - runner().ok( - "a {b: adjust-color(rgba(red, 0.7), $hue: 150, $whiteness: 20%, $blackness: 40%)}\n" - ), - "a {\ - \n b: rgba(51, 153, 102, 0.7);\ - \n}\n" - ); -} -mod blackness { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: adjust-color(#993333, $blackness: 40%)}\n"), - "a {\ - \n b: #333333;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: adjust-color(#993333, $blackness: -20%)}\n"), - "a {\ - \n b: #cc3333;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: adjust-color(#993333, $blackness: 100%)}\n"), - "a {\ - \n b: #2b2b2b;\ - \n}\n" - ); - } - #[test] - fn max_remaining() { - assert_eq!( - runner().ok("a {b: adjust-color(#993333, $blackness: 60%)}\n"), - "a {\ - \n b: #2b2b2b;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: adjust-color(#993333, $blackness: -100%)}\n"), - "a {\ - \n b: #ff3333;\ - \n}\n" - ); - } - #[test] - fn min_remaining() { - assert_eq!( - runner().ok("a {b: adjust-color(#993333, $blackness: -40%)}\n"), - "a {\ - \n b: #ff3333;\ - \n}\n" - ); - } - #[test] - fn zero() { - assert_eq!( - runner().ok("a {b: adjust-color(#993333, $blackness: 0%)}\n"), - "a {\ - \n b: #993333;\ - \n}\n" - ); - } -} -#[test] -fn named() { - assert_eq!( - runner().ok( - "a {b: adjust-color($color: red, $hue: 150, $whiteness: 20%, $blackness: 40%)}\n" - ), - "a {\ - \n b: #339966;\ - \n}\n" - ); -} -mod whiteness { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: adjust-color(#cc6666, $whiteness: 40%)}\n"), - "a {\ - \n b: #cccccc;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: adjust-color(#cc6666, $whiteness: -20%)}\n"), - "a {\ - \n b: #cc3333;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: adjust-color(#cc6666, $whiteness: 100%)}\n"), - "a {\ - \n b: #d5d5d5;\ - \n}\n" - ); - } - #[test] - fn max_remaining() { - assert_eq!( - runner().ok("a {b: adjust-color(#cc6666, $whiteness: 60%)}\n"), - "a {\ - \n b: #d5d5d5;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: adjust-color(#cc6666, $whiteness: -100%)}\n"), - "a {\ - \n b: #cc0000;\ - \n}\n" - ); - } - #[test] - fn min_remaining() { - assert_eq!( - runner().ok("a {b: adjust-color(#cc6666, $whiteness: -40%)}\n"), - "a {\ - \n b: #cc0000;\ - \n}\n" - ); - } - #[test] - fn zero() { - assert_eq!( - runner().ok("a {b: adjust-color(#cc6666, $whiteness: 0%)}\n"), - "a {\ - \n b: #cc6666;\ - \n}\n" - ); - } -} diff --git a/rsass/tests/spec/core_functions/color/adjust_color/mod.rs b/rsass/tests/spec/core_functions/color/adjust_color/mod.rs index 205103ffe..9fa57e71c 100644 --- a/rsass/tests/spec/core_functions/color/adjust_color/mod.rs +++ b/rsass/tests/spec/core_functions/color/adjust_color/mod.rs @@ -6,13 +6,3 @@ fn runner() -> crate::TestRunner { } mod error; - -mod hsl; - -mod hwb; - -mod no_rgb_hsl; - -mod rgb; - -mod units; diff --git a/rsass/tests/spec/core_functions/color/adjust_color/no_rgb_hsl.rs b/rsass/tests/spec/core_functions/color/adjust_color/no_rgb_hsl.rs deleted file mode 100644 index 337549e97..000000000 --- a/rsass/tests/spec/core_functions/color/adjust_color/no_rgb_hsl.rs +++ /dev/null @@ -1,96 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust_color/no_rgb_hsl.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("no_rgb_hsl") -} - -mod alpha { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner() - .ok("a {b: adjust-color(rgba(red, 0.5), $alpha: 0.14)}\n"), - "a {\ - \n b: rgba(255, 0, 0, 0.64);\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner() - .ok("a {b: adjust-color(rgba(red, 0.5), $alpha: -0.14)}\n"), - "a {\ - \n b: rgba(255, 0, 0, 0.36);\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: adjust-color(rgba(red, 0.5), $alpha: 1)}\n"), - "a {\ - \n b: red;\ - \n}\n" - ); - } - #[test] - fn max_remaining() { - assert_eq!( - runner().ok("a {b: adjust-color(rgba(red, 0.5), $alpha: 0.5)}\n"), - "a {\ - \n b: red;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: adjust-color(rgba(red, 0.5), $alpha: -1)}\n"), - "a {\ - \n b: rgba(255, 0, 0, 0);\ - \n}\n" - ); - } - #[test] - fn min_remaining() { - assert_eq!( - runner() - .ok("a {b: adjust-color(rgba(red, 0.5), $alpha: -0.5)}\n"), - "a {\ - \n b: rgba(255, 0, 0, 0);\ - \n}\n" - ); - } - #[test] - fn zero() { - assert_eq!( - runner().ok("a {b: adjust-color(rgba(red, 0.5), $alpha: 0)}\n"), - "a {\ - \n b: rgba(255, 0, 0, 0.5);\ - \n}\n" - ); - } -} -#[test] -fn named() { - assert_eq!( - runner().ok("a {b: adjust-color($color: red)}\n"), - "a {\ - \n b: red;\ - \n}\n" - ); -} -#[test] -fn positional() { - assert_eq!( - runner().ok("a {b: adjust-color(red)}\n"), - "a {\ - \n b: red;\ - \n}\n" - ); -} diff --git a/rsass/tests/spec/core_functions/color/adjust_color/rgb.rs b/rsass/tests/spec/core_functions/color/adjust_color/rgb.rs deleted file mode 100644 index 1d5b19621..000000000 --- a/rsass/tests/spec/core_functions/color/adjust_color/rgb.rs +++ /dev/null @@ -1,201 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust_color/rgb.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("rgb") -} - -#[test] -fn all() { - assert_eq!( - runner().ok( - "a {b: adjust-color(black, $red: 12, $green: 24, $blue: 48)}\n" - ), - "a {\ - \n b: #0c1830;\ - \n}\n" - ); -} -#[test] -fn alpha_arg() { - assert_eq!( - runner().ok( - "a {b: adjust-color(black, $red: 12, $green: 24, $blue: 48, $alpha: -0.3)}\n" - ), - "a {\ - \n b: rgba(12, 24, 48, 0.7);\ - \n}\n" - ); -} -#[test] -fn alpha_input() { - assert_eq!( - runner().ok( - "a {b: adjust-color(rgba(black, 0.3), $red: 12, $green: 24, $blue: 48)}\n" - ), - "a {\ - \n b: rgba(12, 24, 48, 0.3);\ - \n}\n" - ); -} -mod blue { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: adjust-color(black, $blue: 200)}\n"), - "a {\ - \n b: #0000c8;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: adjust-color(blue, $blue: -100)}\n"), - "a {\ - \n b: #00009b;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: adjust-color(black, $blue: 255)}\n"), - "a {\ - \n b: blue;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: adjust-color(blue, $blue: -255)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } - #[test] - fn zero() { - assert_eq!( - runner().ok("a {b: adjust-color(black, $blue: 0)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } -} -mod green { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: adjust-color(black, $green: 200)}\n"), - "a {\ - \n b: #00c800;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: adjust-color(lime, $green: -100)}\n"), - "a {\ - \n b: #009b00;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: adjust-color(black, $green: 255)}\n"), - "a {\ - \n b: lime;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: adjust-color(lime, $green: -255)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } - #[test] - fn zero() { - assert_eq!( - runner().ok("a {b: adjust-color(black, $green: 0)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } -} -#[test] -fn named() { - assert_eq!( - runner().ok( - "a {b: adjust-color($color: black, $red: 12, $green: 24, $blue: 48)}\n" - ), - "a {\ - \n b: #0c1830;\ - \n}\n" - ); -} -mod red { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: adjust-color(black, $red: 200)}\n"), - "a {\ - \n b: #c80000;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: adjust-color(red, $red: -100)}\n"), - "a {\ - \n b: #9b0000;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: adjust-color(black, $red: 255)}\n"), - "a {\ - \n b: red;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: adjust-color(red, $red: -255)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } - #[test] - fn zero() { - assert_eq!( - runner().ok("a {b: adjust-color(black, $red: 0)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } -} diff --git a/rsass/tests/spec/core_functions/color/adjust_hue.rs b/rsass/tests/spec/core_functions/color/adjust_hue.rs index 14b72a6f1..59c47c21b 100644 --- a/rsass/tests/spec/core_functions/color/adjust_hue.rs +++ b/rsass/tests/spec/core_functions/color/adjust_hue.rs @@ -15,11 +15,12 @@ fn above_max() { ); } #[test] +#[ignore] // wrong result fn alpha() { assert_eq!( runner().ok("a {b: adjust-hue(rgba(red, 0.1), 359)}\n"), "a {\ - \n b: rgba(255, 0, 4, 0.1);\ + \n b: rgba(255, 0, 4.25, 0.1);\ \n}\n" ); } @@ -27,6 +28,21 @@ mod error { #[allow(unused)] use super::runner; + #[test] + #[ignore] // wrong error + fn non_legacy() { + assert_eq!( + runner().err( + "a {b: adjust-hue(lch(0% 0 0deg), 10deg)}\n" + ), + "Error: adjust-hue() is only supported for legacy colors. Please use color.adjust() instead with an explicit $space argument.\ + \n ,\ + \n1 | a {b: adjust-hue(lch(0% 0 0deg), 10deg)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } #[test] fn too_few_args() { assert_eq!( @@ -90,29 +106,32 @@ mod error { } } #[test] +#[ignore] // wrong result fn fraction() { assert_eq!( runner().ok("a {b: adjust-hue(red, 0.5)}\n"), "a {\ - \n b: #ff0200;\ + \n b: rgb(255, 2.125, 0);\ \n}\n" ); } #[test] +#[ignore] // wrong result fn max() { assert_eq!( runner().ok("a {b: adjust-hue(red, 359)}\n"), "a {\ - \n b: #ff0004;\ + \n b: rgb(255, 0, 4.25);\ \n}\n" ); } #[test] +#[ignore] // wrong result fn middle() { assert_eq!( runner().ok("a {b: adjust-hue(red, 123)}\n"), "a {\ - \n b: #00ff0d;\ + \n b: rgb(0, 255, 12.75);\ \n}\n" ); } @@ -126,11 +145,12 @@ fn min() { ); } #[test] +#[ignore] // wrong result fn named() { assert_eq!( runner().ok("a {b: adjust-hue($color: red, $degrees: 123)}\n"), "a {\ - \n b: #00ff0d;\ + \n b: rgb(0, 255, 12.75);\ \n}\n" ); } @@ -148,11 +168,12 @@ mod units { use super::runner; #[test] + #[ignore] // wrong result fn angle() { assert_eq!( runner().ok("a {b: adjust-hue(red, 60rad)}\n"), "a {\ - \n b: #00b4ff;\ + \n b: rgb(0, 179.576224164, 255);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/alpha.rs b/rsass/tests/spec/core_functions/color/alpha.rs index 481e9b849..ebb28b1f6 100644 --- a/rsass/tests/spec/core_functions/color/alpha.rs +++ b/rsass/tests/spec/core_functions/color/alpha.rs @@ -12,7 +12,8 @@ mod color { #[test] fn max() { assert_eq!( - runner().ok("a {b: alpha(red)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.alpha(red)}\n"), "a {\ \n b: 1;\ \n}\n" @@ -21,7 +22,8 @@ mod color { #[test] fn middle() { assert_eq!( - runner().ok("a {b: alpha(rgba(red, 0.42))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.alpha(rgba(red, 0.42))}\n"), "a {\ \n b: 0.42;\ \n}\n" @@ -30,7 +32,8 @@ mod color { #[test] fn min() { assert_eq!( - runner().ok("a {b: alpha(rgba(red, 0))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.alpha(rgba(red, 0))}\n"), "a {\ \n b: 0;\ \n}\n" @@ -39,40 +42,103 @@ mod color { #[test] fn named() { assert_eq!( - runner().ok("a {b: alpha($color: rgba(red, 0.73))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.alpha($color: rgba(red, 0.73))}\n"), "a {\ \n b: 0.73;\ \n}\n" ); } } +mod css_overloads { + #[allow(unused)] + use super::runner; + + mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + fn multi_arg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.alpha(c=d, e=f, g=h)}\n"), + "a {\ + \n b: alpha(c=d, e=f, g=h);\ + \n}\n" + ); + } + #[test] + fn one_arg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.alpha(c=d)}\n"), + "a {\ + \n b: alpha(c=d);\ + \n}\n" + ); + } + } + #[test] + fn opacity() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.opacity(1)}\n"), + "a {\ + \n b: opacity(1);\ + \n}\n" + ); + } +} mod error { #[allow(unused)] use super::runner; + #[test] + #[ignore] // wrong error + fn non_legacy() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.alpha(color(srgb 1 1 1))}\n" + ), + "Error: color.alpha() is only supported for legacy colors. Please use color.channel() instead.\ + \n ,\ + \n2 | a {b: color.alpha(color(srgb 1 1 1))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } #[test] fn quoted_string() { assert_eq!( - runner().err("a {b: alpha(\"c=d\")}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.alpha(\"c=d\")}\n" + ), "Error: $color: \"c=d\" is not a color.\ \n ,\ - \n1 | a {b: alpha(\"c=d\")}\ - \n | ^^^^^^^^^^^^\ + \n2 | a {b: color.alpha(\"c=d\")}\ + \n | ^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] #[ignore] // wrong error fn too_few_args() { assert_eq!( - runner().err("a {b: alpha()}\n"), - "Error: Missing argument $color.\ + runner().err( + "@use \"sass:color\";\ + \na {b: color.alpha()}\n" + ), + "Error: () isn\'t a valid CSS value.\ \n ,\ - \n1 | a {b: alpha()}\ - \n | ^^^^^^^\ + \n2 | a {b: color.alpha()}\ + \n | ^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] @@ -91,13 +157,16 @@ mod error { #[test] fn test_type() { assert_eq!( - runner().err("a {b: alpha(1)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.alpha(1)}\n" + ), "Error: $color: 1 is not a color.\ \n ,\ - \n1 | a {b: alpha(1)}\ - \n | ^^^^^^^^\ + \n2 | a {b: color.alpha(1)}\ + \n | ^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod unquoted_string { @@ -107,25 +176,32 @@ mod error { #[test] fn no_equals() { assert_eq!( - runner().err("a {b: alpha(cd)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.alpha(cd)}\n" + ), "Error: $color: cd is not a color.\ \n ,\ - \n1 | a {b: alpha(cd)}\ - \n | ^^^^^^^^^\ + \n2 | a {b: color.alpha(cd)}\ + \n | ^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn non_identifier_before_equals() { assert_eq!( - runner().err("a {b: alpha(unquote(\"1=c\"))}\n"), + runner().err( + "@use \"sass:color\";\ + \n@use \"sass:string\";\ + \na {b: color.alpha(string.unquote(\"1=c\"))}\n" + ), "Error: $color: 1=c is not a color.\ \n ,\ - \n1 | a {b: alpha(unquote(\"1=c\"))}\ - \n | ^^^^^^^^^^^^^^^^^^^^^\ + \n3 | a {b: color.alpha(string.unquote(\"1=c\"))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 3:7 root stylesheet", ); } } @@ -138,7 +214,7 @@ mod error { fn test_type() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.opacity(var(--c))}\n" ), "Error: $color: var(--c) is not a color.\ @@ -176,7 +252,9 @@ mod filter { #[test] fn space_before_equals() { assert_eq!( - runner().ok("a {b: alpha(unquote(\"c = d\"))}\n"), + runner().ok("@use \"sass:color\";\ + \n@use \"sass:string\";\ + \na {b: color.alpha(string.unquote(\"c = d\"))}\n"), "a {\ \n b: alpha(c = d);\ \n}\n" @@ -199,7 +277,8 @@ mod opacity { #[test] fn named() { assert_eq!( - runner().ok("a {b: opacity($color: rgba(red, 0.2))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.opacity($color: rgba(red, 0.2))}\n"), "a {\ \n b: 0.2;\ \n}\n" @@ -208,7 +287,8 @@ mod opacity { #[test] fn positional() { assert_eq!( - runner().ok("a {b: opacity(rgba(red, 0.2))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.opacity(rgba(red, 0.2))}\n"), "a {\ \n b: 0.2;\ \n}\n" @@ -235,7 +315,8 @@ mod opacity { #[test] fn with_unquoted_calc() { assert_eq!( - runner().ok("a {b: opacity(unquote(\'calc(1)\'))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: opacity(string.unquote(\'calc(1)\'))}\n"), "a {\ \n b: opacity(calc(1));\ \n}\n" diff --git a/rsass/tests/spec/core_functions/color/blackness.rs b/rsass/tests/spec/core_functions/color/blackness.rs index b6da01bdc..78736ae34 100644 --- a/rsass/tests/spec/core_functions/color/blackness.rs +++ b/rsass/tests/spec/core_functions/color/blackness.rs @@ -9,11 +9,27 @@ mod error { #[allow(unused)] use super::runner; + #[test] + #[ignore] // wrong error + fn non_legacy() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.blackness(color(srgb 1 1 1))}\n" + ), + "Error: color.blackness() is only supported for legacy colors. Please use color.channel() instead with an explicit $space argument.\ + \n ,\ + \n2 | a {b: color.blackness(color(srgb 1 1 1))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } #[test] fn too_few_args() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.blackness()}\n" ), "Error: Missing argument $color.\ @@ -32,7 +48,7 @@ mod error { fn too_many_args() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.blackness(red, green)}\n" ), "Error: Only 1 argument allowed, but 2 were passed.\ @@ -51,7 +67,7 @@ mod error { fn test_type() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.blackness(1)}\n" ), "Error: $color: 1 is not a color.\ @@ -64,19 +80,20 @@ mod error { } } #[test] +#[ignore] // unexepected error fn fraction() { assert_eq!( - runner().ok("@use \'sass:color\';\ - \na {b: color.blackness(color.hwb(0, 0%, 0.5%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.blackness(hwb(0 0% 0.5%))}\n"), "a {\ - \n b: 0.3921568627%;\ + \n b: 0.5%;\ \n}\n" ); } #[test] fn max() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.blackness(black)}\n"), "a {\ \n b: 100%;\ @@ -88,32 +105,35 @@ mod middle { use super::runner; #[test] + #[ignore] // unexepected error fn half_whiteness() { assert_eq!( - runner().ok("@use \'sass:color\';\ - \na {b: color.blackness(color.hwb(0, 50%, 50%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.blackness(hwb(0 50% 50%))}\n"), "a {\ - \n b: 49.8039215686%;\ + \n b: 50%;\ \n}\n" ); } #[test] + #[ignore] // unexepected error fn high_whiteness() { assert_eq!( - runner().ok("@use \'sass:color\';\ - \na {b: color.blackness(color.hwb(0, 70%, 70%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.blackness(hwb(0 70% 70%))}\n"), "a {\ - \n b: 49.8039215686%;\ + \n b: 50%;\ \n}\n" ); } #[test] + #[ignore] // unexepected error fn zero_whiteness() { assert_eq!( - runner().ok("@use \'sass:color\';\ - \na {b: color.blackness(color.hwb(0, 0%, 50%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.blackness(hwb(0 0% 50%))}\n"), "a {\ - \n b: 49.8039215686%;\ + \n b: 50%;\ \n}\n" ); } @@ -121,7 +141,7 @@ mod middle { #[test] fn min() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.blackness(white)}\n"), "a {\ \n b: 0%;\ @@ -129,12 +149,13 @@ fn min() { ); } #[test] +#[ignore] // unexepected error fn named() { assert_eq!( - runner().ok("@use \'sass:color\';\ - \na {b: color.blackness($color: color.hwb(0, 0%, 42%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.blackness($color: hwb(0 0% 42%))}\n"), "a {\ - \n b: 41.9607843137%;\ + \n b: 42%;\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/blue.rs b/rsass/tests/spec/core_functions/color/blue.rs index 6ee036324..b8b2f91fc 100644 --- a/rsass/tests/spec/core_functions/color/blue.rs +++ b/rsass/tests/spec/core_functions/color/blue.rs @@ -9,55 +9,81 @@ mod error { #[allow(unused)] use super::runner; + #[test] + #[ignore] // wrong error + fn non_legacy() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.blue(color(srgb 1 1 1))}\n" + ), + "Error: color.blue() is only supported for legacy colors. Please use color.channel() instead with an explicit $space argument.\ + \n ,\ + \n2 | a {b: color.blue(color(srgb 1 1 1))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: blue()}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.blue()}\n" + ), "Error: Missing argument $color.\ \n ,--> input.scss\ - \n1 | a {b: blue()}\ - \n | ^^^^^^ invocation\ + \n2 | a {b: color.blue()}\ + \n | ^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ \n1 | @function blue($color) {\ \n | ============ declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: blue(red, green)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.blue(red, green)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: blue(red, green)}\ - \n | ^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: color.blue(red, green)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ \n1 | @function blue($color) {\ \n | ============ declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: blue(1)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.blue(1)}\n" + ), "Error: $color: 1 is not a color.\ \n ,\ - \n1 | a {b: blue(1)}\ - \n | ^^^^^^^\ + \n2 | a {b: color.blue(1)}\ + \n | ^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn max() { assert_eq!( - runner().ok("a {b: blue(rgb(0, 0, 255))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.blue(rgb(0, 0, 255))}\n"), "a {\ \n b: 255;\ \n}\n" @@ -66,7 +92,8 @@ fn max() { #[test] fn middle() { assert_eq!( - runner().ok("a {b: blue(rgb(0, 0, 123))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.blue(rgb(0, 0, 123))}\n"), "a {\ \n b: 123;\ \n}\n" @@ -75,7 +102,8 @@ fn middle() { #[test] fn min() { assert_eq!( - runner().ok("a {b: blue(rgb(0, 0, 0))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.blue(rgb(0, 0, 0))}\n"), "a {\ \n b: 0;\ \n}\n" @@ -84,7 +112,8 @@ fn min() { #[test] fn named() { assert_eq!( - runner().ok("a {b: blue($color: rgb(0, 0, 234))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.blue($color: rgb(0, 0, 234))}\n"), "a {\ \n b: 234;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/color/change/a98_rgb.rs b/rsass/tests/spec/core_functions/color/change/a98_rgb.rs new file mode 100644 index 000000000..eb9de5958 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/a98_rgb.rs @@ -0,0 +1,211 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7), $red: 0.7, $green: 0.4, $blue: 0.2)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.7 0.4 0.2);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7), $red: 0.5, $alpha: 0.9)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.5 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7 / 0.9), $red: 0.5)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.5 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7), $blue: none)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.5 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7), $blue: 100)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.5 100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7), $blue: 50%)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.5 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7), $blue: 0.5)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.5 0.5);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7), $green: none)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 none 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7), $green: -0.2)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 -0.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7), $green: 40%)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.4 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7), $green: 0.4)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.4 0.7);\ + \n}\n" + ); + } +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7), $red: none)}\n" + ), + "a {\ + \n b: color(a98-rgb none 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7), $red: 1.2)}\n"), + "a {\ + \n b: color(a98-rgb 1.2 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7), $red: 50%)}\n"), + "a {\ + \n b: color(a98-rgb 0.5 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7), $red: 0.5)}\n"), + "a {\ + \n b: color(a98-rgb 0.5 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/change/display_p3.rs b/rsass/tests/spec/core_functions/color/change/display_p3.rs new file mode 100644 index 000000000..8eb5cfe67 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/display_p3.rs @@ -0,0 +1,217 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7), $red: 0.7, $green: 0.4, $blue: 0.2)}\n" + ), + "a {\ + \n b: color(display-p3 0.7 0.4 0.2);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7), $red: 0.5, $alpha: 0.9)}\n" + ), + "a {\ + \n b: color(display-p3 0.5 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7 / 0.9), $red: 0.5)}\n" + ), + "a {\ + \n b: color(display-p3 0.5 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7), $blue: none)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7), $blue: 100)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7), $blue: 50%)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7), $blue: 0.5)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 0.5);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7), $green: none)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 none 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7), $green: -0.2)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 -0.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7), $green: 40%)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.4 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7), $green: 0.4)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.4 0.7);\ + \n}\n" + ); + } +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7), $red: none)}\n" + ), + "a {\ + \n b: color(display-p3 none 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7), $red: 1.2)}\n" + ), + "a {\ + \n b: color(display-p3 1.2 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7), $red: 50%)}\n" + ), + "a {\ + \n b: color(display-p3 0.5 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7), $red: 0.5)}\n" + ), + "a {\ + \n b: color(display-p3 0.5 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/change/error/args.rs b/rsass/tests/spec/core_functions/color/change/error/args.rs new file mode 100644 index 000000000..d84f72b52 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/args.rs @@ -0,0 +1,72 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/args.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("args") +} + +#[test] +fn too_few() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change()}\n" + ), + "Error: Missing argument $color.\ + \n ,--> input.scss\ + \n2 | a {b: color.change()}\ + \n | ^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function change($color, $kwargs...) {\ + \n | ========================== declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn too_many() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, 1)}\n" + ), + "Error: Only one positional argument is allowed. All other arguments must be passed by name.\ + \n ,\ + \n2 | a {b: color.change(red, 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn unknown() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $ambience: 10%)}\n" + ), + "Error: $ambience: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.change(red, $ambience: 10%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change-color(#abcdef, $red: 10)}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: color.change-color(#abcdef, $red: 10)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/change/error/bounds.rs b/rsass/tests/spec/core_functions/color/change/error/bounds.rs new file mode 100644 index 000000000..993a3fb80 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/bounds.rs @@ -0,0 +1,58 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/bounds.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("bounds") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + fn too_high() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $alpha: 1.001)}\n" + ), + "Error: $alpha: Expected 1.001 to be within 0 and 1.\ + \n ,\ + \n2 | a {b: color.change(red, $alpha: 1.001)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + fn too_low() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $alpha: -0.001)}\n" + ), + "Error: $alpha: Expected -0.001 to be within 0 and 1.\ + \n ,\ + \n2 | a {b: color.change(red, $alpha: -0.001)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn unit() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $alpha: 150%)}\n" + ), + "Error: $alpha: Expected 150% to be within 0% and 100%.\ + \n ,\ + \n2 | a {b: color.change(red, $alpha: 150%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/change/error/incompatible_channel.rs b/rsass/tests/spec/core_functions/color/change/error/incompatible_channel.rs new file mode 100644 index 000000000..ee7bfcf34 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/incompatible_channel.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/incompatible_channel.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("incompatible_channel") +} + +#[test] +#[ignore] // wrong error +fn legacy_channel() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $whiteness: 50%)}\n" + ), + "Error: $whiteness: Color space srgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.change(color(srgb 0.2 0.5 0.7), $whiteness: 50%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn legacy_space() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $chroma: 50%)}\n" + ), + "Error: $chroma: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.change(red, $chroma: 50%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn modern_both() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $chroma: 50%)}\n" + ), + "Error: $chroma: Color space srgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.change(color(srgb 0.2 0.5 0.7), $chroma: 50%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/change/error/mixed_formats.rs b/rsass/tests/spec/core_functions/color/change/error/mixed_formats.rs new file mode 100644 index 000000000..3e505d8ca --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/mixed_formats.rs @@ -0,0 +1,119 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/mixed_formats.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("mixed_formats") +} + +#[test] +#[ignore] // wrong error +fn blue_and_lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $blue: 1, $lightness: 1%)}\n" + ), + "Error: $lightness: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.change(red, $blue: 1, $lightness: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green_and_saturation() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $green: 1, $saturation: 1%)}\n" + ), + "Error: $saturation: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.change(red, $green: 1, $saturation: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green_and_whiteness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $green: 1, $whiteness: 1%)}\n" + ), + "Error: $whiteness: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.change(red, $green: 1, $whiteness: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn lightness_and_whiteness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $lightness: 1%, $whiteness: 1%)}\n" + ), + "Error: $whiteness: Color space hsl doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.change(red, $lightness: 1%, $whiteness: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red_and_blackness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $red: 1, $blackness: 1%)}\n" + ), + "Error: $blackness: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.change(red, $red: 1, $blackness: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red_and_hue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $red: 1, $hue: 1)}\n" + ), + "Error: $hue: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.change(red, $red: 1, $hue: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn saturation_and_blackness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $saturation: 1%, $blackness: 1%)}\n" + ), + "Error: $blackness: Color space hsl doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.change(red, $saturation: 1%, $blackness: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/change_color/error/mod.rs b/rsass/tests/spec/core_functions/color/change/error/mod.rs similarity index 80% rename from rsass/tests/spec/core_functions/color/change_color/error/mod.rs rename to rsass/tests/spec/core_functions/color/change/error/mod.rs index e14ee35ad..535290e9f 100644 --- a/rsass/tests/spec/core_functions/color/change_color/error/mod.rs +++ b/rsass/tests/spec/core_functions/color/change/error/mod.rs @@ -1,4 +1,4 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/change_color/error" +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error" #[allow(unused)] fn runner() -> crate::TestRunner { @@ -9,8 +9,12 @@ mod args; mod bounds; +mod incompatible_channel; + mod mixed_formats; +mod space; + mod test_type; mod units; diff --git a/rsass/tests/spec/core_functions/color/change/error/space.rs b/rsass/tests/spec/core_functions/color/change/error/space.rs new file mode 100644 index 000000000..eecb00597 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/space.rs @@ -0,0 +1,39 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/space.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("space") +} + +#[test] +#[ignore] // wrong error +fn quoted() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $space: \"lab\")}\n" + ), + "Error: $space: Expected \"lab\" to be an unquoted string.\ + \n ,\ + \n2 | a {b: color.change(red, $space: \"lab\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn unknown() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $space: c)}\n" + ), + "Error: $space: Unknown color space \"c\".\ + \n ,\ + \n2 | a {b: color.change(red, $space: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/change/error/test_type.rs b/rsass/tests/spec/core_functions/color/change/error/test_type.rs new file mode 100644 index 000000000..a2cfe5ca1 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/test_type.rs @@ -0,0 +1,198 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/type.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("type") +} + +#[test] +#[ignore] // wrong error +fn alpha() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $alpha: c)}\n" + ), + "Error: $alpha: c is not a number or unquoted \"none\".\ + \n ,\ + \n2 | a {b: color.change(red, $alpha: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn blackness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $blackness: c)}\n" + ), + "Error: $blackness: c is not a number or unquoted \"none\".\ + \n ,\ + \n2 | a {b: color.change(red, $blackness: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $blue: c)}\n" + ), + "Error: $blue: c is not a number or unquoted \"none\".\ + \n ,\ + \n2 | a {b: color.change(red, $blue: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn color() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(1)}\n" + ), + "Error: $color: 1 is not a color.\ + \n ,\ + \n2 | a {b: color.change(1)}\ + \n | ^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $green: c)}\n" + ), + "Error: $green: c is not a number or unquoted \"none\".\ + \n ,\ + \n2 | a {b: color.change(red, $green: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn hue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $hue: c)}\n" + ), + "Error: $hue: c is not a number or unquoted \"none\".\ + \n ,\ + \n2 | a {b: color.change(red, $hue: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $lightness: c)}\n" + ), + "Error: $lightness: c is not a number or unquoted \"none\".\ + \n ,\ + \n2 | a {b: color.change(red, $lightness: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn quoted_none() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $alpha: \"none\")}\n" + ), + "Error: $alpha: \"none\" is not a number or unquoted \"none\".\ + \n ,\ + \n2 | a {b: color.change(red, $alpha: \"none\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $red: c)}\n" + ), + "Error: $red: c is not a number or unquoted \"none\".\ + \n ,\ + \n2 | a {b: color.change(red, $red: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn saturation() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $saturation: c)}\n" + ), + "Error: $saturation: c is not a number or unquoted \"none\".\ + \n ,\ + \n2 | a {b: color.change(red, $saturation: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn space() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $space: 1)}\n" + ), + "Error: $space: 1 is not a string.\ + \n ,\ + \n2 | a {b: color.change(red, $space: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn whiteness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(red, $whiteness: c)}\n" + ), + "Error: $whiteness: c is not a number or unquoted \"none\".\ + \n ,\ + \n2 | a {b: color.change(red, $whiteness: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/change/error/units/a98_rgb.rs b/rsass/tests/spec/core_functions/color/change/error/units/a98_rgb.rs new file mode 100644 index 000000000..cad5560a8 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/units/a98_rgb.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/units/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +#[test] +#[ignore] // wrong error +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7), $blue: 0.5px)}\n" + ), + "Error: $blue: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(a98-rgb 0.2 0.5 0.7), $blue: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7), $green: 0.5px)}\n" + ), + "Error: $green: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(a98-rgb 0.2 0.5 0.7), $green: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(a98-rgb 0.2 0.5 0.7), $red: 0.5px)}\n" + ), + "Error: $red: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(a98-rgb 0.2 0.5 0.7), $red: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/change/error/units/display_p3.rs b/rsass/tests/spec/core_functions/color/change/error/units/display_p3.rs new file mode 100644 index 000000000..8a2e6ca1f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/units/display_p3.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/units/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +#[test] +#[ignore] // wrong error +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7), $blue: 0.5px)}\n" + ), + "Error: $blue: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(display-p3 0.2 0.5 0.7), $blue: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7), $green: 0.5px)}\n" + ), + "Error: $green: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(display-p3 0.2 0.5 0.7), $green: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(display-p3 0.2 0.5 0.7), $red: 0.5px)}\n" + ), + "Error: $red: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(display-p3 0.2 0.5 0.7), $red: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/adjust_color/error/units.rs b/rsass/tests/spec/core_functions/color/change/error/units/hwb.rs similarity index 51% rename from rsass/tests/spec/core_functions/color/adjust_color/error/units.rs rename to rsass/tests/spec/core_functions/color/change/error/units/hwb.rs index b7912370e..481f9c711 100644 --- a/rsass/tests/spec/core_functions/color/adjust_color/error/units.rs +++ b/rsass/tests/spec/core_functions/color/change/error/units/hwb.rs @@ -1,8 +1,8 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust_color/error/units.hrx" +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/units/hwb.hrx" #[allow(unused)] fn runner() -> crate::TestRunner { - super::runner().with_cwd("units") + super::runner().with_cwd("hwb") } mod none { @@ -12,25 +12,31 @@ mod none { #[test] fn blackness() { assert_eq!( - runner().err("a {b: adjust-color(black, $blackness: 1)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(black, $blackness: 1)}\n" + ), "Error: $blackness: Expected 1 to have unit \"%\".\ \n ,\ - \n1 | a {b: adjust-color(black, $blackness: 1)}\ + \n2 | a {b: color.change(black, $blackness: 1)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn whiteness() { assert_eq!( - runner().err("a {b: adjust-color(white, $whiteness: 1)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(white, $whiteness: 1)}\n" + ), "Error: $whiteness: Expected 1 to have unit \"%\".\ \n ,\ - \n1 | a {b: adjust-color(white, $whiteness: 1)}\ + \n2 | a {b: color.change(white, $whiteness: 1)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -41,25 +47,31 @@ mod wrong { #[test] fn blackness() { assert_eq!( - runner().err("a {b: adjust-color(black, $blackness: 1px)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(black, $blackness: 1px)}\n" + ), "Error: $blackness: Expected 1px to have unit \"%\".\ \n ,\ - \n1 | a {b: adjust-color(black, $blackness: 1px)}\ + \n2 | a {b: color.change(black, $blackness: 1px)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn whiteness() { assert_eq!( - runner().err("a {b: adjust-color(white, $whiteness: 1px)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(white, $whiteness: 1px)}\n" + ), "Error: $whiteness: Expected 1px to have unit \"%\".\ \n ,\ - \n1 | a {b: adjust-color(white, $whiteness: 1px)}\ + \n2 | a {b: color.change(white, $whiteness: 1px)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } diff --git a/rsass/tests/spec/core_functions/color/change/error/units/lab.rs b/rsass/tests/spec/core_functions/color/change/error/units/lab.rs new file mode 100644 index 000000000..bbda453f1 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/units/lab.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/units/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +#[test] +#[ignore] // wrong error +fn a() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(lab(50% 30 -50), $a: 20px)}\n" + ), + "Error: $a: Expected 20px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(lab(50% 30 -50), $a: 20px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn b() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(lab(50% 30 -50), $b: 20px)}\n" + ), + "Error: $b: Expected 20px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(lab(50% 30 -50), $b: 20px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(lab(50% 30 -50), $lightness: 30px)}\n" + ), + "Error: $lightness: Expected 30px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(lab(50% 30 -50), $lightness: 30px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/change/error/units/lch.rs b/rsass/tests/spec/core_functions/color/change/error/units/lch.rs new file mode 100644 index 000000000..636a1a8fd --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/units/lch.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/units/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +#[test] +#[ignore] // wrong error +fn chroma() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(lch(50% 30 50deg), $chroma: 20px)}\n" + ), + "Error: $chroma: Expected 20px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(lch(50% 30 50deg), $chroma: 20px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn hue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(lch(50% 30 50deg), $hue: 20%)}\n" + ), + "Error: $hue: Expected 20% to have an angle unit (deg, grad, rad, turn).\ + \n ,\ + \n2 | a {b: color.change(lch(50% 30 50deg), $hue: 20%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(lch(50% 30 50deg), $lightness: 30px)}\n" + ), + "Error: $lightness: Expected 30px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(lch(50% 30 50deg), $lightness: 30px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/change/error/units/mod.rs b/rsass/tests/spec/core_functions/color/change/error/units/mod.rs new file mode 100644 index 000000000..aa31cd192 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/units/mod.rs @@ -0,0 +1,32 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/units" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("units") +} + +mod a98_rgb; + +mod display_p3; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/change/error/units/oklab.rs b/rsass/tests/spec/core_functions/color/change/error/units/oklab.rs new file mode 100644 index 000000000..37853fb8f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/units/oklab.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/units/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +#[test] +#[ignore] // wrong error +fn a() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3), $a: 0.2px)}\n" + ), + "Error: $a: Expected 0.2px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(oklab(50% 0.2 -0.3), $a: 0.2px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn b() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3), $b: 0.2px)}\n" + ), + "Error: $b: Expected 0.2px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(oklab(50% 0.2 -0.3), $b: 0.2px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3), $lightness: 0.3px)}\n" + ), + "Error: $lightness: Expected 0.3px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(oklab(50% 0.2 -0.3), $lightness: 0.3px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/change/error/units/oklch.rs b/rsass/tests/spec/core_functions/color/change/error/units/oklch.rs new file mode 100644 index 000000000..37811ad74 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/units/oklch.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/units/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +#[test] +#[ignore] // wrong error +fn chroma() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.3 50deg), $chroma: 0.2px)}\n" + ), + "Error: $chroma: Expected 0.2px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(oklch(50% 0.3 50deg), $chroma: 0.2px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn hue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.3 50deg), $hue: 20%)}\n" + ), + "Error: $hue: Expected 20% to have an angle unit (deg, grad, rad, turn).\ + \n ,\ + \n2 | a {b: color.change(oklch(50% 0.3 50deg), $hue: 20%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.3 50deg), $lightness: 30px)}\n" + ), + "Error: $lightness: Expected 30px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(oklch(50% 0.3 50deg), $lightness: 30px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/change/error/units/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/change/error/units/prophoto_rgb.rs new file mode 100644 index 000000000..289e77721 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/units/prophoto_rgb.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/units/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +#[test] +#[ignore] // wrong error +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $blue: 0.5px)}\n" + ), + "Error: $blue: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $blue: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $green: 0.5px)}\n" + ), + "Error: $green: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $green: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $red: 0.5px)}\n" + ), + "Error: $red: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $red: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/change/error/units/rec2020.rs b/rsass/tests/spec/core_functions/color/change/error/units/rec2020.rs new file mode 100644 index 000000000..b9b45c8a3 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/units/rec2020.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/units/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +#[test] +#[ignore] // wrong error +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7), $blue: 0.5px)}\n" + ), + "Error: $blue: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(rec2020 0.2 0.5 0.7), $blue: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7), $green: 0.5px)}\n" + ), + "Error: $green: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(rec2020 0.2 0.5 0.7), $green: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7), $red: 0.5px)}\n" + ), + "Error: $red: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(rec2020 0.2 0.5 0.7), $red: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/change/error/units/srgb.rs b/rsass/tests/spec/core_functions/color/change/error/units/srgb.rs new file mode 100644 index 000000000..43e0fefe5 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/units/srgb.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/units/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +#[test] +#[ignore] // wrong error +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $blue: 0.5px)}\n" + ), + "Error: $blue: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(srgb 0.2 0.5 0.7), $blue: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $green: 0.5px)}\n" + ), + "Error: $green: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(srgb 0.2 0.5 0.7), $green: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $red: 0.5px)}\n" + ), + "Error: $red: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(srgb 0.2 0.5 0.7), $red: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/change/error/units/srgb_linear.rs b/rsass/tests/spec/core_functions/color/change/error/units/srgb_linear.rs new file mode 100644 index 000000000..5cb258914 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/units/srgb_linear.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/units/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +#[test] +#[ignore] // wrong error +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7), $blue: 0.5px)}\n" + ), + "Error: $blue: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(srgb-linear 0.2 0.5 0.7), $blue: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7), $green: 0.5px)}\n" + ), + "Error: $green: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(srgb-linear 0.2 0.5 0.7), $green: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7), $red: 0.5px)}\n" + ), + "Error: $red: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(srgb-linear 0.2 0.5 0.7), $red: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/change/error/units/xyz.rs b/rsass/tests/spec/core_functions/color/change/error/units/xyz.rs new file mode 100644 index 000000000..9a694b5b6 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/units/xyz.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/units/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +#[test] +#[ignore] // wrong error +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7), $z: 0.5px)}\n" + ), + "Error: $z: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(xyz 0.2 0.5 0.7), $z: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7), $y: 0.5px)}\n" + ), + "Error: $y: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(xyz 0.2 0.5 0.7), $y: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7), $x: 0.5px)}\n" + ), + "Error: $x: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(xyz 0.2 0.5 0.7), $x: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/change/error/units/xyz_d50.rs b/rsass/tests/spec/core_functions/color/change/error/units/xyz_d50.rs new file mode 100644 index 000000000..9f9212e6e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/error/units/xyz_d50.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/error/units/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +#[test] +#[ignore] // wrong error +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7), $z: 0.5px)}\n" + ), + "Error: $z: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(xyz-d50 0.2 0.5 0.7), $z: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7), $y: 0.5px)}\n" + ), + "Error: $y: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(xyz-d50 0.2 0.5 0.7), $y: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7), $x: 0.5px)}\n" + ), + "Error: $x: Expected 0.5px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color.change(color(xyz-d50 0.2 0.5 0.7), $x: 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/change/global.rs b/rsass/tests/spec/core_functions/color/change/global.rs new file mode 100644 index 000000000..270e60889 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/global.rs @@ -0,0 +1,27 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/global.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("global") +} + +#[test] +fn legacy() { + assert_eq!( + runner().ok("a {b: change-color(red, $blue: 50)}\n"), + "a {\ + \n b: #ff0032;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn non_legacy() { + assert_eq!( + runner() + .ok("a {b: change-color(pink, $chroma: 0.06, $space: oklch)}\n"), + "a {\ + \n b: rgb(247.5333900768, 195.811523731, 204.5286989775);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/change/hsl.rs b/rsass/tests/spec/core_functions/color/change/hsl.rs new file mode 100644 index 000000000..9b6009925 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/hsl.rs @@ -0,0 +1,434 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +#[test] +#[ignore] // wrong result +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(black, $hue: 12, $saturation: 24%, $lightness: 48%)}\n" + ), + "a {\ + \n b: rgb(151.776, 104.7744, 93.024);\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(black, $hue: 12, $saturation: 24%, $lightness: 48%, $alpha: 0.7)}\n" + ), + "a {\ + \n b: rgba(151.776, 104.7744, 93.024, 0.7);\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(rgba(black, 0.7), $hue: 12, $saturation: 24%, $lightness: 48%)}\n" + ), + "a {\ + \n b: rgba(151.776, 104.7744, 93.024, 0.7);\ + \n}\n" + ); +} +mod hue { + #[allow(unused)] + use super::runner; + + #[test] + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $hue: 540)}\n"), + "a {\ + \n b: aqua;\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn fraction() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $hue: 0.5)}\n"), + "a {\ + \n b: rgb(255, 2.125, 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $hue: 359)}\n"), + "a {\ + \n b: rgb(255, 0, 4.25);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $hue: 123)}\n"), + "a {\ + \n b: rgb(0, 255, 12.75);\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(blue, $hue: 0)}\n"), + "a {\ + \n b: red;\ + \n}\n" + ); + } + #[test] + fn negative() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $hue: -60)}\n"), + "a {\ + \n b: fuchsia;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(hsl(0deg 100% 50%), $hue: none)}\n"), + "a {\ + \n b: hsl(none 100% 50%);\ + \n}\n" + ); + } +} +mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $lightness: 120%)}\n"), + "a {\ + \n b: hsl(0, 100%, 120%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $lightness: -20%)}\n"), + "a {\ + \n b: hsl(0, 100%, -20%);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn fraction() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $lightness: 0.5%)}\n"), + "a {\ + \n b: rgb(2.55, 0, 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $lightness: 63%)}\n"), + "a {\ + \n b: rgb(255, 66.3, 66.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $lightness: 27%)}\n"), + "a {\ + \n b: rgb(137.7, 0, 0);\ + \n}\n" + ); + } + #[test] + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $lightness: 100%)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $lightness: 0%)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(hsl(0deg 100% 50%), $lightness: none)}\n"), + "a {\ + \n b: hsl(0deg 100% none);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // wrong result +fn named() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change($color: black, $hue: 12, $saturation: 24%, $lightness: 48%)}\n" + ), + "a {\ + \n b: rgb(151.776, 104.7744, 93.024);\ + \n}\n" + ); +} +mod saturation { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(plum, $saturation: 120%)}\n"), + "a {\ + \n b: hsl(300, 120%, 74.7058823529%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(plum, $saturation: -20%)}\n"), + "a {\ + \n b: rgb(177.6, 203.4, 177.6);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(plum, $saturation: 76%)}\n"), + "a {\ + \n b: rgb(239.52, 141.48, 239.52);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(plum, $saturation: 14%)}\n"), + "a {\ + \n b: rgb(199.53, 181.47, 199.53);\ + \n}\n" + ); + } + #[test] + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(plum, $saturation: 100%)}\n"), + "a {\ + \n b: #ff7eff;\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(plum, $saturation: 0%)}\n"), + "a {\ + \n b: rgb(190.5, 190.5, 190.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(hsl(0deg 100% 50%), $saturation: none)}\n"), + "a {\ + \n b: hsl(0deg none 50%);\ + \n}\n" + ); + } +} +mod units { + #[allow(unused)] + use super::runner; + + mod hue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn angle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $hue: 60rad)}\n"), + "a {\ + \n b: rgb(0, 179.576224164, 255);\ + \n}\n" + ); + } + #[test] + fn deg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $hue: 60deg)}\n"), + "a {\ + \n b: yellow;\ + \n}\n" + ); + } + #[test] + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $hue: 60)}\n"), + "a {\ + \n b: yellow;\ + \n}\n" + ); + } + #[test] + fn unknown() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $hue: 60in)}\n"), + "a {\ + \n b: yellow;\ + \n}\n" + ); + } + } + mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $lightness: 30%)}\n"), + "a {\ + \n b: #990000;\ + \n}\n" + ); + } + #[test] + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $lightness: 30)}\n"), + "a {\ + \n b: #990000;\ + \n}\n" + ); + } + #[test] + fn unknown() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $lightness: 30in)}\n"), + "a {\ + \n b: #990000;\ + \n}\n" + ); + } + } + mod saturation { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $saturation: 50%)}\n"), + "a {\ + \n b: rgb(191.25, 63.75, 63.75);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $saturation: 50)}\n"), + "a {\ + \n b: rgb(191.25, 63.75, 63.75);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn unknown() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $saturation: 50in)}\n"), + "a {\ + \n b: rgb(191.25, 63.75, 63.75);\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/core_functions/color/change/hwb.rs b/rsass/tests/spec/core_functions/color/change/hwb.rs new file mode 100644 index 000000000..718c5d272 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/hwb.rs @@ -0,0 +1,182 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +#[test] +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(blue, $hue: 150, $whiteness: 20%, $blackness: 40%)}\n" + ), + "a {\ + \n b: #339966;\ + \n}\n" + ); +} +#[test] +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(blue, $hue: 150, $whiteness: 20%, $blackness: 40%, $alpha: 0.3)}\n" + ), + "a {\ + \n b: rgba(51, 153, 102, 0.3);\ + \n}\n" + ); +} +#[test] +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(rgba(blue, 0.7), $hue: 150, $whiteness: 20%, $blackness: 40%)}\n" + ), + "a {\ + \n b: rgba(51, 153, 102, 0.7);\ + \n}\n" + ); +} +mod blackness { + #[allow(unused)] + use super::runner; + + #[test] + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(#993333, $blackness: 80%)}\n"), + "a {\ + \n b: #333333;\ + \n}\n" + ); + } + #[test] + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(#993333, $blackness: 20%)}\n"), + "a {\ + \n b: #cc3333;\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(#993333, $blackness: 100%)}\n"), + "a {\ + \n b: rgb(42.5, 42.5, 42.5);\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(#993333, $blackness: 0%)}\n"), + "a {\ + \n b: #ff3333;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(hwb(180deg 30% 50%), $blackness: none)}\n"), + "a {\ + \n b: hwb(180deg 30% none);\ + \n}\n" + ); + } +} +#[test] +fn named() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change($color: blue, $hue: 150, $whiteness: 20%, $blackness: 40%)}\n" + ), + "a {\ + \n b: #339966;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(#993333, $whiteness: 50%, $blackness: -20%)}\n" + ), + "a {\ + \n b: hsl(0, 233.3333333333%, 85%);\ + \n}\n" + ); +} +mod whiteness { + #[allow(unused)] + use super::runner; + + #[test] + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(#cc6666, $whiteness: 80%)}\n"), + "a {\ + \n b: #cccccc;\ + \n}\n" + ); + } + #[test] + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(#cc6666, $whiteness: 20%)}\n"), + "a {\ + \n b: #cc3333;\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(#cc6666, $whiteness: 100%)}\n"), + "a {\ + \n b: rgb(212.5, 212.5, 212.5);\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(#cc6666, $whiteness: 0%)}\n"), + "a {\ + \n b: #cc0000;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(hwb(180deg 30% 50%), $whiteness: none)}\n"), + "a {\ + \n b: hwb(180deg none 50%);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/change/lab.rs b/rsass/tests/spec/core_functions/color/change/lab.rs new file mode 100644 index 000000000..8accb6820 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/lab.rs @@ -0,0 +1,195 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod a { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lab(50% 20 -30), $a: none)}\n"), + "a {\ + \n b: lab(50% none -30);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lab(50% 20 -30), $a: 200)}\n"), + "a {\ + \n b: lab(50% 200 -30);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lab(50% 20 -30), $a: -40%)}\n"), + "a {\ + \n b: lab(50% -50 -30);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lab(50% 20 -30), $a: 50)}\n"), + "a {\ + \n b: lab(50% 50 -30);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(lab(50% 20 -30), $lightness: 20%, $a: -30, $b: 40)}\n" + ), + "a {\ + \n b: lab(20% -30 40);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(lab(50% 20 -30), $lightness: 30%, $alpha: 0.9)}\n" + ), + "a {\ + \n b: lab(30% 20 -30 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(lab(50% 20 -30 / 0.9), $lightness: 30%)}\n" + ), + "a {\ + \n b: lab(30% 20 -30 / 0.9);\ + \n}\n" + ); +} +mod b { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lab(50% 20 -30), $b: none)}\n"), + "a {\ + \n b: lab(50% 20 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lab(50% 20 -30), $b: -200)}\n"), + "a {\ + \n b: lab(50% 20 -200);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lab(50% 20 -30), $b: -40%)}\n"), + "a {\ + \n b: lab(50% 20 -50);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lab(50% 20 -30), $b: 50)}\n"), + "a {\ + \n b: lab(50% 20 50);\ + \n}\n" + ); + } +} +mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lab(50% 20 -30), $lightness: none)}\n"), + "a {\ + \n b: lab(none 20 -30);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(lab(50% 20 -30), $lightness: 120%)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz 1.7255148283 1.6190494947 2.5266428703) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lab(50% 20 -30), $lightness: 30%)}\n"), + "a {\ + \n b: lab(30% 20 -30);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lab(50% 20 -30), $lightness: 30)}\n"), + "a {\ + \n b: lab(30% 20 -30);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/change/lch.rs b/rsass/tests/spec/core_functions/color/change/lch.rs new file mode 100644 index 000000000..e315025d9 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/lch.rs @@ -0,0 +1,206 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(lch(50% 20 30deg), $lightness: 20%, $chroma: 30, $hue: 40deg)}\n" + ), + "a {\ + \n b: lch(20% 30 40deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(lch(50% 20 30deg), $lightness: 30%, $alpha: 0.9)}\n" + ), + "a {\ + \n b: lch(30% 20 30deg / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(lch(50% 20 30deg / 0.9), $lightness: 30%)}\n" + ), + "a {\ + \n b: lch(30% 20 30deg / 0.9);\ + \n}\n" + ); +} +mod chroma { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn negative() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lch(50% 20 30deg), $chroma: -10)}\n"), + "a {\ + \n b: lch(50% 10 210deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lch(50% 20 30deg), $chroma: none)}\n"), + "a {\ + \n b: lch(50% none 30deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lch(50% 20 30deg), $chroma: 200)}\n"), + "a {\ + \n b: lch(50% 200 30deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lch(50% 20 30deg), $chroma: 40%)}\n"), + "a {\ + \n b: lch(50% 60 30deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lch(50% 20 30deg), $chroma: 50)}\n"), + "a {\ + \n b: lch(50% 50 30deg);\ + \n}\n" + ); + } +} +mod hue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lch(50% 20 30deg), $hue: 400deg)}\n"), + "a {\ + \n b: lch(50% 20 40deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lch(50% 20 30deg), $hue: -20deg)}\n"), + "a {\ + \n b: lch(50% 20 340deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lch(50% 20 30deg), $hue: none)}\n"), + "a {\ + \n b: lch(50% 20 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lch(50% 20 30deg), $hue: 50deg)}\n"), + "a {\ + \n b: lch(50% 20 50deg);\ + \n}\n" + ); + } +} +mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lch(50% 20 30deg), $lightness: none)}\n"), + "a {\ + \n b: lch(none 20 30deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(lch(50% 20 30deg), $lightness: 120%)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz 1.6569354424 1.6040925936 1.5400032443) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lch(50% 20 30deg), $lightness: 30%)}\n"), + "a {\ + \n b: lch(30% 20 30deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lch(50% 20 30deg), $lightness: 30)}\n"), + "a {\ + \n b: lch(30% 20 30deg);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/change/mod.rs b/rsass/tests/spec/core_functions/color/change/mod.rs new file mode 100644 index 000000000..907bdb8ba --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/mod.rs @@ -0,0 +1,44 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("change") +} + +mod a98_rgb; + +mod display_p3; + +mod error; + +mod global; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod no_space; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod space; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/change/no_space.rs b/rsass/tests/spec/core_functions/color/change/no_space.rs new file mode 100644 index 000000000..ef419c53e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/no_space.rs @@ -0,0 +1,141 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/no_space.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("no_space") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(rgba(red, 0.5), $alpha: 0.72)}\n"), + "a {\ + \n b: rgba(255, 0, 0, 0.72);\ + \n}\n" + ); + } + #[test] + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(rgba(red, 0.5), $alpha: 0.36)}\n"), + "a {\ + \n b: rgba(255, 0, 0, 0.36);\ + \n}\n" + ); + } + #[test] + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(rgba(red, 0.5), $alpha: 1)}\n"), + "a {\ + \n b: red;\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(rgba(red, 0.5), $alpha: 0)}\n"), + "a {\ + \n b: rgba(255, 0, 0, 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn non_legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lab(50% 50 50), $alpha: 0.36)}\n"), + "a {\ + \n b: lab(50% 50 50 / 0.36);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $alpha: none)}\n"), + "a {\ + \n b: rgb(255 0 0 / none);\ + \n}\n" + ); + } + mod units { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $alpha: 50%)}\n"), + "a {\ + \n b: rgba(255, 0, 0, 0.5);\ + \n}\n" + ); + } + #[test] + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $alpha: 0.5)}\n"), + "a {\ + \n b: rgba(255, 0, 0, 0.5);\ + \n}\n" + ); + } + #[test] + fn unknown() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $alpha: 0.5px)}\n"), + "a {\ + \n b: rgba(255, 0, 0, 0.5);\ + \n}\n" + ); + } + } +} +#[test] +fn named() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change($color: red)}\n"), + "a {\ + \n b: red;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn non_legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lab(50% 50 50))}\n"), + "a {\ + \n b: lab(50% 50 50);\ + \n}\n" + ); +} +#[test] +fn positional() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red)}\n"), + "a {\ + \n b: red;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/change/oklab.rs b/rsass/tests/spec/core_functions/color/change/oklab.rs new file mode 100644 index 000000000..104bb26c7 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/oklab.rs @@ -0,0 +1,195 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod a { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3), $a: none)}\n"), + "a {\ + \n b: oklab(50% none -0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3), $a: 1)}\n"), + "a {\ + \n b: oklab(50% 1 -0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3), $a: -40%)}\n"), + "a {\ + \n b: oklab(50% -0.16 -0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3), $a: 0.1)}\n"), + "a {\ + \n b: oklab(50% 0.1 -0.3);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3), $lightness: 20%, $a: -0.3, $b: 0.4)}\n" + ), + "a {\ + \n b: oklab(20% -0.3 0.4);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3), $lightness: 30%, $alpha: 0.9)}\n" + ), + "a {\ + \n b: oklab(30% 0.2 -0.3 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3 / 0.9), $lightness: 30%)}\n" + ), + "a {\ + \n b: oklab(30% 0.2 -0.3 / 0.9);\ + \n}\n" + ); +} +mod b { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3), $b: none)}\n"), + "a {\ + \n b: oklab(50% 0.2 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3), $b: -1)}\n"), + "a {\ + \n b: oklab(50% 0.2 -1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3), $b: -40%)}\n"), + "a {\ + \n b: oklab(50% 0.2 -0.16);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3), $b: 0.4)}\n"), + "a {\ + \n b: oklab(50% 0.2 0.4);\ + \n}\n" + ); + } +} +mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3), $lightness: none)}\n"), + "a {\ + \n b: oklab(none 0.2 -0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3), $lightness: 1.2)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz 2.3267923962 1.5626810194 5.2743259015) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3), $lightness: 30%)}\n"), + "a {\ + \n b: oklab(30% 0.2 -0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklab(50% 0.2 -0.3), $lightness: 0.3)}\n"), + "a {\ + \n b: oklab(30% 0.2 -0.3);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/change/oklch.rs b/rsass/tests/spec/core_functions/color/change/oklch.rs new file mode 100644 index 000000000..3c041243d --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/oklch.rs @@ -0,0 +1,208 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.2 30deg), $lightness: 20%, $chroma: 0.1, $hue: 40deg)}\n" + ), + "a {\ + \n b: oklch(20% 0.1 40deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.2 30deg), $lightness: 30%, $alpha: 0.9)}\n" + ), + "a {\ + \n b: oklch(30% 0.2 30deg / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.2 30deg / 0.9), $lightness: 30%)}\n" + ), + "a {\ + \n b: oklch(30% 0.2 30deg / 0.9);\ + \n}\n" + ); +} +mod chroma { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn negative() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.2 30deg), $chroma: -0.1)}\n"), + "a {\ + \n b: oklch(50% 0.1 210deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.2 30deg), $chroma: none)}\n"), + "a {\ + \n b: oklch(50% none 30deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.2 30deg), $chroma: 1)}\n"), + "a {\ + \n b: oklch(50% 1 30deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.2 30deg), $chroma: 40%)}\n"), + "a {\ + \n b: oklch(50% 0.16 30deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.2 30deg), $chroma: 0.1)}\n"), + "a {\ + \n b: oklch(50% 0.1 30deg);\ + \n}\n" + ); + } +} +mod hue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.2 30deg), $hue: 400deg)}\n"), + "a {\ + \n b: oklch(50% 0.2 40deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.2 30deg), $hue: -20deg)}\n"), + "a {\ + \n b: oklch(50% 0.2 340deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.2 30deg), $hue: none)}\n"), + "a {\ + \n b: oklch(50% 0.2 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.2 30deg), $hue: 50deg)}\n"), + "a {\ + \n b: oklch(50% 0.2 50deg);\ + \n}\n" + ); + } +} +mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.2 30deg), $lightness: none)}\n" + ), + "a {\ + \n b: oklch(none 0.2 30deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.2 30deg), $lightness: 120%)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz 2.0602078346 1.6344742217 1.0169251403) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.2 30deg), $lightness: 30%)}\n"), + "a {\ + \n b: oklch(30% 0.2 30deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.2 30deg), $lightness: 0.3)}\n"), + "a {\ + \n b: oklch(30% 0.2 30deg);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/change/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/change/prophoto_rgb.rs new file mode 100644 index 000000000..baa6a9d7a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/prophoto_rgb.rs @@ -0,0 +1,217 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $red: 0.7, $green: 0.4, $blue: 0.2)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.7 0.4 0.2);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $red: 0.5, $alpha: 0.9)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.5 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7 / 0.9), $red: 0.5)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.5 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $blue: none)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $blue: 100)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $blue: 50%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $blue: 0.5)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 0.5);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $green: none)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 none 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $green: -0.2)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 -0.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $green: 40%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.4 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $green: 0.4)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.4 0.7);\ + \n}\n" + ); + } +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $red: none)}\n" + ), + "a {\ + \n b: color(prophoto-rgb none 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $red: 1.2)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 1.2 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $red: 50%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.5 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(prophoto-rgb 0.2 0.5 0.7), $red: 0.5)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.5 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/change/rec2020.rs b/rsass/tests/spec/core_functions/color/change/rec2020.rs new file mode 100644 index 000000000..3f18b57c7 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/rec2020.rs @@ -0,0 +1,211 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7), $red: 0.7, $green: 0.4, $blue: 0.2)}\n" + ), + "a {\ + \n b: color(rec2020 0.7 0.4 0.2);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7), $red: 0.5, $alpha: 0.9)}\n" + ), + "a {\ + \n b: color(rec2020 0.5 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7 / 0.9), $red: 0.5)}\n" + ), + "a {\ + \n b: color(rec2020 0.5 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7), $blue: none)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.5 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7), $blue: 100)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.5 100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7), $blue: 50%)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.5 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7), $blue: 0.5)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.5 0.5);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7), $green: none)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 none 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7), $green: -0.2)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 -0.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7), $green: 40%)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.4 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7), $green: 0.4)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.4 0.7);\ + \n}\n" + ); + } +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7), $red: none)}\n" + ), + "a {\ + \n b: color(rec2020 none 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7), $red: 1.2)}\n"), + "a {\ + \n b: color(rec2020 1.2 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7), $red: 50%)}\n"), + "a {\ + \n b: color(rec2020 0.5 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(rec2020 0.2 0.5 0.7), $red: 0.5)}\n"), + "a {\ + \n b: color(rec2020 0.5 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/change/rgb.rs b/rsass/tests/spec/core_functions/color/change/rgb.rs new file mode 100644 index 000000000..5e3218823 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/rgb.rs @@ -0,0 +1,256 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +#[test] +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(black, $red: 12, $green: 24, $blue: 48)}\n" + ), + "a {\ + \n b: #0c1830;\ + \n}\n" + ); +} +#[test] +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(black, $red: 12, $green: 24, $blue: 48, $alpha: 0.3)}\n" + ), + "a {\ + \n b: rgba(12, 24, 48, 0.3);\ + \n}\n" + ); +} +#[test] +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(rgba(black, 0.3), $red: 12, $green: 24, $blue: 48)}\n" + ), + "a {\ + \n b: rgba(12, 24, 48, 0.3);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(black, $blue: 200)}\n"), + "a {\ + \n b: #0000c8;\ + \n}\n" + ); + } + #[test] + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(blue, $blue: 100)}\n"), + "a {\ + \n b: #000064;\ + \n}\n" + ); + } + #[test] + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(black, $blue: 255)}\n"), + "a {\ + \n b: blue;\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(blue, $blue: 0)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(black, $blue: none)}\n"), + "a {\ + \n b: rgb(0 0 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(black, $blue: 256)}\n"), + "a {\ + \n b: hsl(240, 100.7874015748%, 50.1960784314%);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(black, $green: 200)}\n"), + "a {\ + \n b: #00c800;\ + \n}\n" + ); + } + #[test] + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lime, $green: 100)}\n"), + "a {\ + \n b: darkgreen;\ + \n}\n" + ); + } + #[test] + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(black, $green: 255)}\n"), + "a {\ + \n b: lime;\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(lime, $green: 0)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(black, $green: none)}\n"), + "a {\ + \n b: rgb(0 none 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(black, $green: -50)}\n"), + "a {\ + \n b: hsl(120, 100%, -9.8039215686%);\ + \n}\n" + ); + } +} +#[test] +fn named() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change($color: black, $red: 12, $green: 24, $blue: 48)}\n" + ), + "a {\ + \n b: #0c1830;\ + \n}\n" + ); +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(black, $red: 200)}\n"), + "a {\ + \n b: #c80000;\ + \n}\n" + ); + } + #[test] + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $red: 100)}\n"), + "a {\ + \n b: #640000;\ + \n}\n" + ); + } + #[test] + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(black, $red: 255)}\n"), + "a {\ + \n b: red;\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(red, $red: 0)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(black, $red: none)}\n"), + "a {\ + \n b: rgb(none 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(black, $red: 500)}\n"), + "a {\ + \n b: hsl(0, 5000%, 98.0392156863%);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/change/space.rs b/rsass/tests/spec/core_functions/color/change/space.rs new file mode 100644 index 000000000..c2e15f2d4 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/space.rs @@ -0,0 +1,334 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/space.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("space") +} + +#[test] +#[ignore] // unexepected error +fn identical() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0.2 0deg), $space: lab)}\n"), + "a {\ + \n b: oklch(50% 0.2 0deg);\ + \n}\n" + ); +} +mod legacy { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn to_legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(pink, $saturation: 5%, $space: hsl)}\n"), + "a {\ + \n b: rgb(225.075, 221.925, 222.475);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_modern() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(pink, $chroma: 0.01, $space: oklch)}\n"), + "a {\ + \n b: rgb(217.7587670223, 208.8497864408, 210.1600909257);\ + \n}\n" + ); + } +} +mod missing { + #[allow(unused)] + use super::runner; + + mod arg { + #[allow(unused)] + use super::runner; + + mod legacy { + #[allow(unused)] + use super::runner; + + mod analogous { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn legacy() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(hsl(100deg 50% 50%), $hue: none, $space: hwb)}\n" + ), + "a {\ + \n b: hsl(0, 50%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn modern() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(pink, $red: none, $space: display-p3)}\n"), + "a {\ + \n b: rgb(0, 198.1453699836, 205.7002828396);\ + \n}\n" + ); + } + } + mod same { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn explicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(pink, $red: none, $space: rgb)}\n"), + "a {\ + \n b: rgb(none 192 203);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn implicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(pink, $red: none)}\n"), + "a {\ + \n b: rgb(none 192 203);\ + \n}\n" + ); + } + } + } + mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn analogous() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.1 0.2 0.3), $red: none, $space: display-p3)}\n" + ), + "a {\ + \n b: color(srgb none 0.2018961688 0.3005594241);\ + \n}\n" + ); + } + mod same { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn explicit() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.1 0.2 0.3), $red: none, $space: srgb)}\n" + ), + "a {\ + \n b: color(srgb none 0.2 0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn implicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.1 0.2 0.3), $red: none)}\n"), + "a {\ + \n b: color(srgb none 0.2 0.3);\ + \n}\n" + ); + } + } + } + } + mod color { + #[allow(unused)] + use super::runner; + + mod legacy { + #[allow(unused)] + use super::runner; + + mod analogous { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(hsl(none 50% 50%), $space: hwb)}\n"), + "a {\ + \n b: hsl(0, 50%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn modern() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(rgb(none none none), $space: display-p3)}\n" + ), + "a {\ + \n b: black;\ + \n}\n" + ); + } + } + mod same { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn explicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(rgb(none none none), $space: rgb)}\n"), + "a {\ + \n b: rgb(none none none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn implicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(rgb(none none none))}\n"), + "a {\ + \n b: rgb(none none none);\ + \n}\n" + ); + } + } + } + mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn analogous() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb none none none), $space: display-p3)}\n" + ), + "a {\ + \n b: color(srgb none none none);\ + \n}\n" + ); + } + mod same { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn explicit() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb none none none), $space: srgb)}\n" + ), + "a {\ + \n b: color(srgb none none none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn implicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(srgb none none none))}\n"), + "a {\ + \n b: color(srgb none none none);\ + \n}\n" + ); + } + } + } + } +} +mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn to_legacy() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(lab(50% 10 -20), $saturation: 5%, $space: hsl)}\n" + ), + "a {\ + \n b: lab(53.9442763509% 2.9406893179 -6.1872703789);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_modern() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(lab(50% 10 -20), $chroma: 0.01, $space: oklch)}\n" + ), + "a {\ + \n b: lab(50.5994457353% 1.499908117 -3.4111247636);\ + \n}\n" + ); + } +} +mod powerless { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(hsl(0deg 0% 50%), $space: lab)}\n"), + "a {\ + \n b: hsl(0, 0%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn modern() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(oklch(50% 0 0deg), $space: lab)}\n"), + "a {\ + \n b: oklch(50% 0 none);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/change/srgb.rs b/rsass/tests/spec/core_functions/color/change/srgb.rs new file mode 100644 index 000000000..6721ac301 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/srgb.rs @@ -0,0 +1,193 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $red: 0.7, $green: 0.4, $blue: 0.2)}\n" + ), + "a {\ + \n b: color(srgb 0.7 0.4 0.2);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $red: 0.5, $alpha: 0.9)}\n" + ), + "a {\ + \n b: color(srgb 0.5 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7 / 0.9), $red: 0.5)}\n" + ), + "a {\ + \n b: color(srgb 0.5 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $blue: none)}\n"), + "a {\ + \n b: color(srgb 0.2 0.5 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $blue: 100)}\n"), + "a {\ + \n b: color(srgb 0.2 0.5 100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $blue: 50%)}\n"), + "a {\ + \n b: color(srgb 0.2 0.5 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $blue: 0.5)}\n"), + "a {\ + \n b: color(srgb 0.2 0.5 0.5);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $green: none)}\n"), + "a {\ + \n b: color(srgb 0.2 none 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $green: -0.2)}\n"), + "a {\ + \n b: color(srgb 0.2 -0.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $green: 40%)}\n"), + "a {\ + \n b: color(srgb 0.2 0.4 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $green: 0.4)}\n"), + "a {\ + \n b: color(srgb 0.2 0.4 0.7);\ + \n}\n" + ); + } +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $red: none)}\n"), + "a {\ + \n b: color(srgb none 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $red: 1.2)}\n"), + "a {\ + \n b: color(srgb 1.2 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $red: 50%)}\n"), + "a {\ + \n b: color(srgb 0.5 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(srgb 0.2 0.5 0.7), $red: 0.5)}\n"), + "a {\ + \n b: color(srgb 0.5 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/change/srgb_linear.rs b/rsass/tests/spec/core_functions/color/change/srgb_linear.rs new file mode 100644 index 000000000..7fb437697 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/srgb_linear.rs @@ -0,0 +1,217 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7), $red: 0.7, $green: 0.4, $blue: 0.2)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.7 0.4 0.2);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7), $red: 0.5, $alpha: 0.9)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.5 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7 / 0.9), $red: 0.5)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.5 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7), $blue: none)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7), $blue: 100)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7), $blue: 50%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7), $blue: 0.5)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 0.5);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7), $green: none)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 none 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7), $green: -0.2)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 -0.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7), $green: 40%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.4 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7), $green: 0.4)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.4 0.7);\ + \n}\n" + ); + } +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7), $red: none)}\n" + ), + "a {\ + \n b: color(srgb-linear none 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7), $red: 1.2)}\n" + ), + "a {\ + \n b: color(srgb-linear 1.2 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7), $red: 50%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.5 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(srgb-linear 0.2 0.5 0.7), $red: 0.5)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.5 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/change/xyz.rs b/rsass/tests/spec/core_functions/color/change/xyz.rs new file mode 100644 index 000000000..42ff10e37 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/xyz.rs @@ -0,0 +1,191 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7), $x: 0.7, $y: 0.4, $z: 0.2)}\n" + ), + "a {\ + \n b: color(xyz 0.7 0.4 0.2);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7), $x: 0.5, $alpha: 0.9)}\n" + ), + "a {\ + \n b: color(xyz 0.5 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7 / 0.9), $x: 0.5)}\n"), + "a {\ + \n b: color(xyz 0.5 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +mod x { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7), $x: none)}\n"), + "a {\ + \n b: color(xyz none 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7), $x: 1.2)}\n"), + "a {\ + \n b: color(xyz 1.2 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7), $x: 50%)}\n"), + "a {\ + \n b: color(xyz 0.5 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7), $x: 0.5)}\n"), + "a {\ + \n b: color(xyz 0.5 0.5 0.7);\ + \n}\n" + ); + } +} +mod y { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7), $y: none)}\n"), + "a {\ + \n b: color(xyz 0.2 none 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7), $y: -0.2)}\n"), + "a {\ + \n b: color(xyz 0.2 -0.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7), $y: 40%)}\n"), + "a {\ + \n b: color(xyz 0.2 0.4 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7), $y: 0.4)}\n"), + "a {\ + \n b: color(xyz 0.2 0.4 0.7);\ + \n}\n" + ); + } +} +mod z { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7), $z: none)}\n"), + "a {\ + \n b: color(xyz 0.2 0.5 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7), $z: 100)}\n"), + "a {\ + \n b: color(xyz 0.2 0.5 100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7), $z: 50%)}\n"), + "a {\ + \n b: color(xyz 0.2 0.5 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz 0.2 0.5 0.7), $z: 0.5)}\n"), + "a {\ + \n b: color(xyz 0.2 0.5 0.5);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/change/xyz_d50.rs b/rsass/tests/spec/core_functions/color/change/xyz_d50.rs new file mode 100644 index 000000000..1548ba6ea --- /dev/null +++ b/rsass/tests/spec/core_functions/color/change/xyz_d50.rs @@ -0,0 +1,193 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/change/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7), $x: 0.7, $y: 0.4, $z: 0.2)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.7 0.4 0.2);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7), $x: 0.5, $alpha: 0.9)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.5 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7 / 0.9), $x: 0.5)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.5 0.5 0.7 / 0.9);\ + \n}\n" + ); +} +mod x { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7), $x: none)}\n"), + "a {\ + \n b: color(xyz-d50 none 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7), $x: 1.2)}\n"), + "a {\ + \n b: color(xyz-d50 1.2 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7), $x: 50%)}\n"), + "a {\ + \n b: color(xyz-d50 0.5 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7), $x: 0.5)}\n"), + "a {\ + \n b: color(xyz-d50 0.5 0.5 0.7);\ + \n}\n" + ); + } +} +mod y { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7), $y: none)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 none 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7), $y: -0.2)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 -0.2 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7), $y: 40%)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.4 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7), $y: 0.4)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.4 0.7);\ + \n}\n" + ); + } +} +mod z { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7), $z: none)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.5 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7), $z: 100)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.5 100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn percent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7), $z: 50%)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.5 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(color(xyz-d50 0.2 0.5 0.7), $z: 0.5)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.5 0.5);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/change_color/error/args.rs b/rsass/tests/spec/core_functions/color/change_color/error/args.rs deleted file mode 100644 index 9dfb59318..000000000 --- a/rsass/tests/spec/core_functions/color/change_color/error/args.rs +++ /dev/null @@ -1,49 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/change_color/error/args.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("args") -} - -#[test] -fn too_few() { - assert_eq!( - runner().err("a {b: change-color()}\n"), - "Error: Missing argument $color.\ - \n ,--> input.scss\ - \n1 | a {b: change-color()}\ - \n | ^^^^^^^^^^^^^^ invocation\ - \n \'\ - \n ,--> sass:color\ - \n1 | @function change($color, $kwargs...) {\ - \n | ========================== declaration\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn too_many() { - assert_eq!( - runner().err( - "a {b: change-color(red, 1)}\n" - ), - "Error: Only one positional argument is allowed. All other arguments must be passed by name.\ - \n ,\ - \n1 | a {b: change-color(red, 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn unknown() { - assert_eq!( - runner().err("a {b: change-color(red, $ambience: 10%)}\n"), - "Error: No argument named $ambience.\ - \n ,\ - \n1 | a {b: change-color(red, $ambience: 10%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} diff --git a/rsass/tests/spec/core_functions/color/change_color/error/bounds.rs b/rsass/tests/spec/core_functions/color/change_color/error/bounds.rs deleted file mode 100644 index d14401d82..000000000 --- a/rsass/tests/spec/core_functions/color/change_color/error/bounds.rs +++ /dev/null @@ -1,362 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/change_color/error/bounds.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("bounds") -} - -mod alpha { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: change-color(red, $alpha: 1.001)}\n"), - "Error: $alpha: Expected 1.001 to be within 0 and 1.\ - \n ,\ - \n1 | a {b: change-color(red, $alpha: 1.001)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: change-color(red, $alpha: -0.001)}\n"), - "Error: $alpha: Expected -0.001 to be within 0 and 1.\ - \n ,\ - \n1 | a {b: change-color(red, $alpha: -0.001)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - #[ignore] // wrong error - fn unit() { - assert_eq!( - runner().err( - "// This test covers sass/dart-sass#1745, but should be removed once units are\ - \n// fully forbidden (sass/sass#3374).\ - \na {b: change-color(red, $alpha: 50%)}\n" - ), - "DEPRECATION WARNING: $alpha: Passing a number with unit % is deprecated.\n\ - \nTo preserve current behavior: calc($alpha / 1%)\n\ - \nMore info: https://sass-lang.com/d/function-units\n\ - \n ,\ - \n3 | a {b: change-color(red, $alpha: 50%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet\n\ - \nError: $alpha: Expected 50% to be within 0 and 1.\ - \n ,\ - \n3 | a {b: change-color(red, $alpha: 50%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet", - ); - } -} -mod blackness { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: change-color(red, $blackness: 100.001%)}\n"), - "Error: $blackness: Expected 100.001% to be within 0% and 100%.\ - \n ,\ - \n1 | a {b: change-color(red, $blackness: 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: change-color(red, $blackness: -0.001%)}\n"), - "Error: $blackness: Expected -0.001% to be within 0% and 100%.\ - \n ,\ - \n1 | a {b: change-color(red, $blackness: -0.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } -} -mod blue { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: change-color(blue, $blue: 256)}\n"), - "Error: $blue: Expected 256 to be within 0 and 255.\ - \n ,\ - \n1 | a {b: change-color(blue, $blue: 256)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: change-color(blue, $blue: -1)}\n"), - "Error: $blue: Expected -1 to be within 0 and 255.\ - \n ,\ - \n1 | a {b: change-color(blue, $blue: -1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn unit() { - assert_eq!( - runner().err( - "// This test covers sass/dart-sass#1745, but should be removed once units are\ - \n// fully forbidden (sass/sass#3374).\ - \na {b: change-color(blue, $blue: 300px)}\n" - ), - "Error: $blue: Expected 300px to be within 0 and 255.\ - \n ,\ - \n3 | a {b: change-color(blue, $blue: 300px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet", - ); - } -} -mod green { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: change-color(green, $green: 256)}\n"), - "Error: $green: Expected 256 to be within 0 and 255.\ - \n ,\ - \n1 | a {b: change-color(green, $green: 256)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: change-color(green, $green: -1)}\n"), - "Error: $green: Expected -1 to be within 0 and 255.\ - \n ,\ - \n1 | a {b: change-color(green, $green: -1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn unit() { - assert_eq!( - runner().err( - "// This test covers sass/dart-sass#1745, but should be removed once units are\ - \n// fully forbidden (sass/sass#3374).\ - \na {b: change-color(green, $green: 300px)}\n" - ), - "Error: $green: Expected 300px to be within 0 and 255.\ - \n ,\ - \n3 | a {b: change-color(green, $green: 300px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet", - ); - } -} -mod lightness { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: change-color(red, $lightness: 100.001%)}\n"), - "Error: $lightness: Expected 100.001% to be within 0% and 100%.\ - \n ,\ - \n1 | a {b: change-color(red, $lightness: 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: change-color(red, $lightness: -0.001%)}\n"), - "Error: $lightness: Expected -0.001% to be within 0% and 100%.\ - \n ,\ - \n1 | a {b: change-color(red, $lightness: -0.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - #[ignore] // wrong error - fn unit() { - assert_eq!( - runner().err( - "// This test covers sass/dart-sass#1745, but should be removed once units are\ - \n// fully forbidden (sass/sass#3374).\ - \na {b: change-color(red, $lightness: 200px)}\n" - ), - "DEPRECATION WARNING: $lightness: Passing a number without unit % (200px) is deprecated.\n\ - \nTo preserve current behavior: calc($lightness / 1px * 1%)\n\ - \nMore info: https://sass-lang.com/d/function-units\n\ - \n ,\ - \n3 | a {b: change-color(red, $lightness: 200px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet\n\ - \nError: $lightness: Expected 200px to be within 0% and 100%.\ - \n ,\ - \n3 | a {b: change-color(red, $lightness: 200px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet", - ); - } -} -mod red { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: change-color(red, $red: 256)}\n"), - "Error: $red: Expected 256 to be within 0 and 255.\ - \n ,\ - \n1 | a {b: change-color(red, $red: 256)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: change-color(red, $red: -1)}\n"), - "Error: $red: Expected -1 to be within 0 and 255.\ - \n ,\ - \n1 | a {b: change-color(red, $red: -1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn unit() { - assert_eq!( - runner().err( - "// This test covers sass/dart-sass#1745, but should be removed once units are\ - \n// fully forbidden (sass/sass#3374).\ - \na {b: change-color(red, $red: 300px)}\n" - ), - "Error: $red: Expected 300px to be within 0 and 255.\ - \n ,\ - \n3 | a {b: change-color(red, $red: 300px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet", - ); - } -} -mod saturation { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: change-color(red, $saturation: 100.001%)}\n"), - "Error: $saturation: Expected 100.001% to be within 0% and 100%.\ - \n ,\ - \n1 | a {b: change-color(red, $saturation: 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: change-color(red, $saturation: -0.001%)}\n"), - "Error: $saturation: Expected -0.001% to be within 0% and 100%.\ - \n ,\ - \n1 | a {b: change-color(red, $saturation: -0.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - #[ignore] // wrong error - fn unit() { - assert_eq!( - runner().err( - "// This test covers sass/dart-sass#1745, but should be removed once units are\ - \n// fully forbidden (sass/sass#3374).\ - \na {b: change-color(red, $saturation: 200px)}\n" - ), - "DEPRECATION WARNING: $saturation: Passing a number without unit % (200px) is deprecated.\n\ - \nTo preserve current behavior: calc($saturation / 1px * 1%)\n\ - \nMore info: https://sass-lang.com/d/function-units\n\ - \n ,\ - \n3 | a {b: change-color(red, $saturation: 200px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet\n\ - \nError: $saturation: Expected 200px to be within 0% and 100%.\ - \n ,\ - \n3 | a {b: change-color(red, $saturation: 200px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet", - ); - } -} -mod whiteness { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: change-color(red, $whiteness: 100.001%)}\n"), - "Error: $whiteness: Expected 100.001% to be within 0% and 100%.\ - \n ,\ - \n1 | a {b: change-color(red, $whiteness: 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: change-color(red, $whiteness: -0.001%)}\n"), - "Error: $whiteness: Expected -0.001% to be within 0% and 100%.\ - \n ,\ - \n1 | a {b: change-color(red, $whiteness: -0.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } -} diff --git a/rsass/tests/spec/core_functions/color/change_color/error/mixed_formats.rs b/rsass/tests/spec/core_functions/color/change_color/error/mixed_formats.rs deleted file mode 100644 index e0b785286..000000000 --- a/rsass/tests/spec/core_functions/color/change_color/error/mixed_formats.rs +++ /dev/null @@ -1,96 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/change_color/error/mixed_formats.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("mixed_formats") -} - -#[test] -fn blue_and_lightness() { - assert_eq!( - runner().err("a {b: change-color(red, $blue: 1, $lightness: 1%)}\n"), - "Error: RGB parameters may not be passed along with HSL parameters.\ - \n ,\ - \n1 | a {b: change-color(red, $blue: 1, $lightness: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn green_and_saturation() { - assert_eq!( - runner() - .err("a {b: change-color(red, $green: 1, $saturation: 1%)}\n"), - "Error: RGB parameters may not be passed along with HSL parameters.\ - \n ,\ - \n1 | a {b: change-color(red, $green: 1, $saturation: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn green_and_whiteness() { - assert_eq!( - runner().err("a {b: change-color(red, $green: 1, $whiteness: 1%)}\n"), - "Error: RGB parameters may not be passed along with HWB parameters.\ - \n ,\ - \n1 | a {b: change-color(red, $green: 1, $whiteness: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn lightness_and_whiteness() { - assert_eq!( - runner().err( - "a {b: change-color(red, $lightness: 1%, $whiteness: 1%)}\n" - ), - "Error: HSL parameters may not be passed along with HWB parameters.\ - \n ,\ - \n1 | a {b: change-color(red, $lightness: 1%, $whiteness: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn red_and_blackness() { - assert_eq!( - runner().err("a {b: adjust-color(red, $red: 1, $blackness: 1%)}\n"), - "Error: RGB parameters may not be passed along with HWB parameters.\ - \n ,\ - \n1 | a {b: adjust-color(red, $red: 1, $blackness: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn red_and_hue() { - assert_eq!( - runner().err("a {b: change-color(red, $red: 1, $hue: 1)}\n"), - "Error: RGB parameters may not be passed along with HSL parameters.\ - \n ,\ - \n1 | a {b: change-color(red, $red: 1, $hue: 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn saturation_and_blackness() { - assert_eq!( - runner().err( - "a {b: change-color(red, $saturation: 1%, $blackness: 1%)}\n" - ), - "Error: HSL parameters may not be passed along with HWB parameters.\ - \n ,\ - \n1 | a {b: change-color(red, $saturation: 1%, $blackness: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} diff --git a/rsass/tests/spec/core_functions/color/change_color/error/test_type.rs b/rsass/tests/spec/core_functions/color/change_color/error/test_type.rs deleted file mode 100644 index 62d85256e..000000000 --- a/rsass/tests/spec/core_functions/color/change_color/error/test_type.rs +++ /dev/null @@ -1,127 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/change_color/error/type.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("type") -} - -#[test] -fn alpha() { - assert_eq!( - runner().err("a {b: change-color(red, $alpha: c)}\n"), - "Error: $alpha: c is not a number.\ - \n ,\ - \n1 | a {b: change-color(red, $alpha: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn blackness() { - assert_eq!( - runner().err("a {b: change-color(red, $blackness: c)}\n"), - "Error: $blackness: c is not a number.\ - \n ,\ - \n1 | a {b: change-color(red, $blackness: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn blue() { - assert_eq!( - runner().err("a {b: change-color(red, $blue: c)}\n"), - "Error: $blue: c is not a number.\ - \n ,\ - \n1 | a {b: change-color(red, $blue: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn color() { - assert_eq!( - runner().err("a {b: change-color(1)}\n"), - "Error: $color: 1 is not a color.\ - \n ,\ - \n1 | a {b: change-color(1)}\ - \n | ^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn green() { - assert_eq!( - runner().err("a {b: change-color(red, $green: c)}\n"), - "Error: $green: c is not a number.\ - \n ,\ - \n1 | a {b: change-color(red, $green: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn hue() { - assert_eq!( - runner().err("a {b: change-color(red, $hue: c)}\n"), - "Error: $hue: c is not a number.\ - \n ,\ - \n1 | a {b: change-color(red, $hue: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn lightness() { - assert_eq!( - runner().err("a {b: change-color(red, $lightness: c)}\n"), - "Error: $lightness: c is not a number.\ - \n ,\ - \n1 | a {b: change-color(red, $lightness: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn red() { - assert_eq!( - runner().err("a {b: change-color(red, $red: c)}\n"), - "Error: $red: c is not a number.\ - \n ,\ - \n1 | a {b: change-color(red, $red: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn saturation() { - assert_eq!( - runner().err("a {b: change-color(red, $saturation: c)}\n"), - "Error: $saturation: c is not a number.\ - \n ,\ - \n1 | a {b: change-color(red, $saturation: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn whiteness() { - assert_eq!( - runner().err("a {b: change-color(red, $whiteness: c)}\n"), - "Error: $whiteness: c is not a number.\ - \n ,\ - \n1 | a {b: change-color(red, $whiteness: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} diff --git a/rsass/tests/spec/core_functions/color/change_color/hsl.rs b/rsass/tests/spec/core_functions/color/change_color/hsl.rs deleted file mode 100644 index e1f28c543..000000000 --- a/rsass/tests/spec/core_functions/color/change_color/hsl.rs +++ /dev/null @@ -1,201 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/change_color/hsl.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("hsl") -} - -#[test] -fn all() { - assert_eq!( - runner().ok( - "a {b: change-color(black, $hue: 12, $saturation: 24%, $lightness: 48%)}\n" - ), - "a {\ - \n b: #98695d;\ - \n}\n" - ); -} -#[test] -fn alpha_arg() { - assert_eq!( - runner().ok( - "a {b: change-color(black, $hue: 12, $saturation: 24%, $lightness: 48%, $alpha: 0.7)}\n" - ), - "a {\ - \n b: rgba(152, 105, 93, 0.7);\ - \n}\n" - ); -} -#[test] -fn alpha_input() { - assert_eq!( - runner().ok( - "a {b: change-color(rgba(black, 0.7), $hue: 12, $saturation: 24%, $lightness: 48%)}\n" - ), - "a {\ - \n b: rgba(152, 105, 93, 0.7);\ - \n}\n" - ); -} -mod hue { - #[allow(unused)] - use super::runner; - - #[test] - fn above_max() { - assert_eq!( - runner().ok("a {b: change-color(red, $hue: 540)}\n"), - "a {\ - \n b: aqua;\ - \n}\n" - ); - } - #[test] - fn fraction() { - assert_eq!( - runner().ok("a {b: change-color(red, $hue: 0.5)}\n"), - "a {\ - \n b: #ff0200;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: change-color(red, $hue: 359)}\n"), - "a {\ - \n b: #ff0004;\ - \n}\n" - ); - } - #[test] - fn middle() { - assert_eq!( - runner().ok("a {b: change-color(red, $hue: 123)}\n"), - "a {\ - \n b: #00ff0d;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: change-color(blue, $hue: 0)}\n"), - "a {\ - \n b: red;\ - \n}\n" - ); - } - #[test] - fn negative() { - assert_eq!( - runner().ok("a {b: change-color(red, $hue: -60)}\n"), - "a {\ - \n b: fuchsia;\ - \n}\n" - ); - } -} -mod lightness { - #[allow(unused)] - use super::runner; - - #[test] - fn fraction() { - assert_eq!( - runner().ok("a {b: change-color(red, $lightness: 0.5%)}\n"), - "a {\ - \n b: #030000;\ - \n}\n" - ); - } - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: change-color(red, $lightness: 63%)}\n"), - "a {\ - \n b: #ff4242;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: change-color(red, $lightness: 27%)}\n"), - "a {\ - \n b: #8a0000;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: change-color(red, $lightness: 100%)}\n"), - "a {\ - \n b: white;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: change-color(red, $lightness: 0%)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } -} -#[test] -fn named() { - assert_eq!( - runner().ok( - "a {b: change-color($color: black, $hue: 12, $saturation: 24%, $lightness: 48%)}\n" - ), - "a {\ - \n b: #98695d;\ - \n}\n" - ); -} -mod saturation { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: change-color(plum, $saturation: 76%)}\n"), - "a {\ - \n b: #f08df0;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: change-color(plum, $saturation: 14%)}\n"), - "a {\ - \n b: #c8b5c8;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: change-color(plum, $saturation: 100%)}\n"), - "a {\ - \n b: #ff7eff;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: change-color(plum, $saturation: 0%)}\n"), - "a {\ - \n b: #bfbfbf;\ - \n}\n" - ); - } -} diff --git a/rsass/tests/spec/core_functions/color/change_color/hwb.rs b/rsass/tests/spec/core_functions/color/change_color/hwb.rs deleted file mode 100644 index fb9509a2a..000000000 --- a/rsass/tests/spec/core_functions/color/change_color/hwb.rs +++ /dev/null @@ -1,133 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/change_color/hwb.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("hwb") -} - -#[test] -fn all() { - assert_eq!( - runner().ok( - "a {b: change-color(blue, $hue: 150, $whiteness: 20%, $blackness: 40%)}\n" - ), - "a {\ - \n b: #339966;\ - \n}\n" - ); -} -#[test] -fn alpha_arg() { - assert_eq!( - runner().ok( - "a {b: change-color(blue, $hue: 150, $whiteness: 20%, $blackness: 40%, $alpha: 0.3)}\n" - ), - "a {\ - \n b: rgba(51, 153, 102, 0.3);\ - \n}\n" - ); -} -#[test] -fn alpha_input() { - assert_eq!( - runner().ok( - "a {b: change-color(rgba(blue, 0.7), $hue: 150, $whiteness: 20%, $blackness: 40%)}\n" - ), - "a {\ - \n b: rgba(51, 153, 102, 0.7);\ - \n}\n" - ); -} -mod blackness { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: change-color(#993333, $blackness: 80%)}\n"), - "a {\ - \n b: #333333;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: change-color(#993333, $blackness: 20%)}\n"), - "a {\ - \n b: #cc3333;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: change-color(#993333, $blackness: 100%)}\n"), - "a {\ - \n b: #2b2b2b;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: change-color(#993333, $blackness: 0%)}\n"), - "a {\ - \n b: #ff3333;\ - \n}\n" - ); - } -} -#[test] -fn named() { - assert_eq!( - runner().ok( - "a {b: change-color($color: blue, $hue: 150, $whiteness: 20%, $blackness: 40%)}\n" - ), - "a {\ - \n b: #339966;\ - \n}\n" - ); -} -mod whiteness { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: change-color(#cc6666, $whiteness: 80%)}\n"), - "a {\ - \n b: #cccccc;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: change-color(#cc6666, $whiteness: 20%)}\n"), - "a {\ - \n b: #cc3333;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: change-color(#cc6666, $whiteness: 100%)}\n"), - "a {\ - \n b: #d5d5d5;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: change-color(#cc6666, $whiteness: 0%)}\n"), - "a {\ - \n b: #cc0000;\ - \n}\n" - ); - } -} diff --git a/rsass/tests/spec/core_functions/color/change_color/no_rgb_hsl.rs b/rsass/tests/spec/core_functions/color/change_color/no_rgb_hsl.rs deleted file mode 100644 index b3a451163..000000000 --- a/rsass/tests/spec/core_functions/color/change_color/no_rgb_hsl.rs +++ /dev/null @@ -1,68 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/change_color/no_rgb_hsl.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("no_rgb_hsl") -} - -mod alpha { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner() - .ok("a {b: change-color(rgba(red, 0.5), $alpha: 0.72)}\n"), - "a {\ - \n b: rgba(255, 0, 0, 0.72);\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner() - .ok("a {b: change-color(rgba(red, 0.5), $alpha: 0.36)}\n"), - "a {\ - \n b: rgba(255, 0, 0, 0.36);\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: change-color(rgba(red, 0.5), $alpha: 1)}\n"), - "a {\ - \n b: red;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: change-color(rgba(red, 0.5), $alpha: 0)}\n"), - "a {\ - \n b: rgba(255, 0, 0, 0);\ - \n}\n" - ); - } -} -#[test] -fn named() { - assert_eq!( - runner().ok("a {b: change-color($color: red)}\n"), - "a {\ - \n b: red;\ - \n}\n" - ); -} -#[test] -fn positional() { - assert_eq!( - runner().ok("a {b: change-color(red)}\n"), - "a {\ - \n b: red;\ - \n}\n" - ); -} diff --git a/rsass/tests/spec/core_functions/color/change_color/rgb.rs b/rsass/tests/spec/core_functions/color/change_color/rgb.rs deleted file mode 100644 index 454cf69c1..000000000 --- a/rsass/tests/spec/core_functions/color/change_color/rgb.rs +++ /dev/null @@ -1,174 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/change_color/rgb.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("rgb") -} - -#[test] -fn all() { - assert_eq!( - runner().ok( - "a {b: change-color(black, $red: 12, $green: 24, $blue: 48)}\n" - ), - "a {\ - \n b: #0c1830;\ - \n}\n" - ); -} -#[test] -fn alpha_arg() { - assert_eq!( - runner().ok( - "a {b: change-color(black, $red: 12, $green: 24, $blue: 48, $alpha: 0.3)}\n" - ), - "a {\ - \n b: rgba(12, 24, 48, 0.3);\ - \n}\n" - ); -} -#[test] -fn alpha_input() { - assert_eq!( - runner().ok( - "a {b: change-color(rgba(black, 0.3), $red: 12, $green: 24, $blue: 48)}\n" - ), - "a {\ - \n b: rgba(12, 24, 48, 0.3);\ - \n}\n" - ); -} -mod blue { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: change-color(black, $blue: 200)}\n"), - "a {\ - \n b: #0000c8;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: change-color(blue, $blue: 100)}\n"), - "a {\ - \n b: #000064;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: change-color(black, $blue: 255)}\n"), - "a {\ - \n b: blue;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: change-color(blue, $blue: 0)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } -} -mod green { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: change-color(black, $green: 200)}\n"), - "a {\ - \n b: #00c800;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: change-color(lime, $green: 100)}\n"), - "a {\ - \n b: darkgreen;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: change-color(black, $green: 255)}\n"), - "a {\ - \n b: lime;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: change-color(lime, $green: 0)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } -} -#[test] -fn named() { - assert_eq!( - runner().ok( - "a {b: change-color($color: black, $red: 12, $green: 24, $blue: 48)}\n" - ), - "a {\ - \n b: #0c1830;\ - \n}\n" - ); -} -mod red { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: change-color(black, $red: 200)}\n"), - "a {\ - \n b: #c80000;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: change-color(red, $red: 100)}\n"), - "a {\ - \n b: #640000;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: change-color(black, $red: 255)}\n"), - "a {\ - \n b: red;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: change-color(red, $red: 0)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } -} diff --git a/rsass/tests/spec/core_functions/color/change_color/units.rs b/rsass/tests/spec/core_functions/color/change_color/units.rs deleted file mode 100644 index 217fa5f69..000000000 --- a/rsass/tests/spec/core_functions/color/change_color/units.rs +++ /dev/null @@ -1,144 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/change_color/units.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("units") -} - -mod alpha { - #[allow(unused)] - use super::runner; - - #[test] - fn percent() { - assert_eq!( - runner().ok("a {b: adjust-color(red, $alpha: 0.5%)}\n"), - "a {\ - \n b: red;\ - \n}\n" - ); - } - #[test] - fn unitless() { - assert_eq!( - runner().ok("a {b: change-color(red, $alpha: 0.5)}\n"), - "a {\ - \n b: rgba(255, 0, 0, 0.5);\ - \n}\n" - ); - } - #[test] - fn unknown() { - assert_eq!( - runner().ok("a {b: adjust-color(red, $alpha: 0.5px)}\n"), - "a {\ - \n b: red;\ - \n}\n" - ); - } -} -mod hue { - #[allow(unused)] - use super::runner; - - #[test] - fn angle() { - assert_eq!( - runner().ok("a {b: change-color(red, $hue: 60rad)}\n"), - "a {\ - \n b: #00b4ff;\ - \n}\n" - ); - } - #[test] - fn deg() { - assert_eq!( - runner().ok("a {b: change-color(red, $hue: 60deg)}\n"), - "a {\ - \n b: yellow;\ - \n}\n" - ); - } - #[test] - fn unitless() { - assert_eq!( - runner().ok("a {b: change-color(red, $hue: 60)}\n"), - "a {\ - \n b: yellow;\ - \n}\n" - ); - } - #[test] - fn unknown() { - assert_eq!( - runner().ok("a {b: change-color(red, $hue: 60in)}\n"), - "a {\ - \n b: yellow;\ - \n}\n" - ); - } -} -mod lightness { - #[allow(unused)] - use super::runner; - - #[test] - fn percent() { - assert_eq!( - runner().ok("a {b: change-color(red, $lightness: 30%)}\n"), - "a {\ - \n b: #990000;\ - \n}\n" - ); - } - #[test] - fn unitless() { - assert_eq!( - runner().ok("a {b: change-color(red, $lightness: 30)}\n"), - "a {\ - \n b: #990000;\ - \n}\n" - ); - } - #[test] - fn unknown() { - assert_eq!( - runner().ok("a {b: change-color(red, $lightness: 30in)}\n"), - "a {\ - \n b: #990000;\ - \n}\n" - ); - } -} -mod saturation { - #[allow(unused)] - use super::runner; - - #[test] - fn percent() { - assert_eq!( - runner().ok("a {b: change-color(red, $saturation: 50%)}\n"), - "a {\ - \n b: #bf4040;\ - \n}\n" - ); - } - #[test] - fn unitless() { - assert_eq!( - runner().ok("a {b: change-color(red, $saturation: 50)}\n"), - "a {\ - \n b: #bf4040;\ - \n}\n" - ); - } - #[test] - fn unknown() { - assert_eq!( - runner().ok("a {b: change-color(red, $saturation: 50in)}\n"), - "a {\ - \n b: #bf4040;\ - \n}\n" - ); - } -} diff --git a/rsass/tests/spec/core_functions/color/channel/a98_rgb.rs b/rsass/tests/spec/core_functions/color/channel/a98_rgb.rs new file mode 100644 index 000000000..1e9a1f0da --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/a98_rgb.rs @@ -0,0 +1,85 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/a98-rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98-rgb") +} + +mod foreign { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"blue\", $space: a98-rgb)}\n"), + "a {\ + \n b: 0.7893042668;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"green\", $space: a98-rgb)}\n"), + "a {\ + \n b: 0.7473920857;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"red\", $space: a98-rgb)}\n"), + "a {\ + \n b: 0.9363244101;\ + \n}\n" + ); + } +} +mod local { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(color(a98-rgb 0.2 0.5 0.8), \"blue\")}\n"), + "a {\ + \n b: 0.8;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.channel(color(a98-rgb 0.2 0.5 0.8), \"green\")}\n" + ), + "a {\ + \n b: 0.5;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(color(a98-rgb 0.2 0.5 0.8), \"red\")}\n"), + "a {\ + \n b: 0.2;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/channel/display_p3.rs b/rsass/tests/spec/core_functions/color/channel/display_p3.rs new file mode 100644 index 000000000..fabcc0b43 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/display_p3.rs @@ -0,0 +1,89 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/display-p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display-p3") +} + +mod foreign { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"blue\", $space: display-p3)}\n"), + "a {\ + \n b: 0.7971503319;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"green\", $space: display-p3)}\n"), + "a {\ + \n b: 0.7628803605;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"red\", $space: display-p3)}\n"), + "a {\ + \n b: 0.9621487118;\ + \n}\n" + ); + } +} +mod local { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.channel(color(display-p3 0.2 0.5 0.8), \"blue\")}\n" + ), + "a {\ + \n b: 0.8;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.channel(color(display-p3 0.2 0.5 0.8), \"green\")}\n" + ), + "a {\ + \n b: 0.5;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.channel(color(display-p3 0.2 0.5 0.8), \"red\")}\n" + ), + "a {\ + \n b: 0.2;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/channel/error.rs b/rsass/tests/spec/core_functions/color/channel/error.rs new file mode 100644 index 000000000..d29493021 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/error.rs @@ -0,0 +1,206 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/error.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("error") +} + +mod channel { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn unknown() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.channel(red, \"foo\")}\n" + ), + "Error: $channel: Color red has no channel named foo.\ + \n ,\ + \n2 | a {b: color.channel(red, \"foo\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn unquoted() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.channel(hsl(50deg 50% 50%), hue)}\n" + ), + "Error: $channel: Expected hue to be a quoted string.\ + \n ,\ + \n2 | a {b: color.channel(hsl(50deg 50% 50%), hue)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn wrong_case() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.channel(red, \"RED\")}\n" + ), + "Error: $channel: Color red has no channel named RED.\ + \n ,\ + \n2 | a {b: color.channel(red, \"RED\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn wrong_space() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.channel(red, \"hue\")}\n" + ), + "Error: $channel: Color red has no channel named hue.\ + \n ,\ + \n2 | a {b: color.channel(red, \"hue\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod space { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn quoted() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.channel(red, \"hue\", $space: \"hsl\")}\n" + ), + "Error: $space: Expected \"hsl\" to be an unquoted string.\ + \n ,\ + \n2 | a {b: color.channel(red, \"hue\", $space: \"hsl\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn unknown() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.channel(red, \"hue\", $space: \"foo\")}\n" + ), + "Error: $space: Expected \"foo\" to be an unquoted string.\ + \n ,\ + \n2 | a {b: color.channel(red, \"hue\", $space: \"foo\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +#[test] +#[ignore] // wrong error +fn too_few_args() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.channel(pink)}\n" + ), + "Error: Missing argument $channel.\ + \n ,--> input.scss\ + \n2 | a {b: color.channel(pink)}\ + \n | ^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function channel($color, $channel, $space: null) {\ + \n | ======================================= declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn too_many_args() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.channel(pink, \"red\", rgb, \"red\")}\n" + ), + "Error: Only 3 arguments allowed, but 4 were passed.\ + \n ,--> input.scss\ + \n2 | a {b: color.channel(pink, \"red\", rgb, \"red\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function channel($color, $channel, $space: null) {\ + \n | ======================================= declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +mod test_type { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn channel() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.channel(pink, red)}\n" + ), + "Error: $channel: red is not a string.\ + \n ,\ + \n2 | a {b: color.channel(pink, red)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn color() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.channel(\"pink\", \"red\")}\n" + ), + "Error: $color: \"pink\" is not a color.\ + \n ,\ + \n2 | a {b: color.channel(\"pink\", \"red\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn space() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.channel(pink, \"red\", red)}\n" + ), + "Error: $space: red is not a string.\ + \n ,\ + \n2 | a {b: color.channel(pink, \"red\", red)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/channel/hsl.rs b/rsass/tests/spec/core_functions/color/channel/hsl.rs new file mode 100644 index 000000000..a083de7c5 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/hsl.rs @@ -0,0 +1,99 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod foreign { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"hue\", $space: hsl)}\n"), + "a {\ + \n b: 349.5238095238deg;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"lightness\", $space: hsl)}\n"), + "a {\ + \n b: 87.6470588235%;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"saturation\", $space: hsl)}\n"), + "a {\ + \n b: 100%;\ + \n}\n" + ); + } +} +mod local { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(hsl(10 40% 60%), \"hue\")}\n"), + "a {\ + \n b: 10deg;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(hsl(10deg 40% 60%), \"lightness\")}\n"), + "a {\ + \n b: 60%;\ + \n}\n" + ); + } + mod normalized { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(hsl(540 40% 60%), \"hue\")}\n"), + "a {\ + \n b: 180deg;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(hsl(10deg 40% 60%), \"saturation\")}\n"), + "a {\ + \n b: 40%;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/channel/hwb.rs b/rsass/tests/spec/core_functions/color/channel/hwb.rs new file mode 100644 index 000000000..671b3d87d --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/hwb.rs @@ -0,0 +1,110 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod foreign { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"blackness\", $space: hwb)}\n"), + "a {\ + \n b: 0%;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"hue\", $space: hwb)}\n"), + "a {\ + \n b: 349.5238095238deg;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"whiteness\", $space: hwb)}\n"), + "a {\ + \n b: 75.2941176471%;\ + \n}\n" + ); + } +} +mod local { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(hwb(10deg 30% 40%), \"blackness\")}\n"), + "a {\ + \n b: 40%;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(hwb(10 30% 40%), \"hue\")}\n"), + "a {\ + \n b: 10deg;\ + \n}\n" + ); + } + mod normalized { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(hwb(10deg 70% 50%), \"blackness\")}\n"), + "a {\ + \n b: 41.6666666667%;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(hwb(10deg 70% 50%), \"whiteness\")}\n"), + "a {\ + \n b: 58.3333333333%;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(hwb(10deg 30% 40%), \"whiteness\")}\n"), + "a {\ + \n b: 30%;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/channel/lab.rs b/rsass/tests/spec/core_functions/color/channel/lab.rs new file mode 100644 index 000000000..536adbe7e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/lab.rs @@ -0,0 +1,83 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod foreign { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"a\", $space: lab)}\n"), + "a {\ + \n b: 24.4367702881;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"b\", $space: lab)}\n"), + "a {\ + \n b: 3.7594237161;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"lightness\", $space: lab)}\n"), + "a {\ + \n b: 83.7872528656%;\ + \n}\n" + ); + } +} +mod local { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(lab(50% -150 30), \"a\")}\n"), + "a {\ + \n b: -150;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(lab(50% -150 30), \"b\")}\n"), + "a {\ + \n b: 30;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(lab(50 -150 30), \"lightness\")}\n"), + "a {\ + \n b: 50%;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/channel/lch.rs b/rsass/tests/spec/core_functions/color/channel/lch.rs new file mode 100644 index 000000000..3afdd6dfb --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/lch.rs @@ -0,0 +1,83 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod foreign { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"chroma\", $space: lch)}\n"), + "a {\ + \n b: 24.7242595195;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"hue\", $space: lch)}\n"), + "a {\ + \n b: 8.7459803895deg;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"lightness\", $space: lch)}\n"), + "a {\ + \n b: 83.7872528656%;\ + \n}\n" + ); + } +} +mod local { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(lch(50 80% 0.5turn), \"chroma\")}\n"), + "a {\ + \n b: 120;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(lch(50 80% 0.5turn), \"hue\")}\n"), + "a {\ + \n b: 180deg;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(lch(50 80% 0.5turn), \"lightness\")}\n"), + "a {\ + \n b: 50%;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/channel/missing.rs b/rsass/tests/spec/core_functions/color/channel/missing.rs new file mode 100644 index 000000000..780467d3f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/missing.rs @@ -0,0 +1,18 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/missing.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("missing") +} + +#[test] +#[ignore] // unexepected error +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(rgb(255 none 255), \"green\")}\n"), + "a {\ + \n b: 0;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/channel/mod.rs b/rsass/tests/spec/core_functions/color/channel/mod.rs new file mode 100644 index 000000000..6788a6700 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/mod.rs @@ -0,0 +1,44 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("channel") +} + +mod a98_rgb; + +mod display_p3; + +mod error; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod missing; + +mod named; + +mod oklab; + +mod oklch; + +mod positional; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb_linear; + +mod srgb; + +mod xyz_d50; + +mod xyz; diff --git a/rsass/tests/spec/core_functions/color/channel/named.rs b/rsass/tests/spec/core_functions/color/channel/named.rs new file mode 100644 index 000000000..f2923ac63 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/named.rs @@ -0,0 +1,20 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/named.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("named") +} + +#[test] +#[ignore] // unexepected error +fn test() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.channel($color: pink, $channel: \"hue\", $space: hsl)}\n" + ), + "a {\ + \n b: 349.5238095238deg;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/channel/oklab.rs b/rsass/tests/spec/core_functions/color/channel/oklab.rs new file mode 100644 index 000000000..8e3e97358 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/oklab.rs @@ -0,0 +1,83 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod foreign { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"a\", $space: oklab)}\n"), + "a {\ + \n b: 0.0729803698;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"b\", $space: oklab)}\n"), + "a {\ + \n b: 0.0090714488;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"lightness\", $space: oklab)}\n"), + "a {\ + \n b: 86.7738445294%;\ + \n}\n" + ); + } +} +mod local { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(oklab(0.5 -1 50%), \"a\")}\n"), + "a {\ + \n b: -1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(oklab(0.5 -1 50%), \"b\")}\n"), + "a {\ + \n b: 0.2;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(oklab(0.5 -1 50%), \"lightness\")}\n"), + "a {\ + \n b: 50%;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/channel/oklch.rs b/rsass/tests/spec/core_functions/color/channel/oklch.rs new file mode 100644 index 000000000..7bd6ebb1f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/oklch.rs @@ -0,0 +1,83 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod foreign { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"chroma\", $space: oklch)}\n"), + "a {\ + \n b: 0.0735419986;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"hue\", $space: oklch)}\n"), + "a {\ + \n b: 7.0855142734deg;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"lightness\", $space: oklch)}\n"), + "a {\ + \n b: 86.7738445294%;\ + \n}\n" + ); + } +} +mod local { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(oklch(0.3 80% 30), \"chroma\")}\n"), + "a {\ + \n b: 0.32;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(oklch(0.3 80% 30), \"hue\")}\n"), + "a {\ + \n b: 30deg;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(oklch(0.3 80% 30), \"lightness\")}\n"), + "a {\ + \n b: 30%;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/channel/positional.rs b/rsass/tests/spec/core_functions/color/channel/positional.rs new file mode 100644 index 000000000..eec6c97d8 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/positional.rs @@ -0,0 +1,18 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/positional.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("positional") +} + +#[test] +#[ignore] // unexepected error +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(oklch(60% 70% 0.6turn), \"red\", rgb)}\n"), + "a {\ + \n b: -143.1028884453;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/channel/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/channel/prophoto_rgb.rs new file mode 100644 index 000000000..2f2a80145 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/prophoto_rgb.rs @@ -0,0 +1,91 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/prophoto-rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto-rgb") +} + +mod foreign { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"blue\", $space: prophoto-rgb)}\n"), + "a {\ + \n b: 0.7499576055;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.channel(pink, \"green\", $space: prophoto-rgb)}\n" + ), + "a {\ + \n b: 0.7357592889;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"red\", $space: prophoto-rgb)}\n"), + "a {\ + \n b: 0.8755603733;\ + \n}\n" + ); + } +} +mod local { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.channel(color(prophoto-rgb 0.2 0.5 0.8), \"blue\")}\n" + ), + "a {\ + \n b: 0.8;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.channel(color(prophoto-rgb 0.2 0.5 0.8), \"green\")}\n" + ), + "a {\ + \n b: 0.5;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.channel(color(prophoto-rgb 0.2 0.5 0.8), \"red\")}\n" + ), + "a {\ + \n b: 0.2;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/channel/rec2020.rs b/rsass/tests/spec/core_functions/color/channel/rec2020.rs new file mode 100644 index 000000000..886d42322 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/rec2020.rs @@ -0,0 +1,85 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod foreign { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"blue\", $space: rec2020)}\n"), + "a {\ + \n b: 0.7726929727;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"green\", $space: rec2020)}\n"), + "a {\ + \n b: 0.747938727;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"red\", $space: rec2020)}\n"), + "a {\ + \n b: 0.9098509852;\ + \n}\n" + ); + } +} +mod local { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(color(rec2020 0.2 0.5 0.8), \"blue\")}\n"), + "a {\ + \n b: 0.8;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.channel(color(rec2020 0.2 0.5 0.8), \"green\")}\n" + ), + "a {\ + \n b: 0.5;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(color(rec2020 0.2 0.5 0.8), \"red\")}\n"), + "a {\ + \n b: 0.2;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/channel/rgb.rs b/rsass/tests/spec/core_functions/color/channel/rgb.rs new file mode 100644 index 000000000..9dbfa29b4 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/rgb.rs @@ -0,0 +1,83 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod foreign { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"blue\")}\n"), + "a {\ + \n b: 203;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"green\")}\n"), + "a {\ + \n b: 192;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"red\")}\n"), + "a {\ + \n b: 255;\ + \n}\n" + ); + } +} +mod local { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(#abcdef, \"blue\")}\n"), + "a {\ + \n b: 239;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(#abcdef, \"green\")}\n"), + "a {\ + \n b: 205;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(#abcdef, \"red\")}\n"), + "a {\ + \n b: 171;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/channel/srgb.rs b/rsass/tests/spec/core_functions/color/channel/srgb.rs new file mode 100644 index 000000000..4c5527c06 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/srgb.rs @@ -0,0 +1,83 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod foreign { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"blue\", $space: srgb)}\n"), + "a {\ + \n b: 0.7960784314;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"green\", $space: srgb)}\n"), + "a {\ + \n b: 0.7529411765;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"red\", $space: srgb)}\n"), + "a {\ + \n b: 1;\ + \n}\n" + ); + } +} +mod local { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(color(srgb 0.2 0.5 0.8), \"blue\")}\n"), + "a {\ + \n b: 0.8;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(color(srgb 0.2 0.5 0.8), \"green\")}\n"), + "a {\ + \n b: 0.5;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(color(srgb 0.2 0.5 0.8), \"red\")}\n"), + "a {\ + \n b: 0.2;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/channel/srgb_linear.rs b/rsass/tests/spec/core_functions/color/channel/srgb_linear.rs new file mode 100644 index 000000000..cb0b706a3 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/srgb_linear.rs @@ -0,0 +1,89 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/srgb-linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb-linear") +} + +mod foreign { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"blue\", $space: srgb-linear)}\n"), + "a {\ + \n b: 0.5972017884;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"green\", $space: srgb-linear)}\n"), + "a {\ + \n b: 0.5271151257;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"red\", $space: srgb-linear)}\n"), + "a {\ + \n b: 1;\ + \n}\n" + ); + } +} +mod local { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.channel(color(srgb-linear 0.2 0.5 0.8), \"blue\")}\n" + ), + "a {\ + \n b: 0.8;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.channel(color(srgb-linear 0.2 0.5 0.8), \"green\")}\n" + ), + "a {\ + \n b: 0.5;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.channel(color(srgb-linear 0.2 0.5 0.8), \"red\")}\n" + ), + "a {\ + \n b: 0.2;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/channel/xyz.rs b/rsass/tests/spec/core_functions/color/channel/xyz.rs new file mode 100644 index 000000000..a72821412 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/xyz.rs @@ -0,0 +1,83 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +mod foreign { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn x() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"x\", $space: xyz)}\n"), + "a {\ + \n b: 0.7086623629;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn y() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"y\", $space: xyz)}\n"), + "a {\ + \n b: 0.6327286137;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn z() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"z\", $space: xyz)}\n"), + "a {\ + \n b: 0.6498196913;\ + \n}\n" + ); + } +} +mod local { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn x() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(color(xyz-d65 -0.2 0.5 1.8), \"x\")}\n"), + "a {\ + \n b: -0.2;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn y() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(color(xyz-d65 -0.2 0.5 1.8), \"y\")}\n"), + "a {\ + \n b: 0.5;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn z() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(color(xyz-d65 -0.2 0.5 1.8), \"z\")}\n"), + "a {\ + \n b: 1.8;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/channel/xyz_d50.rs b/rsass/tests/spec/core_functions/color/channel/xyz_d50.rs new file mode 100644 index 000000000..778deb9f6 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/channel/xyz_d50.rs @@ -0,0 +1,83 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/channel/xyz-d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz-d50") +} + +mod foreign { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn x() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"x\", $space: xyz-d50)}\n"), + "a {\ + \n b: 0.7245316215;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn y() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"y\", $space: xyz-d50)}\n"), + "a {\ + \n b: 0.636577424;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn z() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(pink, \"z\", $space: xyz-d50)}\n"), + "a {\ + \n b: 0.4915583688;\ + \n}\n" + ); + } +} +mod local { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn x() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(color(xyz-d50 -0.2 0.5 1.8), \"x\")}\n"), + "a {\ + \n b: -0.2;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn y() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(color(xyz-d50 -0.2 0.5 1.8), \"y\")}\n"), + "a {\ + \n b: 0.5;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn z() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.channel(color(xyz-d50 -0.2 0.5 1.8), \"z\")}\n"), + "a {\ + \n b: 1.8;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/color/alpha.rs b/rsass/tests/spec/core_functions/color/color/alpha.rs new file mode 100644 index 000000000..3f43e96ab --- /dev/null +++ b/rsass/tests/spec/core_functions/color/color/alpha.rs @@ -0,0 +1,195 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/color/alpha.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("alpha") +} + +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color($description: srgb 0.1 0.2 0.3 / 0.4));\n" + ), + "a {\ + \n value: color(srgb 0.1 0.2 0.3 / 0.4);\ + \n space: srgb;\ + \n channels: 0.1 0.2 0.3 / 0.4;\ + \n}\n" + ); +} +mod none { + #[allow(unused)] + use super::runner; + + mod slash { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn alpha() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 0.2 0.3 / none));\n"), + "a {\ + \n value: color(srgb 0.1 0.2 0.3 / none);\ + \n space: srgb;\ + \n channels: 0.1 0.2 0.3 / none;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 0.2 none / 0.4));\n"), + "a {\ + \n value: color(srgb 0.1 0.2 none / 0.4);\ + \n space: srgb;\ + \n channels: 0.1 0.2 none / 0.4;\ + \n}\n" + ); + } + } + mod slash_list { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn alpha() { + assert_eq!( + runner().ok( + "@use \'sass:list\';\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(list.slash(srgb 0.1 0.2 0.3, none)));\n" + ), + "a {\ + \n value: color(srgb 0.1 0.2 0.3 / none);\ + \n space: srgb;\ + \n channels: 0.1 0.2 0.3 / none;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \'sass:list\';\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(list.slash(srgb 0.1 0.2 none, 0.4)));\n" + ), + "a {\ + \n value: color(srgb 0.1 0.2 none / 0.4);\ + \n space: srgb;\ + \n channels: 0.1 0.2 none / 0.4;\ + \n}\n" + ); + } + } +} +#[test] +#[ignore] // unexepected error +fn opaque() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 0.2 0.3 / 1));\n"), + "a {\ + \n value: color(srgb 0.1 0.2 0.3);\ + \n space: srgb;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn partial() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 0.2 0.3 / 0.4));\n"), + "a {\ + \n value: color(srgb 0.1 0.2 0.3 / 0.4);\ + \n space: srgb;\ + \n channels: 0.1 0.2 0.3 / 0.4;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn percent() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 0.2 0.3 / 40%));\n"), + "a {\ + \n value: color(srgb 0.1 0.2 0.3 / 0.4);\ + \n space: srgb;\ + \n channels: 0.1 0.2 0.3 / 0.4;\ + \n}\n" + ); +} +mod relative_color { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn slash() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(from #aaa srgb r g b / 25%));\n"), + "a {\ + \n value: color(from #aaa srgb r g b/25%);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn slash_list() { + assert_eq!( + runner().ok( + "@use \'sass:list\';\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(list.slash(from #aaa srgb r g b, 25%)));\n" + ), + "a {\ + \n value: color(from #aaa srgb r g b / 25%);\ + \n type: string;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn slash_list() { + assert_eq!( + runner().ok( + "@use \"sass:list\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(list.slash(srgb 0.1 0.2 0.3, 0.4)));\n" + ), + "a {\ + \n value: color(srgb 0.1 0.2 0.3 / 0.4);\ + \n space: srgb;\ + \n channels: 0.1 0.2 0.3 / 0.4;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn transparent() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 0.2 0.3 / 0));\n"), + "a {\ + \n value: color(srgb 0.1 0.2 0.3 / 0);\ + \n space: srgb;\ + \n channels: 0.1 0.2 0.3 / 0;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/color/degenerate.rs b/rsass/tests/spec/core_functions/color/color/degenerate.rs new file mode 100644 index 000000000..7d3d71ce5 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/color/degenerate.rs @@ -0,0 +1,112 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/color/degenerate.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("degenerate") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn nan() { + assert_eq!( + runner().ok("a {b: color(srgb 0 0 0 / calc(NaN))}\n"), + "a {\ + \n b: color(srgb 0 0 0 / 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn negative_infinity() { + assert_eq!( + runner().ok("a {b: color(srgb 0 0 0 / calc(-infinity))}\n"), + "a {\ + \n b: color(srgb 0 0 0 / 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn positive_infinity() { + assert_eq!( + runner().ok("a {b: color(srgb 0 0 0 / calc(infinity))}\n"), + "a {\ + \n b: color(srgb 0 0 0);\ + \n}\n" + ); + } +} +mod arg1 { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn nan() { + assert_eq!( + runner().ok("a {b: color(srgb calc(NaN) 0 0)}\n"), + "a {\ + \n b: color(srgb calc(NaN) 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn negative_infinity() { + assert_eq!( + runner().ok("a {b: color(srgb calc(-infinity) 0 0)}\n"), + "a {\ + \n b: color(srgb calc(-infinity) 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn positive_infinity() { + assert_eq!( + runner().ok("a {b: color(srgb calc(infinity) 0 0)}\n"), + "a {\ + \n b: color(srgb calc(infinity) 0 0);\ + \n}\n" + ); + } +} +mod before_alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn nan() { + assert_eq!( + runner().ok("a {b: color(srgb 0 0 calc(NaN) / 0.5)}\n"), + "a {\ + \n b: color(srgb 0 0 calc(NaN) / 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn negative_infinity() { + assert_eq!( + runner().ok("a {b: color(srgb 0 0 calc(-infinity) / 0.5)}\n"), + "a {\ + \n b: color(srgb 0 0 calc(-infinity) / 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn positive_infinity() { + assert_eq!( + runner().ok("a {b: color(srgb 0 0 calc(infinity) / 0.5)}\n"), + "a {\ + \n b: color(srgb 0 0 calc(infinity) / 0.5);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/color/error.rs b/rsass/tests/spec/core_functions/color/color/error.rs new file mode 100644 index 000000000..593d947b0 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/color/error.rs @@ -0,0 +1,425 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/color/error.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("error") +} + +mod list { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn after_space() { + assert_eq!( + runner().err( + "a {b: color(srgb (0.1 0.2 0.3))}\n" + ), + "Error: $description: Expected red channel to be a number, was (0.1 0.2 0.3).\ + \n ,\ + \n1 | a {b: color(srgb (0.1 0.2 0.3))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn bracketed() { + assert_eq!( + runner().err( + "a {b: color([srgb 0.1 0.2 0.3])}\n" + ), + "Error: $description: Expected an unbracketed list, was [srgb 0.1 0.2 0.3]\ + \n ,\ + \n1 | a {b: color([srgb 0.1 0.2 0.3])}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn comma() { + assert_eq!( + runner().err( + "a {b: color((srgb, 0.1, 0.2, 0.3))}\n" + ), + "Error: $description: Expected a space- or slash-separated list, was (srgb, 0.1, 0.2, 0.3)\ + \n ,\ + \n1 | a {b: color((srgb, 0.1, 0.2, 0.3))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + mod slash { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn one() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \n$single-arg-slash-separated: list.append((), srgb 0.1 0.2 0.3, $separator: slash);\ + \na {b: color($single-arg-slash-separated)}\n" + ), + "Error: $description: Only 2 slash-separated elements allowed, but 1 was passed.\ + \n ,\ + \n3 | a {b: color($single-arg-slash-separated)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 3:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn three() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \na {b: color(list.slash(srgb 0.1, 0.2, 0.3))}\n" + ), + "Error: $description: Only 2 slash-separated elements allowed, but 3 were passed.\ + \n ,\ + \n2 | a {b: color(list.slash(srgb 0.1, 0.2, 0.3))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // missing error + fn too_few_channels() { + assert_eq!( + runner().err( + "a {b: color(srgb 0.1 0.2)}\n" + ), + "Error: $description: The srgb color space has 3 channels but (srgb 0.1 0.2) has 2.\ + \n ,\ + \n1 | a {b: color(srgb 0.1 0.2)}\ + \n | ^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn too_many_channels() { + assert_eq!( + runner().err( + "a {b: color(srgb 0.1 0.2 0.3 0.4)}\n" + ), + "Error: $description: The srgb color space has 3 channels but (srgb 0.1 0.2 0.3 0.4) has 4.\ + \n ,\ + \n1 | a {b: color(srgb 0.1 0.2 0.3 0.4)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} +mod relative_color { + #[allow(unused)] + use super::runner; + + mod quoted { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn alpha() { + assert_eq!( + runner().err( + "a {b: color(\"from\" #aaa srgb r g b / 25%)}\n" + ), + "Error: $description: Expected \"from\" to be an unquoted string.\ + \n ,\ + \n1 | a {b: color(\"from\" #aaa srgb r g b / 25%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn no_alpha() { + assert_eq!( + runner().err( + "a {b: color(\"from\" #aaa srgb r g b)}\n" + ), + "Error: $description: Expected \"from\" to be an unquoted string.\ + \n ,\ + \n1 | a {b: color(\"from\" #aaa srgb r g b)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + } + mod wrong_keyword { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn alpha() { + assert_eq!( + runner().err("a {b: color(c #aaa srgb r g b / 25%)}\n"), + "Error: $description: Unknown color space \"c\".\ + \n ,\ + \n1 | a {b: color(c #aaa srgb r g b / 25%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn no_alpha() { + assert_eq!( + runner().err("a {b: color(c #aaa srgb r g b)}\n"), + "Error: $description: Unknown color space \"c\".\ + \n ,\ + \n1 | a {b: color(c #aaa srgb r g b)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + } +} +mod too_few_args { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn no_channels() { + assert_eq!( + runner().err( + "a {b: color(srgb)}\n" + ), + "Error: $description: The srgb color space has 3 channels but srgb has 0.\ + \n ,\ + \n1 | a {b: color(srgb)}\ + \n | ^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn no_space() { + assert_eq!( + runner().err("a {b: color(1 2 3)}\n"), + "Error: $description: 1 is not a string.\ + \n ,\ + \n1 | a {b: color(1 2 3)}\ + \n | ^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn none() { + assert_eq!( + runner().err("a {b: color()}\n"), + "Error: Missing argument $description.\ + \n ,--> input.scss\ + \n1 | a {b: color()}\ + \n | ^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function color($description) {\ + \n | =================== declaration\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} +#[test] +#[ignore] // missing error +fn too_many_args() { + assert_eq!( + runner().err( + "a {b: color(srgb 0.1 0.2 0.3 0.4)}\n" + ), + "Error: $description: The srgb color space has 3 channels but (srgb 0.1 0.2 0.3 0.4) has 4.\ + \n ,\ + \n1 | a {b: color(srgb 0.1 0.2 0.3 0.4)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); +} +mod test_type { + #[allow(unused)] + use super::runner; + + mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn slash_list() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \na {b: color(list.slash(srgb 0.1 0.2 0.3, c))}\n" + ), + "Error: $description: c is not a number.\ + \n ,\ + \n2 | a {b: color(list.slash(srgb 0.1 0.2 0.3, c))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // missing error + fn blue() { + assert_eq!( + runner().err( + "a {b: color(srgb 0.1 0.2 c)}\n" + ), + "Error: $description: Expected blue channel to be a number, was c.\ + \n ,\ + \n1 | a {b: color(srgb 0.1 0.2 c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn green() { + assert_eq!( + runner().err( + "a {b: color(srgb 0.1 c 0.3)}\n" + ), + "Error: $description: Expected green channel to be a number, was c.\ + \n ,\ + \n1 | a {b: color(srgb 0.1 c 0.3)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn red() { + assert_eq!( + runner().err( + "a {b: color(srgb c 0.2 0.3)}\n" + ), + "Error: $description: Expected red channel to be a number, was c.\ + \n ,\ + \n1 | a {b: color(srgb c 0.2 0.3)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} +mod unit { + #[allow(unused)] + use super::runner; + + mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn slash() { + assert_eq!( + runner().err( + "a {b: color(srgb 0.1 0.2 0.3/0.4px)}\n" + ), + "Error: $alpha: Expected 0.4px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: color(srgb 0.1 0.2 0.3/0.4px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn slash_list() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \na {b: color(list.slash(srgb 0.1 0.2 0.3, 0.4px))}\n" + ), + "Error: $alpha: Expected 0.4px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: color(list.slash(srgb 0.1 0.2 0.3, 0.4px))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // missing error + fn blue() { + assert_eq!( + runner().err("a {b: color(srgb 0.1 0.2 0.3px)}\n"), + "Error: $blue: Expected 0.3px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: color(srgb 0.1 0.2 0.3px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn green() { + assert_eq!( + runner().err("a {b: color(srgb 0.1 0.2px 0.3)}\n"), + "Error: $green: Expected 0.2px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: color(srgb 0.1 0.2px 0.3)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn red() { + assert_eq!( + runner().err("a {b: color(srgb 0.1px 0.2 0.3)}\n"), + "Error: $red: Expected 0.1px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: color(srgb 0.1px 0.2 0.3)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} +#[test] +#[ignore] // missing error +fn unknown_space() { + assert_eq!( + runner().err("a {b: color(foo 1 2 3)}\n"), + "Error: $description: Unknown color space \"foo\".\ + \n ,\ + \n1 | a {b: color(foo 1 2 3)}\ + \n | ^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/color/mod.rs b/rsass/tests/spec/core_functions/color/color/mod.rs new file mode 100644 index 000000000..f89191e7a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/color/mod.rs @@ -0,0 +1,20 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/color" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("color") +} + +mod alpha; + +mod degenerate; + +mod error; + +mod no_alpha; + +mod relative_color; + +mod spaces; + +mod special_functions; diff --git a/rsass/tests/spec/core_functions/color/color/no_alpha.rs b/rsass/tests/spec/core_functions/color/color/no_alpha.rs new file mode 100644 index 000000000..30f4449e9 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/color/no_alpha.rs @@ -0,0 +1,91 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/color/no_alpha.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("no_alpha") +} + +#[test] +#[ignore] // unexepected error +fn case() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(sRGB 0.1 none 0.3));\n"), + "a {\ + \n value: color(srgb 0.1 none 0.3);\ + \n space: srgb;\ + \n channels: 0.1 none 0.3 / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color($description: srgb 0.1 0.2 0.3));\n" + ), + "a {\ + \n value: color(srgb 0.1 0.2 0.3);\ + \n space: srgb;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); +} +mod none { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 none 0.3));\n"), + "a {\ + \n value: color(srgb 0.1 none 0.3);\ + \n space: srgb;\ + \n channels: 0.1 none 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 none 0.3));\n"), + "a {\ + \n value: color(srgb 0.1 none 0.3);\ + \n space: srgb;\ + \n channels: 0.1 none 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb none 0.2 0.3));\n"), + "a {\ + \n value: color(srgb none 0.2 0.3);\ + \n space: srgb;\ + \n channels: none 0.2 0.3 / 1;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn relative_color() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(from #aaa srgb r g b));\n"), + "a {\ + \n value: color(from #aaa srgb r g b);\ + \n type: string;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/color/relative_color.rs b/rsass/tests/spec/core_functions/color/color/relative_color.rs new file mode 100644 index 000000000..5088d0276 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/color/relative_color.rs @@ -0,0 +1,110 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/color/relative_color.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("relative_color") +} + +mod calc { + #[allow(unused)] + use super::runner; + + #[test] + fn alpha() { + assert_eq!( + runner() + .ok("a {b: color(from #aaa srgb calc(l + 0.2) a b / 25%)}\n"), + "a {\ + \n b: color(from #aaa srgb calc(l + 0.2) a b/25%);\ + \n}\n" + ); + } + #[test] + fn no_alpha() { + assert_eq!( + runner().ok("a {b: color(from #aaa srgb calc(l + 0.2) a b)}\n"), + "a {\ + \n b: color(from #aaa srgb calc(l + 0.2) a b);\ + \n}\n" + ); + } +} +mod different_case { + #[allow(unused)] + use super::runner; + + #[test] + fn alpha() { + assert_eq!( + runner().ok("a {b: color(From #aaa srgb r g b / 25%)}\n"), + "a {\ + \n b: color(From #aaa srgb r g b/25%);\ + \n}\n" + ); + } + #[test] + fn no_alpha() { + assert_eq!( + runner().ok("a {b: color(From #aaa srgb r g b)}\n"), + "a {\ + \n b: color(From #aaa srgb r g b);\ + \n}\n" + ); + } +} +#[test] +fn slash_list_alpha() { + assert_eq!( + runner().ok("@use \"sass:list\";\ + \na {b: color(list.slash(from #aaa srgb r g b, 25%))}\n"), + "a {\ + \n b: color(from #aaa srgb r g b / 25%);\ + \n}\n" + ); +} +mod test_static { + #[allow(unused)] + use super::runner; + + #[test] + fn alpha() { + assert_eq!( + runner().ok("a {b: color(from #aaa srgb r g b / 25%)}\n"), + "a {\ + \n b: color(from #aaa srgb r g b/25%);\ + \n}\n" + ); + } + #[test] + fn no_alpha() { + assert_eq!( + runner().ok("a {b: color(from #aaa srgb r g b)}\n"), + "a {\ + \n b: color(from #aaa srgb r g b);\ + \n}\n" + ); + } +} +mod var { + #[allow(unused)] + use super::runner; + + #[test] + fn alpha() { + assert_eq!( + runner().ok("a {b: color(from var(--c) srgb r g b / 25%)}\n"), + "a {\ + \n b: color(from var(--c) srgb r g b/25%);\ + \n}\n" + ); + } + #[test] + fn no_alpha() { + assert_eq!( + runner().ok("a {b: color(from var(--c) srgb r g b)}\n"), + "a {\ + \n b: color(from var(--c) srgb r g b);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/color/spaces/a98_rgb.rs b/rsass/tests/spec/core_functions/color/color/spaces/a98_rgb.rs new file mode 100644 index 000000000..5081c4aa5 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/color/spaces/a98_rgb.rs @@ -0,0 +1,229 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/color/spaces/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +mod percent { + #[allow(unused)] + use super::runner; + + mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(a98-rgb 0.1 0.2 130%));\n"), + "a {\ + \n value: color(a98-rgb 0.1 0.2 1.3);\ + \n space: a98-rgb;\ + \n channels: 0.1 0.2 1.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(a98-rgb 0.1 0.2 -30%));\n"), + "a {\ + \n value: color(a98-rgb 0.1 0.2 -0.3);\ + \n space: a98-rgb;\ + \n channels: 0.1 0.2 -0.3 / 1;\ + \n}\n" + ); + } + } + mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(a98-rgb 0.1 120% 0.3));\n"), + "a {\ + \n value: color(a98-rgb 0.1 1.2 0.3);\ + \n space: a98-rgb;\ + \n channels: 0.1 1.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(a98-rgb 0.1 -20% 0.3));\n"), + "a {\ + \n value: color(a98-rgb 0.1 -0.2 0.3);\ + \n space: a98-rgb;\ + \n channels: 0.1 -0.2 0.3 / 1;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(a98-rgb 10% 20% 30%));\n"), + "a {\ + \n value: color(a98-rgb 0.1 0.2 0.3);\ + \n space: a98-rgb;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(a98-rgb 110% 0.2 0.3));\n"), + "a {\ + \n value: color(a98-rgb 1.1 0.2 0.3);\ + \n space: a98-rgb;\ + \n channels: 1.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(a98-rgb -10% 0.2 0.3));\n"), + "a {\ + \n value: color(a98-rgb -0.1 0.2 0.3);\ + \n space: a98-rgb;\ + \n channels: -0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + } +} +mod unitless { + #[allow(unused)] + use super::runner; + + mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(a98-rgb 0.1 0.2 1.3));\n"), + "a {\ + \n value: color(a98-rgb 0.1 0.2 1.3);\ + \n space: a98-rgb;\ + \n channels: 0.1 0.2 1.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(a98-rgb 0.1 0.2 -0.3));\n"), + "a {\ + \n value: color(a98-rgb 0.1 0.2 -0.3);\ + \n space: a98-rgb;\ + \n channels: 0.1 0.2 -0.3 / 1;\ + \n}\n" + ); + } + } + mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(a98-rgb 0.1 1.2 0.3));\n"), + "a {\ + \n value: color(a98-rgb 0.1 1.2 0.3);\ + \n space: a98-rgb;\ + \n channels: 0.1 1.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(a98-rgb 0.1 -0.2 0.3));\n"), + "a {\ + \n value: color(a98-rgb 0.1 -0.2 0.3);\ + \n space: a98-rgb;\ + \n channels: 0.1 -0.2 0.3 / 1;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(a98-rgb 0.1 0.2 0.3));\n"), + "a {\ + \n value: color(a98-rgb 0.1 0.2 0.3);\ + \n space: a98-rgb;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(a98-rgb 1.1 0.2 0.3));\n"), + "a {\ + \n value: color(a98-rgb 1.1 0.2 0.3);\ + \n space: a98-rgb;\ + \n channels: 1.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(a98-rgb -0.1 0.2 0.3));\n"), + "a {\ + \n value: color(a98-rgb -0.1 0.2 0.3);\ + \n space: a98-rgb;\ + \n channels: -0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/core_functions/color/color/spaces/display_p3.rs b/rsass/tests/spec/core_functions/color/color/spaces/display_p3.rs new file mode 100644 index 000000000..138b9e1bd --- /dev/null +++ b/rsass/tests/spec/core_functions/color/color/spaces/display_p3.rs @@ -0,0 +1,229 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/color/spaces/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod percent { + #[allow(unused)] + use super::runner; + + mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(display-p3 0.1 0.2 130%));\n"), + "a {\ + \n value: color(display-p3 0.1 0.2 1.3);\ + \n space: display-p3;\ + \n channels: 0.1 0.2 1.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(display-p3 0.1 0.2 -30%));\n"), + "a {\ + \n value: color(display-p3 0.1 0.2 -0.3);\ + \n space: display-p3;\ + \n channels: 0.1 0.2 -0.3 / 1;\ + \n}\n" + ); + } + } + mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(display-p3 0.1 120% 0.3));\n"), + "a {\ + \n value: color(display-p3 0.1 1.2 0.3);\ + \n space: display-p3;\ + \n channels: 0.1 1.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(display-p3 0.1 -20% 0.3));\n"), + "a {\ + \n value: color(display-p3 0.1 -0.2 0.3);\ + \n space: display-p3;\ + \n channels: 0.1 -0.2 0.3 / 1;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(display-p3 10% 20% 30%));\n"), + "a {\ + \n value: color(display-p3 0.1 0.2 0.3);\ + \n space: display-p3;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(display-p3 110% 0.2 0.3));\n"), + "a {\ + \n value: color(display-p3 1.1 0.2 0.3);\ + \n space: display-p3;\ + \n channels: 1.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(display-p3 -10% 0.2 0.3));\n"), + "a {\ + \n value: color(display-p3 -0.1 0.2 0.3);\ + \n space: display-p3;\ + \n channels: -0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + } +} +mod unitless { + #[allow(unused)] + use super::runner; + + mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(display-p3 0.1 0.2 1.3));\n"), + "a {\ + \n value: color(display-p3 0.1 0.2 1.3);\ + \n space: display-p3;\ + \n channels: 0.1 0.2 1.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(display-p3 0.1 0.2 -0.3));\n"), + "a {\ + \n value: color(display-p3 0.1 0.2 -0.3);\ + \n space: display-p3;\ + \n channels: 0.1 0.2 -0.3 / 1;\ + \n}\n" + ); + } + } + mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(display-p3 0.1 1.2 0.3));\n"), + "a {\ + \n value: color(display-p3 0.1 1.2 0.3);\ + \n space: display-p3;\ + \n channels: 0.1 1.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(display-p3 0.1 -0.2 0.3));\n"), + "a {\ + \n value: color(display-p3 0.1 -0.2 0.3);\ + \n space: display-p3;\ + \n channels: 0.1 -0.2 0.3 / 1;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(display-p3 0.1 0.2 0.3));\n"), + "a {\ + \n value: color(display-p3 0.1 0.2 0.3);\ + \n space: display-p3;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(display-p3 1.1 0.2 0.3));\n"), + "a {\ + \n value: color(display-p3 1.1 0.2 0.3);\ + \n space: display-p3;\ + \n channels: 1.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(display-p3 -0.1 0.2 0.3));\n"), + "a {\ + \n value: color(display-p3 -0.1 0.2 0.3);\ + \n space: display-p3;\ + \n channels: -0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/core_functions/color/color/spaces/mod.rs b/rsass/tests/spec/core_functions/color/color/spaces/mod.rs new file mode 100644 index 000000000..52af3feb7 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/color/spaces/mod.rs @@ -0,0 +1,22 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/color/spaces" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("spaces") +} + +mod a98_rgb; + +mod display_p3; + +mod prophoto_rgb; + +mod rec2020; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/color/spaces/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/color/spaces/prophoto_rgb.rs new file mode 100644 index 000000000..c4317b893 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/color/spaces/prophoto_rgb.rs @@ -0,0 +1,229 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/color/spaces/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod percent { + #[allow(unused)] + use super::runner; + + mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(prophoto-rgb 0.1 0.2 130%));\n"), + "a {\ + \n value: color(prophoto-rgb 0.1 0.2 1.3);\ + \n space: prophoto-rgb;\ + \n channels: 0.1 0.2 1.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(prophoto-rgb 0.1 0.2 -30%));\n"), + "a {\ + \n value: color(prophoto-rgb 0.1 0.2 -0.3);\ + \n space: prophoto-rgb;\ + \n channels: 0.1 0.2 -0.3 / 1;\ + \n}\n" + ); + } + } + mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(prophoto-rgb 0.1 120% 0.3));\n"), + "a {\ + \n value: color(prophoto-rgb 0.1 1.2 0.3);\ + \n space: prophoto-rgb;\ + \n channels: 0.1 1.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(prophoto-rgb 0.1 -20% 0.3));\n"), + "a {\ + \n value: color(prophoto-rgb 0.1 -0.2 0.3);\ + \n space: prophoto-rgb;\ + \n channels: 0.1 -0.2 0.3 / 1;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(prophoto-rgb 10% 20% 30%));\n"), + "a {\ + \n value: color(prophoto-rgb 0.1 0.2 0.3);\ + \n space: prophoto-rgb;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(prophoto-rgb 110% 0.2 0.3));\n"), + "a {\ + \n value: color(prophoto-rgb 1.1 0.2 0.3);\ + \n space: prophoto-rgb;\ + \n channels: 1.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(prophoto-rgb -10% 0.2 0.3));\n"), + "a {\ + \n value: color(prophoto-rgb -0.1 0.2 0.3);\ + \n space: prophoto-rgb;\ + \n channels: -0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + } +} +mod unitless { + #[allow(unused)] + use super::runner; + + mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(prophoto-rgb 0.1 0.2 1.3));\n"), + "a {\ + \n value: color(prophoto-rgb 0.1 0.2 1.3);\ + \n space: prophoto-rgb;\ + \n channels: 0.1 0.2 1.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(prophoto-rgb 0.1 0.2 -0.3));\n"), + "a {\ + \n value: color(prophoto-rgb 0.1 0.2 -0.3);\ + \n space: prophoto-rgb;\ + \n channels: 0.1 0.2 -0.3 / 1;\ + \n}\n" + ); + } + } + mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(prophoto-rgb 0.1 1.2 0.3));\n"), + "a {\ + \n value: color(prophoto-rgb 0.1 1.2 0.3);\ + \n space: prophoto-rgb;\ + \n channels: 0.1 1.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(prophoto-rgb 0.1 -0.2 0.3));\n"), + "a {\ + \n value: color(prophoto-rgb 0.1 -0.2 0.3);\ + \n space: prophoto-rgb;\ + \n channels: 0.1 -0.2 0.3 / 1;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(prophoto-rgb 0.1 0.2 0.3));\n"), + "a {\ + \n value: color(prophoto-rgb 0.1 0.2 0.3);\ + \n space: prophoto-rgb;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(prophoto-rgb 1.1 0.2 0.3));\n"), + "a {\ + \n value: color(prophoto-rgb 1.1 0.2 0.3);\ + \n space: prophoto-rgb;\ + \n channels: 1.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(prophoto-rgb -0.1 0.2 0.3));\n"), + "a {\ + \n value: color(prophoto-rgb -0.1 0.2 0.3);\ + \n space: prophoto-rgb;\ + \n channels: -0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/core_functions/color/color/spaces/rec2020.rs b/rsass/tests/spec/core_functions/color/color/spaces/rec2020.rs new file mode 100644 index 000000000..3662b6364 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/color/spaces/rec2020.rs @@ -0,0 +1,229 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/color/spaces/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod percent { + #[allow(unused)] + use super::runner; + + mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(rec2020 0.1 0.2 130%));\n"), + "a {\ + \n value: color(rec2020 0.1 0.2 1.3);\ + \n space: rec2020;\ + \n channels: 0.1 0.2 1.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(rec2020 0.1 0.2 -30%));\n"), + "a {\ + \n value: color(rec2020 0.1 0.2 -0.3);\ + \n space: rec2020;\ + \n channels: 0.1 0.2 -0.3 / 1;\ + \n}\n" + ); + } + } + mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(rec2020 0.1 120% 0.3));\n"), + "a {\ + \n value: color(rec2020 0.1 1.2 0.3);\ + \n space: rec2020;\ + \n channels: 0.1 1.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(rec2020 0.1 -20% 0.3));\n"), + "a {\ + \n value: color(rec2020 0.1 -0.2 0.3);\ + \n space: rec2020;\ + \n channels: 0.1 -0.2 0.3 / 1;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(rec2020 10% 20% 30%));\n"), + "a {\ + \n value: color(rec2020 0.1 0.2 0.3);\ + \n space: rec2020;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(rec2020 110% 0.2 0.3));\n"), + "a {\ + \n value: color(rec2020 1.1 0.2 0.3);\ + \n space: rec2020;\ + \n channels: 1.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(rec2020 -10% 0.2 0.3));\n"), + "a {\ + \n value: color(rec2020 -0.1 0.2 0.3);\ + \n space: rec2020;\ + \n channels: -0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + } +} +mod unitless { + #[allow(unused)] + use super::runner; + + mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(rec2020 0.1 0.2 1.3));\n"), + "a {\ + \n value: color(rec2020 0.1 0.2 1.3);\ + \n space: rec2020;\ + \n channels: 0.1 0.2 1.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(rec2020 0.1 0.2 -0.3));\n"), + "a {\ + \n value: color(rec2020 0.1 0.2 -0.3);\ + \n space: rec2020;\ + \n channels: 0.1 0.2 -0.3 / 1;\ + \n}\n" + ); + } + } + mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(rec2020 0.1 1.2 0.3));\n"), + "a {\ + \n value: color(rec2020 0.1 1.2 0.3);\ + \n space: rec2020;\ + \n channels: 0.1 1.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(rec2020 0.1 -0.2 0.3));\n"), + "a {\ + \n value: color(rec2020 0.1 -0.2 0.3);\ + \n space: rec2020;\ + \n channels: 0.1 -0.2 0.3 / 1;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(rec2020 0.1 0.2 0.3));\n"), + "a {\ + \n value: color(rec2020 0.1 0.2 0.3);\ + \n space: rec2020;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(rec2020 1.1 0.2 0.3));\n"), + "a {\ + \n value: color(rec2020 1.1 0.2 0.3);\ + \n space: rec2020;\ + \n channels: 1.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(rec2020 -0.1 0.2 0.3));\n"), + "a {\ + \n value: color(rec2020 -0.1 0.2 0.3);\ + \n space: rec2020;\ + \n channels: -0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/core_functions/color/color/spaces/srgb.rs b/rsass/tests/spec/core_functions/color/color/spaces/srgb.rs new file mode 100644 index 000000000..714edbb0b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/color/spaces/srgb.rs @@ -0,0 +1,229 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/color/spaces/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod percent { + #[allow(unused)] + use super::runner; + + mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 0.2 130%));\n"), + "a {\ + \n value: color(srgb 0.1 0.2 1.3);\ + \n space: srgb;\ + \n channels: 0.1 0.2 1.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 0.2 -30%));\n"), + "a {\ + \n value: color(srgb 0.1 0.2 -0.3);\ + \n space: srgb;\ + \n channels: 0.1 0.2 -0.3 / 1;\ + \n}\n" + ); + } + } + mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 120% 0.3));\n"), + "a {\ + \n value: color(srgb 0.1 1.2 0.3);\ + \n space: srgb;\ + \n channels: 0.1 1.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 -20% 0.3));\n"), + "a {\ + \n value: color(srgb 0.1 -0.2 0.3);\ + \n space: srgb;\ + \n channels: 0.1 -0.2 0.3 / 1;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 10% 20% 30%));\n"), + "a {\ + \n value: color(srgb 0.1 0.2 0.3);\ + \n space: srgb;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 110% 0.2 0.3));\n"), + "a {\ + \n value: color(srgb 1.1 0.2 0.3);\ + \n space: srgb;\ + \n channels: 1.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb -10% 0.2 0.3));\n"), + "a {\ + \n value: color(srgb -0.1 0.2 0.3);\ + \n space: srgb;\ + \n channels: -0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + } +} +mod unitless { + #[allow(unused)] + use super::runner; + + mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 0.2 1.3));\n"), + "a {\ + \n value: color(srgb 0.1 0.2 1.3);\ + \n space: srgb;\ + \n channels: 0.1 0.2 1.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 0.2 -0.3));\n"), + "a {\ + \n value: color(srgb 0.1 0.2 -0.3);\ + \n space: srgb;\ + \n channels: 0.1 0.2 -0.3 / 1;\ + \n}\n" + ); + } + } + mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 1.2 0.3));\n"), + "a {\ + \n value: color(srgb 0.1 1.2 0.3);\ + \n space: srgb;\ + \n channels: 0.1 1.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 -0.2 0.3));\n"), + "a {\ + \n value: color(srgb 0.1 -0.2 0.3);\ + \n space: srgb;\ + \n channels: 0.1 -0.2 0.3 / 1;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 0.2 0.3));\n"), + "a {\ + \n value: color(srgb 0.1 0.2 0.3);\ + \n space: srgb;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 1.1 0.2 0.3));\n"), + "a {\ + \n value: color(srgb 1.1 0.2 0.3);\ + \n space: srgb;\ + \n channels: 1.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb -0.1 0.2 0.3));\n"), + "a {\ + \n value: color(srgb -0.1 0.2 0.3);\ + \n space: srgb;\ + \n channels: -0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/core_functions/color/color/spaces/srgb_linear.rs b/rsass/tests/spec/core_functions/color/color/spaces/srgb_linear.rs new file mode 100644 index 000000000..b4b025792 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/color/spaces/srgb_linear.rs @@ -0,0 +1,229 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/color/spaces/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod percent { + #[allow(unused)] + use super::runner; + + mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb-linear 0.1 0.2 130%));\n"), + "a {\ + \n value: color(srgb-linear 0.1 0.2 1.3);\ + \n space: srgb-linear;\ + \n channels: 0.1 0.2 1.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb-linear 0.1 0.2 -30%));\n"), + "a {\ + \n value: color(srgb-linear 0.1 0.2 -0.3);\ + \n space: srgb-linear;\ + \n channels: 0.1 0.2 -0.3 / 1;\ + \n}\n" + ); + } + } + mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb-linear 0.1 120% 0.3));\n"), + "a {\ + \n value: color(srgb-linear 0.1 1.2 0.3);\ + \n space: srgb-linear;\ + \n channels: 0.1 1.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb-linear 0.1 -20% 0.3));\n"), + "a {\ + \n value: color(srgb-linear 0.1 -0.2 0.3);\ + \n space: srgb-linear;\ + \n channels: 0.1 -0.2 0.3 / 1;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb-linear 10% 20% 30%));\n"), + "a {\ + \n value: color(srgb-linear 0.1 0.2 0.3);\ + \n space: srgb-linear;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb-linear 110% 0.2 0.3));\n"), + "a {\ + \n value: color(srgb-linear 1.1 0.2 0.3);\ + \n space: srgb-linear;\ + \n channels: 1.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb-linear -10% 0.2 0.3));\n"), + "a {\ + \n value: color(srgb-linear -0.1 0.2 0.3);\ + \n space: srgb-linear;\ + \n channels: -0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + } +} +mod unitless { + #[allow(unused)] + use super::runner; + + mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb-linear 0.1 0.2 1.3));\n"), + "a {\ + \n value: color(srgb-linear 0.1 0.2 1.3);\ + \n space: srgb-linear;\ + \n channels: 0.1 0.2 1.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb-linear 0.1 0.2 -0.3));\n"), + "a {\ + \n value: color(srgb-linear 0.1 0.2 -0.3);\ + \n space: srgb-linear;\ + \n channels: 0.1 0.2 -0.3 / 1;\ + \n}\n" + ); + } + } + mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb-linear 0.1 1.2 0.3));\n"), + "a {\ + \n value: color(srgb-linear 0.1 1.2 0.3);\ + \n space: srgb-linear;\ + \n channels: 0.1 1.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb-linear 0.1 -0.2 0.3));\n"), + "a {\ + \n value: color(srgb-linear 0.1 -0.2 0.3);\ + \n space: srgb-linear;\ + \n channels: 0.1 -0.2 0.3 / 1;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb-linear 0.1 0.2 0.3));\n"), + "a {\ + \n value: color(srgb-linear 0.1 0.2 0.3);\ + \n space: srgb-linear;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb-linear 1.1 0.2 0.3));\n"), + "a {\ + \n value: color(srgb-linear 1.1 0.2 0.3);\ + \n space: srgb-linear;\ + \n channels: 1.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb-linear -0.1 0.2 0.3));\n"), + "a {\ + \n value: color(srgb-linear -0.1 0.2 0.3);\ + \n space: srgb-linear;\ + \n channels: -0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/core_functions/color/color/spaces/xyz.rs b/rsass/tests/spec/core_functions/color/color/spaces/xyz.rs new file mode 100644 index 000000000..2b9fcb829 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/color/spaces/xyz.rs @@ -0,0 +1,242 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/color/spaces/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +mod percent { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz 10% 20% 30%));\n"), + "a {\ + \n value: color(xyz 0.1 0.2 0.3);\ + \n space: xyz;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + mod x { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz 110% 0.2 0.3));\n"), + "a {\ + \n value: color(xyz 1.1 0.2 0.3);\ + \n space: xyz;\ + \n channels: 1.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz -10% 0.2 0.3));\n"), + "a {\ + \n value: color(xyz -0.1 0.2 0.3);\ + \n space: xyz;\ + \n channels: -0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + } + mod y { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz 0.1 120% 0.3));\n"), + "a {\ + \n value: color(xyz 0.1 1.2 0.3);\ + \n space: xyz;\ + \n channels: 0.1 1.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz 0.1 -20% 0.3));\n"), + "a {\ + \n value: color(xyz 0.1 -0.2 0.3);\ + \n space: xyz;\ + \n channels: 0.1 -0.2 0.3 / 1;\ + \n}\n" + ); + } + } + mod z { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz 0.1 0.2 130%));\n"), + "a {\ + \n value: color(xyz 0.1 0.2 1.3);\ + \n space: xyz;\ + \n channels: 0.1 0.2 1.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz 0.1 0.2 -30%));\n"), + "a {\ + \n value: color(xyz 0.1 0.2 -0.3);\ + \n space: xyz;\ + \n channels: 0.1 0.2 -0.3 / 1;\ + \n}\n" + ); + } + } +} +mod unitless { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz 0.1 0.2 0.3));\n"), + "a {\ + \n value: color(xyz 0.1 0.2 0.3);\ + \n space: xyz;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + mod x { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz 1.1 0.2 0.3));\n"), + "a {\ + \n value: color(xyz 1.1 0.2 0.3);\ + \n space: xyz;\ + \n channels: 1.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz -0.1 0.2 0.3));\n"), + "a {\ + \n value: color(xyz -0.1 0.2 0.3);\ + \n space: xyz;\ + \n channels: -0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + } + mod y { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz 0.1 1.2 0.3));\n"), + "a {\ + \n value: color(xyz 0.1 1.2 0.3);\ + \n space: xyz;\ + \n channels: 0.1 1.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz 0.1 -0.2 0.3));\n"), + "a {\ + \n value: color(xyz 0.1 -0.2 0.3);\ + \n space: xyz;\ + \n channels: 0.1 -0.2 0.3 / 1;\ + \n}\n" + ); + } + } + mod z { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz 0.1 0.2 1.3));\n"), + "a {\ + \n value: color(xyz 0.1 0.2 1.3);\ + \n space: xyz;\ + \n channels: 0.1 0.2 1.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz 0.1 0.2 -0.3));\n"), + "a {\ + \n value: color(xyz 0.1 0.2 -0.3);\ + \n space: xyz;\ + \n channels: 0.1 0.2 -0.3 / 1;\ + \n}\n" + ); + } + } +} +#[test] +#[ignore] // unexepected error +fn xyz_d65() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz-d65 0.1 0.2 0.3));\n"), + "a {\ + \n value: color(xyz 0.1 0.2 0.3);\ + \n space: xyz;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/color/spaces/xyz_d50.rs b/rsass/tests/spec/core_functions/color/color/spaces/xyz_d50.rs new file mode 100644 index 000000000..c9a034a6e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/color/spaces/xyz_d50.rs @@ -0,0 +1,229 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/color/spaces/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod percent { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz-d50 10% 20% 30%));\n"), + "a {\ + \n value: color(xyz-d50 0.1 0.2 0.3);\ + \n space: xyz-d50;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + mod x { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz-d50 110% 0.2 0.3));\n"), + "a {\ + \n value: color(xyz-d50 1.1 0.2 0.3);\ + \n space: xyz-d50;\ + \n channels: 1.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz-d50 -10% 0.2 0.3));\n"), + "a {\ + \n value: color(xyz-d50 -0.1 0.2 0.3);\ + \n space: xyz-d50;\ + \n channels: -0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + } + mod y { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz-d50 0.1 120% 0.3));\n"), + "a {\ + \n value: color(xyz-d50 0.1 1.2 0.3);\ + \n space: xyz-d50;\ + \n channels: 0.1 1.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz-d50 0.1 -20% 0.3));\n"), + "a {\ + \n value: color(xyz-d50 0.1 -0.2 0.3);\ + \n space: xyz-d50;\ + \n channels: 0.1 -0.2 0.3 / 1;\ + \n}\n" + ); + } + } + mod z { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz-d50 0.1 0.2 130%));\n"), + "a {\ + \n value: color(xyz-d50 0.1 0.2 1.3);\ + \n space: xyz-d50;\ + \n channels: 0.1 0.2 1.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz-d50 0.1 0.2 -30%));\n"), + "a {\ + \n value: color(xyz-d50 0.1 0.2 -0.3);\ + \n space: xyz-d50;\ + \n channels: 0.1 0.2 -0.3 / 1;\ + \n}\n" + ); + } + } +} +mod unitless { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz-d50 0.1 0.2 0.3));\n"), + "a {\ + \n value: color(xyz-d50 0.1 0.2 0.3);\ + \n space: xyz-d50;\ + \n channels: 0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + mod x { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz-d50 1.1 0.2 0.3));\n"), + "a {\ + \n value: color(xyz-d50 1.1 0.2 0.3);\ + \n space: xyz-d50;\ + \n channels: 1.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz-d50 -0.1 0.2 0.3));\n"), + "a {\ + \n value: color(xyz-d50 -0.1 0.2 0.3);\ + \n space: xyz-d50;\ + \n channels: -0.1 0.2 0.3 / 1;\ + \n}\n" + ); + } + } + mod y { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz-d50 0.1 1.2 0.3));\n"), + "a {\ + \n value: color(xyz-d50 0.1 1.2 0.3);\ + \n space: xyz-d50;\ + \n channels: 0.1 1.2 0.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz-d50 0.1 -0.2 0.3));\n"), + "a {\ + \n value: color(xyz-d50 0.1 -0.2 0.3);\ + \n space: xyz-d50;\ + \n channels: 0.1 -0.2 0.3 / 1;\ + \n}\n" + ); + } + } + mod z { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz-d50 0.1 0.2 1.3));\n"), + "a {\ + \n value: color(xyz-d50 0.1 0.2 1.3);\ + \n space: xyz-d50;\ + \n channels: 0.1 0.2 1.3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(xyz-d50 0.1 0.2 -0.3));\n"), + "a {\ + \n value: color(xyz-d50 0.1 0.2 -0.3);\ + \n space: xyz-d50;\ + \n channels: 0.1 0.2 -0.3 / 1;\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/core_functions/color/color/special_functions.rs b/rsass/tests/spec/core_functions/color/color/special_functions.rs new file mode 100644 index 000000000..1fa5fc511 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/color/special_functions.rs @@ -0,0 +1,184 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/color/special_functions.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("special_functions") +} + +mod calculation { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb calc(1px + 1%) 0.2 0.3));\n" + ), + "a {\ + \n value: color(srgb calc(1px + 1%) 0.2 0.3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 calc(1px + 1%) 0.3));\n" + ), + "a {\ + \n value: color(srgb 0.1 calc(1px + 1%) 0.3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 0.2 calc(1px + 1%)));\n" + ), + "a {\ + \n value: color(srgb 0.1 0.2 calc(1px + 1%));\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_4() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 0.2 0.3 / calc(1px + 1%)));\n" + ), + "a {\ + \n value: color(srgb 0.1 0.2 0.3/calc(1px + 1%));\ + \n type: string;\ + \n}\n" + ); + } +} +mod multi_argument_var { + #[allow(unused)] + use super::runner; + + mod t1_of_1 { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn alpha() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb var(--foo) / 0.4));\n"), + "a {\ + \n value: color(srgb var(--foo)/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn no_alpha() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb var(--foo)));\n"), + "a {\ + \n value: color(srgb var(--foo));\ + \n type: string;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn t1_of_2() { + assert_eq!( + runner().ok( + "// var() is substituted before parsing, so it may contain multiple arguments.\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb var(--foo) 0.3));\n" + ), + "a {\ + \n value: color(srgb var(--foo) 0.3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn t2_of_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 var(--foo)));\n"), + "a {\ + \n value: color(srgb 0.1 var(--foo));\ + \n type: string;\ + \n}\n" + ); + } +} +mod var { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb var(--foo) 0.2 0.3));\n"), + "a {\ + \n value: color(srgb var(--foo) 0.2 0.3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 var(--foo) 0.3));\n"), + "a {\ + \n value: color(srgb 0.1 var(--foo) 0.3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 0.2 var(--foo)));\n"), + "a {\ + \n value: color(srgb 0.1 0.2 var(--foo));\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_4() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color(srgb 0.1 0.2 0.3 / var(--foo)));\n" + ), + "a {\ + \n value: color(srgb 0.1 0.2 0.3/var(--foo));\ + \n type: string;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/complement.rs b/rsass/tests/spec/core_functions/color/complement.rs index c3fe55d99..9822797cf 100644 --- a/rsass/tests/spec/core_functions/color/complement.rs +++ b/rsass/tests/spec/core_functions/color/complement.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn alpha() { assert_eq!( - runner().ok("a {b: complement(rgba(turquoise, 0.7))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(rgba(turquoise, 0.7))}\n"), "a {\ \n b: rgba(224, 64, 80, 0.7);\ \n}\n" @@ -18,51 +19,279 @@ mod error { #[allow(unused)] use super::runner; + mod null_space { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn non_legacy() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.complement(oklch(0.63 0.26 29.2))}\n" + ), + "Error: $space: null is not a string.\ + \n ,\ + \n2 | a {b: color.complement(oklch(0.63 0.26 29.2))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + mod space { + #[allow(unused)] + use super::runner; + + mod missing { + #[allow(unused)] + use super::runner; + + mod legacy { + #[allow(unused)] + use super::runner; + + mod analogous { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn hue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.complement(hsl(none 30% 40%), $space: lch)}\n" + ), + "Error: $hue: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: lch(38.0910184332% 29.3078189694 none)).\ + \n ,\ + \n2 | a {b: color.complement(hsl(none 30% 40%), $space: lch)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn lightness() { + assert_eq!( + runner().err( + "// This is an error specifically because hsl(0deg 50% none) converts through\ + \n// rgb(0 0 0) to lch(none 0 none), so adjusting the hue fails.\ + \n@use \"sass:color\";\ + \na {b: color.complement(hsl(0deg 50% none), $space: lch)}\n" + ), + "Error: $hue: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: lch(none 0 none)).\ + \n ,\ + \n4 | a {b: color.complement(hsl(0deg 50% none), $space: lch)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 4:7 root stylesheet", + ); + } + } + mod same { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn explicit() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.complement(hsl(none 30% 40%), $space: hsl)}\n" + ), + "Error: $hue: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: hsl(none 30% 40%)).\ + \n ,\ + \n2 | a {b: color.complement(hsl(none 30% 40%), $space: hsl)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn implicit() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.complement(hsl(none 30% 40%))}\n" + ), + "Error: $hue: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: hsl(none 30% 40%)).\ + \n ,\ + \n2 | a {b: color.complement(hsl(none 30% 40%))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + } + mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn analogous() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.complement(lch(40% 30% none), $space: lch)}\n" + ), + "Error: $hue: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: lch(40% 45 none)).\ + \n ,\ + \n2 | a {b: color.complement(lch(40% 30% none), $space: lch)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn same() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.complement(lch(40% 30% none), $space: hsl)}\n" + ), + "Error: $hue: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: hsl(none 46.6772108151% 42.1546574074%)).\ + \n ,\ + \n2 | a {b: color.complement(lch(40% 30% none), $space: hsl)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + } + #[test] + #[ignore] // wrong error + fn non_polar_angle() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.complement(red, xyz)}\n" + ), + "Error: $space: Color space xyz doesn\'t have a hue channel.\ + \n ,\ + \n2 | a {b: color.complement(red, xyz)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + mod powerless { + #[allow(unused)] + use super::runner; + + mod legacy { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn explicit() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.complement(grey, $space: hsl)}\n" + ), + "Error: $hue: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: hsl(none 0% 50.1960784314%)).\ + \n ,\ + \n2 | a {b: color.complement(grey, $space: hsl)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // wrong error + fn modern() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.complement(lab(50% 0 0), $space: lch)}\n" + ), + "Error: $hue: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: lch(50% 0 none)).\ + \n ,\ + \n2 | a {b: color.complement(lab(50% 0 0), $space: lch)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + } #[test] + #[ignore] // wrong error fn too_few_args() { assert_eq!( - runner().err("a {b: complement()}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.complement()}\n" + ), "Error: Missing argument $color.\ \n ,--> input.scss\ - \n1 | a {b: complement()}\ - \n | ^^^^^^^^^^^^ invocation\ + \n2 | a {b: color.complement()}\ + \n | ^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ - \n1 | @function complement($color) {\ - \n | ================== declaration\ + \n1 | @function complement($color, $space: null) {\ + \n | ================================ declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] + #[ignore] // wrong error fn too_many_args() { assert_eq!( - runner().err("a {b: complement(red, 1)}\n"), - "Error: Only 1 argument allowed, but 2 were passed.\ + runner().err( + "@use \"sass:color\";\ + \na {b: color.complement(red, lch, 1)}\n" + ), + "Error: Only 2 arguments allowed, but 3 were passed.\ \n ,--> input.scss\ - \n1 | a {b: complement(red, 1)}\ - \n | ^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: color.complement(red, lch, 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ - \n1 | @function complement($color) {\ - \n | ================== declaration\ + \n1 | @function complement($color, $space: null) {\ + \n | ================================ declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: complement(1)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.complement(1)}\n" + ), "Error: $color: 1 is not a color.\ \n ,\ - \n1 | a {b: complement(1)}\ - \n | ^^^^^^^^^^^^^\ + \n2 | a {b: color.complement(1)}\ + \n | ^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } +#[test] +#[ignore] // unexepected error +fn explicit_space() { + assert_eq!( + runner().ok("a {b: complement(red, hwb)}\n"), + "a {\ + \n b: aqua;\ + \n}\n" + ); +} mod grayscale { #[allow(unused)] use super::runner; @@ -70,7 +299,8 @@ mod grayscale { #[test] fn black() { assert_eq!( - runner().ok("a {b: complement(black)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(black)}\n"), "a {\ \n b: black;\ \n}\n" @@ -79,7 +309,8 @@ mod grayscale { #[test] fn gray() { assert_eq!( - runner().ok("a {b: complement(gray)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(gray)}\n"), "a {\ \n b: gray;\ \n}\n" @@ -88,7 +319,8 @@ mod grayscale { #[test] fn white() { assert_eq!( - runner().ok("a {b: complement(white)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(white)}\n"), "a {\ \n b: white;\ \n}\n" @@ -96,9 +328,11 @@ mod grayscale { } } #[test] +#[ignore] // unexepected error fn named() { assert_eq!( - runner().ok("a {b: complement($color: red)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.complement($color: red, $space: hwb)}\n"), "a {\ \n b: aqua;\ \n}\n" @@ -107,16 +341,201 @@ fn named() { #[test] fn red() { assert_eq!( - runner().ok("a {b: complement(red)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(red)}\n"), "a {\ \n b: aqua;\ \n}\n" ); } +mod space { + #[allow(unused)] + use super::runner; + + mod legacy { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn to_legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(red, $space: hwb)}\n"), + "a {\ + \n b: aqua;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_modern() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(red, $space: oklch)}\n"), + "a {\ + \n b: hsl(188.1998868883, 488.1808399597%, 14.588696385%);\ + \n}\n" + ); + } + } + mod missing { + #[allow(unused)] + use super::runner; + + mod legacy { + #[allow(unused)] + use super::runner; + + mod different { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn explicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(hwb(0deg 50% none), $space: hsl)}\n"), + "a {\ + \n b: hsl(180, 100%, 75%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn implicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(hwb(0deg 50% none))}\n"), + "a {\ + \n b: hsl(180, 100%, 75%);\ + \n}\n" + ); + } + } + mod same { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn explicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(hsl(0deg 50% none), $space: hsl)}\n"), + "a {\ + \n b: hsl(180deg 50% none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn implicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(hsl(0deg 50% none))}\n"), + "a {\ + \n b: hsl(180deg 50% none);\ + \n}\n" + ); + } + } + } + mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn analogous() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(lch(none 50% 0deg), $space: oklch)}\n"), + "a {\ + \n b: lch(none 24.5072211405 180.9107983689deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn different() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.complement(color(srgb none 100 200), $space: oklch)}\n" + ), + "a {\ + \n b: color(srgb 156.4212689375 85.1578644836 -71.2263945029);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn same() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(lch(none 50% 0deg), $space: hsl)}\n"), + "a {\ + \n b: lch(none 0 none);\ + \n}\n" + ); + } + } + } + mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn to_legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(lab(50% 10 -20), $space: hsl)}\n"), + "a {\ + \n b: lab(61.7521821385% -8.5219772697 19.4842183485);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_modern() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(lab(50% 10 -20), $space: oklch)}\n"), + "a {\ + \n b: lab(51.2269614349% -7.7080887555 21.8652618775);\ + \n}\n" + ); + } + } + mod powerless { + #[allow(unused)] + use super::runner; + + mod legacy { + #[allow(unused)] + use super::runner; + + #[test] + fn implicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(hsl(0deg 0% 50%))}\n"), + "a {\ + \n b: hsl(180, 0%, 50%);\ + \n}\n" + ); + } + } + } +} #[test] fn turquoise() { assert_eq!( - runner().ok("a {b: complement(turquoise)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(turquoise)}\n"), "a {\ \n b: #e04050;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/color/darken.rs b/rsass/tests/spec/core_functions/color/darken.rs index fd5d32690..cf1d35433 100644 --- a/rsass/tests/spec/core_functions/color/darken.rs +++ b/rsass/tests/spec/core_functions/color/darken.rs @@ -48,6 +48,21 @@ mod error { } } #[test] + #[ignore] // wrong error + fn non_legacy() { + assert_eq!( + runner().err( + "a {b: darken(color(srgb 1 1 1), 10%)}\n" + ), + "Error: darken() is only supported for legacy colors. Please use color.adjust() instead with an explicit $space argument.\ + \n ,\ + \n1 | a {b: darken(color(srgb 1 1 1), 10%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] fn too_few_args() { assert_eq!( runner().err("a {b: darken(red)}\n"), @@ -110,11 +125,12 @@ mod error { } } #[test] +#[ignore] // wrong result fn fraction() { assert_eq!( runner().ok("a {b: darken(red, 0.5%)}\n"), "a {\ - \n b: #fc0000;\ + \n b: rgb(252.45, 0, 0);\ \n}\n" ); } @@ -137,11 +153,12 @@ fn max_remaining() { ); } #[test] +#[ignore] // wrong result fn middle() { assert_eq!( runner().ok("a {b: darken(red, 14%)}\n"), "a {\ - \n b: #b80000;\ + \n b: rgb(183.6, 0, 0);\ \n}\n" ); } @@ -155,11 +172,12 @@ fn min() { ); } #[test] +#[ignore] // wrong result fn named() { assert_eq!( runner().ok("a {b: darken($color: red, $amount: 14%)}\n"), "a {\ - \n b: #b80000;\ + \n b: rgb(183.6, 0, 0);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/desaturate.rs b/rsass/tests/spec/core_functions/color/desaturate.rs index 56f99379e..e3b338f6f 100644 --- a/rsass/tests/spec/core_functions/color/desaturate.rs +++ b/rsass/tests/spec/core_functions/color/desaturate.rs @@ -6,11 +6,12 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn alpha() { assert_eq!( runner().ok("a {b: desaturate(rgba(plum, 0.3), 100%)}\n"), "a {\ - \n b: rgba(191, 191, 191, 0.3);\ + \n b: rgba(190.5, 190.5, 190.5, 0.3);\ \n}\n" ); } @@ -47,6 +48,21 @@ mod error { ); } } + #[test] + #[ignore] // wrong error + fn non_legacy() { + assert_eq!( + runner().err( + "a {b: desaturate(color(srgb 1 1 1), 10%)}\n" + ), + "Error: desaturate() is only supported for legacy colors. Please use color.adjust() instead with an explicit $space argument.\ + \n ,\ + \n1 | a {b: desaturate(color(srgb 1 1 1), 10%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } mod one_arg { #[allow(unused)] use super::runner; @@ -131,29 +147,32 @@ mod error { } } #[test] +#[ignore] // wrong result fn max() { assert_eq!( runner().ok("a {b: desaturate(plum, 100%)}\n"), "a {\ - \n b: #bfbfbf;\ + \n b: rgb(190.5, 190.5, 190.5);\ \n}\n" ); } #[test] +#[ignore] // wrong result fn max_remaining() { assert_eq!( runner().ok("a {b: desaturate(plum, 48%)}\n"), "a {\ - \n b: #bfbfbf;\ + \n b: rgb(190.5, 190.5, 190.5);\ \n}\n" ); } #[test] +#[ignore] // wrong result fn middle() { assert_eq!( runner().ok("a {b: desaturate(plum, 14%)}\n"), "a {\ - \n b: #d4a9d4;\ + \n b: rgb(211.97, 169.03, 211.97);\ \n}\n" ); } @@ -167,11 +186,12 @@ fn min() { ); } #[test] +#[ignore] // wrong result fn named() { assert_eq!( runner().ok("a {b: desaturate($color: plum, $amount: 14%)}\n"), "a {\ - \n b: #d4a9d4;\ + \n b: rgb(211.97, 169.03, 211.97);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/fade_in.rs b/rsass/tests/spec/core_functions/color/fade_in.rs index 2ec0c460e..95d97aa6d 100644 --- a/rsass/tests/spec/core_functions/color/fade_in.rs +++ b/rsass/tests/spec/core_functions/color/fade_in.rs @@ -55,6 +55,21 @@ mod error { } } #[test] + #[ignore] // wrong error + fn non_legacy() { + assert_eq!( + runner().err( + "a {b: fade-in(color(srgb 1 1 1 / 0.1), 0.1)}\n" + ), + "Error: fade-in() is only supported for legacy colors. Please use color.adjust() instead with an explicit $space argument.\ + \n ,\ + \n1 | a {b: fade-in(color(srgb 1 1 1 / 0.1), 0.1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] fn too_few_args() { assert_eq!( runner().err("a {b: fade-in(red)}\n"), diff --git a/rsass/tests/spec/core_functions/color/fade_out.rs b/rsass/tests/spec/core_functions/color/fade_out.rs index c843f6f27..b05bebe72 100644 --- a/rsass/tests/spec/core_functions/color/fade_out.rs +++ b/rsass/tests/spec/core_functions/color/fade_out.rs @@ -55,6 +55,21 @@ mod error { } } #[test] + #[ignore] // wrong error + fn non_legacy() { + assert_eq!( + runner().err( + "a {b: fade-out(color(srgb 1 1 1), 0.1)}\n" + ), + "Error: fade-out() is only supported for legacy colors. Please use color.adjust() instead with an explicit $space argument.\ + \n ,\ + \n1 | a {b: fade-out(color(srgb 1 1 1), 0.1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] fn too_few_args() { assert_eq!( runner().err("a {b: fade-out(red)}\n"), diff --git a/rsass/tests/spec/core_functions/color/grayscale.rs b/rsass/tests/spec/core_functions/color/grayscale.rs index b6d290424..ee83597a1 100644 --- a/rsass/tests/spec/core_functions/color/grayscale.rs +++ b/rsass/tests/spec/core_functions/color/grayscale.rs @@ -5,15 +5,6 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("grayscale") } -#[test] -fn alpha() { - assert_eq!( - runner().ok("a {b: grayscale(rgba(#633736, 0.3))}\n"), - "a {\ - \n b: rgba(77, 77, 77, 0.3);\ - \n}\n" - ); -} mod error { #[allow(unused)] use super::runner; @@ -21,45 +12,54 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: grayscale()}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.grayscale()}\n" + ), "Error: Missing argument $color.\ \n ,--> input.scss\ - \n1 | a {b: grayscale()}\ - \n | ^^^^^^^^^^^ invocation\ + \n2 | a {b: color.grayscale()}\ + \n | ^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ \n1 | @function grayscale($color) {\ \n | ================= declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: grayscale(red, 1)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.grayscale(red, 1)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: grayscale(red, 1)}\ - \n | ^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: color.grayscale(red, 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ \n1 | @function grayscale($color) {\ \n | ================= declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: grayscale(c)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.grayscale(c)}\n" + ), "Error: $color: c is not a color.\ \n ,\ - \n1 | a {b: grayscale(c)}\ - \n | ^^^^^^^^^^^^\ + \n2 | a {b: color.grayscale(c)}\ + \n | ^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod with_module { @@ -70,7 +70,7 @@ mod error { fn test_type() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.grayscale(var(--c))}\n" ), "Error: $color: var(--c) is not a color.\ @@ -83,101 +83,238 @@ mod error { } } } -#[test] -fn max_saturation() { - assert_eq!( - runner().ok("a {b: grayscale(red)}\n"), +mod global { + #[allow(unused)] + use super::runner; + + #[test] + fn number() { + assert_eq!( + runner().ok( + "// A number should produce a plain function string, for CSS filter functions.\ + \na {b: grayscale(15%)}\n" + ), "a {\ - \n b: gray;\ + \n b: grayscale(15%);\ \n}\n" ); -} -#[test] -fn mid_saturation() { - assert_eq!( - runner().ok("a {b: grayscale(#633736)}\n"), - "a {\ - \n b: #4d4d4d;\ + } + #[test] + fn with_calc() { + assert_eq!( + runner().ok("a {b: grayscale(calc(1 + 2))}\n"), + "a {\ + \n b: grayscale(3);\ \n}\n" - ); + ); + } + #[test] + fn with_css_var() { + assert_eq!( + runner().ok("a {b: grayscale(var(--c))}\n"), + "a {\ + \n b: grayscale(var(--c));\ + \n}\n" + ); + } + #[test] + fn with_unquoted_calc() { + assert_eq!( + runner().ok("a {b: grayscale(unquote(\'calc(1)\'))}\n"), + "a {\ + \n b: grayscale(calc(1));\ + \n}\n" + ); + } } -#[test] -fn named() { - assert_eq!( - runner().ok("a {b: grayscale($color: white)}\n"), - "a {\ +mod legacy { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn alpha() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.grayscale(rgba(#633736, 0.3))}\n"), + "a {\ + \n b: rgba(76.5, 76.5, 76.5, 0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn max_saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.grayscale(red)}\n"), + "a {\ + \n b: rgb(127.5, 127.5, 127.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn mid_saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.grayscale(#633736)}\n"), + "a {\ + \n b: rgb(76.5, 76.5, 76.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn missing() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.grayscale(hsl(none none none))}\n"), + "a {\ + \n b: hsl(none 0% none);\ + \n}\n" + ); + } + mod no_saturation { + #[allow(unused)] + use super::runner; + + #[test] + fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.grayscale(black)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } + #[test] + fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.grayscale(#494949)}\n"), + "a {\ + \n b: #494949;\ + \n}\n" + ); + } + #[test] + fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.grayscale(white)}\n"), + "a {\ \n b: white;\ \n}\n" - ); + ); + } + } + mod powerless { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn different() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.grayscale(hwb(120deg 10% 20%))}\n"), + "a {\ + \n b: hsl(0, 0%, 45%);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn same() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.grayscale(hsl(120deg 10% 20%))}\n"), + "a {\ + \n b: hsl(120, 0%, 20%);\ + \n}\n" + ); + } + } } -mod no_saturation { +mod modern { #[allow(unused)] use super::runner; #[test] - fn black() { + #[ignore] // unexepected error + fn missing() { assert_eq!( - runner().ok("a {b: grayscale(black)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.grayscale(oklch(none none none))}\n"), "a {\ - \n b: black;\ + \n b: oklch(none 0 none);\ \n}\n" ); } #[test] - fn gray() { + #[ignore] // unexepected error + fn polar() { assert_eq!( - runner().ok("a {b: grayscale(#494949)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.grayscale(lch(54.3 107 40.9))}\n"), "a {\ - \n b: #494949;\ + \n b: lch(56.854581217% 0.0000089094 270.4699001175deg);\ \n}\n" ); } #[test] - fn white() { + #[ignore] // unexepected error + fn powerless() { assert_eq!( - runner().ok("a {b: grayscale(white)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.grayscale(oklch(20% 10% 120deg))}\n"), "a {\ - \n b: white;\ + \n b: oklch(20% 0 120deg);\ \n}\n" ); } -} -#[test] -fn number() { - assert_eq!( - runner().ok( - "// A number should produce a plain function string, for CSS filter functions.\ - \na {b: grayscale(15%)}\n" - ), - "a {\ - \n b: grayscale(15%);\ + #[test] + #[ignore] // unexepected error + fn predefined() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.grayscale(color(xyz-d65 0.41 0.21 0.02))}\n"), + "a {\ + \n b: color(xyz 0.232829773 0.2449664044 0.2667826176);\ \n}\n" - ); -} -#[test] -fn with_calc() { - assert_eq!( - runner().ok("a {b: grayscale(calc(1 + 2))}\n"), - "a {\ - \n b: grayscale(3);\ + ); + } + #[test] + #[ignore] // unexepected error + fn rectangular() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.grayscale(lab(50 -30 40))}\n"), + "a {\ + \n b: lab(48.58892555% 0.0000000648 -0.0000078984);\ \n}\n" - ); + ); + } } #[test] -fn with_css_var() { +fn named() { assert_eq!( - runner().ok("a {b: grayscale(var(--c))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.grayscale($color: white)}\n"), "a {\ - \n b: grayscale(var(--c));\ + \n b: white;\ \n}\n" ); } #[test] -fn with_unquoted_calc() { +fn number() { assert_eq!( - runner().ok("a {b: grayscale(unquote(\'calc(1)\'))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.grayscale(1)}\n"), "a {\ - \n b: grayscale(calc(1));\ + \n b: grayscale(1);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/green.rs b/rsass/tests/spec/core_functions/color/green.rs index 867f573c0..dd24f7463 100644 --- a/rsass/tests/spec/core_functions/color/green.rs +++ b/rsass/tests/spec/core_functions/color/green.rs @@ -9,55 +9,81 @@ mod error { #[allow(unused)] use super::runner; + #[test] + #[ignore] // wrong error + fn non_legacy() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.green(color(srgb 1 1 1))}\n" + ), + "Error: color.green() is only supported for legacy colors. Please use color.channel() instead with an explicit $space argument.\ + \n ,\ + \n2 | a {b: color.green(color(srgb 1 1 1))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: green()}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.green()}\n" + ), "Error: Missing argument $color.\ \n ,--> input.scss\ - \n1 | a {b: green()}\ - \n | ^^^^^^^ invocation\ + \n2 | a {b: color.green()}\ + \n | ^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ \n1 | @function green($color) {\ \n | ============= declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: green(red, green)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.green(red, green)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: green(red, green)}\ - \n | ^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: color.green(red, green)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ \n1 | @function green($color) {\ \n | ============= declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: green(1)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.green(1)}\n" + ), "Error: $color: 1 is not a color.\ \n ,\ - \n1 | a {b: green(1)}\ - \n | ^^^^^^^^\ + \n2 | a {b: color.green(1)}\ + \n | ^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn max() { assert_eq!( - runner().ok("a {b: green(rgb(0, 255, 0))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.green(rgb(0, 255, 0))}\n"), "a {\ \n b: 255;\ \n}\n" @@ -66,7 +92,8 @@ fn max() { #[test] fn middle() { assert_eq!( - runner().ok("a {b: green(rgb(0, 123, 0))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.green(rgb(0, 123, 0))}\n"), "a {\ \n b: 123;\ \n}\n" @@ -75,7 +102,8 @@ fn middle() { #[test] fn min() { assert_eq!( - runner().ok("a {b: green(rgb(0, 0, 0))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.green(rgb(0, 0, 0))}\n"), "a {\ \n b: 0;\ \n}\n" @@ -84,7 +112,8 @@ fn min() { #[test] fn named() { assert_eq!( - runner().ok("a {b: green($color: rgb(0, 234, 0))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.green($color: rgb(0, 234, 0))}\n"), "a {\ \n b: 234;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/color/hsl/error/one_arg.rs b/rsass/tests/spec/core_functions/color/hsl/error/one_arg.rs index dccafe804..1d23320f1 100644 --- a/rsass/tests/spec/core_functions/color/hsl/error/one_arg.rs +++ b/rsass/tests/spec/core_functions/color/hsl/error/one_arg.rs @@ -10,38 +10,41 @@ mod list { use super::runner; #[test] + #[ignore] // wrong error fn bracketed() { assert_eq!( - runner().err( - "a {\ + runner().err( + "a {\ \n b: hsl([0 100% 50%]);\ \n}\n" - ), - "Error: $channels must be an unbracketed list.\ + ), + "Error: $channels: Expected an unbracketed list, was [0 100% 50%]\ \n ,\ \n2 | b: hsl([0 100% 50%]);\ \n | ^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:6 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn comma_separated() { assert_eq!( - runner().err( - "a {\ + runner().err( + "a {\ \n b: hsl((0, 100%, 50%));\ \n}\n" - ), - "Error: $channels must be a space-separated list.\ + ), + "Error: $channels: Expected a space- or slash-separated list, was (0, 100%, 50%)\ \n ,\ \n2 | b: hsl((0, 100%, 50%));\ \n | ^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:6 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn empty() { assert_eq!( runner().err( @@ -49,7 +52,7 @@ mod list { \n b: hsl(());\ \n}\n" ), - "Error: Missing element $hue.\ + "Error: $channels: Color component list may not be empty.\ \n ,\ \n2 | b: hsl(());\ \n | ^^^^^^^\ @@ -58,55 +61,59 @@ mod list { ); } #[test] + #[ignore] // wrong error fn four_elements() { assert_eq!( - runner().err( - "a {\ + runner().err( + "a {\ \n b: hsl(0 100% 50% 0.4);\ \n}\n" - ), - "Error: Only 3 elements allowed, but 4 were passed.\ + ), + "Error: $channels: The hsl color space has 3 channels but (0 100% 50% 0.4) has 4.\ \n ,\ \n2 | b: hsl(0 100% 50% 0.4);\ \n | ^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:6 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn one_element() { assert_eq!( - runner().err( - "a {\ + runner().err( + "a {\ \n b: hsl(0);\ \n}\n" - ), - "Error: Missing element $saturation.\ + ), + "Error: $channels: The hsl color space has 3 channels but 0 has 1.\ \n ,\ \n2 | b: hsl(0);\ \n | ^^^^^^\ \n \'\ \n input.scss 2:6 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn two_elements() { assert_eq!( - runner().err( - "a {\ + runner().err( + "a {\ \n b: hsl(0 100%);\ \n}\n" - ), - "Error: Missing element $lightness.\ + ), + "Error: $channels: The hsl color space has 3 channels but (0 100%) has 2.\ \n ,\ \n2 | b: hsl(0 100%);\ \n | ^^^^^^^^^^^\ \n \'\ \n input.scss 2:6 root stylesheet", - ); + ); } } #[test] +#[ignore] // wrong error fn quoted_var_slash() { assert_eq!( runner().err( @@ -114,7 +121,7 @@ fn quoted_var_slash() { \n b: hsl(0 100% \"var(--foo) / 0.4\");\ \n}\n" ), - "Error: $lightness: \"var(--foo) / 0.4\" is not a number.\ + "Error: $channels: Expected lightness channel to be a number, was \"var(--foo) / 0.4\".\ \n ,\ \n2 | b: hsl(0 100% \"var(--foo) / 0.4\");\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ @@ -131,43 +138,46 @@ mod slash_list { use super::runner; #[test] + #[ignore] // wrong error fn bracketed() { assert_eq!( - runner().err( - "@use \"sass:list\";\ + runner().err( + "@use \"sass:list\";\ \na {b: hsl(list.slash([0 100% 50%], 1))}\n" - ), - "Error: $channels must be an unbracketed list.\ + ), + "Error: $channels: Expected an unbracketed list, was [0 100% 50%]\ \n ,\ \n2 | a {b: hsl(list.slash([0 100% 50%], 1))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn comma_separated() { assert_eq!( - runner().err( - "@use \"sass:list\";\ + runner().err( + "@use \"sass:list\";\ \na {b: hsl(list.slash((0, 100%, 50%), 1))}\n" - ), - "Error: $channels must be a space-separated list.\ + ), + "Error: $channels: Expected a space-separated list, was (0, 100%, 50%)\ \n ,\ \n2 | a {b: hsl(list.slash((0, 100%, 50%), 1))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn empty() { assert_eq!( runner().err( "@use \"sass:list\";\ \na {b: hsl(list.slash((), 1))}\n" ), - "Error: Missing element $hue.\ + "Error: $channels: Color component list may not be empty.\ \n ,\ \n2 | a {b: hsl(list.slash((), 1))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^\ @@ -176,73 +186,79 @@ mod slash_list { ); } #[test] + #[ignore] // wrong error fn four_elements() { assert_eq!( - runner().err( - "@use \"sass:list\";\ + runner().err( + "@use \"sass:list\";\ \na {b: hsl(list.slash(0 100% 50% 0.4, 1))}\n" - ), - "Error: Only 3 elements allowed, but 4 were passed.\ + ), + "Error: $channels: The hsl color space has 3 channels but (0 100% 50% 0.4 / 1) has 4.\ \n ,\ \n2 | a {b: hsl(list.slash(0 100% 50% 0.4, 1))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn one_element() { assert_eq!( - runner().err( - "@use \"sass:list\";\ + runner().err( + "@use \"sass:list\";\ \na {b: hsl(list.slash(0, 1))}\n" - ), - "Error: Missing element $saturation.\ + ), + "Error: $channels: The hsl color space has 3 channels but (0 / 1) has 1.\ \n ,\ \n2 | a {b: hsl(list.slash(0, 1))}\ \n | ^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn two_elements() { assert_eq!( - runner().err( - "@use \"sass:list\";\ + runner().err( + "@use \"sass:list\";\ \na {b: hsl(list.slash(0 100%, 1))}\n" - ), - "Error: Missing element $lightness.\ + ), + "Error: $channels: The hsl color space has 3 channels but (0 100% / 1) has 2.\ \n ,\ \n2 | a {b: hsl(list.slash(0 100%, 1))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); + ); } } #[test] + #[ignore] // wrong error fn too_few_elements() { assert_eq!( runner().err( - "a {b: hsl(append((), 0 100% 100%, $separator: slash))}\n" + "@use \"sass:list\";\ + \na {b: hsl(list.append((), 0 100% 100%, $separator: slash))}\n" ), - "Error: Only 2 slash-separated elements allowed, but 1 was passed.\ + "Error: $channels: Only 2 slash-separated elements allowed, but 1 was passed.\ \n ,\ - \n1 | a {b: hsl(append((), 0 100% 100%, $separator: slash))}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: hsl(list.append((), 0 100% 100%, $separator: slash))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] + #[ignore] // wrong error fn too_many_elements() { assert_eq!( runner().err( "@use \"sass:list\";\ \na {b: hsl(list.slash(0 100% 100%, 0.4, 1))}\n" ), - "Error: Only 2 slash-separated elements allowed, but 3 were passed.\ + "Error: $channels: Only 2 slash-separated elements allowed, but 3 were passed.\ \n ,\ \n2 | a {b: hsl(list.slash(0 100% 100%, 0.4, 1))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ @@ -256,51 +272,54 @@ mod test_type { use super::runner; #[test] + #[ignore] // wrong error fn hue() { assert_eq!( - runner().err( - "a {\ + runner().err( + "a {\ \n b: hsl(\"foo\" 100% 50%);\ \n}\n" - ), - "Error: $hue: \"foo\" is not a number.\ + ), + "Error: $channels: Expected hue channel to be a number, was \"foo\".\ \n ,\ \n2 | b: hsl(\"foo\" 100% 50%);\ \n | ^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:6 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn lightness() { assert_eq!( - runner().err( - "a {\ + runner().err( + "a {\ \n b: hsl(0 100% \"foo\");\ \n}\n" - ), - "Error: $lightness: \"foo\" is not a number.\ + ), + "Error: $channels: Expected lightness channel to be a number, was \"foo\".\ \n ,\ \n2 | b: hsl(0 100% \"foo\");\ \n | ^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:6 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn saturation() { assert_eq!( - runner().err( - "a {\ + runner().err( + "a {\ \n b: hsl(0 \"foo\" 50%);\ \n}\n" - ), - "Error: $saturation: \"foo\" is not a number.\ + ), + "Error: $channels: Expected saturation channel to be a number, was \"foo\".\ \n ,\ \n2 | b: hsl(0 \"foo\" 50%);\ \n | ^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:6 root stylesheet", - ); + ); } } diff --git a/rsass/tests/spec/core_functions/color/hsl/four_args/clamped.rs b/rsass/tests/spec/core_functions/color/hsl/four_args/clamped.rs deleted file mode 100644 index b30064c64..000000000 --- a/rsass/tests/spec/core_functions/color/hsl/four_args/clamped.rs +++ /dev/null @@ -1,48 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/hsl/four_args/clamped.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("clamped") -} - -mod alpha { - #[allow(unused)] - use super::runner; - - #[test] - fn above() { - assert_eq!( - runner().ok("a {b: hsl(0, 100%, 50%, 1.1)}\n"), - "a {\ - \n b: hsl(0, 100%, 50%);\ - \n}\n" - ); - } - #[test] - fn below() { - assert_eq!( - runner().ok("a {b: hsla(0, 100%, 50%, -0.1)}\n"), - "a {\ - \n b: hsla(0, 100%, 50%, 0);\ - \n}\n" - ); - } -} -#[test] -fn blue() { - assert_eq!( - runner().ok("a {b: hsl(0, 100%, 9999%, 0.5)}\n"), - "a {\ - \n b: hsla(0, 100%, 100%, 0.5);\ - \n}\n" - ); -} -#[test] -fn saturation() { - assert_eq!( - runner().ok("a {b: hsl(0, -0.1%, 50%, 0.5)}\n"), - "a {\ - \n b: hsla(0, 0%, 50%, 0.5);\ - \n}\n" - ); -} diff --git a/rsass/tests/spec/core_functions/color/hsl/four_args/mod.rs b/rsass/tests/spec/core_functions/color/hsl/four_args/mod.rs index 539d98bd2..e4c20acb3 100644 --- a/rsass/tests/spec/core_functions/color/hsl/four_args/mod.rs +++ b/rsass/tests/spec/core_functions/color/hsl/four_args/mod.rs @@ -7,8 +7,8 @@ fn runner() -> crate::TestRunner { mod alpha; -mod clamped; - mod in_gamut; +mod out_of_gamut; + mod special_functions; diff --git a/rsass/tests/spec/core_functions/color/hsl/four_args/out_of_gamut.rs b/rsass/tests/spec/core_functions/color/hsl/four_args/out_of_gamut.rs new file mode 100644 index 000000000..6bfd8cc6b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/hsl/four_args/out_of_gamut.rs @@ -0,0 +1,209 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/hsl/four_args/out_of_gamut.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("out_of_gamut") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("a {b: hsl(0, 100%, 50%, calc(NaN))}\n"), + "a {\ + \n b: hsla(0, 100%, 50%, 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("a {b: hsl(0, 100%, 50%, calc(-infinity))}\n"), + "a {\ + \n b: hsla(0, 100%, 50%, 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("a {b: hsl(0, 100%, 50%, calc(infinity))}\n"), + "a {\ + \n b: hsl(0, 100%, 50%);\ + \n}\n" + ); + } + } + mod finite { + #[allow(unused)] + use super::runner; + + #[test] + fn above() { + assert_eq!( + runner().ok("a {b: hsl(0, 100%, 50%, 1.1)}\n"), + "a {\ + \n b: hsl(0, 100%, 50%);\ + \n}\n" + ); + } + #[test] + fn below() { + assert_eq!( + runner().ok("a {b: hsla(0, 100%, 50%, -0.1)}\n"), + "a {\ + \n b: hsla(0, 100%, 50%, 0);\ + \n}\n" + ); + } + } +} +mod hue { + #[allow(unused)] + use super::runner; + + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("a {b: hsl(calc(NaN), 100%, 50%)}\n"), + "a {\ + \n b: hsl(calc(NaN), 100%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("a {b: hsl(calc(-infinity), 100%, 50%)}\n"), + "a {\ + \n b: hsl(calc(NaN), 100%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("a {b: hsl(calc(infinity), 100%, 50%)}\n"), + "a {\ + \n b: hsl(calc(NaN), 100%, 50%);\ + \n}\n" + ); + } + } +} +mod lightness { + #[allow(unused)] + use super::runner; + + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("a {b: hsl(0, 100%, calc(NaN))}\n"), + "a {\ + \n b: hsl(0, 100%, calc(NaN * 1%));\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("a {b: hsl(0, 100%, calc(-infinity))}\n"), + "a {\ + \n b: hsl(0, 100%, calc(-infinity * 1%));\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("a {b: hsl(0, 100%, calc(infinity))}\n"), + "a {\ + \n b: hsl(0, 100%, calc(infinity * 1%));\ + \n}\n" + ); + } + } + #[test] + #[ignore] // wrong result + fn finite() { + assert_eq!( + runner().ok("a {b: hsl(0, 100%, 9999%, 0.5)}\n"), + "a {\ + \n b: hsla(0, 100%, 9999%, 0.5);\ + \n}\n" + ); + } +} +mod saturation { + #[allow(unused)] + use super::runner; + + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("a {b: hsl(0, calc(NaN), 50%)}\n"), + "a {\ + \n b: hsl(0, 0%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("a {b: hsl(0, calc(-infinity), 50%)}\n"), + "a {\ + \n b: hsl(0, 0%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("a {b: hsl(0, calc(infinity), 50%)}\n"), + "a {\ + \n b: hsl(0, calc(infinity * 1%), 50%);\ + \n}\n" + ); + } + } + #[test] + fn finite() { + assert_eq!( + runner().ok("a {b: hsl(0, -0.1%, 50%, 0.5)}\n"), + "a {\ + \n b: hsla(0, 0%, 50%, 0.5);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/hsl/four_args/special_functions.rs b/rsass/tests/spec/core_functions/color/hsl/four_args/special_functions.rs index 99c672617..8d8140374 100644 --- a/rsass/tests/spec/core_functions/color/hsl/four_args/special_functions.rs +++ b/rsass/tests/spec/core_functions/color/hsl/four_args/special_functions.rs @@ -57,8 +57,8 @@ mod calc { #[test] fn arg_1() { assert_eq!( - runner() - .ok("a {b: hsl(unquote(\"calc(1)\"), 2%, 3%, 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(string.unquote(\"calc(1)\"), 2%, 3%, 0.4)}\n"), "a {\ \n b: hsl(calc(1), 2%, 3%, 0.4);\ \n}\n" @@ -67,8 +67,8 @@ mod calc { #[test] fn arg_2() { assert_eq!( - runner() - .ok("a {b: hsl(1, unquote(\"calc(2%)\"), 3%, 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1, string.unquote(\"calc(2%)\"), 3%, 0.4)}\n"), "a {\ \n b: hsl(1, calc(2%), 3%, 0.4);\ \n}\n" @@ -77,8 +77,8 @@ mod calc { #[test] fn arg_3() { assert_eq!( - runner() - .ok("a {b: hsl(1, 2%, unquote(\"calc(3%)\"), 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1, 2%, string.unquote(\"calc(3%)\"), 0.4)}\n"), "a {\ \n b: hsl(1, 2%, calc(3%), 0.4);\ \n}\n" @@ -87,8 +87,8 @@ mod calc { #[test] fn arg_4() { assert_eq!( - runner() - .ok("a {b: hsl(1, 2%, 3%, unquote(\"calc(0.4)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1, 2%, 3%, string.unquote(\"calc(0.4)\"))}\n"), "a {\ \n b: hsl(1, 2%, 3%, calc(0.4));\ \n}\n" @@ -108,7 +108,8 @@ mod clamp { fn arg_1() { assert_eq!( runner().ok( - "a {b: hsl(unquote(\"clamp(1, 2, 3)\"), 2%, 3%, 0.4)}\n" + "@use \"sass:string\";\ + \na {b: hsl(string.unquote(\"clamp(1, 2, 3)\"), 2%, 3%, 0.4)}\n" ), "a {\ \n b: hsl(clamp(1, 2, 3), 2%, 3%, 0.4);\ @@ -119,7 +120,8 @@ mod clamp { fn arg_2() { assert_eq!( runner().ok( - "a {b: hsl(1, unquote(\"clamp(2%, 3%, 4%)\"), 3%, 0.4)}\n" + "@use \"sass:string\";\ + \na {b: hsl(1, string.unquote(\"clamp(2%, 3%, 4%)\"), 3%, 0.4)}\n" ), "a {\ \n b: hsl(1, clamp(2%, 3%, 4%), 3%, 0.4);\ @@ -130,7 +132,8 @@ mod clamp { fn arg_3() { assert_eq!( runner().ok( - "a {b: hsl(1, 2%, unquote(\"clamp(3%, 4%, 5%)\"), 0.4)}\n" + "@use \"sass:string\";\ + \na {b: hsl(1, 2%, string.unquote(\"clamp(3%, 4%, 5%)\"), 0.4)}\n" ), "a {\ \n b: hsl(1, 2%, clamp(3%, 4%, 5%), 0.4);\ @@ -141,7 +144,8 @@ mod clamp { fn arg_4() { assert_eq!( runner().ok( - "a {b: hsl(1, 2%, 3%, unquote(\"clamp(0.4, 0.5, 0.6)\"))}\n" + "@use \"sass:string\";\ + \na {b: hsl(1, 2%, 3%, string.unquote(\"clamp(0.4, 0.5, 0.6)\"))}\n" ), "a {\ \n b: hsl(1, 2%, 3%, clamp(0.4, 0.5, 0.6));\ @@ -202,7 +206,8 @@ mod max { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: hsl(unquote(\"max(1)\"), 2%, 3%, 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(string.unquote(\"max(1)\"), 2%, 3%, 0.4)}\n"), "a {\ \n b: hsl(max(1), 2%, 3%, 0.4);\ \n}\n" @@ -211,7 +216,8 @@ mod max { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: hsl(1, unquote(\"max(2%)\"), 3%, 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1, string.unquote(\"max(2%)\"), 3%, 0.4)}\n"), "a {\ \n b: hsl(1, max(2%), 3%, 0.4);\ \n}\n" @@ -220,7 +226,8 @@ mod max { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: hsl(1, 2%, unquote(\"max(3%)\"), 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1, 2%, string.unquote(\"max(3%)\"), 0.4)}\n"), "a {\ \n b: hsl(1, 2%, max(3%), 0.4);\ \n}\n" @@ -229,7 +236,8 @@ mod max { #[test] fn arg_4() { assert_eq!( - runner().ok("a {b: hsl(1, 2%, 3%, unquote(\"max(0.4)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1, 2%, 3%, string.unquote(\"max(0.4)\"))}\n"), "a {\ \n b: hsl(1, 2%, 3%, max(0.4));\ \n}\n" @@ -248,7 +256,8 @@ mod min { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: hsl(unquote(\"min(1)\"), 2%, 3%, 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(string.unquote(\"min(1)\"), 2%, 3%, 0.4)}\n"), "a {\ \n b: hsl(min(1), 2%, 3%, 0.4);\ \n}\n" @@ -257,7 +266,8 @@ mod min { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: hsl(1, unquote(\"min(2%)\"), 3%, 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1, string.unquote(\"min(2%)\"), 3%, 0.4)}\n"), "a {\ \n b: hsl(1, min(2%), 3%, 0.4);\ \n}\n" @@ -266,7 +276,8 @@ mod min { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: hsl(1, 2%, unquote(\"min(3%)\"), 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1, 2%, string.unquote(\"min(3%)\"), 0.4)}\n"), "a {\ \n b: hsl(1, 2%, min(3%), 0.4);\ \n}\n" @@ -275,7 +286,8 @@ mod min { #[test] fn arg_4() { assert_eq!( - runner().ok("a {b: hsl(1, 2%, 3%, unquote(\"min(0.4)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1, 2%, 3%, string.unquote(\"min(0.4)\"))}\n"), "a {\ \n b: hsl(1, 2%, 3%, min(0.4));\ \n}\n" diff --git a/rsass/tests/spec/core_functions/color/hsl/one_arg/alpha.rs b/rsass/tests/spec/core_functions/color/hsl/one_arg/alpha.rs index 01516b4d2..6827e8d7a 100644 --- a/rsass/tests/spec/core_functions/color/hsl/one_arg/alpha.rs +++ b/rsass/tests/spec/core_functions/color/hsl/one_arg/alpha.rs @@ -33,11 +33,12 @@ mod clamped { } } #[test] + #[ignore] // wrong result fn lightness() { assert_eq!( runner().ok("a {b: hsl(0 100% 9999% / 0.5)}\n"), "a {\ - \n b: hsla(0, 100%, 100%, 0.5);\ + \n b: hsla(0, 100%, 9999%, 0.5);\ \n}\n" ); } @@ -104,6 +105,32 @@ mod in_gamut { ); } } +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn slash() { + assert_eq!( + runner().ok("a {b: hsl(180 60% 50% / none)}\n"), + "a {\ + \n b: hsl(180deg 60% 50% / none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn slash_list() { + assert_eq!( + runner().ok("@use \'sass:list\';\ + \na {b: hsl(list.slash(180 60% 50%, none))}\n"), + "a {\ + \n b: hsl(180deg 60% 50% / none);\ + \n}\n" + ); + } +} #[test] fn slash_list() { assert_eq!( diff --git a/rsass/tests/spec/core_functions/color/hsl/one_arg/no_alpha.rs b/rsass/tests/spec/core_functions/color/hsl/one_arg/no_alpha.rs index e7f49d32c..a0d16edd9 100644 --- a/rsass/tests/spec/core_functions/color/hsl/one_arg/no_alpha.rs +++ b/rsass/tests/spec/core_functions/color/hsl/one_arg/no_alpha.rs @@ -14,20 +14,22 @@ mod clamped { use super::runner; #[test] + #[ignore] // wrong result fn above() { assert_eq!( runner().ok("a {b: hsl(0 100% 500%)}\n"), "a {\ - \n b: hsl(0, 100%, 100%);\ + \n b: hsl(0, 100%, 500%);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn below() { assert_eq!( runner().ok("a {b: hsl(0 100% -100%)}\n"), "a {\ - \n b: hsl(0, 100%, 0%);\ + \n b: hsl(0, 100%, -100%);\ \n}\n" ); } @@ -36,15 +38,6 @@ mod clamped { #[allow(unused)] use super::runner; - #[test] - fn above() { - assert_eq!( - runner().ok("a {b: hsl(0 500% 50%)}\n"), - "a {\ - \n b: hsl(0, 100%, 50%);\ - \n}\n" - ); - } #[test] fn below() { assert_eq!( @@ -93,6 +86,41 @@ mod in_gamut { ); } } +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("a {b: hsl(none 100% 50%)}\n"), + "a {\ + \n b: hsl(none 100% 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("a {b: hsl(0 100% none)}\n"), + "a {\ + \n b: hsl(0deg 100% none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("a {b: hsl(0 none 50%)}\n"), + "a {\ + \n b: hsl(0deg none 50%);\ + \n}\n" + ); + } +} #[test] fn named() { assert_eq!( @@ -102,6 +130,26 @@ fn named() { \n}\n" ); } +mod out_of_gamut { + #[allow(unused)] + use super::runner; + + mod saturation { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn above() { + assert_eq!( + runner().ok("a {b: hsl(0 500% 50%)}\n"), + "a {\ + \n b: hsl(0, 500%, 50%);\ + \n}\n" + ); + } + } +} mod units { #[allow(unused)] use super::runner; diff --git a/rsass/tests/spec/core_functions/color/hsl/one_arg/relative_color.rs b/rsass/tests/spec/core_functions/color/hsl/one_arg/relative_color.rs index fb9127aa1..b62f3f9f3 100644 --- a/rsass/tests/spec/core_functions/color/hsl/one_arg/relative_color.rs +++ b/rsass/tests/spec/core_functions/color/hsl/one_arg/relative_color.rs @@ -60,28 +60,34 @@ mod error { use super::runner; #[test] + #[ignore] // wrong error fn alpha() { assert_eq!( - runner().err("a {b: hsl(\"from\" #aaa h s l / 25%)}\n"), - "Error: Only 3 elements allowed, but 5 were passed.\ + runner().err( + "a {b: hsl(\"from\" #aaa h s l / 25%)}\n" + ), + "Error: $channels: Expected hue channel to be a number, was \"from\".\ \n ,\ \n1 | a {b: hsl(\"from\" #aaa h s l / 25%)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 1:7 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn no_alpha() { assert_eq!( - runner().err("a {b: hsl(\"from\" #aaa h s l)}\n"), - "Error: Only 3 elements allowed, but 5 were passed.\ + runner().err( + "a {b: hsl(\"from\" #aaa h s l)}\n" + ), + "Error: $channels: Expected hue channel to be a number, was \"from\".\ \n ,\ \n1 | a {b: hsl(\"from\" #aaa h s l)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 1:7 root stylesheet", - ); + ); } } mod wrong_keyword { @@ -89,28 +95,34 @@ mod error { use super::runner; #[test] + #[ignore] // wrong error fn alpha() { assert_eq!( - runner().err("a {b: hsl(c #aaa h s l / 25%)}\n"), - "Error: Only 3 elements allowed, but 5 were passed.\ + runner().err( + "a {b: hsl(c #aaa h s l / 25%)}\n" + ), + "Error: $channels: Expected hue channel to be a number, was c.\ \n ,\ \n1 | a {b: hsl(c #aaa h s l / 25%)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 1:7 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn no_alpha() { assert_eq!( - runner().err("a {b: hsl(c #aaa h s l)}\n"), - "Error: Only 3 elements allowed, but 5 were passed.\ + runner().err( + "a {b: hsl(c #aaa h s l)}\n" + ), + "Error: $channels: Expected hue channel to be a number, was c.\ \n ,\ \n1 | a {b: hsl(c #aaa h s l)}\ \n | ^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 1:7 root stylesheet", - ); + ); } } } diff --git a/rsass/tests/spec/core_functions/color/hsl/one_arg/special_functions/alpha.rs b/rsass/tests/spec/core_functions/color/hsl/one_arg/special_functions/alpha.rs index 804966932..94eed5f9d 100644 --- a/rsass/tests/spec/core_functions/color/hsl/one_arg/special_functions/alpha.rs +++ b/rsass/tests/spec/core_functions/color/hsl/one_arg/special_functions/alpha.rs @@ -32,20 +32,22 @@ mod calc { ); } #[test] + #[ignore] // wrong result fn arg_3() { assert_eq!( runner().ok("a {b: hsl(1 2% calc(1px + 1%) / 0.4)}\n"), "a {\ - \n b: hsl(1 2% calc(1px + 1%)/0.4);\ + \n b: hsl(1, 2%, calc(1px + 1%), 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_4() { assert_eq!( runner().ok("a {b: hsl(1 2% 3% / calc(1px + 1%))}\n"), "a {\ - \n b: hsl(1 2% 3%/calc(1px + 1%));\ + \n b: hsl(1, 2%, 3%, calc(1px + 1%));\ \n}\n" ); } @@ -57,7 +59,8 @@ mod calc { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: hsl(unquote(\"calc(1)\") 2% 3% / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(string.unquote(\"calc(1)\") 2% 3% / 0.4)}\n"), "a {\ \n b: hsl(calc(1), 2%, 3%, 0.4);\ \n}\n" @@ -66,27 +69,32 @@ mod calc { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: hsl(1 unquote(\"calc(2%)\") 3% / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1 string.unquote(\"calc(2%)\") 3% / 0.4)}\n"), "a {\ \n b: hsl(1, calc(2%), 3%, 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_3() { assert_eq!( - runner().ok("a {b: hsl(1 2% unquote(\"calc(3%)\") / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1 2% string.unquote(\"calc(3%)\") / 0.4)}\n"), "a {\ - \n b: hsl(1 2% calc(3%)/0.4);\ + \n b: hsl(1, 2%, calc(3%), 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_4() { assert_eq!( - runner().ok("a {b: hsl(1 2% 3% / unquote(\"calc(0.4)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1 2% 3% / string.unquote(\"calc(0.4)\"))}\n"), "a {\ - \n b: hsl(1 2% 3%/calc(0.4));\ + \n b: hsl(1, 2%, 3%, calc(0.4));\ \n}\n" ); } @@ -103,9 +111,8 @@ mod clamp { #[test] fn arg_1() { assert_eq!( - runner().ok( - "a {b: hsl(unquote(\"clamp(1, 2, 3)\") 2% 3% / 0.4)}\n" - ), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(string.unquote(\"clamp(1, 2, 3)\") 2% 3% / 0.4)}\n"), "a {\ \n b: hsl(clamp(1, 2, 3), 2%, 3%, 0.4);\ \n}\n" @@ -114,33 +121,38 @@ mod clamp { #[test] fn arg_2() { assert_eq!( - runner().ok( - "a {b: hsl(1 unquote(\"clamp(2%, 3%, 4%)\") 3% / 0.4)}\n" - ), - "a {\ + runner().ok( + "@use \"sass:string\";\ + \na {b: hsl(1 string.unquote(\"clamp(2%, 3%, 4%)\") 3% / 0.4)}\n" + ), + "a {\ \n b: hsl(1, clamp(2%, 3%, 4%), 3%, 0.4);\ \n}\n" - ); + ); } #[test] + #[ignore] // wrong result fn arg_3() { assert_eq!( - runner().ok( - "a {b: hsl(1 2% unquote(\"clamp(3%, 4%, 5%)\") / 0.4)}\n" - ), - "a {\ - \n b: hsl(1 2% clamp(3%, 4%, 5%)/0.4);\ + runner().ok( + "@use \"sass:string\";\ + \na {b: hsl(1 2% string.unquote(\"clamp(3%, 4%, 5%)\") / 0.4)}\n" + ), + "a {\ + \n b: hsl(1, 2%, clamp(3%, 4%, 5%), 0.4);\ \n}\n" - ); + ); } #[test] + #[ignore] // wrong result fn arg_4() { assert_eq!( runner().ok( - "a {b: hsl(1 2% 3% / unquote(\"clamp(0.4, 0.5, 0.6)\"))}\n" + "@use \"sass:string\";\ + \na {b: hsl(1 2% 3% / string.unquote(\"clamp(0.4, 0.5, 0.6)\"))}\n" ), "a {\ - \n b: hsl(1 2% 3%/clamp(0.4, 0.5, 0.6));\ + \n b: hsl(1, 2%, 3%, clamp(0.4, 0.5, 0.6));\ \n}\n" ); } @@ -169,20 +181,22 @@ mod env { ); } #[test] + #[ignore] // wrong result fn arg_3() { assert_eq!( runner().ok("a {b: hsl(1 2% env(--foo) / 0.4)}\n"), "a {\ - \n b: hsl(1 2% env(--foo)/0.4);\ + \n b: hsl(1, 2%, env(--foo), 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_4() { assert_eq!( runner().ok("a {b: hsl(1 2% 3% / env(--foo))}\n"), "a {\ - \n b: hsl(1 2% 3%/env(--foo));\ + \n b: hsl(1, 2%, 3%, env(--foo));\ \n}\n" ); } @@ -198,7 +212,8 @@ mod max { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: hsl(unquote(\"max(1)\") 2% 3% / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(string.unquote(\"max(1)\") 2% 3% / 0.4)}\n"), "a {\ \n b: hsl(max(1), 2%, 3%, 0.4);\ \n}\n" @@ -207,27 +222,32 @@ mod max { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: hsl(1 unquote(\"max(2%)\") 3% / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1 string.unquote(\"max(2%)\") 3% / 0.4)}\n"), "a {\ \n b: hsl(1, max(2%), 3%, 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_3() { assert_eq!( - runner().ok("a {b: hsl(1 2% unquote(\"max(3%)\") / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1 2% string.unquote(\"max(3%)\") / 0.4)}\n"), "a {\ - \n b: hsl(1 2% max(3%)/0.4);\ + \n b: hsl(1, 2%, max(3%), 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_4() { assert_eq!( - runner().ok("a {b: hsl(1 2% 3% / unquote(\"max(0.4)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1 2% 3% / string.unquote(\"max(0.4)\"))}\n"), "a {\ - \n b: hsl(1 2% 3%/max(0.4));\ + \n b: hsl(1, 2%, 3%, max(0.4));\ \n}\n" ); } @@ -244,7 +264,8 @@ mod min { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: hsl(unquote(\"min(1)\") 2% 3% / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(string.unquote(\"min(1)\") 2% 3% / 0.4)}\n"), "a {\ \n b: hsl(min(1), 2%, 3%, 0.4);\ \n}\n" @@ -253,27 +274,32 @@ mod min { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: hsl(1 unquote(\"min(2%)\") 3% / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1 string.unquote(\"min(2%)\") 3% / 0.4)}\n"), "a {\ \n b: hsl(1, min(2%), 3%, 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_3() { assert_eq!( - runner().ok("a {b: hsl(1 2% unquote(\"min(3%)\") / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1 2% string.unquote(\"min(3%)\") / 0.4)}\n"), "a {\ - \n b: hsl(1 2% min(3%)/0.4);\ + \n b: hsl(1, 2%, min(3%), 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_4() { assert_eq!( - runner().ok("a {b: hsl(1 2% 3% / unquote(\"min(0.4)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1 2% 3% / string.unquote(\"min(0.4)\"))}\n"), "a {\ - \n b: hsl(1 2% 3%/min(0.4));\ + \n b: hsl(1, 2%, 3%, min(0.4));\ \n}\n" ); } @@ -337,20 +363,22 @@ mod var { ); } #[test] + #[ignore] // wrong result fn arg_3() { assert_eq!( runner().ok("a {b: hsl(1 2% var(--foo) / 0.4)}\n"), "a {\ - \n b: hsl(1 2% var(--foo)/0.4);\ + \n b: hsl(1, 2%, var(--foo), 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_4() { assert_eq!( runner().ok("a {b: hsl(1 2% 3% / var(--foo))}\n"), "a {\ - \n b: hsl(1 2% 3%/var(--foo));\ + \n b: hsl(1, 2%, 3%, var(--foo));\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/hsl/one_arg/special_functions/no_alpha.rs b/rsass/tests/spec/core_functions/color/hsl/one_arg/special_functions/no_alpha.rs index 81a2bad7a..495434bd4 100644 --- a/rsass/tests/spec/core_functions/color/hsl/one_arg/special_functions/no_alpha.rs +++ b/rsass/tests/spec/core_functions/color/hsl/one_arg/special_functions/no_alpha.rs @@ -48,7 +48,8 @@ mod calc { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: hsl(unquote(\"calc(1)\") 2% 3%)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(string.unquote(\"calc(1)\") 2% 3%)}\n"), "a {\ \n b: hsl(calc(1), 2%, 3%);\ \n}\n" @@ -57,7 +58,8 @@ mod calc { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: hsl(1 unquote(\"calc(2%)\") 3%)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1 string.unquote(\"calc(2%)\") 3%)}\n"), "a {\ \n b: hsl(1, calc(2%), 3%);\ \n}\n" @@ -66,7 +68,8 @@ mod calc { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: hsl(1 2% unquote(\"calc(3%)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1 2% string.unquote(\"calc(3%)\"))}\n"), "a {\ \n b: hsl(1, 2%, calc(3%));\ \n}\n" @@ -85,8 +88,8 @@ mod clamp { #[test] fn arg_1() { assert_eq!( - runner() - .ok("a {b: hsl(unquote(\"clamp(1, 2, 3)\") 2% 3%)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(string.unquote(\"clamp(1, 2, 3)\") 2% 3%)}\n"), "a {\ \n b: hsl(clamp(1, 2, 3), 2%, 3%);\ \n}\n" @@ -95,8 +98,8 @@ mod clamp { #[test] fn arg_2() { assert_eq!( - runner() - .ok("a {b: hsl(1 unquote(\"clamp(2%, 3%, 4%)\") 3%)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1 string.unquote(\"clamp(2%, 3%, 4%)\") 3%)}\n"), "a {\ \n b: hsl(1, clamp(2%, 3%, 4%), 3%);\ \n}\n" @@ -105,8 +108,8 @@ mod clamp { #[test] fn arg_3() { assert_eq!( - runner() - .ok("a {b: hsl(1 2% unquote(\"clamp(3%, 4%, 5%)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1 2% string.unquote(\"clamp(3%, 4%, 5%)\"))}\n"), "a {\ \n b: hsl(1, 2%, clamp(3%, 4%, 5%));\ \n}\n" @@ -157,7 +160,8 @@ mod max { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: hsl(unquote(\"max(1)\") 2% 3%)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(string.unquote(\"max(1)\") 2% 3%)}\n"), "a {\ \n b: hsl(max(1), 2%, 3%);\ \n}\n" @@ -166,7 +170,8 @@ mod max { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: hsl(1 unquote(\"max(2%)\") 3%)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1 string.unquote(\"max(2%)\") 3%)}\n"), "a {\ \n b: hsl(1, max(2%), 3%);\ \n}\n" @@ -175,7 +180,8 @@ mod max { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: hsl(1 2% unquote(\"max(3%)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1 2% string.unquote(\"max(3%)\"))}\n"), "a {\ \n b: hsl(1, 2%, max(3%));\ \n}\n" @@ -194,7 +200,8 @@ mod min { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: hsl(unquote(\"min(1)\") 2% 3%)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(string.unquote(\"min(1)\") 2% 3%)}\n"), "a {\ \n b: hsl(min(1), 2%, 3%);\ \n}\n" @@ -203,7 +210,8 @@ mod min { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: hsl(1 unquote(\"min(2%)\") 3%)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1 string.unquote(\"min(2%)\") 3%)}\n"), "a {\ \n b: hsl(1, min(2%), 3%);\ \n}\n" @@ -212,7 +220,8 @@ mod min { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: hsl(1 2% unquote(\"min(3%)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1 2% string.unquote(\"min(3%)\"))}\n"), "a {\ \n b: hsl(1, 2%, min(3%));\ \n}\n" diff --git a/rsass/tests/spec/core_functions/color/hsl/three_args/bounds.rs b/rsass/tests/spec/core_functions/color/hsl/three_args/bounds.rs new file mode 100644 index 000000000..39d93ccb1 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/hsl/three_args/bounds.rs @@ -0,0 +1,69 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/hsl/three_args/bounds.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("bounds") +} + +mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(hsl(0, 100%, 500%));\n"), + "a {\ + \n value: hsl(0, 100%, 500%);\ + \n space: hsl;\ + \n channels: 0deg 100% 500% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(hsl(0, 100%, -100%));\n"), + "a {\ + \n value: hsl(0, 100%, -100%);\ + \n space: hsl;\ + \n channels: 0deg 100% -100% / 1;\ + \n}\n" + ); + } +} +mod saturation { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(hsl(0, 200%, 50%));\n"), + "a {\ + \n value: hsl(0, 200%, 50%);\ + \n space: hsl;\ + \n channels: 0deg 200% 50% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(hsl(0, -100%, 50%));\n"), + "a {\ + \n value: hsl(0, 0%, 50%);\ + \n space: hsl;\ + \n channels: 0deg 0% 50% / 1;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/hsl/three_args/clamped.rs b/rsass/tests/spec/core_functions/color/hsl/three_args/clamped.rs deleted file mode 100644 index 72d6667b3..000000000 --- a/rsass/tests/spec/core_functions/color/hsl/three_args/clamped.rs +++ /dev/null @@ -1,53 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/hsl/three_args/clamped.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("clamped") -} - -mod lightness { - #[allow(unused)] - use super::runner; - - #[test] - fn above() { - assert_eq!( - runner().ok("a {b: hsl(0, 100%, 500%)}\n"), - "a {\ - \n b: hsl(0, 100%, 100%);\ - \n}\n" - ); - } - #[test] - fn below() { - assert_eq!( - runner().ok("a {b: hsl(0, 100%, -100%)}\n"), - "a {\ - \n b: hsl(0, 100%, 0%);\ - \n}\n" - ); - } -} -mod saturation { - #[allow(unused)] - use super::runner; - - #[test] - fn above() { - assert_eq!( - runner().ok("a {b: hsl(0, 500%, 50%)}\n"), - "a {\ - \n b: hsl(0, 100%, 50%);\ - \n}\n" - ); - } - #[test] - fn below() { - assert_eq!( - runner().ok("a {b: hsl(0, -100%, 50%)}\n"), - "a {\ - \n b: hsl(0, 0%, 50%);\ - \n}\n" - ); - } -} diff --git a/rsass/tests/spec/core_functions/color/hsl/three_args/mod.rs b/rsass/tests/spec/core_functions/color/hsl/three_args/mod.rs index 0af4d0426..05f0d2d63 100644 --- a/rsass/tests/spec/core_functions/color/hsl/three_args/mod.rs +++ b/rsass/tests/spec/core_functions/color/hsl/three_args/mod.rs @@ -5,10 +5,12 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("three_args") } -mod clamped; +mod bounds; mod named; +mod out_of_gamut; + mod special_functions; mod units; diff --git a/rsass/tests/spec/core_functions/color/hsl/three_args/out_of_gamut.rs b/rsass/tests/spec/core_functions/color/hsl/three_args/out_of_gamut.rs new file mode 100644 index 000000000..d28de99e5 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/hsl/three_args/out_of_gamut.rs @@ -0,0 +1,22 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/hsl/three_args/out_of_gamut.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("out_of_gamut") +} + +mod saturation { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn above() { + assert_eq!( + runner().ok("a {b: hsl(0, 500%, 50%)}\n"), + "a {\ + \n b: hsl(0, 500%, 50%);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/hsl/three_args/special_functions.rs b/rsass/tests/spec/core_functions/color/hsl/three_args/special_functions.rs index 1ab5a4df4..1502472a4 100644 --- a/rsass/tests/spec/core_functions/color/hsl/three_args/special_functions.rs +++ b/rsass/tests/spec/core_functions/color/hsl/three_args/special_functions.rs @@ -48,7 +48,8 @@ mod calc { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: hsl(unquote(\"calc(1)\"), 2%, 3%)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(string.unquote(\"calc(1)\"), 2%, 3%)}\n"), "a {\ \n b: hsl(calc(1), 2%, 3%);\ \n}\n" @@ -57,7 +58,8 @@ mod calc { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: hsl(1, unquote(\"calc(2%)\"), 3%)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1, string.unquote(\"calc(2%)\"), 3%)}\n"), "a {\ \n b: hsl(1, calc(2%), 3%);\ \n}\n" @@ -66,7 +68,8 @@ mod calc { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: hsl(1, 2%, unquote(\"calc(3%)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1, 2%, string.unquote(\"calc(3%)\"))}\n"), "a {\ \n b: hsl(1, 2%, calc(3%));\ \n}\n" @@ -85,8 +88,8 @@ mod clamp { #[test] fn arg_1() { assert_eq!( - runner() - .ok("a {b: hsl(unquote(\"clamp(1, 2, 3)\"), 2%, 3%)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(string.unquote(\"clamp(1, 2, 3)\"), 2%, 3%)}\n"), "a {\ \n b: hsl(clamp(1, 2, 3), 2%, 3%);\ \n}\n" @@ -95,9 +98,8 @@ mod clamp { #[test] fn arg_2() { assert_eq!( - runner().ok( - "a {b: hsl(1, unquote(\"clamp(2%, 3%, 4%)\"), 3%)}\n" - ), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1, string.unquote(\"clamp(2%, 3%, 4%)\"), 3%)}\n"), "a {\ \n b: hsl(1, clamp(2%, 3%, 4%), 3%);\ \n}\n" @@ -106,9 +108,8 @@ mod clamp { #[test] fn arg_3() { assert_eq!( - runner().ok( - "a {b: hsl(1, 2%, unquote(\"clamp(3%, 4%, 5%)\"))}\n" - ), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1, 2%, string.unquote(\"clamp(3%, 4%, 5%)\"))}\n"), "a {\ \n b: hsl(1, 2%, clamp(3%, 4%, 5%));\ \n}\n" @@ -159,7 +160,8 @@ mod max { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: hsl(unquote(\"max(1)\"), 2%, 3%)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(string.unquote(\"max(1)\"), 2%, 3%)}\n"), "a {\ \n b: hsl(max(1), 2%, 3%);\ \n}\n" @@ -168,7 +170,8 @@ mod max { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: hsl(1, unquote(\"max(2%)\"), 3%)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1, string.unquote(\"max(2%)\"), 3%)}\n"), "a {\ \n b: hsl(1, max(2%), 3%);\ \n}\n" @@ -177,7 +180,8 @@ mod max { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: hsl(1, 2%, unquote(\"max(3%)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1, 2%, string.unquote(\"max(3%)\"))}\n"), "a {\ \n b: hsl(1, 2%, max(3%));\ \n}\n" @@ -196,7 +200,8 @@ mod min { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: hsl(unquote(\"min(1)\"), 2%, 3%)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(string.unquote(\"min(1)\"), 2%, 3%)}\n"), "a {\ \n b: hsl(min(1), 2%, 3%);\ \n}\n" @@ -205,7 +210,8 @@ mod min { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: hsl(1, unquote(\"min(2%)\"), 3%)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1, string.unquote(\"min(2%)\"), 3%)}\n"), "a {\ \n b: hsl(1, min(2%), 3%);\ \n}\n" @@ -214,7 +220,8 @@ mod min { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: hsl(1, 2%, unquote(\"min(3%)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: hsl(1, 2%, string.unquote(\"min(3%)\"))}\n"), "a {\ \n b: hsl(1, 2%, min(3%));\ \n}\n" diff --git a/rsass/tests/spec/core_functions/color/hue.rs b/rsass/tests/spec/core_functions/color/hue.rs index 100edc101..4cb7c7c16 100644 --- a/rsass/tests/spec/core_functions/color/hue.rs +++ b/rsass/tests/spec/core_functions/color/hue.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn above_max() { assert_eq!( - runner().ok("a {b: hue(hsl(540, 50%, 50%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.hue(hsl(540, 50%, 50%))}\n"), "a {\ \n b: 180deg;\ \n}\n" @@ -18,55 +19,81 @@ mod error { #[allow(unused)] use super::runner; + #[test] + #[ignore] // wrong error + fn non_legacy() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.hue(lch(0% 0 0deg))}\n" + ), + "Error: color.hue() is only supported for legacy colors. Please use color.channel() instead with an explicit $space argument.\ + \n ,\ + \n2 | a {b: color.hue(lch(0% 0 0deg))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: hue()}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.hue()}\n" + ), "Error: Missing argument $color.\ \n ,--> input.scss\ - \n1 | a {b: hue()}\ - \n | ^^^^^ invocation\ + \n2 | a {b: color.hue()}\ + \n | ^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ \n1 | @function hue($color) {\ \n | =========== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: hue(red, green)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.hue(red, green)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: hue(red, green)}\ - \n | ^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: color.hue(red, green)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ \n1 | @function hue($color) {\ \n | =========== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: hue(1)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.hue(1)}\n" + ), "Error: $color: 1 is not a color.\ \n ,\ - \n1 | a {b: hue(1)}\ - \n | ^^^^^^\ + \n2 | a {b: color.hue(1)}\ + \n | ^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn fraction() { assert_eq!( - runner().ok("a {b: hue(hsl(0.5, 50%, 50%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.hue(hsl(0.5, 50%, 50%))}\n"), "a {\ \n b: 0.5deg;\ \n}\n" @@ -75,7 +102,8 @@ fn fraction() { #[test] fn max() { assert_eq!( - runner().ok("a {b: hue(hsl(359, 50%, 50%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.hue(hsl(359, 50%, 50%))}\n"), "a {\ \n b: 359deg;\ \n}\n" @@ -84,7 +112,8 @@ fn max() { #[test] fn middle() { assert_eq!( - runner().ok("a {b: hue(hsl(123, 50%, 50%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.hue(hsl(123, 50%, 50%))}\n"), "a {\ \n b: 123deg;\ \n}\n" @@ -93,7 +122,8 @@ fn middle() { #[test] fn min() { assert_eq!( - runner().ok("a {b: hue(hsl(0, 50%, 50%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.hue(hsl(0, 50%, 50%))}\n"), "a {\ \n b: 0deg;\ \n}\n" @@ -102,7 +132,8 @@ fn min() { #[test] fn named() { assert_eq!( - runner().ok("a {b: hue($color: hsl(234, 50%, 50%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.hue($color: hsl(234, 50%, 50%))}\n"), "a {\ \n b: 234deg;\ \n}\n" @@ -111,7 +142,8 @@ fn named() { #[test] fn negative() { assert_eq!( - runner().ok("a {b: hue(hsl(-180, 50%, 50%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.hue(hsl(-180, 50%, 50%))}\n"), "a {\ \n b: 180deg;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/color/hwb/error/five_args.rs b/rsass/tests/spec/core_functions/color/hwb/error/five_args.rs index 77aea19e4..34273ce9e 100644 --- a/rsass/tests/spec/core_functions/color/hwb/error/five_args.rs +++ b/rsass/tests/spec/core_functions/color/hwb/error/five_args.rs @@ -9,7 +9,7 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(0, 30%, 40%, 0.5, 0)}\n" ), "Error: Only 4 arguments allowed, but 5 were passed.\ diff --git a/rsass/tests/spec/core_functions/color/hwb/error/four_args.rs b/rsass/tests/spec/core_functions/color/hwb/error/four_args.rs index aa10353bd..eeb0125c9 100644 --- a/rsass/tests/spec/core_functions/color/hwb/error/four_args.rs +++ b/rsass/tests/spec/core_functions/color/hwb/error/four_args.rs @@ -13,7 +13,7 @@ mod alpha { fn unit() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(0, 0%, 0%, 0.5px)}\n" ), "Error: $alpha: Expected 0.5px to have unit \"%\" or no units.\ @@ -24,64 +24,20 @@ mod alpha { \n input.scss 2:7 root stylesheet", ); } - #[test] - fn var() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(0, 0%, 0%, var(--c))}\n" - ), - "Error: $alpha: var(--c) is not a number.\ - \n ,\ - \n2 | a {b: color.hwb(0, 0%, 0%, var(--c))}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } } mod blackness { #[allow(unused)] use super::runner; #[test] - fn too_high() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(0, 30%, 101%, 0.5)}\n" - ), - "Error: $blackness: Expected 101% to be within 0% and 100%.\ - \n ,\ - \n2 | a {b: color.hwb(0, 30%, 101%, 0.5)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(0, 30%, -1%, 0.5)}\n" - ), - "Error: $blackness: Expected -1% to be within 0% and 100%.\ - \n ,\ - \n2 | a {b: color.hwb(0, 30%, -1%, 0.5)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] + #[ignore] // wrong error fn test_type() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(0, 30%, \"foo\", 0.5)}\n" ), - "Error: $blackness: \"foo\" is not a number.\ + "Error: Expected blackness channel to be a number, was \"foo\".\ \n ,\ \n2 | a {b: color.hwb(0, 30%, \"foo\", 0.5)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ @@ -97,7 +53,7 @@ mod blackness { fn none() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(0, 30%, 40, 0.5)}\n" ), "Error: $blackness: Expected 40 to have unit \"%\".\ @@ -112,7 +68,7 @@ mod blackness { fn wrong() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(0, 30%, 40px, 0.5)}\n" ), "Error: $blackness: Expected 40px to have unit \"%\".\ @@ -124,34 +80,20 @@ mod blackness { ); } } - #[test] - fn var() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(0, 30%, var(--c), 0.5)}\n" - ), - "Error: $blackness: var(--c) is not a number.\ - \n ,\ - \n2 | a {b: color.hwb(0, 30%, var(--c), 0.5)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } } mod hue { #[allow(unused)] use super::runner; #[test] + #[ignore] // wrong error fn test_type() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(\"foo\", 30%, 40%, 0.5)}\n" ), - "Error: $hue: \"foo\" is not a number.\ + "Error: Expected hue channel to be a number, was \"foo\".\ \n ,\ \n2 | a {b: color.hwb(\"foo\", 30%, 40%, 0.5)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ @@ -159,64 +101,20 @@ mod hue { \n input.scss 2:7 root stylesheet", ); } - #[test] - fn var() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(var(--c), 30%, 40%, 0.5)}\n" - ), - "Error: $hue: var(--c) is not a number.\ - \n ,\ - \n2 | a {b: color.hwb(var(--c), 30%, 40%, 0.5)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } } mod whiteness { #[allow(unused)] use super::runner; #[test] - fn too_high() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(0, 101%, 40%, 0.5)}\n" - ), - "Error: $whiteness: Expected 101% to be within 0% and 100%.\ - \n ,\ - \n2 | a {b: color.hwb(0, 101%, 40%, 0.5)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(0, -1%, 40%, 0.5)}\n" - ), - "Error: $whiteness: Expected -1% to be within 0% and 100%.\ - \n ,\ - \n2 | a {b: color.hwb(0, -1%, 40%, 0.5)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] + #[ignore] // wrong error fn test_type() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(0, \"foo\", 40%, 0.5)}\n" ), - "Error: $whiteness: \"foo\" is not a number.\ + "Error: Expected whiteness channel to be a number, was \"foo\".\ \n ,\ \n2 | a {b: color.hwb(0, \"foo\", 40%, 0.5)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ @@ -232,7 +130,7 @@ mod whiteness { fn none() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(0, 30, 40%, 0.5)}\n" ), "Error: $whiteness: Expected 30 to have unit \"%\".\ @@ -247,7 +145,7 @@ mod whiteness { fn wrong() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(0, 30px, 40%, 0.5)}\n" ), "Error: $whiteness: Expected 30px to have unit \"%\".\ @@ -259,19 +157,4 @@ mod whiteness { ); } } - #[test] - fn var() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(0, var(--c), 40%, 0.5)}\n" - ), - "Error: $whiteness: var(--c) is not a number.\ - \n ,\ - \n2 | a {b: color.hwb(0, var(--c), 40%, 0.5)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } } diff --git a/rsass/tests/spec/core_functions/color/hwb/error/one_arg.rs b/rsass/tests/spec/core_functions/color/hwb/error/one_arg.rs index 2fde4a728..59bac3d3f 100644 --- a/rsass/tests/spec/core_functions/color/hwb/error/one_arg.rs +++ b/rsass/tests/spec/core_functions/color/hwb/error/one_arg.rs @@ -13,28 +13,13 @@ mod alpha { fn unit() { assert_eq!( runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(0 0 0 / 0.5px)}\n" + "@use \"sass:color\";\ + \na {b: color.hwb(0 0% 0% / 0.5px)}\n" ), - "Error: $whiteness: Expected 0 to have unit \"%\".\ + "Error: $alpha: Expected 0.5px to have unit \"%\" or no units.\ \n ,\ - \n2 | a {b: color.hwb(0 0 0 / 0.5px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn var() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(0 0 0 / var(--c))}\n" - ), - "Error: Expected numeric channels, got \"hwb(0 0 0/var(--c))\".\ - \n ,\ - \n2 | a {b: color.hwb(0 0 0 / var(--c))}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: color.hwb(0 0% 0% / 0.5px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", ); @@ -45,49 +30,20 @@ mod blackness { use super::runner; #[test] - fn too_high() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(0 30% 101%)}\n" - ), - "Error: $blackness: Expected 101% to be within 0% and 100%.\ - \n ,\ - \n2 | a {b: color.hwb(0 30% 101%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(0 30% -1%)}\n" - ), - "Error: $blackness: Expected -1% to be within 0% and 100%.\ - \n ,\ - \n2 | a {b: color.hwb(0 30% -1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] + #[ignore] // wrong error fn test_type() { assert_eq!( - runner().err( - "@use \'sass:color\';\ + runner().err( + "@use \"sass:color\";\ \na {b: color.hwb(0 30% \"foo\")}\n" - ), - "Error: $blackness: \"foo\" is not a number.\ + ), + "Error: $channels: Expected blackness channel to be a number, was \"foo\".\ \n ,\ \n2 | a {b: color.hwb(0 30% \"foo\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); + ); } mod unit { #[allow(unused)] @@ -97,7 +53,7 @@ mod blackness { fn none() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(0 30% 40)}\n" ), "Error: $blackness: Expected 40 to have unit \"%\".\ @@ -112,7 +68,7 @@ mod blackness { fn wrong() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(0 30% 40px)}\n" ), "Error: $blackness: Expected 40px to have unit \"%\".\ @@ -124,75 +80,26 @@ mod blackness { ); } } - mod var { - #[allow(unused)] - use super::runner; - - #[test] - fn alpha() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(0 30% var(--c) / 0.5px)}\n" - ), - "Error: Expected numeric channels, got \"hwb(0 30% var(--c)/0.5px)\".\ - \n ,\ - \n2 | a {b: color.hwb(0 30% var(--c) / 0.5px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn no_alpha() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(0 30% var(--c))}\n" - ), - "Error: $blackness: var(--c) is not a number.\ - \n ,\ - \n2 | a {b: color.hwb(0 30% var(--c))}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - } } mod hue { #[allow(unused)] use super::runner; #[test] + #[ignore] // wrong error fn test_type() { assert_eq!( - runner().err( - "@use \'sass:color\';\ + runner().err( + "@use \"sass:color\";\ \na {b: color.hwb(\"foo\" 30% 40%)}\n" - ), - "Error: $hue: \"foo\" is not a number.\ + ), + "Error: $channels: Expected hue channel to be a number, was \"foo\".\ \n ,\ \n2 | a {b: color.hwb(\"foo\" 30% 40%)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn var() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(var(--c) 30% 40%)}\n" - ), - "Error: $hue: var(--c) is not a number.\ - \n ,\ - \n2 | a {b: color.hwb(var(--c) 30% 40%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); + ); } } mod list { @@ -200,13 +107,14 @@ mod list { use super::runner; #[test] + #[ignore] // wrong error fn bracketed() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb([0 30% 40%])}\n" ), - "Error: $channels must be an unbracketed list.\ + "Error: $channels: Expected an unbracketed list, was [0 30% 40%]\ \n ,\ \n2 | a {b: color.hwb([0 30% 40%])}\ \n | ^^^^^^^^^^^^^^^^^^^^^^\ @@ -215,28 +123,30 @@ mod list { ); } #[test] + #[ignore] // wrong error fn comma_separated() { assert_eq!( - runner().err( - "@use \'sass:color\';\ + runner().err( + "@use \"sass:color\";\ \na {b: color.hwb((0, 30%, 40%))}\n" - ), - "Error: $channels must be a space-separated list.\ + ), + "Error: $channels: Expected a space- or slash-separated list, was (0, 30%, 40%)\ \n ,\ \n2 | a {b: color.hwb((0, 30%, 40%))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn empty() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(())}\n" ), - "Error: Missing element $hue.\ + "Error: $channels: Color component list may not be empty.\ \n ,\ \n2 | a {b: color.hwb(())}\ \n | ^^^^^^^^^^^^^\ @@ -245,59 +155,63 @@ mod list { ); } #[test] + #[ignore] // wrong error fn four_elements() { assert_eq!( - runner().err( - "@use \'sass:color\';\ + runner().err( + "@use \"sass:color\";\ \na {b: color.hwb(0 30% 40% 0.4)}\n" - ), - "Error: Only 3 elements allowed, but 4 were passed.\ + ), + "Error: $channels: The hwb color space has 3 channels but (0 30% 40% 0.4) has 4.\ \n ,\ \n2 | a {b: color.hwb(0 30% 40% 0.4)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn one_element() { assert_eq!( - runner().err( - "@use \'sass:color\';\ + runner().err( + "@use \"sass:color\";\ \na {b: color.hwb(0)}\n" - ), - "Error: Missing element $whiteness.\ + ), + "Error: $channels: The hwb color space has 3 channels but 0 has 1.\ \n ,\ \n2 | a {b: color.hwb(0)}\ \n | ^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn two_elements() { assert_eq!( - runner().err( - "@use \'sass:color\';\ + runner().err( + "@use \"sass:color\";\ \na {b: color.hwb(0 30%)}\n" - ), - "Error: Missing element $blackness.\ + ), + "Error: $channels: The hwb color space has 3 channels but (0 30%) has 2.\ \n ,\ \n2 | a {b: color.hwb(0 30%)}\ \n | ^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); + ); } } #[test] +#[ignore] // wrong error fn quoted_var_slash() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(0 30% \"var(--foo) / 0.4\")}\n" ), - "Error: $blackness: \"var(--foo) / 0.4\" is not a number.\ + "Error: $channels: Expected blackness channel to be a number, was \"var(--foo) / 0.4\".\ \n ,\ \n2 | a {b: color.hwb(0 30% \"var(--foo) / 0.4\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ @@ -310,49 +224,20 @@ mod whiteness { use super::runner; #[test] - fn too_high() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(0 101% 40%)}\n" - ), - "Error: $whiteness: Expected 101% to be within 0% and 100%.\ - \n ,\ - \n2 | a {b: color.hwb(0 101% 40%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(0 -1% 40%)}\n" - ), - "Error: $whiteness: Expected -1% to be within 0% and 100%.\ - \n ,\ - \n2 | a {b: color.hwb(0 -1% 40%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] + #[ignore] // wrong error fn test_type() { assert_eq!( - runner().err( - "@use \'sass:color\';\ + runner().err( + "@use \"sass:color\";\ \na {b: color.hwb(0 \"foo\" 40%)}\n" - ), - "Error: $whiteness: \"foo\" is not a number.\ + ), + "Error: $channels: Expected whiteness channel to be a number, was \"foo\".\ \n ,\ \n2 | a {b: color.hwb(0 \"foo\" 40%)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); + ); } mod unit { #[allow(unused)] @@ -362,7 +247,7 @@ mod whiteness { fn none() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(0 30 40%)}\n" ), "Error: $whiteness: Expected 30 to have unit \"%\".\ @@ -377,7 +262,7 @@ mod whiteness { fn wrong() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(0 30px 40%)}\n" ), "Error: $whiteness: Expected 30px to have unit \"%\".\ @@ -389,19 +274,4 @@ mod whiteness { ); } } - #[test] - fn var() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.hwb(0 var(--c) 40%)}\n" - ), - "Error: $whiteness: var(--c) is not a number.\ - \n ,\ - \n2 | a {b: color.hwb(0 var(--c) 40%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } } diff --git a/rsass/tests/spec/core_functions/color/hwb/error/three_args.rs b/rsass/tests/spec/core_functions/color/hwb/error/three_args.rs index 64f31b2a7..86b608cb0 100644 --- a/rsass/tests/spec/core_functions/color/hwb/error/three_args.rs +++ b/rsass/tests/spec/core_functions/color/hwb/error/three_args.rs @@ -10,13 +10,14 @@ mod blackness { use super::runner; #[test] + #[ignore] // wrong error fn test_type() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(0, 100%, \"foo\")}\n" ), - "Error: $blackness: \"foo\" is not a number.\ + "Error: Expected blackness channel to be a number, was \"foo\".\ \n ,\ \n2 | a {b: color.hwb(0, 100%, \"foo\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ @@ -30,13 +31,14 @@ mod hue { use super::runner; #[test] + #[ignore] // wrong error fn test_type() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(\"foo\", 100%, 50%)}\n" ), - "Error: $hue: \"foo\" is not a number.\ + "Error: Expected hue channel to be a number, was \"foo\".\ \n ,\ \n2 | a {b: color.hwb(\"foo\", 100%, 50%)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ @@ -50,13 +52,14 @@ mod whiteness { use super::runner; #[test] + #[ignore] // wrong error fn test_type() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(0, \"foo\", 50%)}\n" ), - "Error: $whiteness: \"foo\" is not a number.\ + "Error: Expected whiteness channel to be a number, was \"foo\".\ \n ,\ \n2 | a {b: color.hwb(0, \"foo\", 50%)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ diff --git a/rsass/tests/spec/core_functions/color/hwb/error/two_args.rs b/rsass/tests/spec/core_functions/color/hwb/error/two_args.rs index 07ba5aa44..6540288de 100644 --- a/rsass/tests/spec/core_functions/color/hwb/error/two_args.rs +++ b/rsass/tests/spec/core_functions/color/hwb/error/two_args.rs @@ -9,7 +9,7 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb(#123, 0.5)}\n" ), "Error: Only 1 argument allowed, but 2 were passed.\ diff --git a/rsass/tests/spec/core_functions/color/hwb/error/zero_args.rs b/rsass/tests/spec/core_functions/color/hwb/error/zero_args.rs index 6220bd164..ff072c4fe 100644 --- a/rsass/tests/spec/core_functions/color/hwb/error/zero_args.rs +++ b/rsass/tests/spec/core_functions/color/hwb/error/zero_args.rs @@ -9,7 +9,7 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb()}\n" ), "Error: Missing argument $channels.\ diff --git a/rsass/tests/spec/core_functions/color/hwb/four_args.rs b/rsass/tests/spec/core_functions/color/hwb/four_args.rs index 083fa4e10..e5126dcae 100644 --- a/rsass/tests/spec/core_functions/color/hwb/four_args.rs +++ b/rsass/tests/spec/core_functions/color/hwb/four_args.rs @@ -9,6 +9,44 @@ mod alpha { #[allow(unused)] use super::runner; + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0, 30%, 40%, calc(NaN))}\n"), + "a {\ + \n b: hsla(0, 33.3333333333%, 45%, 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0, 30%, 40%, calc(-infinity))}\n"), + "a {\ + \n b: hsla(0, 33.3333333333%, 45%, 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0, 30%, 40%, calc(infinity))}\n"), + "a {\ + \n b: hsl(0, 33.3333333333%, 45%);\ + \n}\n" + ); + } + } mod percent { #[allow(unused)] use super::runner; @@ -16,7 +54,7 @@ mod alpha { #[test] fn above_max() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(0, 0%, 0%, 250%)}\n"), "a {\ \n b: red;\ @@ -26,7 +64,7 @@ mod alpha { #[test] fn max() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(0, 0%, 0%, 100%)}\n"), "a {\ \n b: red;\ @@ -34,32 +72,35 @@ mod alpha { ); } #[test] + #[ignore] // wrong result fn min() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(0, 0%, 0%, 0%)}\n"), "a {\ - \n b: rgba(255, 0, 0, 0);\ + \n b: hsla(0, 100%, 50%, 0);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn negative() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(0, 0%, 0%, -10%)}\n"), "a {\ - \n b: rgba(255, 0, 0, 0);\ + \n b: hsla(0, 100%, 50%, 0);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn positive() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(0, 0%, 0%, 45.6%)}\n"), "a {\ - \n b: rgba(255, 0, 0, 0.456);\ + \n b: hsla(0, 100%, 50%, 0.456);\ \n}\n" ); } @@ -71,7 +112,7 @@ mod alpha { #[test] fn above_max() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(0, 0%, 0%, 250)}\n"), "a {\ \n b: red;\ @@ -81,7 +122,7 @@ mod alpha { #[test] fn max() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(0, 0%, 0%, 1)}\n"), "a {\ \n b: red;\ @@ -89,46 +130,267 @@ mod alpha { ); } #[test] + #[ignore] // wrong result fn min() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(0, 0%, 0%, 0)}\n"), "a {\ - \n b: rgba(255, 0, 0, 0);\ + \n b: hsla(0, 100%, 50%, 0);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn negative() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(0, 0%, 0%, -10)}\n"), "a {\ - \n b: rgba(255, 0, 0, 0);\ + \n b: hsla(0, 100%, 50%, 0);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn positive() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(0, 0%, 0%, 0.456)}\n"), "a {\ - \n b: rgba(255, 0, 0, 0.456);\ + \n b: hsla(0, 100%, 50%, 0.456);\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn var() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0, 0%, 0%, var(--c))}\n"), + "a {\ + \n b: hwb(0 0% 0% / var(--c));\ + \n}\n" + ); + } +} +mod blackness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0, 30%, 101%, 0.5)}\n"), + "a {\ + \n b: hsla(0, 0%, 22.9007633588%, 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0, 30%, -1%, 0.5)}\n"), + "a {\ + \n b: hsla(0, 102.8985507246%, 65.5%, 0.5);\ + \n}\n" + ); + } + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0, 30%, calc(NaN * 1%), 0.5)}\n"), + "a {\ + \n b: hsla(calc(NaN), calc(NaN * 1%), calc(NaN * 1%), 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0, 30%, calc(-infinity * 1%), 0.5)}\n"), + "a {\ + \n b: hsla(calc(NaN), calc(NaN * 1%), calc(NaN * 1%), 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0, 30%, calc(infinity * 1%), 0.5)}\n"), + "a {\ + \n b: hsla(calc(NaN), calc(NaN * 1%), calc(NaN * 1%), 0.5);\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn var() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0, 30%, var(--c), 0.5)}\n"), + "a {\ + \n b: hwb(0 30% var(--c) / 0.5);\ + \n}\n" + ); + } +} +mod hue { + #[allow(unused)] + use super::runner; + + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(calc(NaN), 30%, 40%, 0.5)}\n"), + "a {\ + \n b: hsla(0, 0%, 30%, 0.5);\ \n}\n" ); } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(calc(-infinity), 30%, 40%, 0.5)}\n"), + "a {\ + \n b: hsla(0, 0%, 30%, 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(calc(infinity), 30%, 40%, 0.5)}\n"), + "a {\ + \n b: hsla(0, 0%, 30%, 0.5);\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn var() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(var(--c), 30%, 40%, 0.5)}\n"), + "a {\ + \n b: hwb(var(--c) 30% 40% / 0.5);\ + \n}\n" + ); } } #[test] +#[ignore] // wrong result fn named() { assert_eq!( runner().ok( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb($hue: 180, $whiteness: 30%, $blackness: 40%, $alpha: 0.4)}\n" ), "a {\ - \n b: rgba(77, 153, 153, 0.4);\ + \n b: hsla(180, 33.3333333333%, 45%, 0.4);\ \n}\n" ); } +mod whiteness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0, 101%, 40%, 0.5)}\n"), + "a {\ + \n b: hsla(0, 0%, 71.6312056738%, 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0, -1%, 40%, 0.5)}\n"), + "a {\ + \n b: hsla(0, 103.3898305085%, 29.5%, 0.5);\ + \n}\n" + ); + } + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0, calc(NaN * 1%), 40%, 0.5)}\n"), + "a {\ + \n b: hsla(calc(NaN), calc(NaN * 1%), calc(NaN * 1%), 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0, calc(-infinity * 1%), 40%, 0.5)}\n"), + "a {\ + \n b: hsla(calc(NaN), calc(NaN * 1%), calc(NaN * 1%), 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0, calc(infinity * 1%), 40%, 0.5)}\n"), + "a {\ + \n b: hsla(calc(NaN), calc(NaN * 1%), calc(NaN * 1%), 0.5);\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn var() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0, var(--c), 40%, 0.5)}\n"), + "a {\ + \n b: hwb(0 var(--c) 40% / 0.5);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/hwb/global.rs b/rsass/tests/spec/core_functions/color/hwb/global.rs new file mode 100644 index 000000000..f4c67f708 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/hwb/global.rs @@ -0,0 +1,358 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/hwb/global.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("global") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + mod clamped { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn above() { + assert_eq!( + runner().ok("a {b: hwb(0 30% 40% / 1.1)}\n"), + "a {\ + \n b: hsl(0, 33.3333333333%, 45%);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn below() { + assert_eq!( + runner().ok("a {b: hwb(0 30% 40% / -0.1)}\n"), + "a {\ + \n b: hsla(0, 33.3333333333%, 45%, 0);\ + \n}\n" + ); + } + } + mod in_gamut { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn named() { + assert_eq!( + runner().ok("a {b: hwb($channels: 180 30% 40% / 0.4)}\n"), + "a {\ + \n b: hsla(180, 33.3333333333%, 45%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn opaque() { + assert_eq!( + runner().ok("a {b: hwb(180 30% 40% / 1)}\n"), + "a {\ + \n b: hsl(180, 33.3333333333%, 45%);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn parenthesized() { + assert_eq!( + runner().ok( + "// Extra parens shouldn\'t cause the slash to be forced into division.\ + \na {b: (hwb(180 30% 40% / 0.4))}\n" + ), + "a {\ + \n b: hsla(180, 33.3333333333%, 45%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn partial() { + assert_eq!( + runner().ok("a {b: hwb(180 30% 40% / 0.5)}\n"), + "a {\ + \n b: hsla(180, 33.3333333333%, 45%, 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn transparent() { + assert_eq!( + runner().ok("a {b: hwb(180 30% 40% / 0)}\n"), + "a {\ + \n b: hsla(180, 33.3333333333%, 45%, 0);\ + \n}\n" + ); + } + } + mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn slash() { + assert_eq!( + runner().ok("a {b: hwb(0 30% 40% / none)}\n"), + "a {\ + \n b: hwb(0deg 30% 40% / none);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn slash_list() { + assert_eq!( + runner().ok("@use \'sass:list\';\ + \na {b: hwb(list.slash(0 30% 40%, none))}\n"), + "a {\ + \n b: hwb(0deg 30% 40% / none);\ + \n}\n" + ); + } + } +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn blackness() { + assert_eq!( + runner().ok("a {b: hwb(0 30% none)}\n"), + "a {\ + \n b: hwb(0deg 30% none);\ + \n}\n" + ); + } + #[test] + fn hue() { + assert_eq!( + runner().ok("a {b: hwb(none 30% 40%)}\n"), + "a {\ + \n b: hwb(none 30% 40%);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn whiteness() { + assert_eq!( + runner().ok("a {b: hwb(0 none 40%)}\n"), + "a {\ + \n b: hwb(0deg none 40%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // wrong result +fn named() { + assert_eq!( + runner().ok("a {b: hwb($channels: 180 30% 40% / 0.4)}\n"), + "a {\ + \n b: hsla(180, 33.3333333333%, 45%, 0.4);\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn no_alpha() { + assert_eq!( + runner().ok("a {b: hwb(180 30% 40%)}\n"), + "a {\ + \n b: hsl(180, 33.3333333333%, 45%);\ + \n}\n" + ); +} +mod relative_color { + #[allow(unused)] + use super::runner; + + mod calc { + #[allow(unused)] + use super::runner; + + #[test] + fn alpha() { + assert_eq!( + runner() + .ok("a {b: hwb(from #aaa calc(h + 180deg) w b / 25%)}\n"), + "a {\ + \n b: hwb(from #aaa calc(h + 180deg) w b/25%);\ + \n}\n" + ); + } + #[test] + fn no_alpha() { + assert_eq!( + runner().ok("a {b: hwb(from #aaa calc(h + 180deg) w b)}\n"), + "a {\ + \n b: hwb(from #aaa calc(h + 180deg) w b);\ + \n}\n" + ); + } + } + mod different_case { + #[allow(unused)] + use super::runner; + + #[test] + fn alpha() { + assert_eq!( + runner().ok("a {b: hwb(From #aaa h w b / 25%)}\n"), + "a {\ + \n b: hwb(From #aaa h w b/25%);\ + \n}\n" + ); + } + #[test] + fn no_alpha() { + assert_eq!( + runner().ok("a {b: hwb(From #aaa h w b)}\n"), + "a {\ + \n b: hwb(From #aaa h w b);\ + \n}\n" + ); + } + } + mod error { + #[allow(unused)] + use super::runner; + + mod quoted { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn alpha() { + assert_eq!( + runner().err( + "a {b: hwb(\"from\" #aaa h w b / 25%)}\n" + ), + "Error: $channels: Expected hue channel to be a number, was \"from\".\ + \n ,\ + \n1 | a {b: hwb(\"from\" #aaa h w b / 25%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn no_alpha() { + assert_eq!( + runner().err( + "a {b: hwb(\"from\" #aaa h w b)}\n" + ), + "Error: $channels: Expected hue channel to be a number, was \"from\".\ + \n ,\ + \n1 | a {b: hwb(\"from\" #aaa h w b)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + } + mod wrong_keyword { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn alpha() { + assert_eq!( + runner().err( + "a {b: hwb(c #aaa h w b / 25%)}\n" + ), + "Error: $channels: Expected hue channel to be a number, was c.\ + \n ,\ + \n1 | a {b: hwb(c #aaa h w b / 25%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn no_alpha() { + assert_eq!( + runner().err( + "a {b: hwb(c #aaa h w b)}\n" + ), + "Error: $channels: Expected hue channel to be a number, was c.\ + \n ,\ + \n1 | a {b: hwb(c #aaa h w b)}\ + \n | ^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + } + } + #[test] + fn slash_list_alpha() { + assert_eq!( + runner().ok("@use \"sass:list\";\ + \na {b: hwb(list.slash(from #aaa h w b, 25%))}\n"), + "a {\ + \n b: hwb(from #aaa h w b / 25%);\ + \n}\n" + ); + } + mod test_static { + #[allow(unused)] + use super::runner; + + #[test] + fn alpha() { + assert_eq!( + runner().ok("a {b: hwb(from #aaa h w b / 25%)}\n"), + "a {\ + \n b: hwb(from #aaa h w b/25%);\ + \n}\n" + ); + } + #[test] + fn no_alpha() { + assert_eq!( + runner().ok("a {b: hwb(from #aaa h w b)}\n"), + "a {\ + \n b: hwb(from #aaa h w b);\ + \n}\n" + ); + } + } + mod var { + #[allow(unused)] + use super::runner; + + #[test] + fn alpha() { + assert_eq!( + runner().ok("a {b: hwb(from var(--c) h w b / 25%)}\n"), + "a {\ + \n b: hwb(from var(--c) h w b/25%);\ + \n}\n" + ); + } + #[test] + fn no_alpha() { + assert_eq!( + runner().ok("a {b: hwb(from var(--c) h w b)}"), + "a {\ + \n b: hwb(from var(--c) h w b);\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/core_functions/color/hwb/mod.rs b/rsass/tests/spec/core_functions/color/hwb/mod.rs index 5ca942120..5307bb3ef 100644 --- a/rsass/tests/spec/core_functions/color/hwb/mod.rs +++ b/rsass/tests/spec/core_functions/color/hwb/mod.rs @@ -9,6 +9,8 @@ mod error; mod four_args; +mod global; + mod one_arg; mod three_args; diff --git a/rsass/tests/spec/core_functions/color/hwb/one_arg.rs b/rsass/tests/spec/core_functions/color/hwb/one_arg.rs index 61989fa7e..0acbab2a7 100644 --- a/rsass/tests/spec/core_functions/color/hwb/one_arg.rs +++ b/rsass/tests/spec/core_functions/color/hwb/one_arg.rs @@ -14,22 +14,24 @@ mod alpha { use super::runner; #[test] + #[ignore] // wrong result fn above() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(0 30% 40% / 1.1)}\n"), "a {\ - \n b: #994d4d;\ + \n b: hsl(0, 33.3333333333%, 45%);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn below() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(0 30% 40% / -0.1)}\n"), "a {\ - \n b: rgba(153, 77, 77, 0);\ + \n b: hsla(0, 33.3333333333%, 45%, 0);\ \n}\n" ); } @@ -39,77 +41,386 @@ mod alpha { use super::runner; #[test] + #[ignore] // wrong result fn named() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb($channels: 180 30% 40% / 0.4)}\n"), "a {\ - \n b: rgba(77, 153, 153, 0.4);\ + \n b: hsla(180, 33.3333333333%, 45%, 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn opaque() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(180 30% 40% / 1)}\n"), "a {\ - \n b: #4d9999;\ + \n b: hsl(180, 33.3333333333%, 45%);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn parenthesized() { assert_eq!( runner().ok( - "@use \'sass:color\';\n\ + "@use \"sass:color\";\n\ \n// Extra parens shouldn\'t cause the slash to be forced into division.\ \na {b: (color.hwb(180 30% 40% / 0.4))}\n" ), "a {\ - \n b: rgba(77, 153, 153, 0.4);\ + \n b: hsla(180, 33.3333333333%, 45%, 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn partial() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(180 30% 40% / 0.5)}\n"), "a {\ - \n b: rgba(77, 153, 153, 0.5);\ + \n b: hsla(180, 33.3333333333%, 45%, 0.5);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn transparent() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(180 30% 40% / 0)}\n"), "a {\ - \n b: rgba(77, 153, 153, 0);\ + \n b: hsla(180, 33.3333333333%, 45%, 0);\ \n}\n" ); } } + #[test] + #[ignore] // unexepected error + fn var() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0 0 0 / var(--c))}\n"), + "a {\ + \n b: hwb(0 0 0/var(--c));\ + \n}\n" + ); + } +} +mod blackness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0 30% 101%)}\n"), + "a {\ + \n b: hsl(0, 0%, 22.9007633588%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0 30% -1%)}\n"), + "a {\ + \n b: hsl(0, 102.8985507246%, 65.5%);\ + \n}\n" + ); + } + mod var { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn alpha() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0 30% var(--c) / 0.5)}\n"), + "a {\ + \n b: hwb(0 30% var(--c)/0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn no_alpha() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0 30% var(--c))}\n"), + "a {\ + \n b: hwb(0 30% var(--c));\ + \n}\n" + ); + } + } +} +mod hue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn var() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(var(--c) 30% 40%)}\n"), + "a {\ + \n b: hwb(var(--c) 30% 40%);\ + \n}\n" + ); + } } #[test] +#[ignore] // wrong result fn named() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb($channels: 180 30% 40% / 0.4)}\n"), "a {\ - \n b: rgba(77, 153, 153, 0.4);\ + \n b: hsla(180, 33.3333333333%, 45%, 0.4);\ \n}\n" ); } #[test] +#[ignore] // wrong result fn no_alpha() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(180 30% 40%)}\n"), "a {\ - \n b: #4d9999;\ + \n b: hsl(180, 33.3333333333%, 45%);\ + \n}\n" + ); +} +mod relative_color { + #[allow(unused)] + use super::runner; + + mod calc { + #[allow(unused)] + use super::runner; + + #[test] + fn alpha() { + assert_eq!( + runner() + .ok("a {b: hwb(from #aaa calc(h + 180deg) w b / 25%)}\n"), + "a {\ + \n b: hwb(from #aaa calc(h + 180deg) w b/25%);\ + \n}\n" + ); + } + #[test] + fn no_alpha() { + assert_eq!( + runner().ok("a {b: hwb(from #aaa calc(h + 180deg) w b)}\n"), + "a {\ + \n b: hwb(from #aaa calc(h + 180deg) w b);\ + \n}\n" + ); + } + } + mod different_case { + #[allow(unused)] + use super::runner; + + #[test] + fn alpha() { + assert_eq!( + runner().ok("a {b: hwb(From #aaa h w b / 25%)}\n"), + "a {\ + \n b: hwb(From #aaa h w b/25%);\ + \n}\n" + ); + } + #[test] + fn no_alpha() { + assert_eq!( + runner().ok("a {b: hwb(From #aaa h w b)}\n"), + "a {\ + \n b: hwb(From #aaa h w b);\ \n}\n" + ); + } + } + mod error { + #[allow(unused)] + use super::runner; + + mod quoted { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn alpha() { + assert_eq!( + runner().err( + "a {b: hwb(\"from\" #aaa h w b / 25%)}\n" + ), + "Error: $channels: Expected hue channel to be a number, was \"from\".\ + \n ,\ + \n1 | a {b: hwb(\"from\" #aaa h w b / 25%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn no_alpha() { + assert_eq!( + runner().err( + "a {b: hwb(\"from\" #aaa h w b)}\n" + ), + "Error: $channels: Expected hue channel to be a number, was \"from\".\ + \n ,\ + \n1 | a {b: hwb(\"from\" #aaa h w b)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + } + mod wrong_keyword { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn alpha() { + assert_eq!( + runner().err( + "a {b: hwb(c #aaa h w b / 25%)}\n" + ), + "Error: $channels: Expected hue channel to be a number, was c.\ + \n ,\ + \n1 | a {b: hwb(c #aaa h w b / 25%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", ); + } + #[test] + #[ignore] // missing error + fn no_alpha() { + assert_eq!( + runner().err( + "a {b: hwb(c #aaa h w b)}\n" + ), + "Error: $channels: Expected hue channel to be a number, was c.\ + \n ,\ + \n1 | a {b: hwb(c #aaa h w b)}\ + \n | ^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + } + } + #[test] + fn slash_list_alpha() { + assert_eq!( + runner().ok("@use \"sass:list\";\ + \na {b: hwb(list.slash(from #aaa h w b, 25%))}\n"), + "a {\ + \n b: hwb(from #aaa h w b / 25%);\ + \n}\n" + ); + } + mod test_static { + #[allow(unused)] + use super::runner; + + #[test] + fn alpha() { + assert_eq!( + runner().ok("a {b: hwb(from #aaa h w b / 25%)}\n"), + "a {\ + \n b: hwb(from #aaa h w b/25%);\ + \n}\n" + ); + } + #[test] + fn no_alpha() { + assert_eq!( + runner().ok("a {b: hwb(from #aaa h w b)}\n"), + "a {\ + \n b: hwb(from #aaa h w b);\ + \n}\n" + ); + } + } + mod var { + #[allow(unused)] + use super::runner; + + #[test] + fn alpha() { + assert_eq!( + runner().ok("a {b: hwb(from var(--c) h w b / 25%)}\n"), + "a {\ + \n b: hwb(from var(--c) h w b/25%);\ + \n}\n" + ); + } + #[test] + fn no_alpha() { + assert_eq!( + runner().ok("a {b: hwb(from var(--c) h w b)}"), + "a {\ + \n b: hwb(from var(--c) h w b);\ + \n}\n" + ); + } + } +} +mod whiteness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0 101% 40%)}\n"), + "a {\ + \n b: hsl(0, 0%, 71.6312056738%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0 -1% 40%)}\n"), + "a {\ + \n b: hsl(0, 103.3898305085%, 29.5%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn var() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hwb(0 var(--c) 40%)}\n"), + "a {\ + \n b: hwb(0 var(--c) 40%);\ + \n}\n" + ); + } } diff --git a/rsass/tests/spec/core_functions/color/hwb/three_args/bounds.rs b/rsass/tests/spec/core_functions/color/hwb/three_args/bounds.rs new file mode 100644 index 000000000..09d815cff --- /dev/null +++ b/rsass/tests/spec/core_functions/color/hwb/three_args/bounds.rs @@ -0,0 +1,281 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/hwb/three_args/bounds.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("bounds") +} + +mod blackness { + #[allow(unused)] + use super::runner; + + mod above { + #[allow(unused)] + use super::runner; + + mod whiteness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.hwb(0, 120%, 150%));\n"), + "a {\ + \n value: hsl(0, 0%, 44.4444444444%);\ + \n space: hwb;\ + \n channels: 0deg 44.4444444444% 55.5555555556% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.hwb(0, -20%, 150%));\n"), + "a {\ + \n value: hsl(0, 0%, -15.3846153846%);\ + \n space: hwb;\ + \n channels: 0deg -15.3846153846% 115.3846153846% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn mid() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.hwb(0, 10%, 150%));\n"), + "a {\ + \n value: hsl(0, 0%, 6.25%);\ + \n space: hwb;\ + \n channels: 0deg 6.25% 93.75% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.hwb(0, 0%, 150%));\n"), + "a {\ + \n value: black;\ + \n space: hwb;\ + \n channels: 0deg 0% 100% / 1;\ + \n}\n" + ); + } + } + } + mod below { + #[allow(unused)] + use super::runner; + + mod whiteness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.hwb(0, 120%, -50%));\n"), + "a {\ + \n value: hsl(180, 42.8571428571%, 135%);\ + \n space: hwb;\ + \n channels: 0deg 120% -50% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.hwb(0, -20%, -50%));\n"), + "a {\ + \n value: hsl(0, 242.8571428571%, 65%);\ + \n space: hwb;\ + \n channels: 0deg -20% -50% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn mid() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.hwb(0, 10%, -50%));\n"), + "a {\ + \n value: hsl(0, 350%, 80%);\ + \n space: hwb;\ + \n channels: 0deg 10% -50% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.hwb(0, 0%, -50%));\n"), + "a {\ + \n value: hsl(0, 300%, 75%);\ + \n space: hwb;\ + \n channels: 0deg 0% -50% / 1;\ + \n}\n" + ); + } + } + } +} +mod whiteness { + #[allow(unused)] + use super::runner; + + mod above { + #[allow(unused)] + use super::runner; + + mod blackness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.hwb(0, 150%, 120%));\n"), + "a {\ + \n value: hsl(0, 0%, 55.5555555556%);\ + \n space: hwb;\ + \n channels: 0deg 55.5555555556% 44.4444444444% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.hwb(0, 150%, -20%));\n"), + "a {\ + \n value: hsl(0, 0%, 115.3846153846%);\ + \n space: hwb;\ + \n channels: 0deg 115.3846153846% -15.3846153846% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn mid() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.hwb(0, 150%, 10%));\n"), + "a {\ + \n value: hsl(0, 0%, 93.75%);\ + \n space: hwb;\ + \n channels: 0deg 93.75% 6.25% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.hwb(0, 150%, 0%));\n"), + "a {\ + \n value: white;\ + \n space: hwb;\ + \n channels: 0deg 100% 0% / 1;\ + \n}\n" + ); + } + } + } + mod below { + #[allow(unused)] + use super::runner; + + mod blackness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.hwb(0, -50%, 120%));\n"), + "a {\ + \n value: hsl(180, 42.8571428571%, -35%);\ + \n space: hwb;\ + \n channels: 0deg -50% 120% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.hwb(0, -50%, -20%));\n"), + "a {\ + \n value: hsl(0, 242.8571428571%, 35%);\ + \n space: hwb;\ + \n channels: 0deg -50% -20% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn mid() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.hwb(0, -50%, 10%));\n"), + "a {\ + \n value: hsl(0, 350%, 20%);\ + \n space: hwb;\ + \n channels: 0deg -50% 10% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.hwb(0, -50%, 0%));\n"), + "a {\ + \n value: hsl(0, 300%, 25%);\ + \n space: hwb;\ + \n channels: 0deg -50% 0% / 1;\ + \n}\n" + ); + } + } + } +} diff --git a/rsass/tests/spec/core_functions/color/hwb/three_args/mod.rs b/rsass/tests/spec/core_functions/color/hwb/three_args/mod.rs index 363ae5bcb..6cf0c46cf 100644 --- a/rsass/tests/spec/core_functions/color/hwb/three_args/mod.rs +++ b/rsass/tests/spec/core_functions/color/hwb/three_args/mod.rs @@ -5,6 +5,8 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("three_args") } +mod bounds; + mod named; mod units; diff --git a/rsass/tests/spec/core_functions/color/hwb/three_args/named.rs b/rsass/tests/spec/core_functions/color/hwb/three_args/named.rs index 2253c2d11..a764bc490 100644 --- a/rsass/tests/spec/core_functions/color/hwb/three_args/named.rs +++ b/rsass/tests/spec/core_functions/color/hwb/three_args/named.rs @@ -6,14 +6,15 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.hwb($hue: 0, $whiteness: 30%, $blackness: 40%)}\n" ), "a {\ - \n b: #994d4d;\ + \n b: hsl(0, 33.3333333333%, 45%);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/hwb/three_args/units.rs b/rsass/tests/spec/core_functions/color/hwb/three_args/units.rs index bf8c41687..d270da5a6 100644 --- a/rsass/tests/spec/core_functions/color/hwb/three_args/units.rs +++ b/rsass/tests/spec/core_functions/color/hwb/three_args/units.rs @@ -10,12 +10,13 @@ mod hue { use super::runner; #[test] + #[ignore] // wrong result fn deg() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(0deg, 30%, 40%)}\n"), "a {\ - \n b: #994d4d;\ + \n b: hsl(0, 33.3333333333%, 45%);\ \n}\n" ); } @@ -23,20 +24,21 @@ mod hue { #[ignore] // unexepected error fn non_angle() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(1in, 30%, 40%)}\n"), "a {\ - \n b: #994e4d;\ + \n b: hsl(1, 33.3333333333%, 45%);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn rad() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.hwb(1rad, 30%, 40%)}\n"), "a {\ - \n b: #99964d;\ + \n b: hsl(57.2957795131, 33.3333333333%, 45%);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/blue_magentas.rs b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/blue_magentas.rs index 6a90b4a4f..0ff196795 100644 --- a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/blue_magentas.rs +++ b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/blue_magentas.rs @@ -6,57 +6,58 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("@use \'../test-hue\' as *;\ \n@include test-hue(270);\n"), "whiteness-0 {\ - \n blackness-0: #8000ff;\ + \n blackness-0: hsl(270, 100%, 50%);\ \n blackness-20: #6600cc;\ - \n blackness-40: #4d0099;\ + \n blackness-40: hsl(270, 100%, 30%);\ \n blackness-60: #330066;\ - \n blackness-80: #1a0033;\ + \n blackness-80: hsl(270, 100%, 10%);\ \n blackness-100: black;\ \n}\ \nwhiteness-20 {\ \n blackness-0: #9933ff;\ - \n blackness-20: #8033cc;\ + \n blackness-20: hsl(270, 60%, 50%);\ \n blackness-40: rebeccapurple;\ - \n blackness-60: #4d3366;\ + \n blackness-60: hsl(270, 33.3333333333%, 30%);\ \n blackness-80: #333333;\ - \n blackness-100: #2b2b2b;\ + \n blackness-100: hsl(0, 0%, 16.6666666667%);\ \n}\ \nwhiteness-40 {\ - \n blackness-0: #b366ff;\ + \n blackness-0: hsl(270, 100%, 70%);\ \n blackness-20: #9966cc;\ - \n blackness-40: #806699;\ + \n blackness-40: hsl(270, 20%, 50%);\ \n blackness-60: #666666;\ \n blackness-80: #555555;\ - \n blackness-100: #494949;\ + \n blackness-100: hsl(0, 0%, 28.5714285714%);\ \n}\ \nwhiteness-60 {\ \n blackness-0: #cc99ff;\ - \n blackness-20: #b399cc;\ + \n blackness-20: hsl(270, 33.3333333333%, 70%);\ \n blackness-40: #999999;\ - \n blackness-60: gray;\ - \n blackness-80: #6d6d6d;\ - \n blackness-100: #606060;\ + \n blackness-60: hsl(0, 0%, 50%);\ + \n blackness-80: hsl(0, 0%, 42.8571428571%);\ + \n blackness-100: hsl(0, 0%, 37.5%);\ \n}\ \nwhiteness-80 {\ - \n blackness-0: #e6ccff;\ + \n blackness-0: hsl(270, 100%, 90%);\ \n blackness-20: #cccccc;\ \n blackness-40: #aaaaaa;\ - \n blackness-60: #929292;\ - \n blackness-80: gray;\ - \n blackness-100: #717171;\ + \n blackness-60: hsl(0, 0%, 57.1428571429%);\ + \n blackness-80: hsl(0, 0%, 50%);\ + \n blackness-100: hsl(0, 0%, 44.4444444444%);\ \n}\ \nwhiteness-100 {\ \n blackness-0: white;\ - \n blackness-20: #d5d5d5;\ - \n blackness-40: #b6b6b6;\ - \n blackness-60: #9f9f9f;\ - \n blackness-80: #8e8e8e;\ - \n blackness-100: gray;\ + \n blackness-20: hsl(0, 0%, 83.3333333333%);\ + \n blackness-40: hsl(0, 0%, 71.4285714286%);\ + \n blackness-60: hsl(0, 0%, 62.5%);\ + \n blackness-80: hsl(0, 0%, 55.5555555556%);\ + \n blackness-100: hsl(0, 0%, 50%);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/blues.rs b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/blues.rs index b9850aebd..fb5c314d9 100644 --- a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/blues.rs +++ b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/blues.rs @@ -6,6 +6,7 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("@use \'../test-hue\' as *;\ @@ -24,7 +25,7 @@ fn test() { \n blackness-40: #333399;\ \n blackness-60: #333366;\ \n blackness-80: #333333;\ - \n blackness-100: #2b2b2b;\ + \n blackness-100: hsl(0, 0%, 16.6666666667%);\ \n}\ \nwhiteness-40 {\ \n blackness-0: #6666ff;\ @@ -32,31 +33,31 @@ fn test() { \n blackness-40: #666699;\ \n blackness-60: #666666;\ \n blackness-80: #555555;\ - \n blackness-100: #494949;\ + \n blackness-100: hsl(0, 0%, 28.5714285714%);\ \n}\ \nwhiteness-60 {\ \n blackness-0: #9999ff;\ \n blackness-20: #9999cc;\ \n blackness-40: #999999;\ - \n blackness-60: gray;\ - \n blackness-80: #6d6d6d;\ - \n blackness-100: #606060;\ + \n blackness-60: hsl(0, 0%, 50%);\ + \n blackness-80: hsl(0, 0%, 42.8571428571%);\ + \n blackness-100: hsl(0, 0%, 37.5%);\ \n}\ \nwhiteness-80 {\ \n blackness-0: #ccccff;\ \n blackness-20: #cccccc;\ \n blackness-40: #aaaaaa;\ - \n blackness-60: #929292;\ - \n blackness-80: gray;\ - \n blackness-100: #717171;\ + \n blackness-60: hsl(0, 0%, 57.1428571429%);\ + \n blackness-80: hsl(0, 0%, 50%);\ + \n blackness-100: hsl(0, 0%, 44.4444444444%);\ \n}\ \nwhiteness-100 {\ \n blackness-0: white;\ - \n blackness-20: #d5d5d5;\ - \n blackness-40: #b6b6b6;\ - \n blackness-60: #9f9f9f;\ - \n blackness-80: #8e8e8e;\ - \n blackness-100: gray;\ + \n blackness-20: hsl(0, 0%, 83.3333333333%);\ + \n blackness-40: hsl(0, 0%, 71.4285714286%);\ + \n blackness-60: hsl(0, 0%, 62.5%);\ + \n blackness-80: hsl(0, 0%, 55.5555555556%);\ + \n blackness-100: hsl(0, 0%, 50%);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/cyan_blues.rs b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/cyan_blues.rs index 99793e8ea..0435787e5 100644 --- a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/cyan_blues.rs +++ b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/cyan_blues.rs @@ -6,57 +6,58 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("@use \'../test-hue\' as *;\ \n@include test-hue(210);\n"), "whiteness-0 {\ - \n blackness-0: #0080ff;\ + \n blackness-0: hsl(210, 100%, 50%);\ \n blackness-20: #0066cc;\ - \n blackness-40: #004d99;\ + \n blackness-40: hsl(210, 100%, 30%);\ \n blackness-60: #003366;\ - \n blackness-80: #001a33;\ + \n blackness-80: hsl(210, 100%, 10%);\ \n blackness-100: black;\ \n}\ \nwhiteness-20 {\ \n blackness-0: #3399ff;\ - \n blackness-20: #3380cc;\ + \n blackness-20: hsl(210, 60%, 50%);\ \n blackness-40: #336699;\ - \n blackness-60: #334d66;\ + \n blackness-60: hsl(210, 33.3333333333%, 30%);\ \n blackness-80: #333333;\ - \n blackness-100: #2b2b2b;\ + \n blackness-100: hsl(0, 0%, 16.6666666667%);\ \n}\ \nwhiteness-40 {\ - \n blackness-0: #66b3ff;\ + \n blackness-0: hsl(210, 100%, 70%);\ \n blackness-20: #6699cc;\ - \n blackness-40: #668099;\ + \n blackness-40: hsl(210, 20%, 50%);\ \n blackness-60: #666666;\ \n blackness-80: #555555;\ - \n blackness-100: #494949;\ + \n blackness-100: hsl(0, 0%, 28.5714285714%);\ \n}\ \nwhiteness-60 {\ \n blackness-0: #99ccff;\ - \n blackness-20: #99b3cc;\ + \n blackness-20: hsl(210, 33.3333333333%, 70%);\ \n blackness-40: #999999;\ - \n blackness-60: gray;\ - \n blackness-80: #6d6d6d;\ - \n blackness-100: #606060;\ + \n blackness-60: hsl(0, 0%, 50%);\ + \n blackness-80: hsl(0, 0%, 42.8571428571%);\ + \n blackness-100: hsl(0, 0%, 37.5%);\ \n}\ \nwhiteness-80 {\ - \n blackness-0: #cce6ff;\ + \n blackness-0: hsl(210, 100%, 90%);\ \n blackness-20: #cccccc;\ \n blackness-40: #aaaaaa;\ - \n blackness-60: #929292;\ - \n blackness-80: gray;\ - \n blackness-100: #717171;\ + \n blackness-60: hsl(0, 0%, 57.1428571429%);\ + \n blackness-80: hsl(0, 0%, 50%);\ + \n blackness-100: hsl(0, 0%, 44.4444444444%);\ \n}\ \nwhiteness-100 {\ \n blackness-0: white;\ - \n blackness-20: #d5d5d5;\ - \n blackness-40: #b6b6b6;\ - \n blackness-60: #9f9f9f;\ - \n blackness-80: #8e8e8e;\ - \n blackness-100: gray;\ + \n blackness-20: hsl(0, 0%, 83.3333333333%);\ + \n blackness-40: hsl(0, 0%, 71.4285714286%);\ + \n blackness-60: hsl(0, 0%, 62.5%);\ + \n blackness-80: hsl(0, 0%, 55.5555555556%);\ + \n blackness-100: hsl(0, 0%, 50%);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/cyans.rs b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/cyans.rs index 3cb7eef3e..145350a4e 100644 --- a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/cyans.rs +++ b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/cyans.rs @@ -6,6 +6,7 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("@use \'../test-hue\' as *;\ @@ -24,7 +25,7 @@ fn test() { \n blackness-40: #339999;\ \n blackness-60: #336666;\ \n blackness-80: #333333;\ - \n blackness-100: #2b2b2b;\ + \n blackness-100: hsl(0, 0%, 16.6666666667%);\ \n}\ \nwhiteness-40 {\ \n blackness-0: #66ffff;\ @@ -32,31 +33,31 @@ fn test() { \n blackness-40: #669999;\ \n blackness-60: #666666;\ \n blackness-80: #555555;\ - \n blackness-100: #494949;\ + \n blackness-100: hsl(0, 0%, 28.5714285714%);\ \n}\ \nwhiteness-60 {\ \n blackness-0: #99ffff;\ \n blackness-20: #99cccc;\ \n blackness-40: #999999;\ - \n blackness-60: gray;\ - \n blackness-80: #6d6d6d;\ - \n blackness-100: #606060;\ + \n blackness-60: hsl(0, 0%, 50%);\ + \n blackness-80: hsl(0, 0%, 42.8571428571%);\ + \n blackness-100: hsl(0, 0%, 37.5%);\ \n}\ \nwhiteness-80 {\ \n blackness-0: #ccffff;\ \n blackness-20: #cccccc;\ \n blackness-40: #aaaaaa;\ - \n blackness-60: #929292;\ - \n blackness-80: gray;\ - \n blackness-100: #717171;\ + \n blackness-60: hsl(0, 0%, 57.1428571429%);\ + \n blackness-80: hsl(0, 0%, 50%);\ + \n blackness-100: hsl(0, 0%, 44.4444444444%);\ \n}\ \nwhiteness-100 {\ \n blackness-0: white;\ - \n blackness-20: #d5d5d5;\ - \n blackness-40: #b6b6b6;\ - \n blackness-60: #9f9f9f;\ - \n blackness-80: #8e8e8e;\ - \n blackness-100: gray;\ + \n blackness-20: hsl(0, 0%, 83.3333333333%);\ + \n blackness-40: hsl(0, 0%, 71.4285714286%);\ + \n blackness-60: hsl(0, 0%, 62.5%);\ + \n blackness-80: hsl(0, 0%, 55.5555555556%);\ + \n blackness-100: hsl(0, 0%, 50%);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/green_cyans.rs b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/green_cyans.rs index ecd7ff17e..2500a7dc4 100644 --- a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/green_cyans.rs +++ b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/green_cyans.rs @@ -6,57 +6,58 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("@use \'../test-hue\' as *;\ \n@include test-hue(150);\n"), "whiteness-0 {\ - \n blackness-0: #00ff80;\ + \n blackness-0: hsl(150, 100%, 50%);\ \n blackness-20: #00cc66;\ - \n blackness-40: #00994d;\ + \n blackness-40: hsl(150, 100%, 30%);\ \n blackness-60: #006633;\ - \n blackness-80: #00331a;\ + \n blackness-80: hsl(150, 100%, 10%);\ \n blackness-100: black;\ \n}\ \nwhiteness-20 {\ \n blackness-0: #33ff99;\ - \n blackness-20: #33cc80;\ + \n blackness-20: hsl(150, 60%, 50%);\ \n blackness-40: #339966;\ - \n blackness-60: #33664d;\ + \n blackness-60: hsl(150, 33.3333333333%, 30%);\ \n blackness-80: #333333;\ - \n blackness-100: #2b2b2b;\ + \n blackness-100: hsl(0, 0%, 16.6666666667%);\ \n}\ \nwhiteness-40 {\ - \n blackness-0: #66ffb3;\ + \n blackness-0: hsl(150, 100%, 70%);\ \n blackness-20: #66cc99;\ - \n blackness-40: #669980;\ + \n blackness-40: hsl(150, 20%, 50%);\ \n blackness-60: #666666;\ \n blackness-80: #555555;\ - \n blackness-100: #494949;\ + \n blackness-100: hsl(0, 0%, 28.5714285714%);\ \n}\ \nwhiteness-60 {\ \n blackness-0: #99ffcc;\ - \n blackness-20: #99ccb3;\ + \n blackness-20: hsl(150, 33.3333333333%, 70%);\ \n blackness-40: #999999;\ - \n blackness-60: gray;\ - \n blackness-80: #6d6d6d;\ - \n blackness-100: #606060;\ + \n blackness-60: hsl(0, 0%, 50%);\ + \n blackness-80: hsl(0, 0%, 42.8571428571%);\ + \n blackness-100: hsl(0, 0%, 37.5%);\ \n}\ \nwhiteness-80 {\ - \n blackness-0: #ccffe6;\ + \n blackness-0: hsl(150, 100%, 90%);\ \n blackness-20: #cccccc;\ \n blackness-40: #aaaaaa;\ - \n blackness-60: #929292;\ - \n blackness-80: gray;\ - \n blackness-100: #717171;\ + \n blackness-60: hsl(0, 0%, 57.1428571429%);\ + \n blackness-80: hsl(0, 0%, 50%);\ + \n blackness-100: hsl(0, 0%, 44.4444444444%);\ \n}\ \nwhiteness-100 {\ \n blackness-0: white;\ - \n blackness-20: #d5d5d5;\ - \n blackness-40: #b6b6b6;\ - \n blackness-60: #9f9f9f;\ - \n blackness-80: #8e8e8e;\ - \n blackness-100: gray;\ + \n blackness-20: hsl(0, 0%, 83.3333333333%);\ + \n blackness-40: hsl(0, 0%, 71.4285714286%);\ + \n blackness-60: hsl(0, 0%, 62.5%);\ + \n blackness-80: hsl(0, 0%, 55.5555555556%);\ + \n blackness-100: hsl(0, 0%, 50%);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/greens.rs b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/greens.rs index a7ee834d9..a795569f2 100644 --- a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/greens.rs +++ b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/greens.rs @@ -6,6 +6,7 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("@use \'../test-hue\' as *;\ @@ -24,7 +25,7 @@ fn test() { \n blackness-40: #339933;\ \n blackness-60: #336633;\ \n blackness-80: #333333;\ - \n blackness-100: #2b2b2b;\ + \n blackness-100: hsl(0, 0%, 16.6666666667%);\ \n}\ \nwhiteness-40 {\ \n blackness-0: #66ff66;\ @@ -32,31 +33,31 @@ fn test() { \n blackness-40: #669966;\ \n blackness-60: #666666;\ \n blackness-80: #555555;\ - \n blackness-100: #494949;\ + \n blackness-100: hsl(0, 0%, 28.5714285714%);\ \n}\ \nwhiteness-60 {\ \n blackness-0: #99ff99;\ \n blackness-20: #99cc99;\ \n blackness-40: #999999;\ - \n blackness-60: gray;\ - \n blackness-80: #6d6d6d;\ - \n blackness-100: #606060;\ + \n blackness-60: hsl(0, 0%, 50%);\ + \n blackness-80: hsl(0, 0%, 42.8571428571%);\ + \n blackness-100: hsl(0, 0%, 37.5%);\ \n}\ \nwhiteness-80 {\ \n blackness-0: #ccffcc;\ \n blackness-20: #cccccc;\ \n blackness-40: #aaaaaa;\ - \n blackness-60: #929292;\ - \n blackness-80: gray;\ - \n blackness-100: #717171;\ + \n blackness-60: hsl(0, 0%, 57.1428571429%);\ + \n blackness-80: hsl(0, 0%, 50%);\ + \n blackness-100: hsl(0, 0%, 44.4444444444%);\ \n}\ \nwhiteness-100 {\ \n blackness-0: white;\ - \n blackness-20: #d5d5d5;\ - \n blackness-40: #b6b6b6;\ - \n blackness-60: #9f9f9f;\ - \n blackness-80: #8e8e8e;\ - \n blackness-100: gray;\ + \n blackness-20: hsl(0, 0%, 83.3333333333%);\ + \n blackness-40: hsl(0, 0%, 71.4285714286%);\ + \n blackness-60: hsl(0, 0%, 62.5%);\ + \n blackness-80: hsl(0, 0%, 55.5555555556%);\ + \n blackness-100: hsl(0, 0%, 50%);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/magenta_reds.rs b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/magenta_reds.rs index 6da6f6fd6..c6ae2ad36 100644 --- a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/magenta_reds.rs +++ b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/magenta_reds.rs @@ -6,57 +6,58 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("@use \'../test-hue\' as *;\ \n@include test-hue(330);\n"), "whiteness-0 {\ - \n blackness-0: #ff0080;\ + \n blackness-0: hsl(330, 100%, 50%);\ \n blackness-20: #cc0066;\ - \n blackness-40: #99004d;\ + \n blackness-40: hsl(330, 100%, 30%);\ \n blackness-60: #660033;\ - \n blackness-80: #33001a;\ + \n blackness-80: hsl(330, 100%, 10%);\ \n blackness-100: black;\ \n}\ \nwhiteness-20 {\ \n blackness-0: #ff3399;\ - \n blackness-20: #cc3380;\ + \n blackness-20: hsl(330, 60%, 50%);\ \n blackness-40: #993366;\ - \n blackness-60: #66334d;\ + \n blackness-60: hsl(330, 33.3333333333%, 30%);\ \n blackness-80: #333333;\ - \n blackness-100: #2b2b2b;\ + \n blackness-100: hsl(0, 0%, 16.6666666667%);\ \n}\ \nwhiteness-40 {\ - \n blackness-0: #ff66b3;\ + \n blackness-0: hsl(330, 100%, 70%);\ \n blackness-20: #cc6699;\ - \n blackness-40: #996680;\ + \n blackness-40: hsl(330, 20%, 50%);\ \n blackness-60: #666666;\ \n blackness-80: #555555;\ - \n blackness-100: #494949;\ + \n blackness-100: hsl(0, 0%, 28.5714285714%);\ \n}\ \nwhiteness-60 {\ \n blackness-0: #ff99cc;\ - \n blackness-20: #cc99b3;\ + \n blackness-20: hsl(330, 33.3333333333%, 70%);\ \n blackness-40: #999999;\ - \n blackness-60: gray;\ - \n blackness-80: #6d6d6d;\ - \n blackness-100: #606060;\ + \n blackness-60: hsl(0, 0%, 50%);\ + \n blackness-80: hsl(0, 0%, 42.8571428571%);\ + \n blackness-100: hsl(0, 0%, 37.5%);\ \n}\ \nwhiteness-80 {\ - \n blackness-0: #ffcce6;\ + \n blackness-0: hsl(330, 100%, 90%);\ \n blackness-20: #cccccc;\ \n blackness-40: #aaaaaa;\ - \n blackness-60: #929292;\ - \n blackness-80: gray;\ - \n blackness-100: #717171;\ + \n blackness-60: hsl(0, 0%, 57.1428571429%);\ + \n blackness-80: hsl(0, 0%, 50%);\ + \n blackness-100: hsl(0, 0%, 44.4444444444%);\ \n}\ \nwhiteness-100 {\ \n blackness-0: white;\ - \n blackness-20: #d5d5d5;\ - \n blackness-40: #b6b6b6;\ - \n blackness-60: #9f9f9f;\ - \n blackness-80: #8e8e8e;\ - \n blackness-100: gray;\ + \n blackness-20: hsl(0, 0%, 83.3333333333%);\ + \n blackness-40: hsl(0, 0%, 71.4285714286%);\ + \n blackness-60: hsl(0, 0%, 62.5%);\ + \n blackness-80: hsl(0, 0%, 55.5555555556%);\ + \n blackness-100: hsl(0, 0%, 50%);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/magentas.rs b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/magentas.rs index 652c0b6ac..0a3c4f237 100644 --- a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/magentas.rs +++ b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/magentas.rs @@ -6,6 +6,7 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("@use \'../test-hue\' as *;\ @@ -24,7 +25,7 @@ fn test() { \n blackness-40: #993399;\ \n blackness-60: #663366;\ \n blackness-80: #333333;\ - \n blackness-100: #2b2b2b;\ + \n blackness-100: hsl(0, 0%, 16.6666666667%);\ \n}\ \nwhiteness-40 {\ \n blackness-0: #ff66ff;\ @@ -32,31 +33,31 @@ fn test() { \n blackness-40: #996699;\ \n blackness-60: #666666;\ \n blackness-80: #555555;\ - \n blackness-100: #494949;\ + \n blackness-100: hsl(0, 0%, 28.5714285714%);\ \n}\ \nwhiteness-60 {\ \n blackness-0: #ff99ff;\ \n blackness-20: #cc99cc;\ \n blackness-40: #999999;\ - \n blackness-60: gray;\ - \n blackness-80: #6d6d6d;\ - \n blackness-100: #606060;\ + \n blackness-60: hsl(0, 0%, 50%);\ + \n blackness-80: hsl(0, 0%, 42.8571428571%);\ + \n blackness-100: hsl(0, 0%, 37.5%);\ \n}\ \nwhiteness-80 {\ \n blackness-0: #ffccff;\ \n blackness-20: #cccccc;\ \n blackness-40: #aaaaaa;\ - \n blackness-60: #929292;\ - \n blackness-80: gray;\ - \n blackness-100: #717171;\ + \n blackness-60: hsl(0, 0%, 57.1428571429%);\ + \n blackness-80: hsl(0, 0%, 50%);\ + \n blackness-100: hsl(0, 0%, 44.4444444444%);\ \n}\ \nwhiteness-100 {\ \n blackness-0: white;\ - \n blackness-20: #d5d5d5;\ - \n blackness-40: #b6b6b6;\ - \n blackness-60: #9f9f9f;\ - \n blackness-80: #8e8e8e;\ - \n blackness-100: gray;\ + \n blackness-20: hsl(0, 0%, 83.3333333333%);\ + \n blackness-40: hsl(0, 0%, 71.4285714286%);\ + \n blackness-60: hsl(0, 0%, 62.5%);\ + \n blackness-80: hsl(0, 0%, 55.5555555556%);\ + \n blackness-100: hsl(0, 0%, 50%);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/oranges.rs b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/oranges.rs index 7c610ab1d..726ce61f0 100644 --- a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/oranges.rs +++ b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/oranges.rs @@ -6,57 +6,58 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("@use \'../test-hue\' as *;\ \n@include test-hue(30);\n"), "whiteness-0 {\ - \n blackness-0: #ff8000;\ + \n blackness-0: hsl(30, 100%, 50%);\ \n blackness-20: #cc6600;\ - \n blackness-40: #994d00;\ + \n blackness-40: hsl(30, 100%, 30%);\ \n blackness-60: #663300;\ - \n blackness-80: #331a00;\ + \n blackness-80: hsl(30, 100%, 10%);\ \n blackness-100: black;\ \n}\ \nwhiteness-20 {\ \n blackness-0: #ff9933;\ - \n blackness-20: #cc8033;\ + \n blackness-20: hsl(30, 60%, 50%);\ \n blackness-40: #996633;\ - \n blackness-60: #664d33;\ + \n blackness-60: hsl(30, 33.3333333333%, 30%);\ \n blackness-80: #333333;\ - \n blackness-100: #2b2b2b;\ + \n blackness-100: hsl(0, 0%, 16.6666666667%);\ \n}\ \nwhiteness-40 {\ - \n blackness-0: #ffb366;\ + \n blackness-0: hsl(30, 100%, 70%);\ \n blackness-20: #cc9966;\ - \n blackness-40: #998066;\ + \n blackness-40: hsl(30, 20%, 50%);\ \n blackness-60: #666666;\ \n blackness-80: #555555;\ - \n blackness-100: #494949;\ + \n blackness-100: hsl(0, 0%, 28.5714285714%);\ \n}\ \nwhiteness-60 {\ \n blackness-0: #ffcc99;\ - \n blackness-20: #ccb399;\ + \n blackness-20: hsl(30, 33.3333333333%, 70%);\ \n blackness-40: #999999;\ - \n blackness-60: gray;\ - \n blackness-80: #6d6d6d;\ - \n blackness-100: #606060;\ + \n blackness-60: hsl(0, 0%, 50%);\ + \n blackness-80: hsl(0, 0%, 42.8571428571%);\ + \n blackness-100: hsl(0, 0%, 37.5%);\ \n}\ \nwhiteness-80 {\ - \n blackness-0: #ffe6cc;\ + \n blackness-0: hsl(30, 100%, 90%);\ \n blackness-20: #cccccc;\ \n blackness-40: #aaaaaa;\ - \n blackness-60: #929292;\ - \n blackness-80: gray;\ - \n blackness-100: #717171;\ + \n blackness-60: hsl(0, 0%, 57.1428571429%);\ + \n blackness-80: hsl(0, 0%, 50%);\ + \n blackness-100: hsl(0, 0%, 44.4444444444%);\ \n}\ \nwhiteness-100 {\ \n blackness-0: white;\ - \n blackness-20: #d5d5d5;\ - \n blackness-40: #b6b6b6;\ - \n blackness-60: #9f9f9f;\ - \n blackness-80: #8e8e8e;\ - \n blackness-100: gray;\ + \n blackness-20: hsl(0, 0%, 83.3333333333%);\ + \n blackness-40: hsl(0, 0%, 71.4285714286%);\ + \n blackness-60: hsl(0, 0%, 62.5%);\ + \n blackness-80: hsl(0, 0%, 55.5555555556%);\ + \n blackness-100: hsl(0, 0%, 50%);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/reds.rs b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/reds.rs index 00cd151e9..6ff3c193b 100644 --- a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/reds.rs +++ b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/reds.rs @@ -6,6 +6,7 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("@use \'../test-hue\' as *;\ @@ -24,7 +25,7 @@ fn test() { \n blackness-40: #993333;\ \n blackness-60: #663333;\ \n blackness-80: #333333;\ - \n blackness-100: #2b2b2b;\ + \n blackness-100: hsl(0, 0%, 16.6666666667%);\ \n}\ \nwhiteness-40 {\ \n blackness-0: #ff6666;\ @@ -32,31 +33,31 @@ fn test() { \n blackness-40: #996666;\ \n blackness-60: #666666;\ \n blackness-80: #555555;\ - \n blackness-100: #494949;\ + \n blackness-100: hsl(0, 0%, 28.5714285714%);\ \n}\ \nwhiteness-60 {\ \n blackness-0: #ff9999;\ \n blackness-20: #cc9999;\ \n blackness-40: #999999;\ - \n blackness-60: gray;\ - \n blackness-80: #6d6d6d;\ - \n blackness-100: #606060;\ + \n blackness-60: hsl(0, 0%, 50%);\ + \n blackness-80: hsl(0, 0%, 42.8571428571%);\ + \n blackness-100: hsl(0, 0%, 37.5%);\ \n}\ \nwhiteness-80 {\ \n blackness-0: #ffcccc;\ \n blackness-20: #cccccc;\ \n blackness-40: #aaaaaa;\ - \n blackness-60: #929292;\ - \n blackness-80: gray;\ - \n blackness-100: #717171;\ + \n blackness-60: hsl(0, 0%, 57.1428571429%);\ + \n blackness-80: hsl(0, 0%, 50%);\ + \n blackness-100: hsl(0, 0%, 44.4444444444%);\ \n}\ \nwhiteness-100 {\ \n blackness-0: white;\ - \n blackness-20: #d5d5d5;\ - \n blackness-40: #b6b6b6;\ - \n blackness-60: #9f9f9f;\ - \n blackness-80: #8e8e8e;\ - \n blackness-100: gray;\ + \n blackness-20: hsl(0, 0%, 83.3333333333%);\ + \n blackness-40: hsl(0, 0%, 71.4285714286%);\ + \n blackness-60: hsl(0, 0%, 62.5%);\ + \n blackness-80: hsl(0, 0%, 55.5555555556%);\ + \n blackness-100: hsl(0, 0%, 50%);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/yellow_greens.rs b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/yellow_greens.rs index 97f516bdb..2dce463c8 100644 --- a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/yellow_greens.rs +++ b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/yellow_greens.rs @@ -6,57 +6,58 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("@use \'../test-hue\' as *;\ \n@include test-hue(90);\n"), "whiteness-0 {\ - \n blackness-0: #80ff00;\ + \n blackness-0: hsl(90, 100%, 50%);\ \n blackness-20: #66cc00;\ - \n blackness-40: #4d9900;\ + \n blackness-40: hsl(90, 100%, 30%);\ \n blackness-60: #336600;\ - \n blackness-80: #1a3300;\ + \n blackness-80: hsl(90, 100%, 10%);\ \n blackness-100: black;\ \n}\ \nwhiteness-20 {\ \n blackness-0: #99ff33;\ - \n blackness-20: #80cc33;\ + \n blackness-20: hsl(90, 60%, 50%);\ \n blackness-40: #669933;\ - \n blackness-60: #4d6633;\ + \n blackness-60: hsl(90, 33.3333333333%, 30%);\ \n blackness-80: #333333;\ - \n blackness-100: #2b2b2b;\ + \n blackness-100: hsl(0, 0%, 16.6666666667%);\ \n}\ \nwhiteness-40 {\ - \n blackness-0: #b3ff66;\ + \n blackness-0: hsl(90, 100%, 70%);\ \n blackness-20: #99cc66;\ - \n blackness-40: #809966;\ + \n blackness-40: hsl(90, 20%, 50%);\ \n blackness-60: #666666;\ \n blackness-80: #555555;\ - \n blackness-100: #494949;\ + \n blackness-100: hsl(0, 0%, 28.5714285714%);\ \n}\ \nwhiteness-60 {\ \n blackness-0: #ccff99;\ - \n blackness-20: #b3cc99;\ + \n blackness-20: hsl(90, 33.3333333333%, 70%);\ \n blackness-40: #999999;\ - \n blackness-60: gray;\ - \n blackness-80: #6d6d6d;\ - \n blackness-100: #606060;\ + \n blackness-60: hsl(0, 0%, 50%);\ + \n blackness-80: hsl(0, 0%, 42.8571428571%);\ + \n blackness-100: hsl(0, 0%, 37.5%);\ \n}\ \nwhiteness-80 {\ - \n blackness-0: #e6ffcc;\ + \n blackness-0: hsl(90, 100%, 90%);\ \n blackness-20: #cccccc;\ \n blackness-40: #aaaaaa;\ - \n blackness-60: #929292;\ - \n blackness-80: gray;\ - \n blackness-100: #717171;\ + \n blackness-60: hsl(0, 0%, 57.1428571429%);\ + \n blackness-80: hsl(0, 0%, 50%);\ + \n blackness-100: hsl(0, 0%, 44.4444444444%);\ \n}\ \nwhiteness-100 {\ \n blackness-0: white;\ - \n blackness-20: #d5d5d5;\ - \n blackness-40: #b6b6b6;\ - \n blackness-60: #9f9f9f;\ - \n blackness-80: #8e8e8e;\ - \n blackness-100: gray;\ + \n blackness-20: hsl(0, 0%, 83.3333333333%);\ + \n blackness-40: hsl(0, 0%, 71.4285714286%);\ + \n blackness-60: hsl(0, 0%, 62.5%);\ + \n blackness-80: hsl(0, 0%, 55.5555555556%);\ + \n blackness-100: hsl(0, 0%, 50%);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/yellows.rs b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/yellows.rs index 403c5ec60..8d2c727f6 100644 --- a/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/yellows.rs +++ b/rsass/tests/spec/core_functions/color/hwb/three_args/w3c/yellows.rs @@ -6,6 +6,7 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("@use \'../test-hue\' as *;\ @@ -24,7 +25,7 @@ fn test() { \n blackness-40: #999933;\ \n blackness-60: #666633;\ \n blackness-80: #333333;\ - \n blackness-100: #2b2b2b;\ + \n blackness-100: hsl(0, 0%, 16.6666666667%);\ \n}\ \nwhiteness-40 {\ \n blackness-0: #ffff66;\ @@ -32,31 +33,31 @@ fn test() { \n blackness-40: #999966;\ \n blackness-60: #666666;\ \n blackness-80: #555555;\ - \n blackness-100: #494949;\ + \n blackness-100: hsl(0, 0%, 28.5714285714%);\ \n}\ \nwhiteness-60 {\ \n blackness-0: #ffff99;\ \n blackness-20: #cccc99;\ \n blackness-40: #999999;\ - \n blackness-60: gray;\ - \n blackness-80: #6d6d6d;\ - \n blackness-100: #606060;\ + \n blackness-60: hsl(0, 0%, 50%);\ + \n blackness-80: hsl(0, 0%, 42.8571428571%);\ + \n blackness-100: hsl(0, 0%, 37.5%);\ \n}\ \nwhiteness-80 {\ \n blackness-0: #ffffcc;\ \n blackness-20: #cccccc;\ \n blackness-40: #aaaaaa;\ - \n blackness-60: #929292;\ - \n blackness-80: gray;\ - \n blackness-100: #717171;\ + \n blackness-60: hsl(0, 0%, 57.1428571429%);\ + \n blackness-80: hsl(0, 0%, 50%);\ + \n blackness-100: hsl(0, 0%, 44.4444444444%);\ \n}\ \nwhiteness-100 {\ \n blackness-0: white;\ - \n blackness-20: #d5d5d5;\ - \n blackness-40: #b6b6b6;\ - \n blackness-60: #9f9f9f;\ - \n blackness-80: #8e8e8e;\ - \n blackness-100: gray;\ + \n blackness-20: hsl(0, 0%, 83.3333333333%);\ + \n blackness-40: hsl(0, 0%, 71.4285714286%);\ + \n blackness-60: hsl(0, 0%, 62.5%);\ + \n blackness-80: hsl(0, 0%, 55.5555555556%);\ + \n blackness-100: hsl(0, 0%, 50%);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/ie_hex_str.rs b/rsass/tests/spec/core_functions/color/ie_hex_str.rs index e6044996b..f69184ab7 100644 --- a/rsass/tests/spec/core_functions/color/ie_hex_str.rs +++ b/rsass/tests/spec/core_functions/color/ie_hex_str.rs @@ -12,52 +12,62 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: ie-hex-str()}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.ie-hex-str()}\n" + ), "Error: Missing argument $color.\ \n ,--> input.scss\ - \n1 | a {b: ie-hex-str()}\ - \n | ^^^^^^^^^^^^ invocation\ + \n2 | a {b: color.ie-hex-str()}\ + \n | ^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ \n1 | @function ie-hex-str($color) {\ \n | ================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: ie-hex-str(red, blue)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.ie-hex-str(red, blue)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: ie-hex-str(red, blue)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: color.ie-hex-str(red, blue)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ \n1 | @function ie-hex-str($color) {\ \n | ================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: ie-hex-str(c)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.ie-hex-str(c)}\n" + ), "Error: $color: c is not a color.\ \n ,\ - \n1 | a {b: ie-hex-str(c)}\ - \n | ^^^^^^^^^^^^^\ + \n2 | a {b: color.ie-hex-str(c)}\ + \n | ^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn leading_zero() { assert_eq!( - runner().ok("a {b: ie-hex-str(rgba(#020304, 0.003))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.ie-hex-str(rgba(#020304, 0.003))}\n"), "a {\ \n b: #01020304;\ \n}\n" @@ -66,7 +76,8 @@ fn leading_zero() { #[test] fn named() { assert_eq!( - runner().ok("a {b: ie-hex-str($color: #daddee)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.ie-hex-str($color: #daddee)}\n"), "a {\ \n b: #FFDADDEE;\ \n}\n" @@ -75,7 +86,8 @@ fn named() { #[test] fn opaque() { assert_eq!( - runner().ok("a {b: ie-hex-str(#daddee)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.ie-hex-str(#daddee)}\n"), "a {\ \n b: #FFDADDEE;\ \n}\n" @@ -84,7 +96,8 @@ fn opaque() { #[test] fn translucent() { assert_eq!( - runner().ok("a {b: ie-hex-str(rgba(#daddee, 0.3))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.ie-hex-str(rgba(#daddee, 0.3))}\n"), "a {\ \n b: #4DDADDEE;\ \n}\n" @@ -93,7 +106,8 @@ fn translucent() { #[test] fn transparent() { assert_eq!( - runner().ok("a {b: ie-hex-str(rgba(turquoise, 0))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.ie-hex-str(rgba(turquoise, 0))}\n"), "a {\ \n b: #0040E0D0;\ \n}\n" @@ -102,7 +116,9 @@ fn transparent() { #[test] fn test_type() { assert_eq!( - runner().ok("a {b: type-of(ie-hex-str(#daddee))}\n"), + runner().ok("@use \"sass:color\";\ + \n@use \"sass:meta\";\ + \na {b: meta.type-of(color.ie-hex-str(#daddee))}\n"), "a {\ \n b: string;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/color/invert.rs b/rsass/tests/spec/core_functions/color/invert.rs deleted file mode 100644 index 19aeec4d9..000000000 --- a/rsass/tests/spec/core_functions/color/invert.rs +++ /dev/null @@ -1,299 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/invert.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("invert") -} - -#[test] -fn alpha() { - assert_eq!( - runner().ok("a {b: invert(rgba(turquoise, 0.4))}\n"), - "a {\ - \n b: rgba(191, 31, 47, 0.4);\ - \n}\n" - ); -} -#[test] -fn black() { - assert_eq!( - runner().ok("a {b: invert(black)}\n"), - "a {\ - \n b: white;\ - \n}\n" - ); -} -mod error { - #[allow(unused)] - use super::runner; - - mod bounds { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: invert(red, 100.001%)}\n"), - "Error: $weight: Expected 100.001% to be within 0% and 100%.\ - \n ,\ - \n1 | a {b: invert(red, 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: invert(red, -0.001%)}\n"), - "Error: $weight: Expected -0.001% to be within 0% and 100%.\ - \n ,\ - \n1 | a {b: invert(red, -0.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - } - #[test] - fn number_with_weight() { - assert_eq!( - runner().err( - "a {b: invert(1, 50%)}\n" - ), - "Error: Only one argument may be passed to the plain-CSS invert() function.\ - \n ,\ - \n1 | a {b: invert(1, 50%)}\ - \n | ^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_few_args() { - assert_eq!( - runner().err("a {b: invert()}\n"), - "Error: Missing argument $color.\ - \n ,--> input.scss\ - \n1 | a {b: invert()}\ - \n | ^^^^^^^^ invocation\ - \n \'\ - \n ,--> sass:color\ - \n1 | @function invert($color, $weight: 100%) {\ - \n | ============================= declaration\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_many_args() { - assert_eq!( - runner().err("a {b: invert(turquoise, 0%, 1)}\n"), - "Error: Only 2 arguments allowed, but 3 were passed.\ - \n ,--> input.scss\ - \n1 | a {b: invert(turquoise, 0%, 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ - \n \'\ - \n ,--> sass:color\ - \n1 | @function invert($color, $weight: 100%) {\ - \n | ============================= declaration\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - mod test_type { - #[allow(unused)] - use super::runner; - - #[test] - fn color() { - assert_eq!( - runner().err("a {b: invert(c)}\n"), - "Error: $color: c is not a color.\ - \n ,\ - \n1 | a {b: invert(c)}\ - \n | ^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn weight() { - assert_eq!( - runner().err("a {b: invert(red, c)}\n"), - "Error: $weight: c is not a number.\ - \n ,\ - \n1 | a {b: invert(red, c)}\ - \n | ^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn with_module() { - assert_eq!( - runner().err( - "@use \'sass:color\';\ - \na {b: color.invert(var(--c))}\n" - ), - "Error: $color: var(--c) is not a color.\ - \n ,\ - \n2 | a {b: color.invert(var(--c))}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - } -} -#[test] -fn gray() { - assert_eq!( - runner().ok("a {b: invert(gray)}\n"), - "a {\ - \n b: #7f7f7f;\ - \n}\n" - ); -} -#[test] -fn named() { - assert_eq!( - runner().ok("a {b: invert($color: turquoise, $weight: 0%)}\n"), - "a {\ - \n b: turquoise;\ - \n}\n" - ); -} -#[test] -fn number() { - assert_eq!( - runner().ok("a {b: invert(10%)}\n"), - "a {\ - \n b: invert(10%);\ - \n}\n" - ); -} -#[test] -fn turquoise() { - assert_eq!( - runner().ok("a {b: invert(turquoise)}\n"), - "a {\ - \n b: #bf1f2f;\ - \n}\n" - ); -} -mod units { - #[allow(unused)] - use super::runner; - - mod weight { - #[allow(unused)] - use super::runner; - - #[test] - fn unitless() { - assert_eq!( - runner().ok("a {b: invert(turquoise, 10)}\n"), - "a {\ - \n b: #4dcdc0;\ - \n}\n" - ); - } - #[test] - fn unknown() { - assert_eq!( - runner().ok("a {b: invert(turquoise, 10px)}\n"), - "a {\ - \n b: #4dcdc0;\ - \n}\n" - ); - } - } -} -mod weighted { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: invert(turquoise, 92%)}\n"), - "a {\ - \n b: #b52e3c;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: invert(turquoise, 23%)}\n"), - "a {\ - \n b: #5db4ab;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: invert(turquoise, 100%)}\n"), - "a {\ - \n b: #bf1f2f;\ - \n}\n" - ); - } - #[test] - fn middle() { - assert_eq!( - runner().ok("a {b: invert(turquoise, 50%)}\n"), - "a {\ - \n b: gray;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: invert(turquoise, 0%)}\n"), - "a {\ - \n b: turquoise;\ - \n}\n" - ); - } -} -#[test] -fn white() { - assert_eq!( - runner().ok("a {b: invert(white)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); -} -#[test] -fn with_calc() { - assert_eq!( - runner().ok("a {b: invert(calc(1 + 2))}\n"), - "a {\ - \n b: invert(3);\ - \n}\n" - ); -} -#[test] -fn with_css_var() { - assert_eq!( - runner().ok("a {b: invert(var(--c))}\n"), - "a {\ - \n b: invert(var(--c));\ - \n}\n" - ); -} -#[test] -fn with_unquoted_calc() { - assert_eq!( - runner().ok("a {b: invert(unquote(\'calc(1)\'))}\n"), - "a {\ - \n b: invert(calc(1));\ - \n}\n" - ); -} diff --git a/rsass/tests/spec/core_functions/color/invert/alpha.rs b/rsass/tests/spec/core_functions/color/invert/alpha.rs new file mode 100644 index 000000000..4c6fc9080 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/invert/alpha.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/invert/alpha.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("alpha") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(rgba(turquoise, 0.4))}\n"), + "a {\ + \n b: rgba(191, 31, 47, 0.4);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/invert/error.rs b/rsass/tests/spec/core_functions/color/invert/error.rs new file mode 100644 index 000000000..73501cdb0 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/invert/error.rs @@ -0,0 +1,383 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/invert/error.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("error") +} + +mod bounds { + #[allow(unused)] + use super::runner; + + #[test] + fn too_high() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.invert(red, 100.001%)}\n" + ), + "Error: $weight: Expected 100.001% to be within 0% and 100%.\ + \n ,\ + \n2 | a {b: color.invert(red, 100.001%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + fn too_low() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.invert(red, -0.001%)}\n" + ), + "Error: $weight: Expected -0.001% to be within 0% and 100%.\ + \n ,\ + \n2 | a {b: color.invert(red, -0.001%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod global { + #[allow(unused)] + use super::runner; + + #[test] + fn number_with_weight() { + assert_eq!( + runner().err( + "a {b: invert(1, 50%)}\n" + ), + "Error: Only one argument may be passed to the plain-CSS invert() function.\ + \n ,\ + \n1 | a {b: invert(1, 50%)}\ + \n | ^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + mod test_type { + #[allow(unused)] + use super::runner; + + #[test] + fn color() { + assert_eq!( + runner().err("a {b: invert(c)}\n"), + "Error: $color: c is not a color.\ + \n ,\ + \n1 | a {b: invert(c)}\ + \n | ^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + } +} +mod missing { + #[allow(unused)] + use super::runner; + + mod legacy { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn analogous() { + assert_eq!( + runner().err( + "a {b: invert(rgb(10 none 20), $space: xyz)}\n" + ), + "Error: $y: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: color(xyz 0.0025142545 none 0.0067080366)).\ + \n ,\ + \n1 | a {b: invert(rgb(10 none 20), $space: xyz)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn powerless() { + assert_eq!( + runner().err( + "a {b: invert(grey, $space: hsl)}\n" + ), + "Error: $hue: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: hsl(none 0% 50.1960784314%)).\ + \n ,\ + \n1 | a {b: invert(grey, $space: hsl)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + mod same { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn explicit() { + assert_eq!( + runner().err( + "a {b: invert(hsl(0 40% none), $space: hsl)}\n" + ), + "Error: $lightness: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: hsl(0deg 40% none)).\ + \n ,\ + \n1 | a {b: invert(hsl(0 40% none), $space: hsl)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn hwb_hue() { + assert_eq!( + runner().err( + "a {b: invert(hwb(none 10% 20%), $space: hwb)}\n" + ), + "Error: $hue: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: hwb(none 10% 20%)).\ + \n ,\ + \n1 | a {b: invert(hwb(none 10% 20%), $space: hwb)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn implicit() { + assert_eq!( + runner().err( + "a {b: invert(rgb(none 10 20))}\n" + ), + "Error: $red: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: rgb(none 10 20)).\ + \n ,\ + \n1 | a {b: invert(rgb(none 10 20))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + } + } + mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn analogous() { + assert_eq!( + runner().err( + "a {b: invert(color(rec2020 0.1 none 0.2), $space: xyz)}\n" + ), + "Error: $y: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: color(xyz 0.0237000113 none 0.0589013339)).\ + \n ,\ + \n1 | a {b: invert(color(rec2020 0.1 none 0.2), $space: xyz)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn powerless() { + assert_eq!( + runner().err( + "a {b: invert(color(rec2020 0.4 0.4 0.4), $space: lch)}\n" + ), + "Error: $hue: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: lch(48.649404846% 0 none)).\ + \n ,\ + \n1 | a {b: invert(color(rec2020 0.4 0.4 0.4), $space: lch)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn same() { + assert_eq!( + runner().err( + "a {b: invert(color(srgb none 0.1 0.2), $space: srgb)}\n" + ), + "Error: $red: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: color(srgb none 0.1 0.2)).\ + \n ,\ + \n1 | a {b: invert(color(srgb none 0.1 0.2), $space: srgb)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + } +} +mod space { + #[allow(unused)] + use super::runner; + + mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn default_weight() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.invert(lab(50% -10 10))}\n" + ), + "Error: $color: To use color.invert() with non-legacy color lab(50% -10 10), you must provide a $space.\ + \n ,\ + \n2 | a {b: color.invert(lab(50% -10 10))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn zero_weight() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.invert(lab(50% -10 10), 0%)}\n" + ), + "Error: $color: To use color.invert() with non-legacy color lab(50% -10 10), you must provide a $space.\ + \n ,\ + \n2 | a {b: color.invert(lab(50% -10 10), 0%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // wrong error + fn quoted() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.invert(red, 10%, \"lch\")}\n" + ), + "Error: $space: Expected \"lch\" to be an unquoted string.\ + \n ,\ + \n2 | a {b: color.invert(red, 10%, \"lch\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn unknown() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.invert(red, 10%, c)}\n" + ), + "Error: $space: Unknown color space \"c\".\ + \n ,\ + \n2 | a {b: color.invert(red, 10%, c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +#[test] +#[ignore] // wrong error +fn too_few_args() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.invert()}\n" + ), + "Error: Missing argument $color.\ + \n ,--> input.scss\ + \n2 | a {b: color.invert()}\ + \n | ^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function invert($color, $weight: 100%, $space: null) {\ + \n | =========================================== declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn too_many_args() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.invert(turquoise, 0%, hsl, 1)}\n" + ), + "Error: Only 3 arguments allowed, but 4 were passed.\ + \n ,--> input.scss\ + \n2 | a {b: color.invert(turquoise, 0%, hsl, 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function invert($color, $weight: 100%, $space: null) {\ + \n | =========================================== declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +mod test_type { + #[allow(unused)] + use super::runner; + + #[test] + fn color() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.invert(c)}\n" + ), + "Error: $color: c is not a color.\ + \n ,\ + \n2 | a {b: color.invert(c)}\ + \n | ^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn space() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.invert(red, 10%, 1)}\n" + ), + "Error: $space: 1 is not a string.\ + \n ,\ + \n2 | a {b: color.invert(red, 10%, 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + fn weight() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.invert(red, c)}\n" + ), + "Error: $weight: c is not a number.\ + \n ,\ + \n2 | a {b: color.invert(red, c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/invert/global.rs b/rsass/tests/spec/core_functions/color/invert/global.rs new file mode 100644 index 000000000..030060507 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/invert/global.rs @@ -0,0 +1,62 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/invert/global.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("global") +} + +#[test] +fn legacy() { + assert_eq!( + runner().ok("a {b: invert(red)}\n"), + "a {\ + \n b: aqua;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn modern() { + assert_eq!( + runner().ok("a {b: invert(color(srgb 0 0.4 1), $space: srgb)}\n"), + "a {\ + \n b: color(srgb 1 0.6 0);\ + \n}\n" + ); +} +#[test] +fn number() { + assert_eq!( + runner().ok("a {b: invert(10%)}\n"), + "a {\ + \n b: invert(10%);\ + \n}\n" + ); +} +#[test] +fn with_calc() { + assert_eq!( + runner().ok("a {b: invert(calc(1 + 2))}\n"), + "a {\ + \n b: invert(3);\ + \n}\n" + ); +} +#[test] +fn with_css_var() { + assert_eq!( + runner().ok("a {b: invert(var(--c))}\n"), + "a {\ + \n b: invert(var(--c));\ + \n}\n" + ); +} +#[test] +fn with_unquoted_calc() { + assert_eq!( + runner().ok("a {b: invert(unquote(\'calc(1)\'))}\n"), + "a {\ + \n b: invert(calc(1));\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/invert/legacy.rs b/rsass/tests/spec/core_functions/color/invert/legacy.rs new file mode 100644 index 000000000..3cdcf7a66 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/invert/legacy.rs @@ -0,0 +1,300 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/invert/legacy.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("legacy") +} + +mod no_space { + #[allow(unused)] + use super::runner; + + #[test] + fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(black)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); + } + #[test] + fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(gray)}\n"), + "a {\ + \n b: #7f7f7f;\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn hsl() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(hsl(30deg 20% 40%))}\n"), + "a {\ + \n b: hsl(210, 20%, 60%);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn hwb() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(hsl(30deg 20% 40%))}\n"), + "a {\ + \n b: hsl(210, 20%, 60%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(\ + \n color.invert(color.change(rgb(0 50 0), $red: -100, $blue: 500))\ + \n);\n" + ), + "a {\ + \n value: hsl(45, 545.4545454545%, 21.568627451%);\ + \n space: rgb;\ + \n channels: 355 205 -245 / 1;\ + \n}\n" + ); + } + #[test] + fn turquoise() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(turquoise)}\n"), + "a {\ + \n b: #bf1f2f;\ + \n}\n" + ); + } + mod weighted { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(turquoise, 92%)}\n"), + "a {\ + \n b: rgb(180.84, 46.44, 59.88);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(turquoise, 23%)}\n"), + "a {\ + \n b: rgb(93.21, 179.61, 170.97);\ + \n}\n" + ); + } + #[test] + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(turquoise, 100%)}\n"), + "a {\ + \n b: #bf1f2f;\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(turquoise, 50%)}\n"), + "a {\ + \n b: rgb(127.5, 127.5, 127.5);\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(turquoise, 0%)}\n"), + "a {\ + \n b: turquoise;\ + \n}\n" + ); + } + } + #[test] + fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(white)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } +} +mod space { + #[allow(unused)] + use super::runner; + + mod hsl { + #[allow(unused)] + use super::runner; + + mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn analogous() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.invert(hsl(30deg none 40%), $space: lch)}\n" + ), + "Error: $hue: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: lch(43.192289563% none none)).\ + \n ,\ + \n2 | a {b: color.invert(hsl(30deg none 40%), $space: lch)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // unexepected error + fn same() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(hsl(30deg none 40%), $space: hsl)}\n"), + "a {\ + \n b: hsl(210deg none 60%);\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn no_missing() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(hsl(30deg 20% 40%), $space: hsl)}\n"), + "a {\ + \n b: hsl(210, 20%, 60%);\ + \n}\n" + ); + } + } + mod hwb { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn missing() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(hwb(30deg none 40%), $space: hwb)}\n"), + "a {\ + \n b: hwb(210deg 40% none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn no_missing() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(hwb(30deg 20% 40%), $space: hwb)}\n"), + "a {\ + \n b: #6699cc;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn modern() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(#abcdef, $space: display-p3)}\n"), + "a {\ + \n b: rgb(81.948808543, 49.5520621504, 10.5024231747);\ + \n}\n" + ); + } + mod powerless { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn different() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(hsl(120deg 0% 40%), $space: rgb)}\n"), + "a {\ + \n b: hsl(0, 0%, 60%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn same() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(hsl(120deg 0% 40%), $space: hsl)}\n"), + "a {\ + \n b: hsl(300, 0%, 60%);\ + \n}\n" + ); + } + } +} +mod units { + #[allow(unused)] + use super::runner; + + mod weight { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn unitless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(turquoise, 10)}\n"), + "a {\ + \n b: rgb(76.7, 204.7, 191.9);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn unknown() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(turquoise, 10px)}\n"), + "a {\ + \n b: rgb(76.7, 204.7, 191.9);\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/core_functions/color/invert/mod.rs b/rsass/tests/spec/core_functions/color/invert/mod.rs new file mode 100644 index 000000000..e956e9f77 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/invert/mod.rs @@ -0,0 +1,20 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/invert" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("invert") +} + +mod alpha; + +mod error; + +mod global; + +mod legacy; + +mod modern; + +mod named; + +mod number; diff --git a/rsass/tests/spec/core_functions/color/invert/modern.rs b/rsass/tests/spec/core_functions/color/invert/modern.rs new file mode 100644 index 000000000..e19284849 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/invert/modern.rs @@ -0,0 +1,179 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/invert/modern.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("modern") +} + +#[test] +#[ignore] // unexepected error +fn negative_min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(lab(20% -30 110), $space: lab)}\n"), + "a {\ + \n b: lab(80% 30 -110);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn polar() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(lch(20% 80 50deg), $space: lch)}\n"), + "a {\ + \n b: lch(80% 80 230deg);\ + \n}\n" + ); +} +mod space { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn case() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(lch(20% 80 50deg), $space: DISPLAY-p3)}\n"), + "a {\ + \n b: lch(97.4036876937% 47.4823953357 211.8732507605deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn legacy() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.invert(lch(20% 80 50deg), $space: rgb)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz 0.8040115061 1.0427791446 1.4858460828) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn missing_converted() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.invert(color(rec2020 none none none), $space: lab)}\n" + ), + "a {\ + \n b: color(rec2020 1 1 1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn modern() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(lch(20% 80 50deg), $space: xyz)}\n"), + "a {\ + \n b: lch(98.9503159926% 3.6006542179 45.9089280707deg);\ + \n}\n" + ); + } + mod powerless { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn different() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(lch(40% 0% 120deg), $space: lab)}\n"), + "a {\ + \n b: lch(60% 0 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn same() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(lch(40% 0% 120deg), $space: lch)}\n"), + "a {\ + \n b: lch(60% 0 300deg);\ + \n}\n" + ); + } + } +} +mod weight { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.invert(color(a98-rgb 0.1 0.4 0.8), 60%, $space: a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.58 0.52 0.44);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.invert(color(a98-rgb 0.1 0.4 0.8), 100%, $space: a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.9 0.6 0.2);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.invert(color(a98-rgb 0.1 0.4 0.8), 50%, $space: a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.5 0.5 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.invert(color(a98-rgb 0.1 0.4 0.8), 0%, $space: a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1 0.4 0.8);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn zero_min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.invert(color(rec2020 0 0.4 1), $space: rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 1 0.6 0);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/invert/named.rs b/rsass/tests/spec/core_functions/color/invert/named.rs new file mode 100644 index 000000000..0aad6ac7a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/invert/named.rs @@ -0,0 +1,20 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/invert/named.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("named") +} + +#[test] +#[ignore] // unexepected error +fn test() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.invert($color: turquoise, $weight: 10%, $space: oklch)}\n" + ), + "a {\ + \n b: rgb(72.3071640492, 202.5503954693, 158.9647820206);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/invert/number.rs b/rsass/tests/spec/core_functions/color/invert/number.rs new file mode 100644 index 000000000..564ccf6d8 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/invert/number.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/invert/number.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("number") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(1)}\n"), + "a {\ + \n b: invert(1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/is_in_gamut.rs b/rsass/tests/spec/core_functions/color/is_in_gamut.rs new file mode 100644 index 000000000..3551a644e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/is_in_gamut.rs @@ -0,0 +1,443 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/is_in_gamut.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner() + .with_cwd("is_in_gamut") + .mock_file("error/too_few_args/error ", "") +} + +#[test] +#[ignore] // unexepected error +fn a98_rgb() { + let runner = runner().with_cwd("a98-rgb"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(color(a98-rgb 0 1 -1))}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn color_keyword() { + let runner = runner().with_cwd("color_keyword"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(midnightblue)}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn display_p3() { + let runner = runner().with_cwd("display-p3"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(color(display-p3 0 2 0))}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +mod error { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("error") + } + + #[test] + #[ignore] // wrong error + fn invalid_character_end() { + let runner = runner().with_cwd("invalid_character_end"); + assert_eq!( + runner.err( + "@use \"sass:color\";\ + \na {b: color.is-in-gamut(rgb(0 255 0), hsl.)}\n" + ), + "Error: Expected identifier.\ + \n ,\ + \n2 | a {b: color.is-in-gamut(rgb(0 255 0), hsl.)}\ + \n | ^\ + \n \'\ + \n input.scss 2:43 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn invalid_character_start() { + let runner = runner().with_cwd("invalid_character_start"); + assert_eq!( + runner.err( + "@use \"sass:color\";\ + \na {b: color.is-in-gamut(rgb(0 255 0), .hsl)}\n" + ), + "Error: Expected digit.\ + \n ,\ + \n2 | a {b: color.is-in-gamut(rgb(0 255 0), .hsl)}\ + \n | ^\ + \n \'\ + \n input.scss 2:40 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn quoted() { + let runner = runner().with_cwd("quoted"); + assert_eq!( + runner.err( + "@use \"sass:color\";\ + \na {b: color.is-in-gamut(rgb(0 255 0), \"hsl\")}\n" + ), + "Error: $space: Expected \"hsl\" to be an unquoted string.\ + \n ,\ + \n2 | a {b: color.is-in-gamut(rgb(0 255 0), \"hsl\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn space_unknown() { + let runner = runner().with_cwd("space_unknown"); + assert_eq!( + runner.err( + "@use \"sass:color\";\ + \na {b: color.is-in-gamut(rgb(0 255 0), c)}\n" + ), + "Error: $space: Unknown color space \"c\".\ + \n ,\ + \n2 | a {b: color.is-in-gamut(rgb(0 255 0), c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn too_few_args() { + let runner = runner().with_cwd("too_few_args"); + assert_eq!( + runner.err( + "@use \"sass:color\";\ + \na {b: color.is-in-gamut()}\n" + ), + "Error: Missing argument $color.\ + \n ,--> input.scss\ + \n2 | a {b: color.is-in-gamut()}\ + \n | ^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function is-in-gamut($color, $space: null) {\ + \n | ================================= declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn too_many_args() { + let runner = runner().with_cwd("too_many_args"); + assert_eq!( + runner.err( + "@use \"sass:color\";\ + \na {b: color.is-in-gamut(rgb(0 255 0), hwb, c)}\n" + ), + "Error: Only 2 arguments allowed, but 3 were passed.\ + \n ,--> input.scss\ + \n2 | a {b: color.is-in-gamut(rgb(0 255 0), hwb, c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function is-in-gamut($color, $space: null) {\ + \n | ================================= declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn test_type() { + let runner = runner().with_cwd("type"); + assert_eq!( + runner.err( + "@use \"sass:color\";\ + \na {b: color.is-in-gamut(1)}\n" + ), + "Error: $color: 1 is not a color.\ + \n ,\ + \n2 | a {b: color.is-in-gamut(1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +#[test] +#[ignore] // unexepected error +fn hex() { + let runner = runner().with_cwd("hex"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(#f2ece4)}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn hsl() { + let runner = runner().with_cwd("hsl"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(hsl(0 0% -1%))}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn hwb() { + let runner = runner().with_cwd("hwb"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(hwb(0 300% -1%))}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn lab() { + let runner = runner().with_cwd("lab"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(lab(5 110 115))}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn lch() { + let runner = runner().with_cwd("lch"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(lch(90.6 52.8 197))}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn named() { + let runner = runner().with_cwd("named"); + assert_eq!( + runner.ok( + "@use \"sass:color\";\ + \na {b: color.is-in-gamut($color: color(display-p3 1 1 0), $space: srgb)}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn narrow_wide() { + let runner = runner().with_cwd("narrow_wide"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(hsl(50 40% 30%), oklab)}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn oklab() { + let runner = runner().with_cwd("oklab"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(oklab(0.44027 0.08818 -0.13386))}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn oklab_lch() { + let runner = runner().with_cwd("oklab_lch"); + assert_eq!( + runner.ok( + "@use \"sass:color\";\ + \na {b: color.is-in-gamut(oklab(0.44027 0.08818 -0.13386), lch)}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn oklch() { + let runner = runner().with_cwd("oklch"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(oklch(70% 0.1 200))}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn prophoto_rgb() { + let runner = runner().with_cwd("prophoto-rgb"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(color(prophoto-rgb 2 0 0))}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn rec2020() { + let runner = runner().with_cwd("rec2020"); + assert_eq!( + runner.ok( + "@use \"sass:color\";\ + \na {b: color.is-in-gamut(color(rec2020 0.979780 -1 0.00579))}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn rgb() { + let runner = runner().with_cwd("rgb"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(color.change(black, $green: 300))}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn rgba() { + let runner = runner().with_cwd("rgba"); + assert_eq!( + runner.ok( + "@use \"sass:color\";\ + \na {b: color.is-in-gamut(color.change(rgba(0 122 180 / 0.4), $red: -1))}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn space() { + let runner = runner().with_cwd("space"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(color(display-p3 1 1 0), oklch)}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn srgb_linear() { + let runner = runner().with_cwd("srgb-linear"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(color(srgb-linear -1 0 0))}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn srgb() { + let runner = runner().with_cwd("srgb"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(color(srgb 0 0 1.5))}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn wide_narrow() { + let runner = runner().with_cwd("wide_narrow"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(color(display-p3 1 1 0), hwb)}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn xyz_d50() { + let runner = runner().with_cwd("xyz-d50"); + assert_eq!( + runner.ok( + "@use \"sass:color\";\ + \na {b: color.is-in-gamut(color(xyz-d50 0.2005 0.14089 0.4472))}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn xyz_d65() { + let runner = runner().with_cwd("xyz-d65"); + assert_eq!( + runner.ok( + "@use \"sass:color\";\ + \na {b: color.is-in-gamut(color(xyz-d65 0.21661 0.14602 0.59452))}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn xyz() { + let runner = runner().with_cwd("xyz"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-in-gamut(color(xyz 0.0426 0.0442 0.0364))}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/is_legacy.rs b/rsass/tests/spec/core_functions/color/is_legacy.rs new file mode 100644 index 000000000..a2911aa1b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/is_legacy.rs @@ -0,0 +1,329 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/is_legacy.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner() + .with_cwd("is_legacy") + .mock_file("error/too_few_args/error ", "") +} + +#[test] +#[ignore] // unexepected error +fn a98_rgb() { + let runner = runner().with_cwd("a98-rgb"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-legacy(color(a98-rgb 0 1 0))}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn color_keyword() { + let runner = runner().with_cwd("color_keyword"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-legacy(midnightblue)}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn display_p3() { + let runner = runner().with_cwd("display-p3"); + assert_eq!( + runner.ok( + "@use \"sass:color\";\ + \na {b: color.is-legacy(color(display-p3 0.515 0.35 0.3 / 1))}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); +} +mod error { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("error") + } + + #[test] + #[ignore] // wrong error + fn too_few_args() { + let runner = runner().with_cwd("too_few_args"); + assert_eq!( + runner.err( + "@use \"sass:color\";\ + \na {b: color.is-legacy()}\n" + ), + "Error: Missing argument $color.\ + \n ,--> input.scss\ + \n2 | a {b: color.is-legacy()}\ + \n | ^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function is-legacy($color) {\ + \n | ================= declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn too_many_args() { + let runner = runner().with_cwd("too_many_args"); + assert_eq!( + runner.err( + "@use \"sass:color\";\ + \na {b: color.is-legacy(rgb(0 255 0), a)}\n" + ), + "Error: Only 1 argument allowed, but 2 were passed.\ + \n ,--> input.scss\ + \n2 | a {b: color.is-legacy(rgb(0 255 0), a)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function is-legacy($color) {\ + \n | ================= declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn test_type() { + let runner = runner().with_cwd("type"); + assert_eq!( + runner.err( + "@use \"sass:color\";\ + \na {b: color.is-legacy(1)}\n" + ), + "Error: $color: 1 is not a color.\ + \n ,\ + \n2 | a {b: color.is-legacy(1)}\ + \n | ^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +#[test] +#[ignore] // unexepected error +fn hex() { + let runner = runner().with_cwd("hex"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-legacy(#f2ece4)}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn hsl() { + let runner = runner().with_cwd("hsl"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-legacy(hsl(110 31% 32%))}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn hwb() { + let runner = runner().with_cwd("hwb"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-legacy(hwb(0 50% 0%))}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn lab() { + let runner = runner().with_cwd("lab"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-legacy(lab(5 110 115))}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn lch() { + let runner = runner().with_cwd("lch"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-legacy(lch(90.6 52.8 197))}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn named() { + let runner = runner().with_cwd("named"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-legacy($color: rgb(255 0 0))}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn oklab() { + let runner = runner().with_cwd("oklab"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-legacy(oklab(0.44027 0.08818 -0.13386))}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn oklch() { + let runner = runner().with_cwd("oklch"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-legacy(oklch(70% 0.1 200))}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn prophoto_rgb() { + let runner = runner().with_cwd("prophoto-rgb"); + assert_eq!( + runner.ok( + "@use \"sass:color\";\ + \na {b: color.is-legacy(color(prophoto-rgb 0.42444 0.934918 0.190922))}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn rec2020() { + let runner = runner().with_cwd("rec2020"); + assert_eq!( + runner.ok( + "@use \"sass:color\";\ + \na {b: color.is-legacy(color(rec2020 0.42053 0.979780 0.00579))}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn rgb() { + let runner = runner().with_cwd("rgb"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-legacy(rgb(0 255 0))}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn rgba() { + let runner = runner().with_cwd("rgba"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-legacy(rgba(72 122 180 / .2))}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn srgb_linear() { + let runner = runner().with_cwd("srgb-linear"); + assert_eq!( + runner.ok( + "@use \"sass:color\";\ + \na {b: color.is-legacy(color(srgb-linear 0.45098 0.07843 0.823530))}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn srgb() { + let runner = runner().with_cwd("srgb"); + assert_eq!( + runner.ok( + "@use \"sass:color\";\ + \na {b: color.is-legacy(color(srgb 0.45098 0.07843 0.823530))}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn xyz_d50() { + let runner = runner().with_cwd("xyz-d50"); + assert_eq!( + runner.ok( + "@use \"sass:color\";\ + \na {b: color.is-legacy(color(xyz-d50 0.2005 0.14089 0.4472))}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn xyz_d65() { + let runner = runner().with_cwd("xyz-d65"); + assert_eq!( + runner.ok( + "@use \"sass:color\";\ + \na {b: color.is-legacy(color(xyz-d65 0.21661 0.14602 0.59452))}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn xyz() { + let runner = runner().with_cwd("xyz"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.is-legacy(color(xyz 0.0426 0.0442 0.0364))}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/is_missing.rs b/rsass/tests/spec/core_functions/color/is_missing.rs new file mode 100644 index 000000000..3bd943c87 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/is_missing.rs @@ -0,0 +1,337 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/is_missing.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("is_missing") +} + +mod error { + #[allow(unused)] + use super::runner; + + mod channel { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn unquoted() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-missing(hsl(0deg 50% 50%), hue)}\n" + ), + "Error: $channel: Expected hue to be a quoted string.\ + \n ,\ + \n2 | a {b: color.is-missing(hsl(0deg 50% 50%), hue)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn wrong_case() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-missing(black, \"RED\")}\n" + ), + "Error: $channel: Color black doesn\'t have a channel named \"RED\".\ + \n ,\ + \n2 | a {b: color.is-missing(black, \"RED\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn wrong_space() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-missing(black, \"hue\")}\n" + ), + "Error: $channel: Color black doesn\'t have a channel named \"hue\".\ + \n ,\ + \n2 | a {b: color.is-missing(black, \"hue\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // wrong error + fn too_few_args() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-missing(black)}\n" + ), + "Error: Missing argument $channel.\ + \n ,--> input.scss\ + \n2 | a {b: color.is-missing(black)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function is-missing($color, $channel) {\ + \n | ============================ declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn too_many_args() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-missing(black, \"red\", rgb)}\n" + ), + "Error: Only 2 arguments allowed, but 3 were passed.\ + \n ,--> input.scss\ + \n2 | a {b: color.is-missing(black, \"red\", rgb)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function is-missing($color, $channel) {\ + \n | ============================ declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + mod test_type { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn channel() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-missing(black, red)}\n" + ), + "Error: $channel: red is not a string.\ + \n ,\ + \n2 | a {b: color.is-missing(black, red)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn color() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-missing(\"black\", \"red\")}\n" + ), + "Error: $color: \"black\" is not a color.\ + \n ,\ + \n2 | a {b: color.is-missing(\"black\", \"red\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } +} +mod test_false { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn explicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-missing(#abcdef, \"red\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + mod not_powerless { + #[allow(unused)] + use super::runner; + + mod converted { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn legacy() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.is-missing(color.to-space(#aaaaab, hsl), \"hue\")}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn non_legacy() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.is-missing(color.to-space(#aaaaab, lch), \"hue\")}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); + } + } + mod direct { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-missing(hsl(0deg 50% 1%), \"hue\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn non_legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-missing(lch(50% 1% 0deg), \"hue\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + } + } + mod powerless { + #[allow(unused)] + use super::runner; + + mod converted { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn legacy() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.is-missing(color.to-space(#aaaaaa, hsl), \"hue\")}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); + } + } + mod direct { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-missing(hsl(0deg 50% 0%), \"hue\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn non_legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-missing(lch(50% 0% 0deg), \"hue\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + } + } +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-missing($color: black, $channel: \"red\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +mod test_true { + #[allow(unused)] + use super::runner; + + mod explicit { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-missing(rgb(none 30 100), \"red\")}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn non_legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-missing(lab(50% 30 none), \"b\")}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } + } + mod powerless { + #[allow(unused)] + use super::runner; + + mod converted { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn non_legacy() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.is-missing(color.to-space(#aaaaaa, lch), \"hue\")}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } + } + } +} diff --git a/rsass/tests/spec/core_functions/color/is_powerless/error.rs b/rsass/tests/spec/core_functions/color/is_powerless/error.rs new file mode 100644 index 000000000..a872f382e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/is_powerless/error.rs @@ -0,0 +1,206 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/is_powerless/error.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("error") +} + +mod channel { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn unknown() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-powerless(black, \"c\")}\n" + ), + "Error: $channel: Color black doesn\'t have a channel named \"c\".\ + \n ,\ + \n2 | a {b: color.is-powerless(black, \"c\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn unquoted() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-powerless(hsl(0deg 0% 0%), hue)}\n" + ), + "Error: $channel: Expected hue to be a quoted string.\ + \n ,\ + \n2 | a {b: color.is-powerless(hsl(0deg 0% 0%), hue)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn wrong_case() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-powerless(black, \"RED\")}\n" + ), + "Error: $channel: Color black doesn\'t have a channel named \"RED\".\ + \n ,\ + \n2 | a {b: color.is-powerless(black, \"RED\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn wrong_space() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-powerless(black, \"hue\")}\n" + ), + "Error: $channel: Color black doesn\'t have a channel named \"hue\".\ + \n ,\ + \n2 | a {b: color.is-powerless(black, \"hue\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod space { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn quoted() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-powerless(black, \"red\", $space: \"rgb\")}\n" + ), + "Error: $space: Expected \"rgb\" to be an unquoted string.\ + \n ,\ + \n2 | a {b: color.is-powerless(black, \"red\", $space: \"rgb\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn unknown() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-powerless(black, \"red\", $space: c)}\n" + ), + "Error: $space: Unknown color space \"c\".\ + \n ,\ + \n2 | a {b: color.is-powerless(black, \"red\", $space: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +#[test] +#[ignore] // wrong error +fn too_few_args() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-powerless(black)}\n" + ), + "Error: Missing argument $channel.\ + \n ,--> input.scss\ + \n2 | a {b: color.is-powerless(black)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function is-powerless($color, $channel, $space: null) {\ + \n | ============================================ declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn too_many_args() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-powerless(black, \"red\", rgb, c)}\n" + ), + "Error: Only 3 arguments allowed, but 4 were passed.\ + \n ,--> input.scss\ + \n2 | a {b: color.is-powerless(black, \"red\", rgb, c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function is-powerless($color, $channel, $space: null) {\ + \n | ============================================ declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +mod test_type { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn channel() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-powerless(black, 1)}\n" + ), + "Error: $channel: 1 is not a string.\ + \n ,\ + \n2 | a {b: color.is-powerless(black, 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn color() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-powerless(c, \"red\")}\n" + ), + "Error: $color: c is not a color.\ + \n ,\ + \n2 | a {b: color.is-powerless(c, \"red\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn space() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.is-powerless(black, \"red\", $space: 1)}\n" + ), + "Error: $space: 1 is not a string.\ + \n ,\ + \n2 | a {b: color.is-powerless(black, \"red\", $space: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/is_powerless/hsl.rs b/rsass/tests/spec/core_functions/color/is_powerless/hsl.rs new file mode 100644 index 000000000..f61295e69 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/is_powerless/hsl.rs @@ -0,0 +1,106 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/is_powerless/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod hue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn full_lightness() { + assert_eq!( + runner().ok( + "// These used to be considered powerless by the CSS spec, but are no longer, so\ + \n// Sass shouldn\'t consdier it powerless either.\ + \n@use \"sass:color\";\ + \na {b: color.is-powerless(hsl(0deg 50% 100%), \"hue\")}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near_zero_saturation() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.is-powerless(hsl(0deg 0.000000000001% 50%), \"hue\")}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(hsl(0deg 50% 50%), \"hue\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero_lightness() { + assert_eq!( + runner().ok( + "// These used to be considered powerless by the CSS spec, but are no longer, so\ + \n// Sass shouldn\'t consdier it powerless either.\ + \n@use \"sass:color\";\ + \na {b: color.is-powerless(hsl(0deg 50% 0%), \"hue\")}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero_saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(hsl(0deg 0% 50%), \"hue\")}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } +} +mod saturation { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn full_lightness() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.is-powerless(hsl(0deg 0% 100%), \"saturation\")}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero_lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(hsl(0deg 0% 0%), \"saturation\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/is_powerless/hwb.rs b/rsass/tests/spec/core_functions/color/is_powerless/hwb.rs new file mode 100644 index 000000000..8b27437ac --- /dev/null +++ b/rsass/tests/spec/core_functions/color/is_powerless/hwb.rs @@ -0,0 +1,94 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/is_powerless/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod hue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn full_blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(hwb(0deg 0% 100%), \"hue\")}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn full_whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(hwb(0deg 100% 0%), \"hue\")}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn grey() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(hwb(0deg 40% 60%), \"hue\")}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn normalized_grey() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(hwb(0deg 60% 80%), \"hue\")}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn not_greyscale() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(hwb(0deg 30% 40%), \"hue\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + mod out_of_gamut { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn colorful() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(hwb(0deg -30% 50%), \"hue\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn grey() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(hwb(0deg -30% 130%), \"hue\")}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/core_functions/color/is_powerless/lab.rs b/rsass/tests/spec/core_functions/color/is_powerless/lab.rs new file mode 100644 index 000000000..bdcf8acda --- /dev/null +++ b/rsass/tests/spec/core_functions/color/is_powerless/lab.rs @@ -0,0 +1,61 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/is_powerless/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod a { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn full_lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(lab(100% 0 0), \"a\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero_lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(lab(0% 0 0), \"a\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } +} +mod b { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn full_lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(lab(100% 0 0), \"b\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero_lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(lab(0% 0 0), \"b\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/is_powerless/lch.rs b/rsass/tests/spec/core_functions/color/is_powerless/lch.rs new file mode 100644 index 000000000..39da57de9 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/is_powerless/lch.rs @@ -0,0 +1,104 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/is_powerless/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod chroma { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn full_lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(lch(100% 0% 0deg), \"chroma\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero_lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(lch(0% 0% 0deg), \"chroma\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } +} +mod hue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn full_lightness() { + assert_eq!( + runner().ok( + "// These used to be considered powerless by the CSS spec, but are no longer, so\ + \n// Sass shouldn\'t consdier it powerless either.\ + \n@use \"sass:color\";\ + \na {b: color.is-powerless(lch(100% 50% 0deg), \"hue\")}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near_zero_chroma() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.is-powerless(lch(50% 0.000000000001% 0deg), \"hue\")}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(lch(50% 50% 0deg), \"hue\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero_chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(lch(50% 0% 0deg), \"hue\")}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero_lightness() { + assert_eq!( + runner().ok( + "// These used to be considered powerless by the CSS spec, but are no longer, so\ + \n// Sass shouldn\'t consdier it powerless either.\ + \n@use \"sass:color\";\ + \na {b: color.is-powerless(lch(0% 50% 0deg), \"hue\")}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/change_color/mod.rs b/rsass/tests/spec/core_functions/color/is_powerless/mod.rs similarity index 54% rename from rsass/tests/spec/core_functions/color/change_color/mod.rs rename to rsass/tests/spec/core_functions/color/is_powerless/mod.rs index 07824a869..9ccd318fe 100644 --- a/rsass/tests/spec/core_functions/color/change_color/mod.rs +++ b/rsass/tests/spec/core_functions/color/is_powerless/mod.rs @@ -1,8 +1,8 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/change_color" +//! Tests auto-converted from "sass-spec/spec/core_functions/color/is_powerless" #[allow(unused)] fn runner() -> crate::TestRunner { - super::runner().with_cwd("change_color") + super::runner().with_cwd("is_powerless") } mod error; @@ -11,8 +11,14 @@ mod hsl; mod hwb; -mod no_rgb_hsl; +mod lab; -mod rgb; +mod lch; -mod units; +mod named; + +mod oklab; + +mod oklch; + +mod space; diff --git a/rsass/tests/spec/core_functions/color/is_powerless/named.rs b/rsass/tests/spec/core_functions/color/is_powerless/named.rs new file mode 100644 index 000000000..e69ac3f78 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/is_powerless/named.rs @@ -0,0 +1,20 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/is_powerless/named.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("named") +} + +#[test] +#[ignore] // unexepected error +fn test() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.is-powerless($color: red, $channel: \"a\", $space: lab)}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/is_powerless/oklab.rs b/rsass/tests/spec/core_functions/color/is_powerless/oklab.rs new file mode 100644 index 000000000..5c8083a99 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/is_powerless/oklab.rs @@ -0,0 +1,61 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/is_powerless/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod a { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn full_lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(oklab(100% 0 0), \"a\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero_lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(oklab(0% 0 0), \"a\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } +} +mod b { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn full_lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(oklab(100% 0 0), \"b\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero_lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(oklab(0% 0 0), \"b\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/is_powerless/oklch.rs b/rsass/tests/spec/core_functions/color/is_powerless/oklch.rs new file mode 100644 index 000000000..aad25387c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/is_powerless/oklch.rs @@ -0,0 +1,104 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/is_powerless/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod chroma { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn full_lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(oklch(100% 0% 0deg), \"chroma\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero_lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(oklch(0% 0% 0deg), \"chroma\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } +} +mod hue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn full_lightness() { + assert_eq!( + runner().ok( + "// These used to be considered powerless by the CSS spec, but are no longer, so\ + \n// Sass shouldn\'t consdier it powerless either.\ + \n@use \"sass:color\";\ + \na {b: color.is-powerless(oklch(100% 50% 0deg), \"hue\")}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near_zero_chroma() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.is-powerless(oklch(50% 0.000000000001% 0deg), \"hue\")}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(oklch(50% 50% 0deg), \"hue\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero_chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(oklch(50% 0% 0deg), \"hue\")}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero_lightness() { + assert_eq!( + runner().ok( + "// These used to be considered powerless by the CSS spec, but are no longer, so\ + \n// Sass shouldn\'t consdier it powerless either.\ + \n@use \"sass:color\";\ + \na {b: color.is-powerless(oklch(0% 50% 0deg), \"hue\")}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/is_powerless/space.rs b/rsass/tests/spec/core_functions/color/is_powerless/space.rs new file mode 100644 index 000000000..33e3124db --- /dev/null +++ b/rsass/tests/spec/core_functions/color/is_powerless/space.rs @@ -0,0 +1,29 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/is_powerless/space.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("space") +} + +#[test] +#[ignore] // unexepected error +fn not_powerless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(grey, \"a\", $space: lab)}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn powerless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.is-powerless(grey, \"hue\", $space: hsl)}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/lab/alpha.rs b/rsass/tests/spec/core_functions/color/lab/alpha.rs new file mode 100644 index 000000000..717dc6576 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/lab/alpha.rs @@ -0,0 +1,226 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/lab/alpha.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("alpha") +} + +mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 -3 / calc(NaN)));\n"), + "a {\ + \n value: lab(1% 2 -3 / 0);\ + \n space: lab;\ + \n channels: 1% 2 -3 / 0;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 -3 / calc(-infinity)));\n"), + "a {\ + \n value: lab(1% 2 -3 / 0);\ + \n space: lab;\ + \n channels: 1% 2 -3 / 0;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 -3 / calc(infinity)));\n"), + "a {\ + \n value: lab(1% 2 -3);\ + \n space: lab;\ + \n channels: 1% 2 -3 / 1;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab($channels: 1% 2 3 / 0.4));\n"), + "a {\ + \n value: lab(1% 2 3 / 0.4);\ + \n space: lab;\ + \n channels: 1% 2 3 / 0.4;\ + \n}\n" + ); +} +mod none { + #[allow(unused)] + use super::runner; + + mod slash { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn alpha() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 3 / none));\n"), + "a {\ + \n value: lab(1% 2 3 / none);\ + \n space: lab;\ + \n channels: 1% 2 3 / none;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 none / 0.4));\n"), + "a {\ + \n value: lab(1% 2 none / 0.4);\ + \n space: lab;\ + \n channels: 1% 2 none / 0.4;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b_and_alpha() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 none / none));\n"), + "a {\ + \n value: lab(1% 2 none / none);\ + \n space: lab;\ + \n channels: 1% 2 none / none;\ + \n}\n" + ); + } + } + mod slash_list { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn alpha() { + assert_eq!( + runner().ok("@use \'sass:list\';\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(list.slash(1% 2 3, none)));\n"), + "a {\ + \n value: lab(1% 2 3 / none);\ + \n space: lab;\ + \n channels: 1% 2 3 / none;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \'sass:list\';\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(list.slash(1% 2 none, 0.4)));\n"), + "a {\ + \n value: lab(1% 2 none / 0.4);\ + \n space: lab;\ + \n channels: 1% 2 none / 0.4;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b_and_alpha() { + assert_eq!( + runner().ok("@use \'sass:list\';\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(list.slash(1% 2 none, none)));\n"), + "a {\ + \n value: lab(1% 2 none / none);\ + \n space: lab;\ + \n channels: 1% 2 none / none;\ + \n}\n" + ); + } + } +} +#[test] +#[ignore] // unexepected error +fn opaque() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 3 / 1));\n"), + "a {\ + \n value: lab(1% 2 3);\ + \n space: lab;\ + \n channels: 1% 2 3 / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn partial() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 3 / 0.4));\n"), + "a {\ + \n value: lab(1% 2 3 / 0.4);\ + \n space: lab;\ + \n channels: 1% 2 3 / 0.4;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn percent() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 3 / 40%));\n"), + "a {\ + \n value: lab(1% 2 3 / 0.4);\ + \n space: lab;\ + \n channels: 1% 2 3 / 0.4;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn slash_list() { + assert_eq!( + runner().ok("@use \"sass:list\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(list.slash(1% 2 3, 0.4)));\n"), + "a {\ + \n value: lab(1% 2 3 / 0.4);\ + \n space: lab;\ + \n channels: 1% 2 3 / 0.4;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn transparent() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(0 255 127 / 0));\n"), + "a {\ + \n value: lab(0% 255 127 / 0);\ + \n space: lab;\ + \n channels: 0% 255 127 / 0;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/lab/error.rs b/rsass/tests/spec/core_functions/color/lab/error.rs new file mode 100644 index 000000000..f1b4fa56a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/lab/error.rs @@ -0,0 +1,353 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/lab/error.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("error") +} + +mod list { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn bracketed() { + assert_eq!( + runner().err("a {b: lab([1% 2 3])}\n"), + "Error: $channels: Expected an unbracketed list, was [1% 2 3]\ + \n ,\ + \n1 | a {b: lab([1% 2 3])}\ + \n | ^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn comma() { + assert_eq!( + runner().err( + "a {b: lab((1%, 2, 3))}\n" + ), + "Error: $channels: Expected a space- or slash-separated list, was (1%, 2, 3)\ + \n ,\ + \n1 | a {b: lab((1%, 2, 3))}\ + \n | ^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn empty() { + assert_eq!( + runner().err("a {b: lab(())}\n"), + "Error: $channels: Color component list may not be empty.\ + \n ,\ + \n1 | a {b: lab(())}\ + \n | ^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn empty_space() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \n$empty-space: list.join((), (), $separator: space);\ + \na {b: lab(())}\n" + ), + "Error: $channels: Color component list may not be empty.\ + \n ,\ + \n3 | a {b: lab(())}\ + \n | ^^^^^^^\ + \n \'\ + \n input.scss 3:7 root stylesheet", + ); + } + mod slash { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn one() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \n$single-arg-slash-separated: list.append((), 1% 2 3, $separator: slash);\ + \na {b: lab($single-arg-slash-separated)}\n" + ), + "Error: $channels: Only 2 slash-separated elements allowed, but 1 was passed.\ + \n ,\ + \n3 | a {b: lab($single-arg-slash-separated)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 3:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn three() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \na {b: lab(list.slash(1%, 2, 3))}\n" + ), + "Error: $channels: Only 2 slash-separated elements allowed, but 3 were passed.\ + \n ,\ + \n2 | a {b: lab(list.slash(1%, 2, 3))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // missing error + fn too_few_channels() { + assert_eq!( + runner().err( + "a {b: lab(1% 2)}\n" + ), + "Error: $channels: The lab color space has 3 channels but (1% 2) has 2.\ + \n ,\ + \n1 | a {b: lab(1% 2)}\ + \n | ^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn too_many_channels() { + assert_eq!( + runner().err( + "a {b: lab(1% 2 3 0.4)}\n" + ), + "Error: $channels: The lab color space has 3 channels but (1% 2 3 0.4) has 4.\ + \n ,\ + \n1 | a {b: lab(1% 2 3 0.4)}\ + \n | ^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} +#[test] +#[ignore] // missing error +fn too_few_args() { + assert_eq!( + runner().err("a {b: lab()}\n"), + "Error: Missing argument $channels.\ + \n ,--> input.scss\ + \n1 | a {b: lab()}\ + \n | ^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function lab($channels) {\ + \n | ============== declaration\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); +} +#[test] +#[ignore] // missing error +fn too_many_args() { + assert_eq!( + runner().err("a {b: lab(1%, 2, 3, 0.4)}\n"), + "Error: Only 1 argument allowed, but 4 were passed.\ + \n ,--> input.scss\ + \n1 | a {b: lab(1%, 2, 3, 0.4)}\ + \n | ^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function lab($channels) {\ + \n | ============== declaration\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); +} +mod test_type { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn a() { + assert_eq!( + runner().err("a {b: lab(1% c 3)}\n"), + "Error: $channels: Expected a channel to be a number, was c.\ + \n ,\ + \n1 | a {b: lab(1% c 3)}\ + \n | ^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn slash() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \na {b: lab(1% 2 3 / c)}\n" + ), + "Error: $channels: c is not a number.\ + \n ,\ + \n2 | a {b: lab(1% 2 3 / c)}\ + \n | ^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn slash_list() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \na {b: lab(list.slash(1% 2 3, c))}\n" + ), + "Error: $channels: c is not a number.\ + \n ,\ + \n2 | a {b: lab(list.slash(1% 2 3, c))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + mod b { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn direct() { + assert_eq!( + runner().err("a {b: lab(1% 2 c)}\n"), + "Error: $channels: Expected b channel to be a number, was c.\ + \n ,\ + \n1 | a {b: lab(1% 2 c)}\ + \n | ^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn slash() { + assert_eq!( + runner().err("a {b: lab(1% 2 c / 0.4)}\n"), + "Error: $channels: Expected b channel to be a number, was c.\ + \n ,\ + \n1 | a {b: lab(1% 2 c / 0.4)}\ + \n | ^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // missing error + fn lightness() { + assert_eq!( + runner().err( + "a {b: lab(c 2 3)}\n" + ), + "Error: $channels: Expected lightness channel to be a number, was c.\ + \n ,\ + \n1 | a {b: lab(c 2 3)}\ + \n | ^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} +mod unit { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn a() { + assert_eq!( + runner().err("a {b: lab(1% 2px 3)}\n"), + "Error: $a: Expected 2px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: lab(1% 2px 3)}\ + \n | ^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn slash() { + assert_eq!( + runner().err( + "a {b: lab(1% 2 3/0.4px)}\n" + ), + "Error: $alpha: Expected 0.4px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: lab(1% 2 3/0.4px)}\ + \n | ^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn slash_list() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \na {b: lab(list.slash(1% 2 3, 0.4px))}\n" + ), + "Error: $alpha: Expected 0.4px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: lab(list.slash(1% 2 3, 0.4px))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // missing error + fn b() { + assert_eq!( + runner().err("a {b: lab(1% 2 3px)}\n"), + "Error: $b: Expected 3px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: lab(1% 2 3px)}\ + \n | ^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn lightness() { + assert_eq!( + runner().err("a {b: lab(1px 2 3)}\n"), + "Error: $lightness: Expected 1px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: lab(1px 2 3)}\ + \n | ^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/lab/mod.rs b/rsass/tests/spec/core_functions/color/lab/mod.rs new file mode 100644 index 000000000..b96fe1cdb --- /dev/null +++ b/rsass/tests/spec/core_functions/color/lab/mod.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/lab" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod alpha; + +mod error; + +mod no_alpha; + +mod relative_color; + +mod special_functions; diff --git a/rsass/tests/spec/core_functions/color/lab/no_alpha.rs b/rsass/tests/spec/core_functions/color/lab/no_alpha.rs new file mode 100644 index 000000000..c11389662 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/lab/no_alpha.rs @@ -0,0 +1,392 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/lab/no_alpha.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("no_alpha") +} + +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab($channels: 1% 2 3));\n"), + "a {\ + \n value: lab(1% 2 3);\ + \n space: lab;\ + \n channels: 1% 2 3 / 1;\ + \n}\n" + ); +} +mod none { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% none 3));\n"), + "a {\ + \n value: lab(1% none 3);\ + \n space: lab;\ + \n channels: 1% none 3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 none));\n"), + "a {\ + \n value: lab(1% 2 none);\ + \n space: lab;\ + \n channels: 1% 2 none / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(none 2 3));\n"), + "a {\ + \n value: lab(none 2 3);\ + \n space: lab;\ + \n channels: none 2 3 / 1;\ + \n}\n" + ); + } +} +mod percent { + #[allow(unused)] + use super::runner; + + mod ab { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 101% 150%));\n"), + "a {\ + \n value: lab(1% 126.25 187.5);\ + \n space: lab;\ + \n channels: 1% 126.25 187.5 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% -101% -150%));\n"), + "a {\ + \n value: lab(1% -126.25 -187.5);\ + \n space: lab;\ + \n channels: 1% -126.25 -187.5 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2% -3%));\n"), + "a {\ + \n value: lab(1% 2.5 -3.75);\ + \n space: lab;\ + \n channels: 1% 2.5 -3.75 / 1;\ + \n}\n" + ); + } + } + mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(110% 2 3));\n"), + "a {\ + \n value: lab(100% 2 3);\ + \n space: lab;\ + \n channels: 100% 2 3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(-1% 2 3));\n"), + "a {\ + \n value: lab(0% 2 3);\ + \n space: lab;\ + \n channels: 0% 2 3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2% -3%));\n"), + "a {\ + \n value: lab(1% 2.5 -3.75);\ + \n space: lab;\ + \n channels: 1% 2.5 -3.75 / 1;\ + \n}\n" + ); + } + } +} +mod unitless { + #[allow(unused)] + use super::runner; + + mod a { + #[allow(unused)] + use super::runner; + + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% calc(NaN) -3));\n"), + "a {\ + \n value: lab(1% calc(NaN) -3);\ + \n space: lab;\ + \n channels: 1% calc(NaN) -3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% calc(-infinity) -3));\n"), + "a {\ + \n value: lab(1% calc(-infinity) -3);\ + \n space: lab;\ + \n channels: 1% calc(-infinity) -3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% calc(infinity) -3));\n"), + "a {\ + \n value: lab(1% calc(infinity) -3);\ + \n space: lab;\ + \n channels: 1% calc(infinity) -3 / 1;\ + \n}\n" + ); + } + } + } + mod ab { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 126 300));\n"), + "a {\ + \n value: lab(1% 126 300);\ + \n space: lab;\ + \n channels: 1% 126 300 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% -126 -300));\n"), + "a {\ + \n value: lab(1% -126 -300);\ + \n space: lab;\ + \n channels: 1% -126 -300 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 -3));\n"), + "a {\ + \n value: lab(1% 2 -3);\ + \n space: lab;\ + \n channels: 1% 2 -3 / 1;\ + \n}\n" + ); + } + } + mod b { + #[allow(unused)] + use super::runner; + + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 calc(NaN)));\n"), + "a {\ + \n value: lab(1% 2 calc(NaN));\ + \n space: lab;\ + \n channels: 1% 2 calc(NaN) / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 calc(-infinity)));\n"), + "a {\ + \n value: lab(1% 2 calc(-infinity));\ + \n space: lab;\ + \n channels: 1% 2 calc(-infinity) / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 calc(infinity)));\n"), + "a {\ + \n value: lab(1% 2 calc(infinity));\ + \n space: lab;\ + \n channels: 1% 2 calc(infinity) / 1;\ + \n}\n" + ); + } + } + } + mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(101 2 3));\n"), + "a {\ + \n value: lab(100% 2 3);\ + \n space: lab;\ + \n channels: 100% 2 3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(-1 2 3));\n"), + "a {\ + \n value: lab(0% 2 3);\ + \n space: lab;\ + \n channels: 0% 2 3 / 1;\ + \n}\n" + ); + } + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(calc(NaN) 2 -3));\n"), + "a {\ + \n value: lab(0% 2 -3);\ + \n space: lab;\ + \n channels: 0% 2 -3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(calc(-infinity) 2 -3));\n"), + "a {\ + \n value: lab(0% 2 -3);\ + \n space: lab;\ + \n channels: 0% 2 -3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(calc(infinity) 2 -3));\n"), + "a {\ + \n value: lab(100% 2 -3);\ + \n space: lab;\ + \n channels: 100% 2 -3 / 1;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(10 2 -3));\n"), + "a {\ + \n value: lab(10% 2 -3);\ + \n space: lab;\ + \n channels: 10% 2 -3 / 1;\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/core_functions/color/lab/relative_color.rs b/rsass/tests/spec/core_functions/color/lab/relative_color.rs new file mode 100644 index 000000000..f156fbaec --- /dev/null +++ b/rsass/tests/spec/core_functions/color/lab/relative_color.rs @@ -0,0 +1,184 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/lab/relative_color.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("relative_color") +} + +mod calc { + #[allow(unused)] + use super::runner; + + #[test] + fn alpha() { + assert_eq!( + runner().ok("a {b: lab(from #aaa calc(l + 0.2) a b / 25%)}\n"), + "a {\ + \n b: lab(from #aaa calc(l + 0.2) a b/25%);\ + \n}\n" + ); + } + #[test] + fn no_alpha() { + assert_eq!( + runner().ok("a {b: lab(from #aaa calc(l + 0.2) a b)}\n"), + "a {\ + \n b: lab(from #aaa calc(l + 0.2) a b);\ + \n}\n" + ); + } +} +mod different_case { + #[allow(unused)] + use super::runner; + + #[test] + fn alpha() { + assert_eq!( + runner().ok("a {b: lab(From #aaa l a b / 25%)}\n"), + "a {\ + \n b: lab(From #aaa l a b/25%);\ + \n}\n" + ); + } + #[test] + fn no_alpha() { + assert_eq!( + runner().ok("a {b: lab(From #aaa l a b)}\n"), + "a {\ + \n b: lab(From #aaa l a b);\ + \n}\n" + ); + } +} +mod error { + #[allow(unused)] + use super::runner; + + mod quoted { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn alpha() { + assert_eq!( + runner().err( + "a {b: lab(\"from\" #aaa l a b / 25%)}\n" + ), + "Error: $channels: Expected lightness channel to be a number, was \"from\".\ + \n ,\ + \n1 | a {b: lab(\"from\" #aaa l a b / 25%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn no_alpha() { + assert_eq!( + runner().err( + "a {b: lab(\"from\" #aaa l a b)}\n" + ), + "Error: $channels: Expected lightness channel to be a number, was \"from\".\ + \n ,\ + \n1 | a {b: lab(\"from\" #aaa l a b)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + } + mod wrong_keyword { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn alpha() { + assert_eq!( + runner().err( + "a {b: lab(c #aaa l a b / 25%)}\n" + ), + "Error: $channels: Expected lightness channel to be a number, was c.\ + \n ,\ + \n1 | a {b: lab(c #aaa l a b / 25%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn no_alpha() { + assert_eq!( + runner().err( + "a {b: lab(c #aaa l a b)}\n" + ), + "Error: $channels: Expected lightness channel to be a number, was c.\ + \n ,\ + \n1 | a {b: lab(c #aaa l a b)}\ + \n | ^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + } +} +#[test] +fn slash_list_alpha() { + assert_eq!( + runner().ok("@use \"sass:list\";\ + \na {b: lab(list.slash(from #aaa r g b, 25%))}\n"), + "a {\ + \n b: lab(from #aaa r g b / 25%);\ + \n}\n" + ); +} +mod test_static { + #[allow(unused)] + use super::runner; + + #[test] + fn alpha() { + assert_eq!( + runner().ok("a {b: lab(from #aaa l a b / 25%)}\n"), + "a {\ + \n b: lab(from #aaa l a b/25%);\ + \n}\n" + ); + } + #[test] + fn no_alpha() { + assert_eq!( + runner().ok("a {b: lab(from #aaa l a b)}\n"), + "a {\ + \n b: lab(from #aaa l a b);\ + \n}\n" + ); + } +} +mod var { + #[allow(unused)] + use super::runner; + + #[test] + fn alpha() { + assert_eq!( + runner().ok("a {b: lab(from var(--c) l a b / 25%)}\n"), + "a {\ + \n b: lab(from var(--c) l a b/25%);\ + \n}\n" + ); + } + #[test] + fn no_alpha() { + assert_eq!( + runner().ok("a {b: lab(from var(--c) l a b)}\n"), + "a {\ + \n b: lab(from var(--c) l a b);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/lab/special_functions/alpha.rs b/rsass/tests/spec/core_functions/color/lab/special_functions/alpha.rs new file mode 100644 index 000000000..15cd17ac7 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/lab/special_functions/alpha.rs @@ -0,0 +1,486 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/lab/special_functions/alpha.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("alpha") +} + +mod calc { + #[allow(unused)] + use super::runner; + + mod calculation { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(calc(1px + 1%) 2 3 / 0.4));\n"), + "a {\ + \n value: lab(calc(1px + 1%) 2 3/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% calc(1px + 1%) 3 / 0.4));\n"), + "a {\ + \n value: lab(1% calc(1px + 1%) 3/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 calc(1px + 1%) / 0.4));\n"), + "a {\ + \n value: lab(1% 2 calc(1px + 1%)/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_4() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 3 / calc(1px + 1%)));\n"), + "a {\ + \n value: lab(1% 2 3/calc(1px + 1%));\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn with_slash() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 3 / calc(var(--a) / 2)));\n"), + "a {\ + \n value: lab(1% 2 3/calc(var(--a) / 2));\ + \n type: string;\ + \n}\n" + ); + } + } + mod string { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(unquote(\"calc(1%)\") 2 3 / 0.4));\n" + ), + "a {\ + \n value: lab(calc(1%) 2 3/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% unquote(\"calc(2)\") 3 / 0.4));\n" + ), + "a {\ + \n value: lab(1% calc(2) 3/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 unquote(\"calc(3)\") / 0.4));\n" + ), + "a {\ + \n value: lab(1% 2 calc(3)/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_4() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 3 / unquote(\"calc(0.4)\")));\n" + ), + "a {\ + \n value: lab(1% 2 3/calc(0.4));\ + \n type: string;\ + \n}\n" + ); + } + } +} +mod clamp { + #[allow(unused)] + use super::runner; + + mod string { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(unquote(\"clamp(1%, 2, 3)\") 2 3 / 0.4));\n" + ), + "a {\ + \n value: lab(clamp(1%, 2, 3) 2 3/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% unquote(\"clamp(2, 3, 4)\") 3 / 0.4));\n" + ), + "a {\ + \n value: lab(1% clamp(2, 3, 4) 3/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 unquote(\"clamp(3, 4, 5)\") / 0.4));\n" + ), + "a {\ + \n value: lab(1% 2 clamp(3, 4, 5)/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_4() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 3 / unquote(\"clamp(0.4, 0.5, 0.6)\")));\n" + ), + "a {\ + \n value: lab(1% 2 3/clamp(0.4, 0.5, 0.6));\ + \n type: string;\ + \n}\n" + ); + } + } +} +mod env { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(env(--foo) 2 3 / 0.4));\n"), + "a {\ + \n value: lab(env(--foo) 2 3/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% env(--foo) 3 / 0.4));\n"), + "a {\ + \n value: lab(1% env(--foo) 3/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 env(--foo) / 0.4));\n"), + "a {\ + \n value: lab(1% 2 env(--foo)/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_4() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 3 / env(--foo)));\n"), + "a {\ + \n value: lab(1% 2 3/env(--foo));\ + \n type: string;\ + \n}\n" + ); + } +} +mod max { + #[allow(unused)] + use super::runner; + + mod string { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(unquote(\"max(1%)\") 2 3 / 0.4));\n" + ), + "a {\ + \n value: lab(max(1%) 2 3/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% unquote(\"max(2)\") 3 / 0.4));\n" + ), + "a {\ + \n value: lab(1% max(2) 3/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 unquote(\"max(3)\") / 0.4));\n" + ), + "a {\ + \n value: lab(1% 2 max(3)/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_4() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 3 / unquote(\"max(0.4)\")));\n" + ), + "a {\ + \n value: lab(1% 2 3/max(0.4));\ + \n type: string;\ + \n}\n" + ); + } + } +} +mod min { + #[allow(unused)] + use super::runner; + + mod string { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(unquote(\"min(1%)\") 2 3 / 0.4));\n" + ), + "a {\ + \n value: lab(min(1%) 2 3/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% unquote(\"min(2)\") 3 / 0.4));\n" + ), + "a {\ + \n value: lab(1% min(2) 3/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 unquote(\"min(3)\") / 0.4));\n" + ), + "a {\ + \n value: lab(1% 2 min(3)/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_4() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 3 / unquote(\"min(0.4)\")));\n" + ), + "a {\ + \n value: lab(1% 2 3/min(0.4));\ + \n type: string;\ + \n}\n" + ); + } + } +} +mod multi_argument_var { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn t1_of_1() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(var(--foo) / 0.4));\n"), + "a {\ + \n value: lab(var(--foo)/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn t1_of_2() { + assert_eq!( + runner().ok( + "// var() is substituted before parsing, so it may contain multiple arguments.\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(var(--foo) 2 / 0.4));\n" + ), + "a {\ + \n value: lab(var(--foo) 2/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn t2_of_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% var(--foo) / 0.4));\n"), + "a {\ + \n value: lab(1% var(--foo)/0.4);\ + \n type: string;\ + \n}\n" + ); + } +} +mod var { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(var(--foo) 2 3 / 0.4));\n"), + "a {\ + \n value: lab(var(--foo) 2 3/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% var(--foo) 3 / 0.4));\n"), + "a {\ + \n value: lab(1% var(--foo) 3/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 var(--foo) / 0.4));\n"), + "a {\ + \n value: lab(1% 2 var(--foo)/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_4() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 3 / var(--foo)));\n"), + "a {\ + \n value: lab(1% 2 3/var(--foo));\ + \n type: string;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/lab/special_functions/mod.rs b/rsass/tests/spec/core_functions/color/lab/special_functions/mod.rs new file mode 100644 index 000000000..260eeb793 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/lab/special_functions/mod.rs @@ -0,0 +1,12 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/lab/special_functions" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("special_functions") +} + +mod alpha; + +mod no_alpha; + +mod slash_list; diff --git a/rsass/tests/spec/core_functions/color/lab/special_functions/no_alpha.rs b/rsass/tests/spec/core_functions/color/lab/special_functions/no_alpha.rs new file mode 100644 index 000000000..7b233bad4 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/lab/special_functions/no_alpha.rs @@ -0,0 +1,355 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/lab/special_functions/no_alpha.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("no_alpha") +} + +mod calc { + #[allow(unused)] + use super::runner; + + mod calculation { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(calc(1px + 1%) 2 3));\n"), + "a {\ + \n value: lab(calc(1px + 1%) 2 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% calc(1px + 1%) 3));\n"), + "a {\ + \n value: lab(1% calc(1px + 1%) 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 calc(1px + 1%)));\n"), + "a {\ + \n value: lab(1% 2 calc(1px + 1%));\ + \n type: string;\ + \n}\n" + ); + } + } + mod string { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(unquote(\"calc(1%)\") 2 3));\n"), + "a {\ + \n value: lab(calc(1%) 2 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% unquote(\"calc(2)\") 3));\n"), + "a {\ + \n value: lab(1% calc(2) 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 unquote(\"calc(3)\")));\n"), + "a {\ + \n value: lab(1% 2 calc(3));\ + \n type: string;\ + \n}\n" + ); + } + } +} +mod clamp { + #[allow(unused)] + use super::runner; + + mod string { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(unquote(\"clamp(1%, 2, 3)\") 2 3));\n" + ), + "a {\ + \n value: lab(clamp(1%, 2, 3) 2 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% unquote(\"clamp(2, 3, 4)\") 3));\n" + ), + "a {\ + \n value: lab(1% clamp(2, 3, 4) 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 unquote(\"clamp(3, 4, 5)\")));\n" + ), + "a {\ + \n value: lab(1% 2 clamp(3, 4, 5));\ + \n type: string;\ + \n}\n" + ); + } + } +} +mod env { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(env(--foo) 2 3));\n"), + "a {\ + \n value: lab(env(--foo) 2 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% env(--foo) 3));\n"), + "a {\ + \n value: lab(1% env(--foo) 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 env(--foo)));\n"), + "a {\ + \n value: lab(1% 2 env(--foo));\ + \n type: string;\ + \n}\n" + ); + } +} +mod max { + #[allow(unused)] + use super::runner; + + mod string { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(unquote(\"max(1%)\") 2 3));\n"), + "a {\ + \n value: lab(max(1%) 2 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% unquote(\"max(2)\") 3));\n"), + "a {\ + \n value: lab(1% max(2) 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 unquote(\"max(3)\")));\n"), + "a {\ + \n value: lab(1% 2 max(3));\ + \n type: string;\ + \n}\n" + ); + } + } +} +mod min { + #[allow(unused)] + use super::runner; + + mod string { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(unquote(\"min(1%)\") 2 3));\n"), + "a {\ + \n value: lab(min(1%) 2 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% unquote(\"min(2)\") 3));\n"), + "a {\ + \n value: lab(1% min(2) 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 unquote(\"min(3)\")));\n"), + "a {\ + \n value: lab(1% 2 min(3));\ + \n type: string;\ + \n}\n" + ); + } + } +} +mod multi_argument_var { + #[allow(unused)] + use super::runner; + + #[test] + fn t1_of_1() { + assert_eq!( + runner().ok("a {b: lab(var(--foo))}\n"), + "a {\ + \n b: lab(var(--foo));\ + \n}\n" + ); + } + #[test] + fn t1_of_2() { + assert_eq!( + runner().ok( + "// var() is substituted before parsing, so it may contain multiple arguments.\ + \na {b: lab(var(--foo) 2)}\n" + ), + "a {\ + \n b: lab(var(--foo) 2);\ + \n}\n" + ); + } + #[test] + fn t2_of_2() { + assert_eq!( + runner().ok("a {b: lab(1% var(--foo))}\n"), + "a {\ + \n b: lab(1% var(--foo));\ + \n}\n" + ); + } +} +mod var { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(var(--foo) 2 3));\n"), + "a {\ + \n value: lab(var(--foo) 2 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% var(--foo) 3));\n"), + "a {\ + \n value: lab(1% var(--foo) 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(1% 2 var(--foo)));\n"), + "a {\ + \n value: lab(1% 2 var(--foo));\ + \n type: string;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/lab/special_functions/slash_list.rs b/rsass/tests/spec/core_functions/color/lab/special_functions/slash_list.rs new file mode 100644 index 000000000..78f67ba88 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/lab/special_functions/slash_list.rs @@ -0,0 +1,48 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/lab/special_functions/slash_list.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("slash_list") +} + +#[test] +#[ignore] // unexepected error +fn alpha() { + assert_eq!( + runner().ok("@use \"sass:list\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(list.slash(1% 2 3, var(--c))));\n"), + "a {\ + \n value: lab(1% 2 3 / var(--c));\ + \n type: string;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn channels() { + assert_eq!( + runner().ok("@use \"sass:list\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(list.slash(var(--foo), 0.4)));\n"), + "a {\ + \n value: lab(var(--foo) / 0.4);\ + \n type: string;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn some_channels() { + assert_eq!( + runner().ok( + "@use \"sass:list\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lab(list.slash(1% var(--foo), 0.4)));\n" + ), + "a {\ + \n value: lab(1% var(--foo) / 0.4);\ + \n type: string;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/lch/alpha.rs b/rsass/tests/spec/core_functions/color/lch/alpha.rs new file mode 100644 index 000000000..018ebd109 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/lch/alpha.rs @@ -0,0 +1,199 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/lch/alpha.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("alpha") +} + +mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 3deg / calc(NaN)));\n"), + "a {\ + \n value: lch(1% 2 3deg / 0);\ + \n space: lch;\ + \n channels: 1% 2 3deg / 0;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 3deg / calc(-infinity)));\n"), + "a {\ + \n value: lch(1% 2 3deg / 0);\ + \n space: lch;\ + \n channels: 1% 2 3deg / 0;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 3deg / calc(infinity)));\n"), + "a {\ + \n value: lch(1% 2 3deg);\ + \n space: lch;\ + \n channels: 1% 2 3deg / 1;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch($channels: 1% 2 3deg / 0.4));\n"), + "a {\ + \n value: lch(1% 2 3deg / 0.4);\ + \n space: lch;\ + \n channels: 1% 2 3deg / 0.4;\ + \n}\n" + ); +} +mod none { + #[allow(unused)] + use super::runner; + + mod slash { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn alpha() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 3deg / none));\n"), + "a {\ + \n value: lch(1% 2 3deg / none);\ + \n space: lch;\ + \n channels: 1% 2 3deg / none;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 none / 0.4));\n"), + "a {\ + \n value: lch(1% 2 none / 0.4);\ + \n space: lch;\ + \n channels: 1% 2 none / 0.4;\ + \n}\n" + ); + } + } + mod slash_list { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn alpha() { + assert_eq!( + runner().ok("@use \'sass:list\';\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(list.slash(1% 2 3deg, none)));\n"), + "a {\ + \n value: lch(1% 2 3deg / none);\ + \n space: lch;\ + \n channels: 1% 2 3deg / none;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \'sass:list\';\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(list.slash(1% 2 none, 0.4)));\n"), + "a {\ + \n value: lch(1% 2 none / 0.4);\ + \n space: lch;\ + \n channels: 1% 2 none / 0.4;\ + \n}\n" + ); + } + } +} +#[test] +#[ignore] // unexepected error +fn opaque() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 3deg / 1));\n"), + "a {\ + \n value: lch(1% 2 3deg);\ + \n space: lch;\ + \n channels: 1% 2 3deg / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn partial() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 3deg / 0.4));\n"), + "a {\ + \n value: lch(1% 2 3deg / 0.4);\ + \n space: lch;\ + \n channels: 1% 2 3deg / 0.4;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn percent() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 3deg / 40%));\n"), + "a {\ + \n value: lch(1% 2 3deg / 0.4);\ + \n space: lch;\ + \n channels: 1% 2 3deg / 0.4;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn slash_list() { + assert_eq!( + runner().ok("@use \"sass:list\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(list.slash(1% 2 3deg, 0.4)));\n"), + "a {\ + \n value: lch(1% 2 3deg / 0.4);\ + \n space: lch;\ + \n channels: 1% 2 3deg / 0.4;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn transparent() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 3deg / 0));\n"), + "a {\ + \n value: lch(1% 2 3deg / 0);\ + \n space: lch;\ + \n channels: 1% 2 3deg / 0;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/lch/error.rs b/rsass/tests/spec/core_functions/color/lch/error.rs new file mode 100644 index 000000000..a3ad123c3 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/lch/error.rs @@ -0,0 +1,343 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/lch/error.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("error") +} + +mod list { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn bracketed() { + assert_eq!( + runner().err("a {b: lch([1% 2 3deg])}\n"), + "Error: $channels: Expected an unbracketed list, was [1% 2 3deg]\ + \n ,\ + \n1 | a {b: lch([1% 2 3deg])}\ + \n | ^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn comma() { + assert_eq!( + runner().err( + "a {b: lch((1%, 2, 3deg))}\n" + ), + "Error: $channels: Expected a space- or slash-separated list, was (1%, 2, 3deg)\ + \n ,\ + \n1 | a {b: lch((1%, 2, 3deg))}\ + \n | ^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn empty() { + assert_eq!( + runner().err("a {b: lch(())}\n"), + "Error: $channels: Color component list may not be empty.\ + \n ,\ + \n1 | a {b: lch(())}\ + \n | ^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn empty_space() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \n$empty-space: list.join((), (), $separator: space);\ + \na {b: lch(())}\n" + ), + "Error: $channels: Color component list may not be empty.\ + \n ,\ + \n3 | a {b: lch(())}\ + \n | ^^^^^^^\ + \n \'\ + \n input.scss 3:7 root stylesheet", + ); + } + mod slash { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn one() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \n$single-arg-slash-separated: list.append((), 1% 2 3deg, $separator: slash);\ + \na {b: lch($single-arg-slash-separated)}\n" + ), + "Error: $channels: Only 2 slash-separated elements allowed, but 1 was passed.\ + \n ,\ + \n3 | a {b: lch($single-arg-slash-separated)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 3:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn three() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \na {b: lch(list.slash(1%, 2, 3deg))}\n" + ), + "Error: $channels: Only 2 slash-separated elements allowed, but 3 were passed.\ + \n ,\ + \n2 | a {b: lch(list.slash(1%, 2, 3deg))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // missing error + fn too_few_channels() { + assert_eq!( + runner().err( + "a {b: lch(1% 2)}\n" + ), + "Error: $channels: The lch color space has 3 channels but (1% 2) has 2.\ + \n ,\ + \n1 | a {b: lch(1% 2)}\ + \n | ^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn too_many_channels() { + assert_eq!( + runner().err( + "a {b: lch(1% 2 3deg 0.4)}\n" + ), + "Error: $channels: The lch color space has 3 channels but (1% 2 3deg 0.4) has 4.\ + \n ,\ + \n1 | a {b: lch(1% 2 3deg 0.4)}\ + \n | ^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} +#[test] +#[ignore] // missing error +fn too_few_args() { + assert_eq!( + runner().err("a {b: lch()}\n"), + "Error: Missing argument $channels.\ + \n ,--> input.scss\ + \n1 | a {b: lch()}\ + \n | ^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function lch($channels) {\ + \n | ============== declaration\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); +} +#[test] +#[ignore] // missing error +fn too_many_args() { + assert_eq!( + runner().err("a {b: lch(1%, 2, 3deg, 0.4)}\n"), + "Error: Only 1 argument allowed, but 4 were passed.\ + \n ,--> input.scss\ + \n1 | a {b: lch(1%, 2, 3deg, 0.4)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function lch($channels) {\ + \n | ============== declaration\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); +} +mod test_type { + #[allow(unused)] + use super::runner; + + mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn slash_list() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \na {b: lch(list.slash(1% 2 3deg, c))}\n" + ), + "Error: $channels: c is not a number.\ + \n ,\ + \n2 | a {b: lch(list.slash(1% 2 3deg, c))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // missing error + fn chroma() { + assert_eq!( + runner().err( + "a {b: lch(1% c 3deg)}\n" + ), + "Error: $channels: Expected chroma channel to be a number, was c.\ + \n ,\ + \n1 | a {b: lch(1% c 3deg)}\ + \n | ^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn hue() { + assert_eq!( + runner().err("a {b: lch(1% 2 c)}\n"), + "Error: $channels: Expected hue channel to be a number, was c.\ + \n ,\ + \n1 | a {b: lch(1% 2 c)}\ + \n | ^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn lightness() { + assert_eq!( + runner().err( + "a {b: lch(c 2 3deg)}\n" + ), + "Error: $channels: Expected lightness channel to be a number, was c.\ + \n ,\ + \n1 | a {b: lch(c 2 3deg)}\ + \n | ^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} +mod unit { + #[allow(unused)] + use super::runner; + + mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn slash() { + assert_eq!( + runner().err( + "a {b: lch(1% 2 3deg/0.4px)}\n" + ), + "Error: $alpha: Expected 0.4px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: lch(1% 2 3deg/0.4px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn slash_list() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \na {b: lch(list.slash(1% 2 3deg, 0.4px))}\n" + ), + "Error: $alpha: Expected 0.4px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: lch(list.slash(1% 2 3deg, 0.4px))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // missing error + fn chroma() { + assert_eq!( + runner().err("a {b: lch(1% 2px 3deg)}\n"), + "Error: $chroma: Expected 2px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: lch(1% 2px 3deg)}\ + \n | ^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + mod hue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn percent() { + assert_eq!( + runner().err( + "a {b: lch(1% 2 3%)}\n" + ), + "Error: $hue: Expected 3% to have an angle unit (deg, grad, rad, turn).\ + \n ,\ + \n1 | a {b: lch(1% 2 3%)}\ + \n | ^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn unrelated() { + assert_eq!( + runner().err( + "a {b: lch(1% 2 3px)}\n" + ), + "Error: $hue: Expected 3px to have an angle unit (deg, grad, rad, turn).\ + \n ,\ + \n1 | a {b: lch(1% 2 3px)}\ + \n | ^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // missing error + fn lightness() { + assert_eq!( + runner().err("a {b: lch(1px 2 3deg)}\n"), + "Error: $lightness: Expected 1px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: lch(1px 2 3deg)}\ + \n | ^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale_color/mod.rs b/rsass/tests/spec/core_functions/color/lch/mod.rs similarity index 56% rename from rsass/tests/spec/core_functions/color/scale_color/mod.rs rename to rsass/tests/spec/core_functions/color/lch/mod.rs index a3057a52d..f068fa412 100644 --- a/rsass/tests/spec/core_functions/color/scale_color/mod.rs +++ b/rsass/tests/spec/core_functions/color/lch/mod.rs @@ -1,16 +1,14 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale_color" +//! Tests auto-converted from "sass-spec/spec/core_functions/color/lch" #[allow(unused)] fn runner() -> crate::TestRunner { - super::runner().with_cwd("scale_color") + super::runner().with_cwd("lch") } -mod error; - -mod hsl; +mod alpha; -mod hwb; +mod error; -mod no_rgb_hsl; +mod no_alpha; -mod rgb; +mod special_functions; diff --git a/rsass/tests/spec/core_functions/color/lch/no_alpha.rs b/rsass/tests/spec/core_functions/color/lch/no_alpha.rs new file mode 100644 index 000000000..0ca710388 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/lch/no_alpha.rs @@ -0,0 +1,387 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/lch/no_alpha.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("no_alpha") +} + +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch($channels: 1% 2 3deg));\n"), + "a {\ + \n value: lch(1% 2 3deg);\ + \n space: lch;\ + \n channels: 1% 2 3deg / 1;\ + \n}\n" + ); +} +mod none { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% none 3deg));\n"), + "a {\ + \n value: lch(1% none 3deg);\ + \n space: lch;\ + \n channels: 1% none 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 none));\n"), + "a {\ + \n value: lch(1% 2 none);\ + \n space: lch;\ + \n channels: 1% 2 none / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(none 2 3deg));\n"), + "a {\ + \n value: lch(none 2 3deg);\ + \n space: lch;\ + \n channels: none 2 3deg / 1;\ + \n}\n" + ); + } +} +mod percent { + #[allow(unused)] + use super::runner; + + mod chroma { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 101% 3deg));\n"), + "a {\ + \n value: lch(1% 151.5 3deg);\ + \n space: lch;\ + \n channels: 1% 151.5 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% -1% 3deg));\n"), + "a {\ + \n value: lch(1% 0 3deg);\ + \n space: lch;\ + \n channels: 1% 0 3deg / 1;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2% 3deg));\n"), + "a {\ + \n value: lch(1% 3 3deg);\ + \n space: lch;\ + \n channels: 1% 3 3deg / 1;\ + \n}\n" + ); + } + mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(110% 2 3deg));\n"), + "a {\ + \n value: lch(100% 2 3deg);\ + \n space: lch;\ + \n channels: 100% 2 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(-1% 2 3deg));\n"), + "a {\ + \n value: lch(0% 2 3deg);\ + \n space: lch;\ + \n channels: 0% 2 3deg / 1;\ + \n}\n" + ); + } + } +} +mod unitless { + #[allow(unused)] + use super::runner; + + mod chroma { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 0.5 3deg));\n"), + "a {\ + \n value: lch(1% 0.5 3deg);\ + \n space: lch;\ + \n channels: 1% 0.5 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% -0.1 3deg));\n"), + "a {\ + \n value: lch(1% 0 3deg);\ + \n space: lch;\ + \n channels: 1% 0 3deg / 1;\ + \n}\n" + ); + } + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% calc(NaN) 3deg));\n"), + "a {\ + \n value: lch(1% 0 3deg);\ + \n space: lch;\ + \n channels: 1% 0 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% calc(-infinity) 3deg));\n"), + "a {\ + \n value: lch(1% 0 3deg);\ + \n space: lch;\ + \n channels: 1% 0 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% calc(infinity) 3deg));\n"), + "a {\ + \n value: lch(1% calc(infinity) 3deg);\ + \n space: lch;\ + \n channels: 1% calc(infinity) 3deg / 1;\ + \n}\n" + ); + } + } + } + mod hue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 361deg));\n"), + "a {\ + \n value: lch(1% 2 1deg);\ + \n space: lch;\ + \n channels: 1% 2 1deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 -1deg));\n"), + "a {\ + \n value: lch(1% 2 359deg);\ + \n space: lch;\ + \n channels: 1% 2 359deg / 1;\ + \n}\n" + ); + } + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 calc(NaN)));\n"), + "a {\ + \n value: lch(1% 2 calc(NaN * 1deg));\ + \n space: lch;\ + \n channels: 1% 2 calc(NaN * 1deg) / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 calc(-infinity)));\n"), + "a {\ + \n value: lch(1% 2 calc(NaN * 1deg));\ + \n space: lch;\ + \n channels: 1% 2 calc(NaN * 1deg) / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 calc(infinity)));\n"), + "a {\ + \n value: lch(1% 2 calc(NaN * 1deg));\ + \n space: lch;\ + \n channels: 1% 2 calc(NaN * 1deg) / 1;\ + \n}\n" + ); + } + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1 2 3deg));\n"), + "a {\ + \n value: lch(1% 2 3deg);\ + \n space: lch;\ + \n channels: 1% 2 3deg / 1;\ + \n}\n" + ); + } + mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(101 2 3deg));\n"), + "a {\ + \n value: lch(100% 2 3deg);\ + \n space: lch;\ + \n channels: 100% 2 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(-1 2 3deg));\n"), + "a {\ + \n value: lch(0% 2 3deg);\ + \n space: lch;\ + \n channels: 0% 2 3deg / 1;\ + \n}\n" + ); + } + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(calc(NaN) 2 3deg));\n"), + "a {\ + \n value: lch(0% 2 3deg);\ + \n space: lch;\ + \n channels: 0% 2 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(calc(-infinity) 2 3deg));\n"), + "a {\ + \n value: lch(0% 2 3deg);\ + \n space: lch;\ + \n channels: 0% 2 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(calc(infinity) 2 3deg));\n"), + "a {\ + \n value: lch(100% 2 3deg);\ + \n space: lch;\ + \n channels: 100% 2 3deg / 1;\ + \n}\n" + ); + } + } + } +} diff --git a/rsass/tests/spec/core_functions/color/lch/special_functions.rs b/rsass/tests/spec/core_functions/color/lch/special_functions.rs new file mode 100644 index 000000000..25dd50091 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/lch/special_functions.rs @@ -0,0 +1,174 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/lch/special_functions.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("special_functions") +} + +mod calculation { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(calc(1px + 1%) 2 3deg));\n"), + "a {\ + \n value: lch(calc(1px + 1%) 2 3deg);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% calc(1px + 1%) 3deg));\n"), + "a {\ + \n value: lch(1% calc(1px + 1%) 3deg);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 calc(1px + 1%)));\n"), + "a {\ + \n value: lch(1% 2 calc(1px + 1%));\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_4() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 3deg / calc(1px + 1%)));\n"), + "a {\ + \n value: lch(1% 2 3deg/calc(1px + 1%));\ + \n type: string;\ + \n}\n" + ); + } +} +mod multi_argument_var { + #[allow(unused)] + use super::runner; + + mod t1_of_1 { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn alpha() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(var(--foo) / 0.4));\n"), + "a {\ + \n value: lch(var(--foo)/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn no_alpha() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(var(--foo)));\n"), + "a {\ + \n value: lch(var(--foo));\ + \n type: string;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn t1_of_2() { + assert_eq!( + runner().ok( + "// var() is substituted before parsing, so it may contain multiple arguments.\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(var(--foo) 2deg));\n" + ), + "a {\ + \n value: lch(var(--foo) 2deg);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn t2_of_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% var(--foo)));\n"), + "a {\ + \n value: lch(1% var(--foo));\ + \n type: string;\ + \n}\n" + ); + } +} +mod var { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(var(--foo) 2 3deg));\n"), + "a {\ + \n value: lch(var(--foo) 2 3deg);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% var(--foo) 3deg));\n"), + "a {\ + \n value: lch(1% var(--foo) 3deg);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 var(--foo)));\n"), + "a {\ + \n value: lch(1% 2 var(--foo));\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_4() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(lch(1% 2 3deg / var(--foo)));\n"), + "a {\ + \n value: lch(1% 2 3deg/var(--foo));\ + \n type: string;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/lighten.rs b/rsass/tests/spec/core_functions/color/lighten.rs index 1e987767c..f1a7f4e10 100644 --- a/rsass/tests/spec/core_functions/color/lighten.rs +++ b/rsass/tests/spec/core_functions/color/lighten.rs @@ -48,6 +48,21 @@ mod error { } } #[test] + #[ignore] // wrong error + fn non_legacy() { + assert_eq!( + runner().err( + "a {b: lighten(color(srgb 0 0 0), 10%)}\n" + ), + "Error: lighten() is only supported for legacy colors. Please use color.adjust() instead with an explicit $space argument.\ + \n ,\ + \n1 | a {b: lighten(color(srgb 0 0 0), 10%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] fn too_few_args() { assert_eq!( runner().err("a {b: lighten(red)}\n"), @@ -110,11 +125,12 @@ mod error { } } #[test] +#[ignore] // wrong result fn fraction() { assert_eq!( runner().ok("a {b: lighten(red, 0.5%)}\n"), "a {\ - \n b: #ff0303;\ + \n b: rgb(255, 2.55, 2.55);\ \n}\n" ); } @@ -137,11 +153,12 @@ fn max_remaining() { ); } #[test] +#[ignore] // wrong result fn middle() { assert_eq!( runner().ok("a {b: lighten(red, 14%)}\n"), "a {\ - \n b: #ff4747;\ + \n b: rgb(255, 71.4, 71.4);\ \n}\n" ); } @@ -155,11 +172,12 @@ fn min() { ); } #[test] +#[ignore] // wrong result fn named() { assert_eq!( runner().ok("a {b: lighten($color: red, $amount: 14%)}\n"), "a {\ - \n b: #ff4747;\ + \n b: rgb(255, 71.4, 71.4);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/lightness.rs b/rsass/tests/spec/core_functions/color/lightness.rs index ad22f49ea..fbf2e9aa5 100644 --- a/rsass/tests/spec/core_functions/color/lightness.rs +++ b/rsass/tests/spec/core_functions/color/lightness.rs @@ -9,55 +9,81 @@ mod error { #[allow(unused)] use super::runner; + #[test] + #[ignore] // wrong error + fn non_legacy() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.lightness(lch(0% 0 0deg))}\n" + ), + "Error: color.lightness() is only supported for legacy colors. Please use color.channel() instead with an explicit $space argument.\ + \n ,\ + \n2 | a {b: color.lightness(lch(0% 0 0deg))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: lightness()}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.lightness()}\n" + ), "Error: Missing argument $color.\ \n ,--> input.scss\ - \n1 | a {b: lightness()}\ - \n | ^^^^^^^^^^^ invocation\ + \n2 | a {b: color.lightness()}\ + \n | ^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ \n1 | @function lightness($color) {\ \n | ================= declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: lightness(red, green)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.lightness(red, green)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: lightness(red, green)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: color.lightness(red, green)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ \n1 | @function lightness($color) {\ \n | ================= declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: lightness(1)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.lightness(1)}\n" + ), "Error: $color: 1 is not a color.\ \n ,\ - \n1 | a {b: lightness(1)}\ - \n | ^^^^^^^^^^^^\ + \n2 | a {b: color.lightness(1)}\ + \n | ^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn fraction() { assert_eq!( - runner().ok("a {b: lightness(hsl(0, 100%, 0.5%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.lightness(hsl(0, 100%, 0.5%))}\n"), "a {\ \n b: 0.5%;\ \n}\n" @@ -66,7 +92,8 @@ fn fraction() { #[test] fn max() { assert_eq!( - runner().ok("a {b: lightness(hsl(0, 100%, 100%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.lightness(hsl(0, 100%, 100%))}\n"), "a {\ \n b: 100%;\ \n}\n" @@ -75,7 +102,8 @@ fn max() { #[test] fn middle() { assert_eq!( - runner().ok("a {b: lightness(hsl(0, 100%, 50%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.lightness(hsl(0, 100%, 50%))}\n"), "a {\ \n b: 50%;\ \n}\n" @@ -84,7 +112,8 @@ fn middle() { #[test] fn min() { assert_eq!( - runner().ok("a {b: lightness(hsl(0, 100%, 0%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.lightness(hsl(0, 100%, 0%))}\n"), "a {\ \n b: 0%;\ \n}\n" @@ -93,7 +122,8 @@ fn min() { #[test] fn named() { assert_eq!( - runner().ok("a {b: lightness($color: hsl(0, 100%, 42%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.lightness($color: hsl(0, 100%, 42%))}\n"), "a {\ \n b: 42%;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/color/mix.rs b/rsass/tests/spec/core_functions/color/mix.rs deleted file mode 100644 index a578b6a41..000000000 --- a/rsass/tests/spec/core_functions/color/mix.rs +++ /dev/null @@ -1,393 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/mix.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("mix") -} - -mod alpha { - #[allow(unused)] - use super::runner; - - #[test] - fn even() { - assert_eq!( - runner() - .ok("a {b: mix(rgba(#91e16f, 0.3), rgba(#0144bf, 0.3))}\n"), - "a {\ - \n b: rgba(73, 147, 151, 0.3);\ - \n}\n" - ); - } - #[test] - fn first() { - assert_eq!( - runner().ok("a {b: mix(#91e16f, transparent)}\n"), - "a {\ - \n b: rgba(145, 225, 111, 0.5);\ - \n}\n" - ); - } - #[test] - fn firstwards() { - assert_eq!( - runner() - .ok("a {b: mix(rgba(#91e16f, 0.8), rgba(#0144bf, 0.3))}\n"), - "a {\ - \n b: rgba(109, 186, 131, 0.55);\ - \n}\n" - ); - } - #[test] - fn last() { - assert_eq!( - runner().ok("a {b: mix(transparent, #0144bf)}\n"), - "a {\ - \n b: rgba(1, 68, 191, 0.5);\ - \n}\n" - ); - } - #[test] - fn lastwards() { - assert_eq!( - runner() - .ok("a {b: mix(rgba(#91e16f, 0.4), rgba(#0144bf, 0.9))}\n"), - "a {\ - \n b: rgba(37, 107, 171, 0.65);\ - \n}\n" - ); - } -} -mod both_weights { - #[allow(unused)] - use super::runner; - - #[test] - fn contradiction() { - assert_eq!( - runner().ok( - "// When we weight entirely towards a transparent color, the formula for\ - \n// computing the combined alpha would divide by zero, so we just return\ - \n// transparent as a special case.\ - \na {b: mix(transparent, #0144bf, 100%)}\n" - ), - "a {\ - \n b: rgba(0, 0, 0, 0);\ - \n}\n" - ); - } - mod mixed { - #[allow(unused)] - use super::runner; - - #[test] - fn firstwards() { - assert_eq!( - runner().ok( - "a {b: mix(rgba(#91e16f, 0.8), rgba(#0144bf, 0.3), 63%)}\n" - ), - "a {\ - \n b: rgba(121, 199, 124, 0.615);\ - \n}\n" - ); - } - #[test] - fn lastwards() { - assert_eq!( - runner().ok( - "a {b: mix(rgba(#91e16f, 0.2), rgba(#0144bf, 0.7), 42%)}\n" - ), - "a {\ - \n b: rgba(29, 99, 175, 0.49);\ - \n}\n" - ); - } - } - mod transparent { - #[allow(unused)] - use super::runner; - - #[test] - fn first() { - assert_eq!( - runner().ok("a {b: mix(transparent, #0144bf, 70%)}\n"), - "a {\ - \n b: rgba(1, 68, 191, 0.3);\ - \n}\n" - ); - } - #[test] - fn last() { - assert_eq!( - runner().ok("a {b: mix(#91e16f, transparent, 70%)}\n"), - "a {\ - \n b: rgba(145, 225, 111, 0.7);\ - \n}\n" - ); - } - } - mod weighted { - #[allow(unused)] - use super::runner; - - #[test] - fn first() { - assert_eq!( - runner().ok( - "a {b: mix(rgba(#91e16f, 0.2), rgba(#0144bf, 0.7), 100%)}\n" - ), - "a {\ - \n b: rgba(145, 225, 111, 0.2);\ - \n}\n" - ); - } - #[test] - fn last() { - assert_eq!( - runner().ok( - "a {b: mix(rgba(#91e16f, 0.2), rgba(#0144bf, 0.7), 0%)}\n" - ), - "a {\ - \n b: rgba(1, 68, 191, 0.7);\ - \n}\n" - ); - } - } -} -mod error { - #[allow(unused)] - use super::runner; - - mod bounds { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: mix(red, blue, 100.001%)}\n"), - "Error: $weight: Expected 100.001% to be within 0% and 100%.\ - \n ,\ - \n1 | a {b: mix(red, blue, 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: mix(red, blue, -0.001%)}\n"), - "Error: $weight: Expected -0.001% to be within 0% and 100%.\ - \n ,\ - \n1 | a {b: mix(red, blue, -0.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - } - #[test] - fn too_few_args() { - assert_eq!( - runner().err("a {b: mix(red)}\n"), - "Error: Missing argument $color2.\ - \n ,--> input.scss\ - \n1 | a {b: mix(red)}\ - \n | ^^^^^^^^ invocation\ - \n \'\ - \n ,--> sass:color\ - \n1 | @function mix($color1, $color2, $weight: 50%) {\ - \n | =================================== declaration\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_many_args() { - assert_eq!( - runner().err("a {b: mix(red, blue, 100, 1)}\n"), - "Error: Only 3 arguments allowed, but 4 were passed.\ - \n ,--> input.scss\ - \n1 | a {b: mix(red, blue, 100, 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^ invocation\ - \n \'\ - \n ,--> sass:color\ - \n1 | @function mix($color1, $color2, $weight: 50%) {\ - \n | =================================== declaration\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - mod test_type { - #[allow(unused)] - use super::runner; - - #[test] - fn color1() { - assert_eq!( - runner().err("a {b: mix(1, blue)}\n"), - "Error: $color1: 1 is not a color.\ - \n ,\ - \n1 | a {b: mix(1, blue)}\ - \n | ^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn color2() { - assert_eq!( - runner().err("a {b: mix(red, 1)}\n"), - "Error: $color2: 1 is not a color.\ - \n ,\ - \n1 | a {b: mix(red, 1)}\ - \n | ^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn weight() { - assert_eq!( - runner().err("a {b: mix(red, blue, green)}\n"), - "Error: $weight: green is not a number.\ - \n ,\ - \n1 | a {b: mix(red, blue, green)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - } -} -mod explicit_weight { - #[allow(unused)] - use super::runner; - - #[test] - fn even() { - assert_eq!( - runner().ok("a {b: mix(#91e16f, #0144bf, 50%)}\n"), - "a {\ - \n b: #499397;\ - \n}\n" - ); - } - #[test] - fn first() { - assert_eq!( - runner().ok("a {b: mix(#91e16f, #0144bf, 100%)}\n"), - "a {\ - \n b: #91e16f;\ - \n}\n" - ); - } - #[test] - fn firstwards() { - assert_eq!( - runner().ok("a {b: mix(#91e16f, #0144bf, 92%)}\n"), - "a {\ - \n b: #85d475;\ - \n}\n" - ); - } - #[test] - fn last() { - assert_eq!( - runner().ok("a {b: mix(#91e16f, #0144bf, 0%)}\n"), - "a {\ - \n b: #0144bf;\ - \n}\n" - ); - } - #[test] - fn lastwards() { - assert_eq!( - runner().ok("a {b: mix(#91e16f, #0144bf, 43%)}\n"), - "a {\ - \n b: #3f889d;\ - \n}\n" - ); - } -} -#[test] -fn named() { - assert_eq!( - runner().ok( - "a {b: mix($color1: #91e16f, $color2: #0144bf, $weight: 92%)}\n" - ), - "a {\ - \n b: #85d475;\ - \n}\n" - ); -} -mod units { - #[allow(unused)] - use super::runner; - - mod weight { - #[allow(unused)] - use super::runner; - - #[test] - fn unitless() { - assert_eq!( - runner().ok("a {b: mix(#91e16f, #0144bf, 50)}\n"), - "a {\ - \n b: #499397;\ - \n}\n" - ); - } - #[test] - fn unknown() { - assert_eq!( - runner().ok("a {b: mix(#91e16f, #0144bf, 50px)}\n"), - "a {\ - \n b: #499397;\ - \n}\n" - ); - } - } -} -mod unweighted { - #[allow(unused)] - use super::runner; - - #[test] - fn average() { - assert_eq!( - runner().ok( - "// All channels should be averaged across the two colors.\ - \na {b: mix(#91e16f, #0144bf)}\n" - ), - "a {\ - \n b: #499397;\ - \n}\n" - ); - } - #[test] - fn identical() { - assert_eq!( - runner().ok( - "// If two channels have the same values, they should be the same in the output.\ - \na {b: mix(#123456, #123456)}\n" - ), - "a {\ - \n b: #123456;\ - \n}\n" - ); - } - #[test] - fn min_and_max() { - assert_eq!( - runner().ok( - "// Each channel becomes the average of 255 and 0, which is 128 = 0xAA.\ - \na {b: mix(#ff00ff, #00ff00)}\n" - ), - "a {\ - \n b: gray;\ - \n}\n" - ); - } -} diff --git a/rsass/tests/spec/core_functions/color/mix/alpha.rs b/rsass/tests/spec/core_functions/color/mix/alpha.rs new file mode 100644 index 000000000..119f9b14a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/mix/alpha.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/mix/alpha.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("alpha") +} + +#[test] +#[ignore] // wrong result +fn even() { + assert_eq!( + runner().ok("a {b: mix(rgba(#91e16f, 0.3), rgba(#0144bf, 0.3))}\n"), + "a {\ + \n b: rgba(73, 146.5, 151, 0.3);\ + \n}\n" + ); +} +#[test] +fn first() { + assert_eq!( + runner().ok("a {b: mix(#91e16f, transparent)}\n"), + "a {\ + \n b: rgba(145, 225, 111, 0.5);\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn firstwards() { + assert_eq!( + runner().ok("a {b: mix(rgba(#91e16f, 0.8), rgba(#0144bf, 0.3))}\n"), + "a {\ + \n b: rgba(109, 185.75, 131, 0.55);\ + \n}\n" + ); +} +#[test] +fn last() { + assert_eq!( + runner().ok("a {b: mix(transparent, #0144bf)}\n"), + "a {\ + \n b: rgba(1, 68, 191, 0.5);\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn lastwards() { + assert_eq!( + runner().ok("a {b: mix(rgba(#91e16f, 0.4), rgba(#0144bf, 0.9))}\n"), + "a {\ + \n b: rgba(37, 107.25, 171, 0.65);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/mix/both_weights.rs b/rsass/tests/spec/core_functions/color/mix/both_weights.rs new file mode 100644 index 000000000..8d43dc6be --- /dev/null +++ b/rsass/tests/spec/core_functions/color/mix/both_weights.rs @@ -0,0 +1,100 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/mix/both_weights.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("both_weights") +} + +#[test] +fn contradiction() { + assert_eq!( + runner().ok( + "// When we weight entirely towards a transparent color, the formula for\ + \n// computing the combined alpha would divide by zero, so we just return\ + \n// transparent as a special case.\ + \na {b: mix(transparent, #0144bf, 100%)}\n" + ), + "a {\ + \n b: rgba(0, 0, 0, 0);\ + \n}\n" + ); +} +mod mixed { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn firstwards() { + assert_eq!( + runner().ok( + "a {b: mix(rgba(#91e16f, 0.8), rgba(#0144bf, 0.3), 63%)}\n" + ), + "a {\ + \n b: rgba(121.4247787611, 199.296460177, 124.0973451327, 0.615);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn lastwards() { + assert_eq!( + runner().ok( + "a {b: mix(rgba(#91e16f, 0.2), rgba(#0144bf, 0.7), 42%)}\n" + ), + "a {\ + \n b: rgba(29, 98.5277777778, 175.4444444444, 0.49);\ + \n}\n" + ); + } +} +mod transparent { + #[allow(unused)] + use super::runner; + + #[test] + fn first() { + assert_eq!( + runner().ok("a {b: mix(transparent, #0144bf, 70%)}\n"), + "a {\ + \n b: rgba(1, 68, 191, 0.3);\ + \n}\n" + ); + } + #[test] + fn last() { + assert_eq!( + runner().ok("a {b: mix(#91e16f, transparent, 70%)}\n"), + "a {\ + \n b: rgba(145, 225, 111, 0.7);\ + \n}\n" + ); + } +} +mod weighted { + #[allow(unused)] + use super::runner; + + #[test] + fn first() { + assert_eq!( + runner().ok( + "a {b: mix(rgba(#91e16f, 0.2), rgba(#0144bf, 0.7), 100%)}\n" + ), + "a {\ + \n b: rgba(145, 225, 111, 0.2);\ + \n}\n" + ); + } + #[test] + fn last() { + assert_eq!( + runner().ok( + "a {b: mix(rgba(#91e16f, 0.2), rgba(#0144bf, 0.7), 0%)}\n" + ), + "a {\ + \n b: rgba(1, 68, 191, 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/mix/error.rs b/rsass/tests/spec/core_functions/color/mix/error.rs new file mode 100644 index 000000000..572c0839b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/mix/error.rs @@ -0,0 +1,352 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/mix/error.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("error") +} + +mod bounds { + #[allow(unused)] + use super::runner; + + #[test] + fn too_high() { + assert_eq!( + runner().err("a {b: mix(red, blue, 100.001%)}\n"), + "Error: $weight: Expected 100.001% to be within 0% and 100%.\ + \n ,\ + \n1 | a {b: mix(red, blue, 100.001%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + fn too_low() { + assert_eq!( + runner().err("a {b: mix(red, blue, -0.001%)}\n"), + "Error: $weight: Expected -0.001% to be within 0% and 100%.\ + \n ,\ + \n1 | a {b: mix(red, blue, -0.001%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} +#[test] +#[ignore] // wrong error +fn color_interpolation_method() { + assert_eq!( + runner().err("a {b: mix(red, blue, $method: brighter)}\n"), + "Error: $method: Unknown color space \"brighter\".\ + \n ,\ + \n1 | a {b: mix(red, blue, $method: brighter)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn extra_character_end() { + assert_eq!( + runner().err("a {b: mix(red, blue, $method: hsl longer hue.)}\n"), + "Error: Expected identifier.\ + \n ,\ + \n1 | a {b: mix(red, blue, $method: hsl longer hue.)}\ + \n | ^\ + \n \'\ + \n input.scss 1:46 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn extra_character_start() { + assert_eq!( + runner().err("a {b: mix(red, blue, $method: ,hsl longer hue)}\n"), + "Error: Expected expression.\ + \n ,\ + \n1 | a {b: mix(red, blue, $method: ,hsl longer hue)}\ + \n | ^\ + \n \'\ + \n input.scss 1:31 root stylesheet", + ); +} +mod interpolation { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn number() { + assert_eq!( + runner().err("a {b: mix(red, blue, $method: hsl 1)}\n"), + "Error: $method: 1 is not a string.\ + \n ,\ + \n1 | a {b: mix(red, blue, $method: hsl 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} +mod interpolation_list { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn quoted() { + assert_eq!( + runner().err( + "a {b: mix(red, blue, $method: \"hsl longer hue\")}\n" + ), + "Error: $method: Expected \"hsl longer hue\" to be an unquoted string.\ + \n ,\ + \n1 | a {b: mix(red, blue, $method: \"hsl longer hue\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn separator() { + assert_eq!( + runner().err("a {b: mix(red, blue, $method: hsl, longer hue)}\n"), + "Error: Positional arguments must come before keyword arguments.\ + \n ,\ + \n1 | a {b: mix(red, blue, $method: hsl, longer hue)}\ + \n | ^^^^^^^^^^\ + \n \'\ + \n input.scss 1:36 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn slash() { + assert_eq!( + runner().err("a {b: mix(red, blue, $method: hsl/longer/hue)}\n"), + "Error: $method: Unknown color space \"hsl/longer/hue\".\ + \n ,\ + \n1 | a {b: mix(red, blue, $method: hsl/longer/hue)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} +mod invalid_method { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn unsupported() { + assert_eq!( + runner().err( + "// \"specified\" was a method in an earlier draft of CSS Colors 4, but it was\ + \n// dropped because it required implementations to lazily normalize hues.\ + \na {b: mix(red, blue, $method: hsl specified hue)}\n" + ), + "Error: $method: Unknown hue interpolation method specified.\ + \n ,\ + \n3 | a {b: mix(red, blue, $method: hsl specified hue)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 3:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn wrong_hue_keyword() { + assert_eq!( + runner().err( + "a {b: mix(red, blue, $method: hsl longer shade)}\n" + ), + "Error: $method: Expected unquoted string \"hue\" at the end of (hsl longer shade), was shade.\ + \n ,\ + \n1 | a {b: mix(red, blue, $method: hsl longer shade)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} +#[test] +#[ignore] // wrong error +fn missing_hue_string() { + assert_eq!( + runner().err( + "a {b: mix(red, blue, $method: lch decreasing)}\n" + ), + "Error: $method: Expected unquoted string \"hue\" after (lch decreasing).\ + \n ,\ + \n1 | a {b: mix(red, blue, $method: lch decreasing)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); +} +mod null_method { + #[allow(unused)] + use super::runner; + + mod non_legacy { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn color1() { + assert_eq!( + runner().err( + "a {b: mix(lch(20% -20 0), red)}\n" + ), + "Error: $color1: To use color.mix() with non-legacy color lch(20% 0 0deg), you must provide a $method.\ + \n ,\ + \n1 | a {b: mix(lch(20% -20 0), red)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn color2() { + assert_eq!( + runner().err( + "a {b: mix(red, lch(20% -20 0))}\n" + ), + "Error: $color2: To use color.mix() with non-legacy color lch(20% 0 0deg), you must provide a $method.\ + \n ,\ + \n1 | a {b: mix(red, lch(20% -20 0))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + } +} +#[test] +#[ignore] // wrong error +fn parentheses() { + assert_eq!( + runner() + .err("a {b: mix(red, blue, $method: lch (decreasing hue))}\n"), + "Error: $method: (decreasing hue) is not a string.\ + \n ,\ + \n1 | a {b: mix(red, blue, $method: lch (decreasing hue))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn rectangular_space_with_method() { + assert_eq!( + runner().err( + "a {b: mix(red, blue, $method: srgb longer hue)}\n" + ), + "Error: $method: Hue interpolation method \"HueInterpolationMethod.longer hue\" may not be set for rectangular color space srgb.\ + \n ,\ + \n1 | a {b: mix(red, blue, $method: srgb longer hue)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn too_few_args() { + assert_eq!( + runner().err( + "a {b: mix(red)}\n" + ), + "Error: Missing argument $color2.\ + \n ,--> input.scss\ + \n1 | a {b: mix(red)}\ + \n | ^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function mix($color1, $color2, $weight: 50%, $method: null) {\ + \n | ================================================== declaration\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn too_many_args() { + assert_eq!( + runner().err( + "a {b: mix(red, blue, 30%, lch, 1)}\n" + ), + "Error: Only 4 arguments allowed, but 5 were passed.\ + \n ,--> input.scss\ + \n1 | a {b: mix(red, blue, 30%, lch, 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function mix($color1, $color2, $weight: 50%, $method: null) {\ + \n | ================================================== declaration\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); +} +mod test_type { + #[allow(unused)] + use super::runner; + + #[test] + fn color1() { + assert_eq!( + runner().err("a {b: mix(1, blue)}\n"), + "Error: $color1: 1 is not a color.\ + \n ,\ + \n1 | a {b: mix(1, blue)}\ + \n | ^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + fn color2() { + assert_eq!( + runner().err("a {b: mix(red, 1)}\n"), + "Error: $color2: 1 is not a color.\ + \n ,\ + \n1 | a {b: mix(red, 1)}\ + \n | ^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + fn weight() { + assert_eq!( + runner().err("a {b: mix(red, blue, green)}\n"), + "Error: $weight: green is not a number.\ + \n ,\ + \n1 | a {b: mix(red, blue, green)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} +#[test] +#[ignore] // wrong error +fn unknown_interpolation() { + assert_eq!( + runner().err("a {b: mix(red, blue, $method: lch longerhue)}\n"), + "Error: $method: Unknown hue interpolation method longerhue.\ + \n ,\ + \n1 | a {b: mix(red, blue, $method: lch longerhue)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/mix/explicit_method.rs b/rsass/tests/spec/core_functions/color/mix/explicit_method.rs new file mode 100644 index 000000000..5c5145d66 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/mix/explicit_method.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/mix/explicit_method.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("explicit_method") +} + +#[test] +#[ignore] // unexepected error +fn non_srgb() { + assert_eq!( + runner().ok( + "a {b: mix(lab(54.3 80.8 69.9), lch(46.3 68 134), $method: oklch)}\n" + ), + "a {\ + \n b: lab(50.3820989016% 23.739480318 159.7498257827);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn previously_invalid() { + assert_eq!( + runner().ok( + "// An earlier draft of CSS Colors 4 didn\'t allow some spaces because they were\ + \n// redundant with others, but they should be allowed now.\ + \na {b: mix(lab(54.3 80.8 69.9), lch(46.3 68 134), $method: display-p3)}\n" + ), + "a {\ + \n b: lab(43.9078099681% 26.0060363023 48.9943374049);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn srgb() { + assert_eq!( + runner().ok("a {b: mix(red, green, $method: xyz)}\n"), + "a {\ + \n b: rgb(187.5160306784, 92.3735312967, 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn weighted() { + assert_eq!( + runner().ok( + "a {b: mix(lab(54.3 80.8 69.9), lch(46.3 68 134), 30%, oklch)}\n" + ), + "a {\ + \n b: lab(48.946809662% -7.9262399011 131.5295913021);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/mix/explicit_weight.rs b/rsass/tests/spec/core_functions/color/mix/explicit_weight.rs new file mode 100644 index 000000000..b2bc9e98d --- /dev/null +++ b/rsass/tests/spec/core_functions/color/mix/explicit_weight.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/mix/explicit_weight.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("explicit_weight") +} + +#[test] +#[ignore] // wrong result +fn even() { + assert_eq!( + runner().ok("a {b: mix(#91e16f, #0144bf, 50%)}\n"), + "a {\ + \n b: rgb(73, 146.5, 151);\ + \n}\n" + ); +} +#[test] +fn first() { + assert_eq!( + runner().ok("a {b: mix(#91e16f, #0144bf, 100%)}\n"), + "a {\ + \n b: #91e16f;\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn firstwards() { + assert_eq!( + runner().ok("a {b: mix(#91e16f, #0144bf, 92%)}\n"), + "a {\ + \n b: rgb(133.48, 212.44, 117.4);\ + \n}\n" + ); +} +#[test] +fn last() { + assert_eq!( + runner().ok("a {b: mix(#91e16f, #0144bf, 0%)}\n"), + "a {\ + \n b: #0144bf;\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn lastwards() { + assert_eq!( + runner().ok("a {b: mix(#91e16f, #0144bf, 43%)}\n"), + "a {\ + \n b: rgb(62.92, 135.51, 156.6);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/mix/hue_interpolation.rs b/rsass/tests/spec/core_functions/color/mix/hue_interpolation.rs new file mode 100644 index 000000000..ea3ed7723 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/mix/hue_interpolation.rs @@ -0,0 +1,162 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/mix/hue_interpolation.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hue_interpolation") +} + +#[test] +#[ignore] // unexepected error +fn case_insensitive() { + assert_eq!( + runner().ok( + "a {b: mix(oklch(0.5 0.1 30), oklch(0.5 0.1 190), $method: oKlCh LONger HUE)}\n" + ), + "a {\ + \n b: oklch(50% 0.1 290deg);\ + \n}\n" + ); +} +mod decreasing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn acute() { + assert_eq!( + runner().ok( + "a {b: mix(oklch(0.5 0.1 30), oklch(0.5 0.1 190), $method: oklch decreasing hue)}\n" + ), + "a {\ + \n b: oklch(50% 0.1 290deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn obtuse() { + assert_eq!( + runner().ok( + "a {b: mix(oklch(0.5 0.1 30), oklch(0.5 0.1 230), $method: oklch decreasing hue)}\n" + ), + "a {\ + \n b: oklch(50% 0.1 310deg);\ + \n}\n" + ); + } +} +mod default { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn acute() { + assert_eq!( + runner().ok( + "a {b: mix(oklch(0.5 0.1 30), oklch(0.5 0.1 190), $method: oklch)}\n" + ), + "a {\ + \n b: oklch(50% 0.1 110deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn obtuse() { + assert_eq!( + runner().ok( + "a {b: mix(oklch(0.5 0.1 30), oklch(0.5 0.1 230), $method: oklch)}\n" + ), + "a {\ + \n b: oklch(50% 0.1 310deg);\ + \n}\n" + ); + } +} +mod increasing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn acute() { + assert_eq!( + runner().ok( + "a {b: mix(oklch(0.5 0.1 30), oklch(0.5 0.1 190), $method: oklch increasing hue)}\n" + ), + "a {\ + \n b: oklch(50% 0.1 110deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn obtuse() { + assert_eq!( + runner().ok( + "a {b: mix(oklch(0.5 0.1 30), oklch(0.5 0.1 230), $method: oklch increasing hue)}\n" + ), + "a {\ + \n b: oklch(50% 0.1 130deg);\ + \n}\n" + ); + } +} +mod longer { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn obtuse() { + assert_eq!( + runner().ok( + "a {b: mix(oklch(0.5 0.1 30), oklch(0.5 0.1 230), $method: oklch longer hue)}\n" + ), + "a {\ + \n b: oklch(50% 0.1 130deg);\ + \n}\n" + ); + } +} +mod shorter { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn acute() { + assert_eq!( + runner().ok( + "a {b: mix(oklch(0.5 0.1 30), oklch(0.5 0.1 190), $method: oklch shorter hue)}\n" + ), + "a {\ + \n b: oklch(50% 0.1 110deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn obtuse() { + assert_eq!( + runner().ok( + "a {b: mix(oklch(0.5 0.1 30), oklch(0.5 0.1 230), $method: oklch shorter hue)}\n" + ), + "a {\ + \n b: oklch(50% 0.1 310deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn weighted() { + assert_eq!( + runner().ok("a {b: mix(red, green, 20%, lch longer hue)}\n"), + "a {\ + \n b: rgb(201.9125152451, 62.5456438786, 25.0531427989);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/mix/missing.rs b/rsass/tests/spec/core_functions/color/mix/missing.rs new file mode 100644 index 000000000..1f780477d --- /dev/null +++ b/rsass/tests/spec/core_functions/color/mix/missing.rs @@ -0,0 +1,315 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/mix/missing.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("missing") +} + +mod explicit { + #[allow(unused)] + use super::runner; + + mod analogous { + #[allow(unused)] + use super::runner; + + mod legacy { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn both() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.mix(rgb(0 none 200), rgb(200 none 0), $method: rec2020)}\n" + ), + "a {\ + \n b: rgb(129.0248146672, 0, 115.9531222724);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn color1() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.mix(rgb(none 100 200), rgb(200 100 0), $method: rec2020)}\n" + ), + "a {\ + \n b: rgb(199.7671172587, 91.8239078594, 117.7284104313);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn color2() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.mix(rgb(0 100 200), rgb(200 none 0), $method: rec2020)}\n" + ), + "a {\ + \n b: rgb(128.6114294932, 95.678836923, 112.8090426091);\ + \n}\n" + ); + } + } + mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn both() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.mix(\ + \n color(srgb 0.1 0.2 none),\ + \n color(srgb 0.3 0.2 none),\ + \n $method: rec2020\ + \n );\ + \n}\n"), + "a {\ + \n b: color(srgb 0.2110804397 0.2012136757 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn color1() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.mix(\ + \n color(srgb none 0.1 0.2),\ + \n color(srgb 0.1 0.2 0.3),\ + \n $method: rec2020\ + \n );\ + \n}\n"), + "a {\ + \n b: color(srgb 0.146201736 0.1492595622 0.2497768167);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn color2() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.mix(\ + \n color(srgb 0.1 0.2 0.3),\ + \n color(srgb 0.1 none 0.2),\ + \n $method: rec2020\ + \n );\ + \n}\n"), + "a {\ + \n b: color(srgb 0.0134568276 0.2030946777 0.2456679982);\ + \n}\n" + ); + } + } + } + mod same { + #[allow(unused)] + use super::runner; + + mod legacy { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn both() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.mix(rgb(0 none 200), rgb(200 none 0), $method: rgb)}\n" + ), + "a {\ + \n b: rgb(100 none 100);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn color1() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.mix(rgb(none 100 200), rgb(200 100 0), $method: rgb)}\n" + ), + "a {\ + \n b: #c86464;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn color2() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.mix(rgb(0 100 200), rgb(200 none 0), $method: rgb)}\n" + ), + "a {\ + \n b: #646464;\ + \n}\n" + ); + } + } + mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn both() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.mix(\ + \n color(srgb 0.1 0.2 none),\ + \n color(srgb 0.3 0.2 none),\ + \n $method: srgb\ + \n );\ + \n}\n"), + "a {\ + \n b: color(srgb 0.2 0.2 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn color1() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.mix(\ + \n color(srgb none 0.1 0.2),\ + \n color(srgb 0.1 0.2 0.3),\ + \n $method: srgb\ + \n );\ + \n}\n"), + "a {\ + \n b: color(srgb 0.1 0.15 0.25);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn color2() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.mix(\ + \n color(srgb 0.1 0.2 0.3),\ + \n color(srgb 0.1 none 0.2),\ + \n $method: srgb\ + \n );\ + \n}\n"), + "a {\ + \n b: color(srgb 0.1 0.2 0.25);\ + \n}\n" + ); + } + } + } +} +mod powerless { + #[allow(unused)] + use super::runner; + + mod legacy { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn both() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.mix(hsl(120deg 0% 50%), hsl(0deg 0% 30%), $method: lch)}\n" + ), + "a {\ + \n b: hsl(0, 0%, 39.7779408276%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn color1() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.mix(hsl(0deg 0% 30%), hsl(120deg 50% 50%), $method: lch)}\n" + ), + "a {\ + \n b: hsl(113.4583259264, 28.061366187%, 40.5877359835%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn color2() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.mix(hsl(120deg 50% 50%), hsl(0deg 0% 30%), $method: lch)}\n" + ), + "a {\ + \n b: hsl(113.4583259264, 28.061366187%, 40.5877359835%);\ + \n}\n" + ); + } + } + mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn both() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.mix(lch(50% 0% 120deg), lch(30% 0% 0deg), $method: hsl)}\n" + ), + "a {\ + \n b: lch(40.2238896861% 0 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn color1() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.mix(lch(30% 0% 0deg), lch(50% 10% 120deg), $method: hsl)}\n" + ), + "a {\ + \n b: lch(39.8551054023% 6.455971398 120.4338354849deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn color2() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.mix(lch(50% 10% 120deg), lch(30% 0% 0deg), $method: hsl)}\n" + ), + "a {\ + \n b: lch(39.8551054023% 6.455971398 120.4338354849deg);\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/core_functions/color/mix/mixed_spaces.rs b/rsass/tests/spec/core_functions/color/mix/mixed_spaces.rs new file mode 100644 index 000000000..6855376f4 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/mix/mixed_spaces.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/mix/mixed_spaces.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("mixed_spaces") +} + +#[test] +#[ignore] // unexepected error +fn test() { + assert_eq!( + runner().ok("a {b: mix(hsl(0 100% 50%), green, $method: lch)}\n"), + "a {\ + \n b: hsl(50.9351301875, 199.2813015981%, 19.0269267557%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/mix/mod.rs b/rsass/tests/spec/core_functions/color/mix/mod.rs new file mode 100644 index 000000000..4d7aa9627 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/mix/mod.rs @@ -0,0 +1,30 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/mix" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("mix") +} + +mod alpha; + +mod both_weights; + +mod error; + +mod explicit_method; + +mod explicit_weight; + +mod hue_interpolation; + +mod missing; + +mod mixed_spaces; + +mod named; + +mod predefined; + +mod units; + +mod unweighted; diff --git a/rsass/tests/spec/core_functions/color/mix/named.rs b/rsass/tests/spec/core_functions/color/mix/named.rs new file mode 100644 index 000000000..8bcf41762 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/mix/named.rs @@ -0,0 +1,31 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/mix/named.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("named") +} + +#[test] +#[ignore] // unexepected error +fn polar_space() { + assert_eq!( + runner().ok( + "a {b: mix($color1: #91e16f, $color2: #0144bf, $weight: 92%, $method: hsl decreasing hue)}\n" + ), + "a {\ + \n b: rgb(177.749777646, 225.4953896552, 98.9846103448);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn rectangular_space() { + assert_eq!( + runner().ok( + "a {b: mix($color1: #91e16f, $color2: #0144bf, $weight: 92%, $method: lab)}\n" + ), + "a {\ + \n b: rgb(141.3483384924, 211.5499489073, 120.4340844852);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/mix/predefined.rs b/rsass/tests/spec/core_functions/color/mix/predefined.rs new file mode 100644 index 000000000..fd14d17f5 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/mix/predefined.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/mix/predefined.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("predefined") +} + +#[test] +#[ignore] // unexepected error +fn rgb() { + assert_eq!( + runner().ok( + "a {b: mix(color(display-p3 1 0 0), color(display-p3 0 1 0), 20%, oklch)}\n" + ), + "a {\ + \n b: color(display-p3 0.6684751745 0.8535262883 -0.4281891831);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn rgb_explicit_method() { + assert_eq!( + runner().ok( + "a {b: mix(color(display-p3 1 0 0), color(display-p3 0 1 0), 60%, $method: hsl)}\n" + ), + "a {\ + \n b: color(display-p3 1.0849635599 0.8595336595 -0.252822726);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn xyz() { + assert_eq!( + runner().ok( + "a {b: mix(color(xyz 0.15 0.24 0), color(xyz 1 .2 0), 65%, lch)}\n" + ), + "a {\ + \n b: color(xyz 0.2607187352 0.230899759 -0.0359437687);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn xyz_explicit_method() { + assert_eq!( + runner().ok( + "a {b: mix(color(xyz-d50 0.15 0.24 0), color(xyz-d65 1 .2 0), $method: hwb)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.5250037958 0.2975068714 -0.1396614468);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/mix/units.rs b/rsass/tests/spec/core_functions/color/mix/units.rs new file mode 100644 index 000000000..dc53b82f1 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/mix/units.rs @@ -0,0 +1,32 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/mix/units.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("units") +} + +mod weight { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn unitless() { + assert_eq!( + runner().ok("a {b: mix(#91e16f, #0144bf, 50)}\n"), + "a {\ + \n b: rgb(73, 146.5, 151);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn unknown() { + assert_eq!( + runner().ok("a {b: mix(#91e16f, #0144bf, 50px)}\n"), + "a {\ + \n b: rgb(73, 146.5, 151);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/mix/unweighted.rs b/rsass/tests/spec/core_functions/color/mix/unweighted.rs new file mode 100644 index 000000000..1867aff1f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/mix/unweighted.rs @@ -0,0 +1,44 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/mix/unweighted.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("unweighted") +} + +#[test] +#[ignore] // wrong result +fn average() { + assert_eq!( + runner() + .ok("// All channels should be averaged across the two colors.\ + \na {b: mix(#91e16f, #0144bf)}\n"), + "a {\ + \n b: rgb(73, 146.5, 151);\ + \n}\n" + ); +} +#[test] +fn identical() { + assert_eq!( + runner().ok( + "// If two channels have the same values, they should be the same in the output.\ + \na {b: mix(#123456, #123456)}\n" + ), + "a {\ + \n b: #123456;\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn min_and_max() { + assert_eq!( + runner().ok( + "// Each channel becomes the average of 255 and 0, which is 128 = 0xAA.\ + \na {b: mix(#ff00ff, #00ff00)}\n" + ), + "a {\ + \n b: rgb(127.5, 127.5, 127.5);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/mod.rs b/rsass/tests/spec/core_functions/color/mod.rs index 4eddaf83e..30e1fb592 100644 --- a/rsass/tests/spec/core_functions/color/mod.rs +++ b/rsass/tests/spec/core_functions/color/mod.rs @@ -5,6 +5,8 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("color") } +mod adjust; + mod adjust_color; mod adjust_hue; @@ -15,7 +17,11 @@ mod blackness; mod blue; -mod change_color; +mod change; + +mod channel; + +mod color; mod complement; @@ -43,22 +49,46 @@ mod ie_hex_str; mod invert; +mod is_in_gamut; + +mod is_legacy; + +mod is_missing; + +mod is_powerless; + +mod lab; + +mod lch; + mod lighten; mod lightness; mod mix; +mod oklab; + +mod oklch; + mod red; mod rgb; mod rgba; +mod same; + mod saturate; mod saturation; -mod scale_color; +mod scale; + +mod space; + +mod to_gamut; + +mod to_space; mod whiteness; diff --git a/rsass/tests/spec/core_functions/color/oklab/alpha.rs b/rsass/tests/spec/core_functions/color/oklab/alpha.rs new file mode 100644 index 000000000..4d814d445 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/oklab/alpha.rs @@ -0,0 +1,231 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/oklab/alpha.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("alpha") +} + +mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2 -3 / calc(NaN)));\n"), + "a {\ + \n value: oklab(1% 2 -3 / 0);\ + \n space: oklab;\ + \n channels: 1% 2 -3 / 0;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2 -3 / calc(-infinity)));\n"), + "a {\ + \n value: oklab(1% 2 -3 / 0);\ + \n space: oklab;\ + \n channels: 1% 2 -3 / 0;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2 -3 / calc(infinity)));\n"), + "a {\ + \n value: oklab(1% 2 -3);\ + \n space: oklab;\ + \n channels: 1% 2 -3 / 1;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab($channels: 1% 2 3 / 0.4));\n"), + "a {\ + \n value: oklab(1% 2 3 / 0.4);\ + \n space: oklab;\ + \n channels: 1% 2 3 / 0.4;\ + \n}\n" + ); +} +mod none { + #[allow(unused)] + use super::runner; + + mod slash { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn alpha() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2 3 / none));\n"), + "a {\ + \n value: oklab(1% 2 3 / none);\ + \n space: oklab;\ + \n channels: 1% 2 3 / none;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2 none / 0.4));\n"), + "a {\ + \n value: oklab(1% 2 none / 0.4);\ + \n space: oklab;\ + \n channels: 1% 2 none / 0.4;\ + \n}\n" + ); + } + } + mod slash_list { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn alpha() { + assert_eq!( + runner().ok("@use \'sass:list\';\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(list.slash(1% 2 3, none)));\n"), + "a {\ + \n value: oklab(1% 2 3 / none);\ + \n space: oklab;\ + \n channels: 1% 2 3 / none;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \'sass:list\';\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(list.slash(1% 2 none, 0.4)));\n"), + "a {\ + \n value: oklab(1% 2 none / 0.4);\ + \n space: oklab;\ + \n channels: 1% 2 none / 0.4;\ + \n}\n" + ); + } + } +} +#[test] +#[ignore] // unexepected error +fn opaque() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2 3 / 1));\n"), + "a {\ + \n value: oklab(1% 2 3);\ + \n space: oklab;\ + \n channels: 1% 2 3 / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn partial() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2 3 / 0.4));\n"), + "a {\ + \n value: oklab(1% 2 3 / 0.4);\ + \n space: oklab;\ + \n channels: 1% 2 3 / 0.4;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn percent() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2 3 / 40%));\n"), + "a {\ + \n value: oklab(1% 2 3 / 0.4);\ + \n space: oklab;\ + \n channels: 1% 2 3 / 0.4;\ + \n}\n" + ); +} +mod relative_color { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn slash() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(from #aaa l a b / 25%));\n"), + "a {\ + \n value: oklab(from #aaa l a b/25%);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn slash_list() { + assert_eq!( + runner().ok( + "@use \'sass:list\';\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(list.slash(from #aaa l a b, 25%)));\n" + ), + "a {\ + \n value: oklab(from #aaa l a b / 25%);\ + \n type: string;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn slash_list() { + assert_eq!( + runner().ok("@use \"sass:list\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(list.slash(1% 2 3, 0.4)));\n"), + "a {\ + \n value: oklab(1% 2 3 / 0.4);\ + \n space: oklab;\ + \n channels: 1% 2 3 / 0.4;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn transparent() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(0 255 127 / 0));\n"), + "a {\ + \n value: oklab(0% 255 127 / 0);\ + \n space: oklab;\ + \n channels: 0% 255 127 / 0;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/oklab/error.rs b/rsass/tests/spec/core_functions/color/oklab/error.rs new file mode 100644 index 000000000..2fa7d407c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/oklab/error.rs @@ -0,0 +1,319 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/oklab/error.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("error") +} + +mod list { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn bracketed() { + assert_eq!( + runner().err("a {b: oklab([1% 2 3])}\n"), + "Error: $channels: Expected an unbracketed list, was [1% 2 3]\ + \n ,\ + \n1 | a {b: oklab([1% 2 3])}\ + \n | ^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn comma() { + assert_eq!( + runner().err( + "a {b: oklab((1%, 2, 3))}\n" + ), + "Error: $channels: Expected a space- or slash-separated list, was (1%, 2, 3)\ + \n ,\ + \n1 | a {b: oklab((1%, 2, 3))}\ + \n | ^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn empty() { + assert_eq!( + runner().err("a {b: oklab(())}\n"), + "Error: $channels: Color component list may not be empty.\ + \n ,\ + \n1 | a {b: oklab(())}\ + \n | ^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn empty_space() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \n$empty-space: list.join((), (), $separator: space);\ + \na {b: oklab(())}\n" + ), + "Error: $channels: Color component list may not be empty.\ + \n ,\ + \n3 | a {b: oklab(())}\ + \n | ^^^^^^^^^\ + \n \'\ + \n input.scss 3:7 root stylesheet", + ); + } + mod slash { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn one() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \n$single-arg-slash-separated: list.append((), 1% 2 3, $separator: slash);\ + \na {b: oklab($single-arg-slash-separated)}\n" + ), + "Error: $channels: Only 2 slash-separated elements allowed, but 1 was passed.\ + \n ,\ + \n3 | a {b: oklab($single-arg-slash-separated)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 3:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn three() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \na {b: oklab(list.slash(1%, 2, 3))}\n" + ), + "Error: $channels: Only 2 slash-separated elements allowed, but 3 were passed.\ + \n ,\ + \n2 | a {b: oklab(list.slash(1%, 2, 3))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // missing error + fn too_few_channels() { + assert_eq!( + runner().err( + "a {b: oklab(1% 2)}\n" + ), + "Error: $channels: The oklab color space has 3 channels but (1% 2) has 2.\ + \n ,\ + \n1 | a {b: oklab(1% 2)}\ + \n | ^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn too_many_channels() { + assert_eq!( + runner().err( + "a {b: oklab(1% 2 3 0.4)}\n" + ), + "Error: $channels: The oklab color space has 3 channels but (1% 2 3 0.4) has 4.\ + \n ,\ + \n1 | a {b: oklab(1% 2 3 0.4)}\ + \n | ^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} +#[test] +#[ignore] // missing error +fn too_few_args() { + assert_eq!( + runner().err("a {b: oklab()}\n"), + "Error: Missing argument $channels.\ + \n ,--> input.scss\ + \n1 | a {b: oklab()}\ + \n | ^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function oklab($channels) {\ + \n | ================ declaration\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); +} +#[test] +#[ignore] // missing error +fn too_many_args() { + assert_eq!( + runner().err("a {b: oklab(1%, 2, 3, 0.4)}\n"), + "Error: Only 1 argument allowed, but 4 were passed.\ + \n ,--> input.scss\ + \n1 | a {b: oklab(1%, 2, 3, 0.4)}\ + \n | ^^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function oklab($channels) {\ + \n | ================ declaration\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); +} +mod test_type { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn a() { + assert_eq!( + runner().err("a {b: oklab(1% c 3)}\n"), + "Error: $channels: Expected a channel to be a number, was c.\ + \n ,\ + \n1 | a {b: oklab(1% c 3)}\ + \n | ^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn slash_list() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \na {b: oklab(list.slash(1% 2 3, c))}\n" + ), + "Error: $channels: c is not a number.\ + \n ,\ + \n2 | a {b: oklab(list.slash(1% 2 3, c))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // missing error + fn b() { + assert_eq!( + runner().err("a {b: oklab(1% 2 c)}\n"), + "Error: $channels: Expected b channel to be a number, was c.\ + \n ,\ + \n1 | a {b: oklab(1% 2 c)}\ + \n | ^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn lightness() { + assert_eq!( + runner().err( + "a {b: oklab(c 2 3)}\n" + ), + "Error: $channels: Expected lightness channel to be a number, was c.\ + \n ,\ + \n1 | a {b: oklab(c 2 3)}\ + \n | ^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} +mod unit { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn a() { + assert_eq!( + runner().err("a {b: oklab(1% 2px 3)}\n"), + "Error: $a: Expected 2px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: oklab(1% 2px 3)}\ + \n | ^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn slash() { + assert_eq!( + runner().err( + "a {b: oklab(1% 2 3/0.4px)}\n" + ), + "Error: $alpha: Expected 0.4px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: oklab(1% 2 3/0.4px)}\ + \n | ^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn slash_list() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \na {b: oklab(list.slash(1% 2 3, 0.4px))}\n" + ), + "Error: $alpha: Expected 0.4px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: oklab(list.slash(1% 2 3, 0.4px))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // missing error + fn b() { + assert_eq!( + runner().err("a {b: oklab(1% 2 3px)}\n"), + "Error: $b: Expected 3px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: oklab(1% 2 3px)}\ + \n | ^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn lightness() { + assert_eq!( + runner().err("a {b: oklab(1px 2 3)}\n"), + "Error: $lightness: Expected 1px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: oklab(1px 2 3)}\ + \n | ^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/oklab/mod.rs b/rsass/tests/spec/core_functions/color/oklab/mod.rs new file mode 100644 index 000000000..b6f99ea99 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/oklab/mod.rs @@ -0,0 +1,14 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/oklab" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod alpha; + +mod error; + +mod no_alpha; + +mod special_functions; diff --git a/rsass/tests/spec/core_functions/color/oklab/no_alpha.rs b/rsass/tests/spec/core_functions/color/oklab/no_alpha.rs new file mode 100644 index 000000000..cc49c565b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/oklab/no_alpha.rs @@ -0,0 +1,404 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/oklab/no_alpha.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("no_alpha") +} + +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab($channels: 1% 2 3));\n"), + "a {\ + \n value: oklab(1% 2 3);\ + \n space: oklab;\ + \n channels: 1% 2 3 / 1;\ + \n}\n" + ); +} +mod none { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% none 3));\n"), + "a {\ + \n value: oklab(1% none 3);\ + \n space: oklab;\ + \n channels: 1% none 3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2 none));\n"), + "a {\ + \n value: oklab(1% 2 none);\ + \n space: oklab;\ + \n channels: 1% 2 none / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(none 2 3));\n"), + "a {\ + \n value: oklab(none 2 3);\ + \n space: oklab;\ + \n channels: none 2 3 / 1;\ + \n}\n" + ); + } +} +mod percent { + #[allow(unused)] + use super::runner; + + mod ab { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 101% 150%));\n"), + "a {\ + \n value: oklab(1% 0.404 0.6);\ + \n space: oklab;\ + \n channels: 1% 0.404 0.6 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% -101% -150%));\n"), + "a {\ + \n value: oklab(1% -0.404 -0.6);\ + \n space: oklab;\ + \n channels: 1% -0.404 -0.6 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2% -3%));\n"), + "a {\ + \n value: oklab(1% 0.008 -0.012);\ + \n space: oklab;\ + \n channels: 1% 0.008 -0.012 / 1;\ + \n}\n" + ); + } + } + mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(110% 2 3));\n"), + "a {\ + \n value: oklab(100% 2 3);\ + \n space: oklab;\ + \n channels: 100% 2 3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(-1% 2 3));\n"), + "a {\ + \n value: oklab(0% 2 3);\ + \n space: oklab;\ + \n channels: 0% 2 3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2% -3%));\n"), + "a {\ + \n value: oklab(1% 0.008 -0.012);\ + \n space: oklab;\ + \n channels: 1% 0.008 -0.012 / 1;\ + \n}\n" + ); + } + } +} +#[test] +#[ignore] // unexepected error +fn relative_color() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(from #aaa l a b));\n"), + "a {\ + \n value: oklab(from #aaa l a b);\ + \n type: string;\ + \n}\n" + ); +} +mod unitless { + #[allow(unused)] + use super::runner; + + mod a { + #[allow(unused)] + use super::runner; + + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% calc(NaN) -300));\n"), + "a {\ + \n value: oklab(1% calc(NaN) -300);\ + \n space: oklab;\ + \n channels: 1% calc(NaN) -300 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% calc(-infinity) -300));\n"), + "a {\ + \n value: oklab(1% calc(-infinity) -300);\ + \n space: oklab;\ + \n channels: 1% calc(-infinity) -300 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% calc(infinity) -300));\n"), + "a {\ + \n value: oklab(1% calc(infinity) -300);\ + \n space: oklab;\ + \n channels: 1% calc(infinity) -300 / 1;\ + \n}\n" + ); + } + } + } + mod ab { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 126 300));\n"), + "a {\ + \n value: oklab(1% 126 300);\ + \n space: oklab;\ + \n channels: 1% 126 300 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% -126 -300));\n"), + "a {\ + \n value: oklab(1% -126 -300);\ + \n space: oklab;\ + \n channels: 1% -126 -300 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2 -3));\n"), + "a {\ + \n value: oklab(1% 2 -3);\ + \n space: oklab;\ + \n channels: 1% 2 -3 / 1;\ + \n}\n" + ); + } + } + mod b { + #[allow(unused)] + use super::runner; + + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2 calc(NaN)));\n"), + "a {\ + \n value: oklab(1% 2 calc(NaN));\ + \n space: oklab;\ + \n channels: 1% 2 calc(NaN) / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2 calc(-infinity)));\n"), + "a {\ + \n value: oklab(1% 2 calc(-infinity));\ + \n space: oklab;\ + \n channels: 1% 2 calc(-infinity) / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2 calc(infinity)));\n"), + "a {\ + \n value: oklab(1% 2 calc(infinity));\ + \n space: oklab;\ + \n channels: 1% 2 calc(infinity) / 1;\ + \n}\n" + ); + } + } + } + mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1.1 2 3));\n"), + "a {\ + \n value: oklab(100% 2 3);\ + \n space: oklab;\ + \n channels: 100% 2 3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(-0.1 2 3));\n"), + "a {\ + \n value: oklab(0% 2 3);\ + \n space: oklab;\ + \n channels: 0% 2 3 / 1;\ + \n}\n" + ); + } + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(calc(NaN) 2 -3));\n"), + "a {\ + \n value: oklab(0% 2 -3);\ + \n space: oklab;\ + \n channels: 0% 2 -3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(calc(-infinity) 2 -3));\n"), + "a {\ + \n value: oklab(0% 2 -3);\ + \n space: oklab;\ + \n channels: 0% 2 -3 / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(calc(infinity) 2 -3));\n"), + "a {\ + \n value: oklab(100% 2 -3);\ + \n space: oklab;\ + \n channels: 100% 2 -3 / 1;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(0.1 2 -3));\n"), + "a {\ + \n value: oklab(10% 2 -3);\ + \n space: oklab;\ + \n channels: 10% 2 -3 / 1;\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/core_functions/color/oklab/special_functions.rs b/rsass/tests/spec/core_functions/color/oklab/special_functions.rs new file mode 100644 index 000000000..23b492a24 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/oklab/special_functions.rs @@ -0,0 +1,174 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/oklab/special_functions.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("special_functions") +} + +mod calculation { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(calc(1px + 1%) 2 3));\n"), + "a {\ + \n value: oklab(calc(1px + 1%) 2 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% calc(1px + 1%) 3));\n"), + "a {\ + \n value: oklab(1% calc(1px + 1%) 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2 calc(1px + 1%)));\n"), + "a {\ + \n value: oklab(1% 2 calc(1px + 1%));\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_4() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2 3 / calc(1px + 1%)));\n"), + "a {\ + \n value: oklab(1% 2 3/calc(1px + 1%));\ + \n type: string;\ + \n}\n" + ); + } +} +mod multi_argument_var { + #[allow(unused)] + use super::runner; + + mod t1_of_1 { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn alpha() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(var(--foo) / 0.4));\n"), + "a {\ + \n value: oklab(var(--foo)/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn no_alpha() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(var(--foo)));\n"), + "a {\ + \n value: oklab(var(--foo));\ + \n type: string;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn t1_of_2() { + assert_eq!( + runner().ok( + "// var() is substituted before parsing, so it may contain multiple arguments.\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(var(--foo) 2));\n" + ), + "a {\ + \n value: oklab(var(--foo) 2);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn t2_of_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% var(--foo)));\n"), + "a {\ + \n value: oklab(1% var(--foo));\ + \n type: string;\ + \n}\n" + ); + } +} +mod var { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(var(--foo) 2 3));\n"), + "a {\ + \n value: oklab(var(--foo) 2 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% var(--foo) 3));\n"), + "a {\ + \n value: oklab(1% var(--foo) 3);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2 var(--foo)));\n"), + "a {\ + \n value: oklab(1% 2 var(--foo));\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_4() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklab(1% 2 3 / var(--foo)));\n"), + "a {\ + \n value: oklab(1% 2 3/var(--foo));\ + \n type: string;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/oklch/alpha.rs b/rsass/tests/spec/core_functions/color/oklch/alpha.rs new file mode 100644 index 000000000..4d3115aed --- /dev/null +++ b/rsass/tests/spec/core_functions/color/oklch/alpha.rs @@ -0,0 +1,211 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/oklch/alpha.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("alpha") +} + +mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 0.2 3deg / calc(NaN)));\n"), + "a {\ + \n value: oklch(1% 0.2 3deg / 0);\ + \n space: oklch;\ + \n channels: 1% 0.2 3deg / 0;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 0.2 3deg / calc(-infinity)));\n" + ), + "a {\ + \n value: oklch(1% 0.2 3deg / 0);\ + \n space: oklch;\ + \n channels: 1% 0.2 3deg / 0;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 0.2 3deg / calc(infinity)));\n" + ), + "a {\ + \n value: oklch(1% 0.2 3deg);\ + \n space: oklch;\ + \n channels: 1% 0.2 3deg / 1;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch($channels: 1% 0.2 3deg / 0.4));\n" + ), + "a {\ + \n value: oklch(1% 0.2 3deg / 0.4);\ + \n space: oklch;\ + \n channels: 1% 0.2 3deg / 0.4;\ + \n}\n" + ); +} +mod none { + #[allow(unused)] + use super::runner; + + mod slash { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn alpha() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 0.2 3deg / none));\n"), + "a {\ + \n value: oklch(1% 0.2 3deg / none);\ + \n space: oklch;\ + \n channels: 1% 0.2 3deg / none;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 0.2 none / 0.4));\n"), + "a {\ + \n value: oklch(1% 0.2 none / 0.4);\ + \n space: oklch;\ + \n channels: 1% 0.2 none / 0.4;\ + \n}\n" + ); + } + } + mod slash_list { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn alpha() { + assert_eq!( + runner().ok( + "@use \'sass:list\';\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(list.slash(1% 0.2 3deg, none)));\n" + ), + "a {\ + \n value: oklch(1% 0.2 3deg / none);\ + \n space: oklch;\ + \n channels: 1% 0.2 3deg / none;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok( + "@use \'sass:list\';\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(list.slash(1% 0.2 none, 0.4)));\n" + ), + "a {\ + \n value: oklch(1% 0.2 none / 0.4);\ + \n space: oklch;\ + \n channels: 1% 0.2 none / 0.4;\ + \n}\n" + ); + } + } +} +#[test] +#[ignore] // unexepected error +fn opaque() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 0.2 3deg / 1));\n"), + "a {\ + \n value: oklch(1% 0.2 3deg);\ + \n space: oklch;\ + \n channels: 1% 0.2 3deg / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn partial() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 0.2 3deg / 0.4));\n"), + "a {\ + \n value: oklch(1% 0.2 3deg / 0.4);\ + \n space: oklch;\ + \n channels: 1% 0.2 3deg / 0.4;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn percent() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 0.2 3deg / 40%));\n"), + "a {\ + \n value: oklch(1% 0.2 3deg / 0.4);\ + \n space: oklch;\ + \n channels: 1% 0.2 3deg / 0.4;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn slash_list() { + assert_eq!( + runner().ok( + "@use \"sass:list\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(list.slash(1% 0.2 3deg, 0.4)));\n" + ), + "a {\ + \n value: oklch(1% 0.2 3deg / 0.4);\ + \n space: oklch;\ + \n channels: 1% 0.2 3deg / 0.4;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn transparent() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 0.2 3deg / 0));\n"), + "a {\ + \n value: oklch(1% 0.2 3deg / 0);\ + \n space: oklch;\ + \n channels: 1% 0.2 3deg / 0;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/oklch/error.rs b/rsass/tests/spec/core_functions/color/oklch/error.rs new file mode 100644 index 000000000..c8d634a06 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/oklch/error.rs @@ -0,0 +1,345 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/oklch/error.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("error") +} + +mod list { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn bracketed() { + assert_eq!( + runner().err( + "a {b: oklch([1% 0.2 3deg])}\n" + ), + "Error: $channels: Expected an unbracketed list, was [1% 0.2 3deg]\ + \n ,\ + \n1 | a {b: oklch([1% 0.2 3deg])}\ + \n | ^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn comma() { + assert_eq!( + runner().err( + "a {b: oklch((1%, 2, 3deg))}\n" + ), + "Error: $channels: Expected a space- or slash-separated list, was (1%, 2, 3deg)\ + \n ,\ + \n1 | a {b: oklch((1%, 2, 3deg))}\ + \n | ^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn empty() { + assert_eq!( + runner().err("a {b: oklch(())}\n"), + "Error: $channels: Color component list may not be empty.\ + \n ,\ + \n1 | a {b: oklch(())}\ + \n | ^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn empty_space() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \n$empty-space: list.join((), (), $separator: space);\ + \na {b: oklch(())}\n" + ), + "Error: $channels: Color component list may not be empty.\ + \n ,\ + \n3 | a {b: oklch(())}\ + \n | ^^^^^^^^^\ + \n \'\ + \n input.scss 3:7 root stylesheet", + ); + } + mod slash { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn one() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \n$single-arg-slash-separated: list.append((), 1% 0.2 3deg, $separator: slash);\ + \na {b: oklch($single-arg-slash-separated)}\n" + ), + "Error: $channels: Only 2 slash-separated elements allowed, but 1 was passed.\ + \n ,\ + \n3 | a {b: oklch($single-arg-slash-separated)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 3:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn three() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \na {b: oklch(list.slash(1%, 2, 3deg))}\n" + ), + "Error: $channels: Only 2 slash-separated elements allowed, but 3 were passed.\ + \n ,\ + \n2 | a {b: oklch(list.slash(1%, 2, 3deg))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // missing error + fn too_few_channels() { + assert_eq!( + runner().err( + "a {b: oklch(1% 2)}\n" + ), + "Error: $channels: The oklch color space has 3 channels but (1% 2) has 2.\ + \n ,\ + \n1 | a {b: oklch(1% 2)}\ + \n | ^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn too_many_channels() { + assert_eq!( + runner().err( + "a {b: oklch(1% 0.2 3deg 0.4)}\n" + ), + "Error: $channels: The oklch color space has 3 channels but (1% 0.2 3deg 0.4) has 4.\ + \n ,\ + \n1 | a {b: oklch(1% 0.2 3deg 0.4)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} +#[test] +#[ignore] // missing error +fn too_few_args() { + assert_eq!( + runner().err("a {b: oklch()}\n"), + "Error: Missing argument $channels.\ + \n ,--> input.scss\ + \n1 | a {b: oklch()}\ + \n | ^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function oklch($channels) {\ + \n | ================ declaration\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); +} +#[test] +#[ignore] // missing error +fn too_many_args() { + assert_eq!( + runner().err("a {b: oklch(1%, 2, 3deg, 0.4)}\n"), + "Error: Only 1 argument allowed, but 4 were passed.\ + \n ,--> input.scss\ + \n1 | a {b: oklch(1%, 2, 3deg, 0.4)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function oklch($channels) {\ + \n | ================ declaration\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); +} +mod test_type { + #[allow(unused)] + use super::runner; + + mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn slash_list() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \na {b: oklch(list.slash(1% 0.2 3deg, c))}\n" + ), + "Error: $channels: c is not a number.\ + \n ,\ + \n2 | a {b: oklch(list.slash(1% 0.2 3deg, c))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // missing error + fn chroma() { + assert_eq!( + runner().err( + "a {b: oklch(1% c 3deg)}\n" + ), + "Error: $channels: Expected chroma channel to be a number, was c.\ + \n ,\ + \n1 | a {b: oklch(1% c 3deg)}\ + \n | ^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn hue() { + assert_eq!( + runner().err("a {b: oklch(1% 0.2 c)}\n"), + "Error: $channels: Expected hue channel to be a number, was c.\ + \n ,\ + \n1 | a {b: oklch(1% 0.2 c)}\ + \n | ^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn lightness() { + assert_eq!( + runner().err( + "a {b: oklch(c 0.2 3deg)}\n" + ), + "Error: $channels: Expected lightness channel to be a number, was c.\ + \n ,\ + \n1 | a {b: oklch(c 0.2 3deg)}\ + \n | ^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} +mod unit { + #[allow(unused)] + use super::runner; + + mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn slash() { + assert_eq!( + runner().err( + "a {b: oklch(1% 0.2 3deg/0.4px)}\n" + ), + "Error: $alpha: Expected 0.4px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: oklch(1% 0.2 3deg/0.4px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn slash_list() { + assert_eq!( + runner().err( + "@use \'sass:list\';\ + \na {b: oklch(list.slash(1% 0.2 3deg, 0.4px))}\n" + ), + "Error: $alpha: Expected 0.4px to have unit \"%\" or no units.\ + \n ,\ + \n2 | a {b: oklch(list.slash(1% 0.2 3deg, 0.4px))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // missing error + fn chroma() { + assert_eq!( + runner().err("a {b: oklch(1% 2px 3deg)}\n"), + "Error: $chroma: Expected 2px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: oklch(1% 2px 3deg)}\ + \n | ^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + mod hue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // missing error + fn percent() { + assert_eq!( + runner().err( + "a {b: oklch(1% 0.2 3%)}\n" + ), + "Error: $hue: Expected 3% to have an angle unit (deg, grad, rad, turn).\ + \n ,\ + \n1 | a {b: oklch(1% 0.2 3%)}\ + \n | ^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + #[ignore] // missing error + fn unrelated() { + assert_eq!( + runner().err( + "a {b: oklch(1% 0.2 3px)}\n" + ), + "Error: $hue: Expected 3px to have an angle unit (deg, grad, rad, turn).\ + \n ,\ + \n1 | a {b: oklch(1% 0.2 3px)}\ + \n | ^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + } + #[test] + #[ignore] // missing error + fn lightness() { + assert_eq!( + runner().err("a {b: oklch(1px 0.2 3deg)}\n"), + "Error: $lightness: Expected 1px to have unit \"%\" or no units.\ + \n ,\ + \n1 | a {b: oklch(1px 0.2 3deg)}\ + \n | ^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/oklch/mod.rs b/rsass/tests/spec/core_functions/color/oklch/mod.rs new file mode 100644 index 000000000..8c424d0f2 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/oklch/mod.rs @@ -0,0 +1,14 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/oklch" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod alpha; + +mod error; + +mod no_alpha; + +mod special_functions; diff --git a/rsass/tests/spec/core_functions/color/oklch/no_alpha.rs b/rsass/tests/spec/core_functions/color/oklch/no_alpha.rs new file mode 100644 index 000000000..57f85b07f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/oklch/no_alpha.rs @@ -0,0 +1,387 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/oklch/no_alpha.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("no_alpha") +} + +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch($channels: 1% 0.2 3deg));\n"), + "a {\ + \n value: oklch(1% 0.2 3deg);\ + \n space: oklch;\ + \n channels: 1% 0.2 3deg / 1;\ + \n}\n" + ); +} +mod none { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% none 3deg));\n"), + "a {\ + \n value: oklch(1% none 3deg);\ + \n space: oklch;\ + \n channels: 1% none 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 0.2 none));\n"), + "a {\ + \n value: oklch(1% 0.2 none);\ + \n space: oklch;\ + \n channels: 1% 0.2 none / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(none 0.2 3deg));\n"), + "a {\ + \n value: oklch(none 0.2 3deg);\ + \n space: oklch;\ + \n channels: none 0.2 3deg / 1;\ + \n}\n" + ); + } +} +mod percent { + #[allow(unused)] + use super::runner; + + mod chroma { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 101% 3deg));\n"), + "a {\ + \n value: oklch(1% 0.404 3deg);\ + \n space: oklch;\ + \n channels: 1% 0.404 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% -1% 3deg));\n"), + "a {\ + \n value: oklch(1% 0 3deg);\ + \n space: oklch;\ + \n channels: 1% 0 3deg / 1;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 2% 3deg));\n"), + "a {\ + \n value: oklch(1% 0.008 3deg);\ + \n space: oklch;\ + \n channels: 1% 0.008 3deg / 1;\ + \n}\n" + ); + } + mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(110% 0.2 3deg));\n"), + "a {\ + \n value: oklch(100% 0.2 3deg);\ + \n space: oklch;\ + \n channels: 100% 0.2 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(-1% 0.2 3deg));\n"), + "a {\ + \n value: oklch(0% 0.2 3deg);\ + \n space: oklch;\ + \n channels: 0% 0.2 3deg / 1;\ + \n}\n" + ); + } + } +} +mod unitless { + #[allow(unused)] + use super::runner; + + mod chroma { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 0.5 3deg));\n"), + "a {\ + \n value: oklch(1% 0.5 3deg);\ + \n space: oklch;\ + \n channels: 1% 0.5 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% -0.1 3deg));\n"), + "a {\ + \n value: oklch(1% 0 3deg);\ + \n space: oklch;\ + \n channels: 1% 0 3deg / 1;\ + \n}\n" + ); + } + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% calc(NaN) 3deg));\n"), + "a {\ + \n value: oklch(1% 0 3deg);\ + \n space: oklch;\ + \n channels: 1% 0 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% calc(-infinity) 3deg));\n"), + "a {\ + \n value: oklch(1% 0 3deg);\ + \n space: oklch;\ + \n channels: 1% 0 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% calc(infinity) 3deg));\n"), + "a {\ + \n value: oklch(1% calc(infinity) 3deg);\ + \n space: oklch;\ + \n channels: 1% calc(infinity) 3deg / 1;\ + \n}\n" + ); + } + } + } + mod hue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 0.2 361deg));\n"), + "a {\ + \n value: oklch(1% 0.2 1deg);\ + \n space: oklch;\ + \n channels: 1% 0.2 1deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 0.2 -1deg));\n"), + "a {\ + \n value: oklch(1% 0.2 359deg);\ + \n space: oklch;\ + \n channels: 1% 0.2 359deg / 1;\ + \n}\n" + ); + } + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 2 calc(NaN)));\n"), + "a {\ + \n value: oklch(1% 2 calc(NaN * 1deg));\ + \n space: oklch;\ + \n channels: 1% 2 calc(NaN * 1deg) / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 2 calc(-infinity)));\n"), + "a {\ + \n value: oklch(1% 2 calc(NaN * 1deg));\ + \n space: oklch;\ + \n channels: 1% 2 calc(NaN * 1deg) / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 2 calc(infinity)));\n"), + "a {\ + \n value: oklch(1% 2 calc(NaN * 1deg));\ + \n space: oklch;\ + \n channels: 1% 2 calc(NaN * 1deg) / 1;\ + \n}\n" + ); + } + } + } + #[test] + #[ignore] // unexepected error + fn in_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(0.1 0.2 3deg));\n"), + "a {\ + \n value: oklch(10% 0.2 3deg);\ + \n space: oklch;\ + \n channels: 10% 0.2 3deg / 1;\ + \n}\n" + ); + } + mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1.1 0.2 3deg));\n"), + "a {\ + \n value: oklch(100% 0.2 3deg);\ + \n space: oklch;\ + \n channels: 100% 0.2 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn below_range() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(-0.1 0.2 3deg));\n"), + "a {\ + \n value: oklch(0% 0.2 3deg);\ + \n space: oklch;\ + \n channels: 0% 0.2 3deg / 1;\ + \n}\n" + ); + } + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(calc(NaN) 0.2 3deg));\n"), + "a {\ + \n value: oklch(0% 0.2 3deg);\ + \n space: oklch;\ + \n channels: 0% 0.2 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(calc(-infinity) 0.2 3deg));\n"), + "a {\ + \n value: oklch(0% 0.2 3deg);\ + \n space: oklch;\ + \n channels: 0% 0.2 3deg / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(calc(infinity) 0.2 3deg));\n"), + "a {\ + \n value: oklch(100% 0.2 3deg);\ + \n space: oklch;\ + \n channels: 100% 0.2 3deg / 1;\ + \n}\n" + ); + } + } + } +} diff --git a/rsass/tests/spec/core_functions/color/oklch/special_functions.rs b/rsass/tests/spec/core_functions/color/oklch/special_functions.rs new file mode 100644 index 000000000..ba83f3548 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/oklch/special_functions.rs @@ -0,0 +1,176 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/oklch/special_functions.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("special_functions") +} + +mod calculation { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(calc(1px + 1%) 0.2 3deg));\n"), + "a {\ + \n value: oklch(calc(1px + 1%) 0.2 3deg);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% calc(1px + 1%) 3deg));\n"), + "a {\ + \n value: oklch(1% calc(1px + 1%) 3deg);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 0.2 calc(1px + 1%)));\n"), + "a {\ + \n value: oklch(1% 0.2 calc(1px + 1%));\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_4() { + assert_eq!( + runner().ok( + "@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 0.2 3deg / calc(1px + 1%)));\n" + ), + "a {\ + \n value: oklch(1% 0.2 3deg/calc(1px + 1%));\ + \n type: string;\ + \n}\n" + ); + } +} +mod multi_argument_var { + #[allow(unused)] + use super::runner; + + mod t1_of_1 { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn alpha() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(var(--foo) / 0.4));\n"), + "a {\ + \n value: oklch(var(--foo)/0.4);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn no_alpha() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(var(--foo)));\n"), + "a {\ + \n value: oklch(var(--foo));\ + \n type: string;\ + \n}\n" + ); + } + } + #[test] + #[ignore] // unexepected error + fn t1_of_2() { + assert_eq!( + runner().ok( + "// var() is substituted before parsing, so it may contain multiple arguments.\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(var(--foo) 2deg));\n" + ), + "a {\ + \n value: oklch(var(--foo) 2deg);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn t2_of_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% var(--foo)));\n"), + "a {\ + \n value: oklch(1% var(--foo));\ + \n type: string;\ + \n}\n" + ); + } +} +mod var { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn arg_1() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(var(--foo) 0.2 3deg));\n"), + "a {\ + \n value: oklch(var(--foo) 0.2 3deg);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_2() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% var(--foo) 3deg));\n"), + "a {\ + \n value: oklch(1% var(--foo) 3deg);\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_3() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 0.2 var(--foo)));\n"), + "a {\ + \n value: oklch(1% 0.2 var(--foo));\ + \n type: string;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn arg_4() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(oklch(1% 0.2 3deg / var(--foo)));\n"), + "a {\ + \n value: oklch(1% 0.2 3deg/var(--foo));\ + \n type: string;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/red.rs b/rsass/tests/spec/core_functions/color/red.rs index 495b050d0..f37616513 100644 --- a/rsass/tests/spec/core_functions/color/red.rs +++ b/rsass/tests/spec/core_functions/color/red.rs @@ -9,55 +9,81 @@ mod error { #[allow(unused)] use super::runner; + #[test] + #[ignore] // wrong error + fn non_legacy() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.red(color(srgb 1 1 1))}\n" + ), + "Error: color.red() is only supported for legacy colors. Please use color.channel() instead with an explicit $space argument.\ + \n ,\ + \n2 | a {b: color.red(color(srgb 1 1 1))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: red()}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.red()}\n" + ), "Error: Missing argument $color.\ \n ,--> input.scss\ - \n1 | a {b: red()}\ - \n | ^^^^^ invocation\ + \n2 | a {b: color.red()}\ + \n | ^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ \n1 | @function red($color) {\ \n | =========== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: red(red, green)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.red(red, green)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: red(red, green)}\ - \n | ^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: color.red(red, green)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ \n1 | @function red($color) {\ \n | =========== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: red(1)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.red(1)}\n" + ), "Error: $color: 1 is not a color.\ \n ,\ - \n1 | a {b: red(1)}\ - \n | ^^^^^^\ + \n2 | a {b: color.red(1)}\ + \n | ^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn max() { assert_eq!( - runner().ok("a {b: red(rgb(255, 0, 0))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.red(rgb(255, 0, 0))}\n"), "a {\ \n b: 255;\ \n}\n" @@ -66,7 +92,8 @@ fn max() { #[test] fn middle() { assert_eq!( - runner().ok("a {b: red(rgb(123, 0, 0))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.red(rgb(123, 0, 0))}\n"), "a {\ \n b: 123;\ \n}\n" @@ -75,7 +102,8 @@ fn middle() { #[test] fn min() { assert_eq!( - runner().ok("a {b: red(rgb(0, 0, 0))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.red(rgb(0, 0, 0))}\n"), "a {\ \n b: 0;\ \n}\n" @@ -84,7 +112,8 @@ fn min() { #[test] fn named() { assert_eq!( - runner().ok("a {b: red($color: rgb(234, 0, 0))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.red($color: rgb(234, 0, 0))}\n"), "a {\ \n b: 234;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/color/rgb/error/one_arg.rs b/rsass/tests/spec/core_functions/color/rgb/error/one_arg.rs index bb213a148..79c3d3fb8 100644 --- a/rsass/tests/spec/core_functions/color/rgb/error/one_arg.rs +++ b/rsass/tests/spec/core_functions/color/rgb/error/one_arg.rs @@ -10,6 +10,7 @@ mod list { use super::runner; #[test] + #[ignore] // wrong error fn bracketed() { assert_eq!( runner().err( @@ -17,7 +18,7 @@ mod list { \n b: rgb([1 2 3]);\ \n}\n" ), - "Error: $channels must be an unbracketed list.\ + "Error: $channels: Expected an unbracketed list, was [1 2 3]\ \n ,\ \n2 | b: rgb([1 2 3]);\ \n | ^^^^^^^^^^^^\ @@ -26,22 +27,24 @@ mod list { ); } #[test] + #[ignore] // wrong error fn comma_separated() { assert_eq!( - runner().err( - "a {\ + runner().err( + "a {\ \n b: rgb((1, 2, 3));\ \n}\n" - ), - "Error: $channels must be a space-separated list.\ + ), + "Error: $channels: Expected a space- or slash-separated list, was (1, 2, 3)\ \n ,\ \n2 | b: rgb((1, 2, 3));\ \n | ^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:6 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn empty() { assert_eq!( runner().err( @@ -49,7 +52,7 @@ mod list { \n b: rgb(());\ \n}\n" ), - "Error: Missing element $red.\ + "Error: $channels: Color component list may not be empty.\ \n ,\ \n2 | b: rgb(());\ \n | ^^^^^^^\ @@ -58,55 +61,59 @@ mod list { ); } #[test] + #[ignore] // wrong error fn four_elements() { assert_eq!( - runner().err( - "a {\ + runner().err( + "a {\ \n b: rgb(1 2 3 0.4);\ \n}\n" - ), - "Error: Only 3 elements allowed, but 4 were passed.\ + ), + "Error: $channels: The rgb color space has 3 channels but (1 2 3 0.4) has 4.\ \n ,\ \n2 | b: rgb(1 2 3 0.4);\ \n | ^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:6 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn one_element() { assert_eq!( - runner().err( - "a {\ + runner().err( + "a {\ \n b: rgb(1);\ \n}\n" - ), - "Error: Missing element $green.\ + ), + "Error: $channels: The rgb color space has 3 channels but 1 has 1.\ \n ,\ \n2 | b: rgb(1);\ \n | ^^^^^^\ \n \'\ \n input.scss 2:6 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn two_elements() { assert_eq!( - runner().err( - "a {\ + runner().err( + "a {\ \n b: rgb(1 2);\ \n}\n" - ), - "Error: Missing element $blue.\ + ), + "Error: $channels: The rgb color space has 3 channels but (1 2) has 2.\ \n ,\ \n2 | b: rgb(1 2);\ \n | ^^^^^^^^\ \n \'\ \n input.scss 2:6 root stylesheet", - ); + ); } } #[test] +#[ignore] // wrong error fn quoted_var_slash() { assert_eq!( runner().err( @@ -114,7 +121,7 @@ fn quoted_var_slash() { \n b: rgb(1 2 \"var(--foo) / 0.4\");\ \n}\n" ), - "Error: $blue: \"var(--foo) / 0.4\" is not a number.\ + "Error: $channels: Expected blue channel to be a number, was \"var(--foo) / 0.4\".\ \n ,\ \n2 | b: rgb(1 2 \"var(--foo) / 0.4\");\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ @@ -131,13 +138,14 @@ mod slash_list { use super::runner; #[test] + #[ignore] // wrong error fn bracketed() { assert_eq!( runner().err( "@use \"sass:list\";\ \na {b: rgb(list.slash([1 2 3], 1))}\n" ), - "Error: $channels must be an unbracketed list.\ + "Error: $channels: Expected an unbracketed list, was [1 2 3]\ \n ,\ \n2 | a {b: rgb(list.slash([1 2 3], 1))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ @@ -146,28 +154,30 @@ mod slash_list { ); } #[test] + #[ignore] // wrong error fn comma_separated() { assert_eq!( - runner().err( - "@use \"sass:list\";\ + runner().err( + "@use \"sass:list\";\ \na {b: rgb(list.slash((1, 2, 3), 1))}\n" - ), - "Error: $channels must be a space-separated list.\ + ), + "Error: $channels: Expected a space-separated list, was (1, 2, 3)\ \n ,\ \n2 | a {b: rgb(list.slash((1, 2, 3), 1))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn empty() { assert_eq!( runner().err( "@use \"sass:list\";\ \na {b: rgb(list.slash((), 1))}\n" ), - "Error: Missing element $red.\ + "Error: $channels: Color component list may not be empty.\ \n ,\ \n2 | a {b: rgb(list.slash((), 1))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^\ @@ -176,73 +186,79 @@ mod slash_list { ); } #[test] + #[ignore] // wrong error fn four_elements() { assert_eq!( - runner().err( - "@use \"sass:list\";\ + runner().err( + "@use \"sass:list\";\ \na {b: rgb(list.slash(1 2 3 0.4, 1))}\n" - ), - "Error: Only 3 elements allowed, but 4 were passed.\ + ), + "Error: $channels: The rgb color space has 3 channels but (1 2 3 0.4 / 1) has 4.\ \n ,\ \n2 | a {b: rgb(list.slash(1 2 3 0.4, 1))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn one_element() { assert_eq!( - runner().err( - "@use \"sass:list\";\ + runner().err( + "@use \"sass:list\";\ \na {b: rgb(list.slash(1, 1))}\n" - ), - "Error: Missing element $green.\ + ), + "Error: $channels: The rgb color space has 3 channels but (1 / 1) has 1.\ \n ,\ \n2 | a {b: rgb(list.slash(1, 1))}\ \n | ^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn two_elements() { assert_eq!( - runner().err( - "@use \"sass:list\";\ + runner().err( + "@use \"sass:list\";\ \na {b: rgb(list.slash(1 2, 1))}\n" - ), - "Error: Missing element $blue.\ + ), + "Error: $channels: The rgb color space has 3 channels but (1 2 / 1) has 2.\ \n ,\ \n2 | a {b: rgb(list.slash(1 2, 1))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); + ); } } #[test] + #[ignore] // wrong error fn too_few_elements() { assert_eq!( runner().err( - "a {b: rgb(append((), 1 2 3, $separator: slash))}\n" + "@use \"sass:list\";\ + \na {b: rgb(list.append((), 1 2 3, $separator: slash))}\n" ), - "Error: Only 2 slash-separated elements allowed, but 1 was passed.\ + "Error: $channels: Only 2 slash-separated elements allowed, but 1 was passed.\ \n ,\ - \n1 | a {b: rgb(append((), 1 2 3, $separator: slash))}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: rgb(list.append((), 1 2 3, $separator: slash))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] + #[ignore] // wrong error fn too_many_elements() { assert_eq!( runner().err( "@use \"sass:list\";\ \na {b: rgb(list.slash(1 2 3, 0.4, 1))}\n" ), - "Error: Only 2 slash-separated elements allowed, but 3 were passed.\ + "Error: $channels: Only 2 slash-separated elements allowed, but 3 were passed.\ \n ,\ \n2 | a {b: rgb(list.slash(1 2 3, 0.4, 1))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ @@ -256,51 +272,54 @@ mod test_type { use super::runner; #[test] + #[ignore] // wrong error fn blue() { assert_eq!( - runner().err( - "a {\ + runner().err( + "a {\ \n b: rgb(1 2 \"foo\");\ \n}\n" - ), - "Error: $blue: \"foo\" is not a number.\ + ), + "Error: $channels: Expected blue channel to be a number, was \"foo\".\ \n ,\ \n2 | b: rgb(1 2 \"foo\");\ \n | ^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:6 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn green() { assert_eq!( - runner().err( - "a {\ + runner().err( + "a {\ \n b: rgb(1 \"foo\" 3);\ \n}\n" - ), - "Error: $green: \"foo\" is not a number.\ + ), + "Error: $channels: Expected green channel to be a number, was \"foo\".\ \n ,\ \n2 | b: rgb(1 \"foo\" 3);\ \n | ^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:6 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn red() { assert_eq!( - runner().err( - "a {\ + runner().err( + "a {\ \n b: rgb(\"foo\" 2 3);\ \n}\n" - ), - "Error: $red: \"foo\" is not a number.\ + ), + "Error: $channels: Expected red channel to be a number, was \"foo\".\ \n ,\ \n2 | b: rgb(\"foo\" 2 3);\ \n | ^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:6 root stylesheet", - ); + ); } } diff --git a/rsass/tests/spec/core_functions/color/rgb/four_args/clamped.rs b/rsass/tests/spec/core_functions/color/rgb/four_args/clamped.rs index c3d830e59..d19d382c1 100644 --- a/rsass/tests/spec/core_functions/color/rgb/four_args/clamped.rs +++ b/rsass/tests/spec/core_functions/color/rgb/four_args/clamped.rs @@ -27,31 +27,186 @@ mod alpha { \n}\n" ); } + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("a {b: rgb(0, 0, 0, calc(NaN))}\n"), + "a {\ + \n b: rgba(0, 0, 0, 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("a {b: rgb(0, 0, 0, calc(-infinity))}\n"), + "a {\ + \n b: rgba(0, 0, 0, 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("a {b: rgb(0, 0, 0, calc(infinity))}\n"), + "a {\ + \n b: rgb(0, 0, 0);\ + \n}\n" + ); + } + } } -#[test] -fn blue() { - assert_eq!( - runner().ok("a {b: rgb(0, 0, 9999, 0.5)}\n"), - "a {\ +mod blue { + #[allow(unused)] + use super::runner; + + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("a {b: rgb(0, 0, calc(NaN), 0.5)}\n"), + "a {\ + \n b: rgba(0, 0, 0, 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("a {b: rgb(0, 0, calc(-infinity), 0.5)}\n"), + "a {\ + \n b: rgba(0, 0, 0, 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("a {b: rgb(0, 0, calc(infinity), 0.5)}\n"), + "a {\ + \n b: rgba(0, 0, 255, 0.5);\ + \n}\n" + ); + } + } + #[test] + fn finite() { + assert_eq!( + runner().ok("a {b: rgb(0, 0, 9999, 0.5)}\n"), + "a {\ \n b: rgba(0, 0, 255, 0.5);\ \n}\n" - ); + ); + } } -#[test] -fn green() { - assert_eq!( - runner().ok("a {b: rgb(0, -1, 0, 0.5)}\n"), - "a {\ +mod green { + #[allow(unused)] + use super::runner; + + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("a {b: rgb(0, calc(NaN), 0, 0.5)}\n"), + "a {\ \n b: rgba(0, 0, 0, 0.5);\ \n}\n" - ); + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("a {b: rgb(0, calc(-infinity), 0, 0.5)}\n"), + "a {\ + \n b: rgba(0, 0, 0, 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("a {b: rgb(0, calc(infinity), 0, 0.5)}\n"), + "a {\ + \n b: rgba(0, 255, 0, 0.5);\ + \n}\n" + ); + } + } + #[test] + fn finite() { + assert_eq!( + runner().ok("a {b: rgb(0, -1, 0, 0.5)}\n"), + "a {\ + \n b: rgba(0, 0, 0, 0.5);\ + \n}\n" + ); + } } -#[test] -fn red() { - assert_eq!( - runner().ok("a {b: rgb(256, 0, 0, 0.5)}\n"), - "a {\ +mod red { + #[allow(unused)] + use super::runner; + + mod degenerate { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn nan() { + assert_eq!( + runner().ok("a {b: rgb(calc(NaN), 0, 0, 0.5)}\n"), + "a {\ + \n b: rgba(0, 0, 0, 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn negative_infinity() { + assert_eq!( + runner().ok("a {b: rgb(calc(-infinity), 0, 0, 0.5)}\n"), + "a {\ + \n b: rgba(0, 0, 0, 0.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn positive_infinity() { + assert_eq!( + runner().ok("a {b: rgb(calc(infinity), 0, 0, 0.5)}\n"), + "a {\ \n b: rgba(255, 0, 0, 0.5);\ \n}\n" - ); + ); + } + } + #[test] + fn finite() { + assert_eq!( + runner().ok("a {b: rgb(256, 0, 0, 0.5)}\n"), + "a {\ + \n b: rgba(255, 0, 0, 0.5);\ + \n}\n" + ); + } } diff --git a/rsass/tests/spec/core_functions/color/rgb/four_args/special_functions.rs b/rsass/tests/spec/core_functions/color/rgb/four_args/special_functions.rs index f8ffc628a..724d7ecc4 100644 --- a/rsass/tests/spec/core_functions/color/rgb/four_args/special_functions.rs +++ b/rsass/tests/spec/core_functions/color/rgb/four_args/special_functions.rs @@ -57,7 +57,8 @@ mod calc { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: rgb(unquote(\"calc(1)\"), 2, 3, 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(string.unquote(\"calc(1)\"), 2, 3, 0.4)}\n"), "a {\ \n b: rgb(calc(1), 2, 3, 0.4);\ \n}\n" @@ -66,7 +67,8 @@ mod calc { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: rgb(1, unquote(\"calc(2)\"), 3, 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, string.unquote(\"calc(2)\"), 3, 0.4)}\n"), "a {\ \n b: rgb(1, calc(2), 3, 0.4);\ \n}\n" @@ -75,7 +77,8 @@ mod calc { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: rgb(1, 2, unquote(\"calc(3)\"), 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, 2, string.unquote(\"calc(3)\"), 0.4)}\n"), "a {\ \n b: rgb(1, 2, calc(3), 0.4);\ \n}\n" @@ -84,7 +87,8 @@ mod calc { #[test] fn arg_4() { assert_eq!( - runner().ok("a {b: rgb(1, 2, 3, unquote(\"calc(0.4)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, 2, 3, string.unquote(\"calc(0.4)\"))}\n"), "a {\ \n b: rgb(1, 2, 3, calc(0.4));\ \n}\n" @@ -103,9 +107,8 @@ mod clamp { #[test] fn arg_1() { assert_eq!( - runner().ok( - "a {b: rgb(unquote(\"clamp(1, 2, 3)\"), 2, 3, 0.4)}\n" - ), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(string.unquote(\"clamp(1, 2, 3)\"), 2, 3, 0.4)}\n"), "a {\ \n b: rgb(clamp(1, 2, 3), 2, 3, 0.4);\ \n}\n" @@ -114,9 +117,8 @@ mod clamp { #[test] fn arg_2() { assert_eq!( - runner().ok( - "a {b: rgb(1, unquote(\"clamp(2, 3, 4)\"), 3, 0.4)}\n" - ), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, string.unquote(\"clamp(2, 3, 4)\"), 3, 0.4)}\n"), "a {\ \n b: rgb(1, clamp(2, 3, 4), 3, 0.4);\ \n}\n" @@ -125,9 +127,8 @@ mod clamp { #[test] fn arg_3() { assert_eq!( - runner().ok( - "a {b: rgb(1, 2, unquote(\"clamp(3, 4, 5)\"), 0.4)}\n" - ), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, 2, string.unquote(\"clamp(3, 4, 5)\"), 0.4)}\n"), "a {\ \n b: rgb(1, 2, clamp(3, 4, 5), 0.4);\ \n}\n" @@ -137,7 +138,8 @@ mod clamp { fn arg_4() { assert_eq!( runner().ok( - "a {b: rgb(1, 2, 3, unquote(\"clamp(0.4, 0.5, 0.6)\"))}\n" + "@use \"sass:string\";\ + \na {b: rgb(1, 2, 3, string.unquote(\"clamp(0.4, 0.5, 0.6)\"))}\n" ), "a {\ \n b: rgb(1, 2, 3, clamp(0.4, 0.5, 0.6));\ @@ -198,7 +200,8 @@ mod max { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: rgb(unquote(\"max(1)\"), 2, 3, 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(string.unquote(\"max(1)\"), 2, 3, 0.4)}\n"), "a {\ \n b: rgb(max(1), 2, 3, 0.4);\ \n}\n" @@ -207,7 +210,8 @@ mod max { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: rgb(1, unquote(\"max(2)\"), 3, 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, string.unquote(\"max(2)\"), 3, 0.4)}\n"), "a {\ \n b: rgb(1, max(2), 3, 0.4);\ \n}\n" @@ -216,7 +220,8 @@ mod max { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: rgb(1, 2, unquote(\"max(3)\"), 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, 2, string.unquote(\"max(3)\"), 0.4)}\n"), "a {\ \n b: rgb(1, 2, max(3), 0.4);\ \n}\n" @@ -225,7 +230,8 @@ mod max { #[test] fn arg_4() { assert_eq!( - runner().ok("a {b: rgb(1, 2, 3, unquote(\"max(0.4)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, 2, 3, string.unquote(\"max(0.4)\"))}\n"), "a {\ \n b: rgb(1, 2, 3, max(0.4));\ \n}\n" @@ -244,7 +250,8 @@ mod min { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: rgb(unquote(\"min(1)\"), 2, 3, 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(string.unquote(\"min(1)\"), 2, 3, 0.4)}\n"), "a {\ \n b: rgb(min(1), 2, 3, 0.4);\ \n}\n" @@ -253,7 +260,8 @@ mod min { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: rgb(1, unquote(\"min(2)\"), 3, 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, string.unquote(\"min(2)\"), 3, 0.4)}\n"), "a {\ \n b: rgb(1, min(2), 3, 0.4);\ \n}\n" @@ -262,7 +270,8 @@ mod min { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: rgb(1, 2, unquote(\"min(3)\"), 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, 2, string.unquote(\"min(3)\"), 0.4)}\n"), "a {\ \n b: rgb(1, 2, min(3), 0.4);\ \n}\n" @@ -271,7 +280,8 @@ mod min { #[test] fn arg_4() { assert_eq!( - runner().ok("a {b: rgb(1, 2, 3, unquote(\"min(0.4)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, 2, 3, string.unquote(\"min(0.4)\"))}\n"), "a {\ \n b: rgb(1, 2, 3, min(0.4));\ \n}\n" diff --git a/rsass/tests/spec/core_functions/color/rgb/one_arg/alpha.rs b/rsass/tests/spec/core_functions/color/rgb/one_arg/alpha.rs index eb9a59f30..89af5d089 100644 --- a/rsass/tests/spec/core_functions/color/rgb/one_arg/alpha.rs +++ b/rsass/tests/spec/core_functions/color/rgb/one_arg/alpha.rs @@ -5,7 +5,7 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("alpha") } -mod clamped { +mod bounds { #[allow(unused)] use super::runner; @@ -13,74 +13,161 @@ mod clamped { #[allow(unused)] use super::runner; - #[test] - fn above() { - assert_eq!( - runner().ok("a {b: rgb(0 0 0 / 1.1)}\n"), - "a {\ - \n b: rgb(0, 0, 0);\ + mod percent { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(rgb(0 0 0 / 250%));\n"), + "a {\ + \n value: rgb(0, 0, 0);\ + \n space: rgb;\ + \n channels: 0 0 0 / 1;\ \n}\n" - ); - } - #[test] - fn below() { - assert_eq!( - runner().ok("a {b: rgb(0 0 0 / -0.1)}\n"), - "a {\ - \n b: rgba(0, 0, 0, 0);\ + ); + } + #[test] + #[ignore] // unexepected error + fn below() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(rgb(0 0 0 / -10%));\n"), + "a {\ + \n value: rgba(0, 0, 0, 0);\ + \n space: rgb;\ + \n channels: 0 0 0 / 0;\ \n}\n" - ); + ); + } } - mod percent { + mod unitless { #[allow(unused)] use super::runner; #[test] + #[ignore] // unexepected error fn above() { assert_eq!( - runner().ok("a {b: rgb(0 0 0 / 250%)}\n"), + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(rgb(0 0 0 / 1.1));\n"), "a {\ - \n b: rgb(0, 0, 0);\ + \n value: rgb(0, 0, 0);\ + \n space: rgb;\ + \n channels: 0 0 0 / 1;\ \n}\n" ); } #[test] + #[ignore] // unexepected error fn below() { assert_eq!( - runner().ok("a {b: rgb(0 0 0 / -10%)}\n"), + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(rgb(0 0 0 / -0.1));\n"), "a {\ - \n b: rgba(0, 0, 0, 0);\ + \n value: rgba(0, 0, 0, 0);\ + \n space: rgb;\ + \n channels: 0 0 0 / 0;\ \n}\n" ); } } } - #[test] - fn blue() { - assert_eq!( - runner().ok("a {b: rgb(0 0 9999 / 0.5)}\n"), - "a {\ - \n b: rgba(0, 0, 255, 0.5);\ + mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(rgb(0 0 999));\n"), + "a {\ + \n value: rgb(0, 0, 255);\ + \n space: rgb;\ + \n channels: 0 0 255 / 1;\ \n}\n" - ); + ); + } + #[test] + #[ignore] // unexepected error + fn below() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(rgb(0 0 -500));\n"), + "a {\ + \n value: rgb(0, 0, 0);\ + \n space: rgb;\ + \n channels: 0 0 0 / 1;\ + \n}\n" + ); + } } - #[test] - fn green() { - assert_eq!( - runner().ok("a {b: rgb(0 -1 0 / 0.5)}\n"), - "a {\ - \n b: rgba(0, 0, 0, 0.5);\ + mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(rgb(0 500 0));\n"), + "a {\ + \n value: rgb(0, 255, 0);\ + \n space: rgb;\ + \n channels: 0 255 0 / 1;\ \n}\n" - ); + ); + } + #[test] + #[ignore] // unexepected error + fn below() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(rgb(0 -100 0));\n"), + "a {\ + \n value: rgb(0, 0, 0);\ + \n space: rgb;\ + \n channels: 0 0 0 / 1;\ + \n}\n" + ); + } } - #[test] - fn red() { - assert_eq!( - runner().ok("a {b: rgb(256 0 0 / 0.5)}\n"), - "a {\ - \n b: rgba(255, 0, 0, 0.5);\ + mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn above() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(rgb(256 0 0));\n"), + "a {\ + \n value: rgb(255, 0, 0);\ + \n space: rgb;\ + \n channels: 255 0 0 / 1;\ \n}\n" - ); + ); + } + #[test] + #[ignore] // unexepected error + fn below() { + assert_eq!( + runner().ok("@use \'core_functions/color/utils\';\ + \n@include utils.inspect(rgb(-1 0 0));\n"), + "a {\ + \n value: rgb(0, 0, 0);\ + \n space: rgb;\ + \n channels: 0 0 0 / 1;\ + \n}\n" + ); + } } } mod in_gamut { @@ -145,6 +232,32 @@ mod in_gamut { ); } } +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn slash() { + assert_eq!( + runner().ok("a {b: rgb(0 255 127 / none)}\n"), + "a {\ + \n b: rgb(0 255 127 / none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn slash_list() { + assert_eq!( + runner().ok("@use \'sass:list\';\ + \na {b: rgb(list.slash(0 255 127, none))}\n"), + "a {\ + \n b: rgb(0 255 127 / none);\ + \n}\n" + ); + } +} #[test] fn slash_list() { assert_eq!( diff --git a/rsass/tests/spec/core_functions/color/rgb/one_arg/no_alpha.rs b/rsass/tests/spec/core_functions/color/rgb/one_arg/no_alpha.rs index 41d72f854..5ed2f733e 100644 --- a/rsass/tests/spec/core_functions/color/rgb/one_arg/no_alpha.rs +++ b/rsass/tests/spec/core_functions/color/rgb/one_arg/no_alpha.rs @@ -5,6 +5,41 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("no_alpha") } +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("a {b: rgb(18 52 none)}\n"), + "a {\ + \n b: rgb(18 52 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("a {b: rgb(18 none 66)}\n"), + "a {\ + \n b: rgb(18 none 66);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("a {b: rgb(none 52 66)}\n"), + "a {\ + \n b: rgb(none 52 66);\ + \n}\n" + ); + } +} mod percents { #[allow(unused)] use super::runner; @@ -14,21 +49,23 @@ mod percents { use super::runner; #[test] + #[ignore] // wrong result fn percent() { assert_eq!( runner().ok("a {b: rgb(7.1% 20.4% 33.9%)}\n"), "a {\ - \n b: rgb(18, 52, 86);\ + \n b: rgb(18.105, 52.02, 86.445);\ \n}\n" ); } } #[test] + #[ignore] // wrong result fn boundaries() { assert_eq!( runner().ok("a {b: rgb(0% 100% 50%)}\n"), "a {\ - \n b: rgb(0, 255, 128);\ + \n b: rgb(0, 255, 127.5);\ \n}\n" ); } @@ -69,11 +106,12 @@ mod percents { use super::runner; #[test] + #[ignore] // wrong result fn green() { assert_eq!( runner().ok("a {b: rgb(190 68% 237)}\n"), "a {\ - \n b: rgb(190, 173, 237);\ + \n b: rgb(190, 173.4, 237);\ \n}\n" ); } @@ -83,11 +121,12 @@ mod percents { use super::runner; #[test] + #[ignore] // wrong result fn green() { assert_eq!( runner().ok("a {b: rgb(74.7% 173 93%)}\n"), "a {\ - \n b: rgb(190, 173, 237);\ + \n b: rgb(190.485, 173, 237.15);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/rgb/one_arg/relative_color.rs b/rsass/tests/spec/core_functions/color/rgb/one_arg/relative_color.rs index e474bed97..cc18d3558 100644 --- a/rsass/tests/spec/core_functions/color/rgb/one_arg/relative_color.rs +++ b/rsass/tests/spec/core_functions/color/rgb/one_arg/relative_color.rs @@ -60,28 +60,34 @@ mod error { use super::runner; #[test] + #[ignore] // wrong error fn alpha() { assert_eq!( - runner().err("a {b: rgb(\"from\" #aaa r g b / 25%)}\n"), - "Error: Only 3 elements allowed, but 5 were passed.\ + runner().err( + "a {b: rgb(\"from\" #aaa r g b / 25%)}\n" + ), + "Error: $channels: Expected red channel to be a number, was \"from\".\ \n ,\ \n1 | a {b: rgb(\"from\" #aaa r g b / 25%)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 1:7 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn no_alpha() { assert_eq!( - runner().err("a {b: rgb(\"from\" #aaa r g b)}\n"), - "Error: Only 3 elements allowed, but 5 were passed.\ + runner().err( + "a {b: rgb(\"from\" #aaa r g b)}\n" + ), + "Error: $channels: Expected red channel to be a number, was \"from\".\ \n ,\ \n1 | a {b: rgb(\"from\" #aaa r g b)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 1:7 root stylesheet", - ); + ); } } mod wrong_keyword { @@ -89,28 +95,34 @@ mod error { use super::runner; #[test] + #[ignore] // wrong error fn alpha() { assert_eq!( - runner().err("a {b: rgb(c #aaa r g b / 25%)}\n"), - "Error: Only 3 elements allowed, but 5 were passed.\ + runner().err( + "a {b: rgb(c #aaa r g b / 25%)}\n" + ), + "Error: $channels: Expected red channel to be a number, was c.\ \n ,\ \n1 | a {b: rgb(c #aaa r g b / 25%)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 1:7 root stylesheet", - ); + ); } #[test] + #[ignore] // wrong error fn no_alpha() { assert_eq!( - runner().err("a {b: rgb(c #aaa r g b)}\n"), - "Error: Only 3 elements allowed, but 5 were passed.\ + runner().err( + "a {b: rgb(c #aaa r g b)}\n" + ), + "Error: $channels: Expected red channel to be a number, was c.\ \n ,\ \n1 | a {b: rgb(c #aaa r g b)}\ \n | ^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 1:7 root stylesheet", - ); + ); } } } @@ -118,9 +130,9 @@ mod error { fn slash_list_alpha() { assert_eq!( runner().ok("@use \"sass:list\";\ - \na {b: rgb(list.slash(from #aaa h s l, 25%))}\n"), + \na {b: rgb(list.slash(from #aaa r g b, 25%))}\n"), "a {\ - \n b: rgb(from #aaa h s l / 25%);\ + \n b: rgb(from #aaa r g b / 25%);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/rgb/one_arg/special_functions/alpha.rs b/rsass/tests/spec/core_functions/color/rgb/one_arg/special_functions/alpha.rs index 351f0eb3b..a1a82cfc6 100644 --- a/rsass/tests/spec/core_functions/color/rgb/one_arg/special_functions/alpha.rs +++ b/rsass/tests/spec/core_functions/color/rgb/one_arg/special_functions/alpha.rs @@ -32,20 +32,22 @@ mod calc { ); } #[test] + #[ignore] // wrong result fn arg_3() { assert_eq!( runner().ok("a {b: rgb(1 2 calc(1px + 1%) / 0.4)}\n"), "a {\ - \n b: rgb(1 2 calc(1px + 1%)/0.4);\ + \n b: rgb(1, 2, calc(1px + 1%), 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_4() { assert_eq!( runner().ok("a {b: rgb(1 2 3 / calc(1px + 1%))}\n"), "a {\ - \n b: rgb(1 2 3/calc(1px + 1%));\ + \n b: rgb(1, 2, 3, calc(1px + 1%));\ \n}\n" ); } @@ -57,7 +59,8 @@ mod calc { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: rgb(unquote(\"calc(1)\") 2 3 / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(string.unquote(\"calc(1)\") 2 3 / 0.4)}\n"), "a {\ \n b: rgb(calc(1), 2, 3, 0.4);\ \n}\n" @@ -66,27 +69,32 @@ mod calc { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: rgb(1 unquote(\"calc(2)\") 3 / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 string.unquote(\"calc(2)\") 3 / 0.4)}\n"), "a {\ \n b: rgb(1, calc(2), 3, 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_3() { assert_eq!( - runner().ok("a {b: rgb(1 2 unquote(\"calc(3)\") / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 2 string.unquote(\"calc(3)\") / 0.4)}\n"), "a {\ - \n b: rgb(1 2 calc(3)/0.4);\ + \n b: rgb(1, 2, calc(3), 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_4() { assert_eq!( - runner().ok("a {b: rgb(1 2 3 / unquote(\"calc(0.4)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 2 3 / string.unquote(\"calc(0.4)\"))}\n"), "a {\ - \n b: rgb(1 2 3/calc(0.4));\ + \n b: rgb(1, 2, 3, calc(0.4));\ \n}\n" ); } @@ -103,9 +111,8 @@ mod clamp { #[test] fn arg_1() { assert_eq!( - runner().ok( - "a {b: rgb(unquote(\"clamp(1, 2, 3)\") 2 3 / 0.4)}\n" - ), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(string.unquote(\"clamp(1, 2, 3)\") 2 3 / 0.4)}\n"), "a {\ \n b: rgb(clamp(1, 2, 3), 2, 3, 0.4);\ \n}\n" @@ -114,35 +121,36 @@ mod clamp { #[test] fn arg_2() { assert_eq!( - runner().ok( - "a {b: rgb(1 unquote(\"clamp(2, 3, 4)\") 3 / 0.4)}\n" - ), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 string.unquote(\"clamp(2, 3, 4)\") 3 / 0.4)}\n"), "a {\ \n b: rgb(1, clamp(2, 3, 4), 3, 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_3() { assert_eq!( - runner().ok( - "a {b: rgb(1 2 unquote(\"clamp(3, 4, 5)\") / 0.4)}\n" - ), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 2 string.unquote(\"clamp(3, 4, 5)\") / 0.4)}\n"), "a {\ - \n b: rgb(1 2 clamp(3, 4, 5)/0.4);\ + \n b: rgb(1, 2, clamp(3, 4, 5), 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_4() { assert_eq!( - runner().ok( - "a {b: rgb(1 2 3 / unquote(\"clamp(0.4, 0.5, 0.6)\"))}\n" - ), - "a {\ - \n b: rgb(1 2 3/clamp(0.4, 0.5, 0.6));\ + runner().ok( + "@use \"sass:string\";\ + \na {b: rgb(1 2 3 / string.unquote(\"clamp(0.4, 0.5, 0.6)\"))}\n" + ), + "a {\ + \n b: rgb(1, 2, 3, clamp(0.4, 0.5, 0.6));\ \n}\n" - ); + ); } } } @@ -169,20 +177,22 @@ mod env { ); } #[test] + #[ignore] // wrong result fn arg_3() { assert_eq!( runner().ok("a {b: rgb(1 2 env(--foo) / 0.4)}\n"), "a {\ - \n b: rgb(1 2 env(--foo)/0.4);\ + \n b: rgb(1, 2, env(--foo), 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_4() { assert_eq!( runner().ok("a {b: rgb(1 2 3 / env(--foo))}\n"), "a {\ - \n b: rgb(1 2 3/env(--foo));\ + \n b: rgb(1, 2, 3, env(--foo));\ \n}\n" ); } @@ -198,7 +208,8 @@ mod max { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: rgb(unquote(\"max(1)\") 2 3 / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(string.unquote(\"max(1)\") 2 3 / 0.4)}\n"), "a {\ \n b: rgb(max(1), 2, 3, 0.4);\ \n}\n" @@ -207,27 +218,32 @@ mod max { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: rgb(1 unquote(\"max(2)\") 3 / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 string.unquote(\"max(2)\") 3 / 0.4)}\n"), "a {\ \n b: rgb(1, max(2), 3, 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_3() { assert_eq!( - runner().ok("a {b: rgb(1 2 unquote(\"max(3)\") / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 2 string.unquote(\"max(3)\") / 0.4)}\n"), "a {\ - \n b: rgb(1 2 max(3)/0.4);\ + \n b: rgb(1, 2, max(3), 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_4() { assert_eq!( - runner().ok("a {b: rgb(1 2 3 / unquote(\"max(0.4)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 2 3 / string.unquote(\"max(0.4)\"))}\n"), "a {\ - \n b: rgb(1 2 3/max(0.4));\ + \n b: rgb(1, 2, 3, max(0.4));\ \n}\n" ); } @@ -244,7 +260,8 @@ mod min { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: rgb(unquote(\"min(1)\") 2 3 / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(string.unquote(\"min(1)\") 2 3 / 0.4)}\n"), "a {\ \n b: rgb(min(1), 2, 3, 0.4);\ \n}\n" @@ -253,27 +270,32 @@ mod min { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: rgb(1 unquote(\"min(2)\") 3 / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 string.unquote(\"min(2)\") 3 / 0.4)}\n"), "a {\ \n b: rgb(1, min(2), 3, 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_3() { assert_eq!( - runner().ok("a {b: rgb(1 2 unquote(\"min(3)\") / 0.4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 2 string.unquote(\"min(3)\") / 0.4)}\n"), "a {\ - \n b: rgb(1 2 min(3)/0.4);\ + \n b: rgb(1, 2, min(3), 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_4() { assert_eq!( - runner().ok("a {b: rgb(1 2 3 / unquote(\"min(0.4)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 2 3 / string.unquote(\"min(0.4)\"))}\n"), "a {\ - \n b: rgb(1 2 3/min(0.4));\ + \n b: rgb(1, 2, 3, min(0.4));\ \n}\n" ); } @@ -337,20 +359,22 @@ mod var { ); } #[test] + #[ignore] // wrong result fn arg_3() { assert_eq!( runner().ok("a {b: rgb(1 2 var(--foo) / 0.4)}\n"), "a {\ - \n b: rgb(1 2 var(--foo)/0.4);\ + \n b: rgb(1, 2, var(--foo), 0.4);\ \n}\n" ); } #[test] + #[ignore] // wrong result fn arg_4() { assert_eq!( runner().ok("a {b: rgb(1 2 3 / var(--foo))}\n"), "a {\ - \n b: rgb(1 2 3/var(--foo));\ + \n b: rgb(1, 2, 3, var(--foo));\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/rgb/one_arg/special_functions/no_alpha.rs b/rsass/tests/spec/core_functions/color/rgb/one_arg/special_functions/no_alpha.rs index 357de87ec..46d418c89 100644 --- a/rsass/tests/spec/core_functions/color/rgb/one_arg/special_functions/no_alpha.rs +++ b/rsass/tests/spec/core_functions/color/rgb/one_arg/special_functions/no_alpha.rs @@ -48,7 +48,8 @@ mod calc { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: rgb(unquote(\"calc(1)\") 2 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(string.unquote(\"calc(1)\") 2 3)}\n"), "a {\ \n b: rgb(calc(1), 2, 3);\ \n}\n" @@ -57,7 +58,8 @@ mod calc { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: rgb(1 unquote(\"calc(2)\") 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 string.unquote(\"calc(2)\") 3)}\n"), "a {\ \n b: rgb(1, calc(2), 3);\ \n}\n" @@ -66,7 +68,8 @@ mod calc { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: rgb(1 2 unquote(\"calc(3)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 2 string.unquote(\"calc(3)\"))}\n"), "a {\ \n b: rgb(1, 2, calc(3));\ \n}\n" @@ -85,7 +88,8 @@ mod clamp { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: rgb(unquote(\"clamp(1, 2, 3)\") 2 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(string.unquote(\"clamp(1, 2, 3)\") 2 3)}\n"), "a {\ \n b: rgb(clamp(1, 2, 3), 2, 3);\ \n}\n" @@ -94,7 +98,8 @@ mod clamp { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: rgb(1 unquote(\"clamp(2, 3, 4)\") 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 string.unquote(\"clamp(2, 3, 4)\") 3)}\n"), "a {\ \n b: rgb(1, clamp(2, 3, 4), 3);\ \n}\n" @@ -103,7 +108,8 @@ mod clamp { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: rgb(1 2 unquote(\"clamp(3, 4, 5)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 2 string.unquote(\"clamp(3, 4, 5)\"))}\n"), "a {\ \n b: rgb(1, 2, clamp(3, 4, 5));\ \n}\n" @@ -154,7 +160,8 @@ mod max { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: rgb(unquote(\"max(1)\") 2 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(string.unquote(\"max(1)\") 2 3)}\n"), "a {\ \n b: rgb(max(1), 2, 3);\ \n}\n" @@ -163,7 +170,8 @@ mod max { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: rgb(1 unquote(\"max(2)\") 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 string.unquote(\"max(2)\") 3)}\n"), "a {\ \n b: rgb(1, max(2), 3);\ \n}\n" @@ -172,7 +180,8 @@ mod max { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: rgb(1 2 unquote(\"max(3)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 2 string.unquote(\"max(3)\"))}\n"), "a {\ \n b: rgb(1, 2, max(3));\ \n}\n" @@ -191,7 +200,8 @@ mod min { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: rgb(unquote(\"min(1)\") 2 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(string.unquote(\"min(1)\") 2 3)}\n"), "a {\ \n b: rgb(min(1), 2, 3);\ \n}\n" @@ -200,7 +210,8 @@ mod min { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: rgb(1 unquote(\"min(2)\") 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 string.unquote(\"min(2)\") 3)}\n"), "a {\ \n b: rgb(1, min(2), 3);\ \n}\n" @@ -209,7 +220,8 @@ mod min { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: rgb(1 2 unquote(\"min(3)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1 2 string.unquote(\"min(3)\"))}\n"), "a {\ \n b: rgb(1, 2, min(3));\ \n}\n" diff --git a/rsass/tests/spec/core_functions/color/rgb/three_args/percents.rs b/rsass/tests/spec/core_functions/color/rgb/three_args/percents.rs index 1c6cfe325..556fae6a0 100644 --- a/rsass/tests/spec/core_functions/color/rgb/three_args/percents.rs +++ b/rsass/tests/spec/core_functions/color/rgb/three_args/percents.rs @@ -10,21 +10,23 @@ mod all { use super::runner; #[test] + #[ignore] // wrong result fn percent() { assert_eq!( runner().ok("a {b: rgb(7.1%, 20.4%, 33.9%)}\n"), "a {\ - \n b: rgb(18, 52, 86);\ + \n b: rgb(18.105, 52.02, 86.445);\ \n}\n" ); } } #[test] +#[ignore] // wrong result fn boundaries() { assert_eq!( runner().ok("a {b: rgb(0%, 100%, 50%)}\n"), "a {\ - \n b: rgb(0, 255, 128);\ + \n b: rgb(0, 255, 127.5);\ \n}\n" ); } @@ -65,11 +67,12 @@ mod percent { use super::runner; #[test] + #[ignore] // wrong result fn green() { assert_eq!( runner().ok("a {b: rgb(190, 68%, 237)}\n"), "a {\ - \n b: rgb(190, 173, 237);\ + \n b: rgb(190, 173.4, 237);\ \n}\n" ); } @@ -79,11 +82,12 @@ mod unitless { use super::runner; #[test] + #[ignore] // wrong result fn green() { assert_eq!( runner().ok("a {b: rgb(74.7%, 173, 93%)}\n"), "a {\ - \n b: rgb(190, 173, 237);\ + \n b: rgb(190.485, 173, 237.15);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/rgb/three_args/special_functions.rs b/rsass/tests/spec/core_functions/color/rgb/three_args/special_functions.rs index 0ae461d28..61af73eab 100644 --- a/rsass/tests/spec/core_functions/color/rgb/three_args/special_functions.rs +++ b/rsass/tests/spec/core_functions/color/rgb/three_args/special_functions.rs @@ -16,7 +16,8 @@ mod calc { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: rgb(unquote(\"calc(1)\"), 2, 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(string.unquote(\"calc(1)\"), 2, 3)}\n"), "a {\ \n b: rgb(calc(1), 2, 3);\ \n}\n" @@ -25,7 +26,8 @@ mod calc { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: rgb(1, unquote(\"calc(2)\"), 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, string.unquote(\"calc(2)\"), 3)}\n"), "a {\ \n b: rgb(1, calc(2), 3);\ \n}\n" @@ -34,7 +36,8 @@ mod calc { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: rgb(1, 2, unquote(\"calc(3)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, 2, string.unquote(\"calc(3)\"))}\n"), "a {\ \n b: rgb(1, 2, calc(3));\ \n}\n" @@ -53,8 +56,8 @@ mod clamp { #[test] fn arg_1() { assert_eq!( - runner() - .ok("a {b: rgb(unquote(\"clamp(1, 2, 3)\"), 2, 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(string.unquote(\"clamp(1, 2, 3)\"), 2, 3)}\n"), "a {\ \n b: rgb(clamp(1, 2, 3), 2, 3);\ \n}\n" @@ -63,8 +66,8 @@ mod clamp { #[test] fn arg_2() { assert_eq!( - runner() - .ok("a {b: rgb(1, unquote(\"clamp(2, 3, 4)\"), 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, string.unquote(\"clamp(2, 3, 4)\"), 3)}\n"), "a {\ \n b: rgb(1, clamp(2, 3, 4), 3);\ \n}\n" @@ -73,8 +76,8 @@ mod clamp { #[test] fn arg_3() { assert_eq!( - runner() - .ok("a {b: rgb(1, 2, unquote(\"clamp(3, 4, 5)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, 2, string.unquote(\"clamp(3, 4, 5)\"))}\n"), "a {\ \n b: rgb(1, 2, clamp(3, 4, 5));\ \n}\n" @@ -125,7 +128,8 @@ mod max { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: rgb(unquote(\"max(1)\"), 2, 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(string.unquote(\"max(1)\"), 2, 3)}\n"), "a {\ \n b: rgb(max(1), 2, 3);\ \n}\n" @@ -134,7 +138,8 @@ mod max { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: rgb(1, unquote(\"max(2)\"), 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, string.unquote(\"max(2)\"), 3)}\n"), "a {\ \n b: rgb(1, max(2), 3);\ \n}\n" @@ -143,7 +148,8 @@ mod max { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: rgb(1, 2, unquote(\"max(3)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, 2, string.unquote(\"max(3)\"))}\n"), "a {\ \n b: rgb(1, 2, max(3));\ \n}\n" @@ -162,7 +168,8 @@ mod min { #[test] fn arg_1() { assert_eq!( - runner().ok("a {b: rgb(unquote(\"min(1)\"), 2, 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(string.unquote(\"min(1)\"), 2, 3)}\n"), "a {\ \n b: rgb(min(1), 2, 3);\ \n}\n" @@ -171,7 +178,8 @@ mod min { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: rgb(1, unquote(\"min(2)\"), 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, string.unquote(\"min(2)\"), 3)}\n"), "a {\ \n b: rgb(1, min(2), 3);\ \n}\n" @@ -180,7 +188,8 @@ mod min { #[test] fn arg_3() { assert_eq!( - runner().ok("a {b: rgb(1, 2, unquote(\"min(3)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(1, 2, string.unquote(\"min(3)\"))}\n"), "a {\ \n b: rgb(1, 2, min(3));\ \n}\n" diff --git a/rsass/tests/spec/core_functions/color/rgb/two_args.rs b/rsass/tests/spec/core_functions/color/rgb/two_args.rs index 931a42c2a..ef19c89bc 100644 --- a/rsass/tests/spec/core_functions/color/rgb/two_args.rs +++ b/rsass/tests/spec/core_functions/color/rgb/two_args.rs @@ -116,7 +116,8 @@ mod special_functions { #[test] fn arg_2() { assert_eq!( - runner().ok("a {b: rgb(blue, unquote(\"calc(0.4)\"))}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: rgb(blue, string.unquote(\"calc(0.4)\"))}\n"), "a {\ \n b: rgb(0, 0, 255, calc(0.4));\ \n}\n" diff --git a/rsass/tests/spec/core_functions/color/same.rs b/rsass/tests/spec/core_functions/color/same.rs new file mode 100644 index 000000000..f2c7b678c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/same.rs @@ -0,0 +1,315 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/same.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("same") +} + +mod error { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn too_few_args() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.same(plum)}\n" + ), + "Error: Missing argument $color2.\ + \n ,--> input.scss\ + \n2 | a {b: color.same(plum)}\ + \n | ^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function same($color1, $color2) {\ + \n | ====================== declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn too_many_args() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.same(red, green, blue)}\n" + ), + "Error: Only 2 arguments allowed, but 3 were passed.\ + \n ,--> input.scss\ + \n2 | a {b: color.same(red, green, blue)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function same($color1, $color2) {\ + \n | ====================== declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + mod test_type { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn color1() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.same(1, red)}\n" + ), + "Error: $color1: 1 is not a color.\ + \n ,\ + \n2 | a {b: color.same(1, red)}\ + \n | ^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn color2() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.same(red, 1)}\n" + ), + "Error: $color2: 1 is not a color.\ + \n ,\ + \n2 | a {b: color.same(red, 1)}\ + \n | ^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + } +} +mod test_false { + #[allow(unused)] + use super::runner; + + mod different_space { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn both_none() { + assert_eq!( + runner().ok( + "// This test verifies that none is converted to 0 *before* conversion to XYZ.\ + \n@use \"sass:color\";\ + \na {\ + \n b: color.same(\ + \n color(rec2020 0.5 none 0.2),\ + \n color(xyz 0.174805932224126 none 0.058901333881161)\ + \n );\ + \n}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn no_none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.same(color(srgb 0.1 0.2 0.3), color(srgb-linear 0.1 0.2 0.3))}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); + } + } + mod same_space { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn no_none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.same(#abcdef, #fedcba)}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none_and_nonzero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.same(\ + \n color(prophoto-rgb 0.1 0.2 none),\ + \n color(prophoto-rgb 0.1 0.2 0.3)\ + \n );\ + \n}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + } +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.same($color1: red, $color2: green)}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +mod test_true { + #[allow(unused)] + use super::runner; + + mod different_space { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn both_none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.same(\ + \n color(srgb-linear none 0.9 0.8),\ + \n rgb(none 243.445228830895 231.114597102735)\ + \n );\ + \n}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn no_none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.same(plum, hsl(300, 47.2868217054%, 74.7058823529%))}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn one_none() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.same(\ + \n color(rec2020 0.5 none 0.2),\ + \n oklab(44.668866707461% 0.236673642675 0.018728349677)\ + \n );\ + \n}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } + } + mod same_space { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn both_none() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.same(color(display-p3 0.1 0.3 none), color(display-p3 0.1 0.3 none));\ + \n}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn identical() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.same(#abcdef, #abcdef)}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none_and_zero() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.same(color(display-p3 0.1 0.3 none), color(display-p3 0.1 0.3 0))}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.same(color(srgb 2.3 -1 42), color(srgb 2.3 -1 42))}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn with_alpha() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.same(oklch(50% 30% 120deg / 0.3), oklch(50% 30% 120deg / 0.3))}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn within_epsilon() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.same(\ + \n lab(50.0000000000001 29.9999999999999 -20.0000000000001),\ + \n lab(50 30 -20)\ + \n );\ + \n}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/core_functions/color/saturate.rs b/rsass/tests/spec/core_functions/color/saturate.rs index b939821b8..16db214ff 100644 --- a/rsass/tests/spec/core_functions/color/saturate.rs +++ b/rsass/tests/spec/core_functions/color/saturate.rs @@ -5,10 +5,95 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("saturate") } +mod css_overload { + #[allow(unused)] + use super::runner; + + #[test] + fn named() { + assert_eq!( + runner().ok("a {b: saturate($amount: 50%)}\n"), + "a {\ + \n b: saturate(50%);\ + \n}\n" + ); + } + #[test] + fn unit() { + assert_eq!( + runner().ok("a {b: saturate(50%)}\n"), + "a {\ + \n b: saturate(50%);\ + \n}\n" + ); + } + #[test] + fn unitless() { + assert_eq!( + runner().ok("a {b: saturate(1)}\n"), + "a {\ + \n b: saturate(1);\ + \n}\n" + ); + } + #[test] + fn with_calc() { + assert_eq!( + runner().ok("a {b: saturate(calc(1 + 2))}\n"), + "a {\ + \n b: saturate(3);\ + \n}\n" + ); + } + #[test] + fn with_css_var() { + assert_eq!( + runner().ok("a {b: saturate(var(--c))}\n"), + "a {\ + \n b: saturate(var(--c));\ + \n}\n" + ); + } + #[test] + fn with_sass_var() { + assert_eq!( + runner().ok("$c: 1;\ + \na {b: saturate($c)}\n"), + "a {\ + \n b: saturate(1);\ + \n}\n" + ); + } + #[test] + fn with_unquoted_calc() { + assert_eq!( + runner().ok("@use \"sass:string\";\ + \na {b: saturate(string.unquote(\'calc(1)\'))}\n"), + "a {\ + \n b: saturate(calc(1));\ + \n}\n" + ); + } +} mod error { #[allow(unused)] use super::runner; + #[test] + #[ignore] // wrong error + fn non_legacy() { + assert_eq!( + runner().err( + "a {b: saturate(color(srgb 1 1 1), 10%)}\n" + ), + "Error: saturate() is only supported for legacy colors. Please use color.adjust() instead with an explicit $space argument.\ + \n ,\ + \n1 | a {b: saturate(color(srgb 1 1 1), 10%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } mod one_arg { #[allow(unused)] use super::runner; @@ -135,7 +220,7 @@ mod error { fn test_type() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.saturate(var(--c))}\n" ), "Error: Missing argument $amount.\ @@ -153,75 +238,6 @@ mod error { } } } -mod one_arg { - #[allow(unused)] - use super::runner; - - #[test] - fn named() { - assert_eq!( - runner().ok("a {b: saturate($amount: 50%)}\n"), - "a {\ - \n b: saturate(50%);\ - \n}\n" - ); - } - #[test] - fn unit() { - assert_eq!( - runner().ok("a {b: saturate(50%)}\n"), - "a {\ - \n b: saturate(50%);\ - \n}\n" - ); - } - #[test] - fn unitless() { - assert_eq!( - runner().ok("a {b: saturate(1)}\n"), - "a {\ - \n b: saturate(1);\ - \n}\n" - ); - } - #[test] - fn with_calc() { - assert_eq!( - runner().ok("a {b: saturate(calc(1 + 2))}\n"), - "a {\ - \n b: saturate(3);\ - \n}\n" - ); - } - #[test] - fn with_css_var() { - assert_eq!( - runner().ok("a {b: saturate(var(--c))}\n"), - "a {\ - \n b: saturate(var(--c));\ - \n}\n" - ); - } - #[test] - fn with_sass_var() { - assert_eq!( - runner().ok("$c: 1;\ - \na {b: saturate($c)}\n"), - "a {\ - \n b: saturate(1);\ - \n}\n" - ); - } - #[test] - fn with_unquoted_calc() { - assert_eq!( - runner().ok("a {b: saturate(unquote(\'calc(1)\'))}\n"), - "a {\ - \n b: saturate(calc(1));\ - \n}\n" - ); - } -} mod two_args { #[allow(unused)] use super::runner; @@ -254,11 +270,12 @@ mod two_args { ); } #[test] + #[ignore] // wrong result fn middle() { assert_eq!( runner().ok("a {b: saturate(plum, 14%)}\n"), "a {\ - \n b: #e697e6;\ + \n b: rgb(230.03, 150.97, 230.03);\ \n}\n" ); } @@ -272,11 +289,12 @@ mod two_args { ); } #[test] + #[ignore] // wrong result fn named() { assert_eq!( runner().ok("a {b: saturate($color: plum, $amount: 14%)}\n"), "a {\ - \n b: #e697e6;\ + \n b: rgb(230.03, 150.97, 230.03);\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/color/saturation.rs b/rsass/tests/spec/core_functions/color/saturation.rs index c5a6addba..a0e1f3b04 100644 --- a/rsass/tests/spec/core_functions/color/saturation.rs +++ b/rsass/tests/spec/core_functions/color/saturation.rs @@ -9,55 +9,81 @@ mod error { #[allow(unused)] use super::runner; + #[test] + #[ignore] // wrong error + fn non_legacy() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.saturation(color(srgb 1 1 1))}\n" + ), + "Error: color.saturation() is only supported for legacy colors. Please use color.channel() instead with an explicit $space argument.\ + \n ,\ + \n2 | a {b: color.saturation(color(srgb 1 1 1))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: saturation()}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.saturation()}\n" + ), "Error: Missing argument $color.\ \n ,--> input.scss\ - \n1 | a {b: saturation()}\ - \n | ^^^^^^^^^^^^ invocation\ + \n2 | a {b: color.saturation()}\ + \n | ^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ \n1 | @function saturation($color) {\ \n | ================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: saturation(red, green)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.saturation(red, green)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: saturation(red, green)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: color.saturation(red, green)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:color\ \n1 | @function saturation($color) {\ \n | ================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: saturation(1)}\n"), + runner().err( + "@use \"sass:color\";\ + \na {b: color.saturation(1)}\n" + ), "Error: $color: 1 is not a color.\ \n ,\ - \n1 | a {b: saturation(1)}\ - \n | ^^^^^^^^^^^^^\ + \n2 | a {b: color.saturation(1)}\ + \n | ^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn fraction() { assert_eq!( - runner().ok("a {b: saturation(hsl(0, 0.5%, 50%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.saturation(hsl(0, 0.5%, 50%))}\n"), "a {\ \n b: 0.5%;\ \n}\n" @@ -66,7 +92,8 @@ fn fraction() { #[test] fn max() { assert_eq!( - runner().ok("a {b: saturation(hsl(0, 100%, 50%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.saturation(hsl(0, 100%, 50%))}\n"), "a {\ \n b: 100%;\ \n}\n" @@ -75,7 +102,8 @@ fn max() { #[test] fn middle() { assert_eq!( - runner().ok("a {b: saturation(hsl(0, 50%, 50%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.saturation(hsl(0, 50%, 50%))}\n"), "a {\ \n b: 50%;\ \n}\n" @@ -84,7 +112,8 @@ fn middle() { #[test] fn min() { assert_eq!( - runner().ok("a {b: saturation(hsl(0, 0%, 50%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.saturation(hsl(0, 0%, 50%))}\n"), "a {\ \n b: 0%;\ \n}\n" @@ -93,7 +122,8 @@ fn min() { #[test] fn named() { assert_eq!( - runner().ok("a {b: saturation($color: hsl(0, 42%, 50%))}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.saturation($color: hsl(0, 42%, 50%))}\n"), "a {\ \n b: 42%;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/color/scale/a98_rgb.rs b/rsass/tests/spec/core_functions/color/scale/a98_rgb.rs new file mode 100644 index 000000000..1a59820ee --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/a98_rgb.rs @@ -0,0 +1,268 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(a98-rgb 0.2 0.5 0.7), $red: 12%, $green: 24%, $blue: 48%\ + \n );\ + \n}\n" + ), + "a {\ + \n b: color(a98-rgb 0.296 0.62 0.844);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(a98-rgb 0.2 0.5 0.7),\ + \n $red: 12%, $green: 24%, $blue: 48%, $alpha: -70%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(a98-rgb 0.296 0.62 0.844 / 0.3);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(a98-rgb 0.2 0.5 0.7 / 0.3),\ + \n $red: 12%, $green: 24%, $blue: 48%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(a98-rgb 0.296 0.62 0.844 / 0.3);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $blue: 42%)}\n"), + "a {\ + \n b: color(a98-rgb 0.2 0.5 0.826);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $blue: -16%)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.5 0.588);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $blue: 100%)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.5 1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $blue: -100%)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.5 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $blue: 0%)}\n"), + "a {\ + \n b: color(a98-rgb 0.2 0.5 0.7);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $green: 12%)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.56 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $green: -86%)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.07 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $green: 100%)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 1 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $green: -100%)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $green: 0%)}\n"), + "a {\ + \n b: color(a98-rgb 0.2 0.5 0.7);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n $color: color(a98-rgb 0.2 0.5 0.7),\ + \n $red: 12%, $green: 24%, $blue: 48%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(a98-rgb 0.296 0.62 0.844);\ + \n}\n" + ); +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $red: 86%)}\n"), + "a {\ + \n b: color(a98-rgb 0.888 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $red: -33%)}\n"), + "a {\ + \n b: color(a98-rgb 0.134 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $red: 100%)}\n"), + "a {\ + \n b: color(a98-rgb 1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $red: -100%)}\n" + ), + "a {\ + \n b: color(a98-rgb 0 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $red: 0%)}\n"), + "a {\ + \n b: color(a98-rgb 0.2 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/display_p3.rs b/rsass/tests/spec/core_functions/color/scale/display_p3.rs new file mode 100644 index 000000000..8f861538c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/display_p3.rs @@ -0,0 +1,282 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(display-p3 0.2 0.5 0.7), $red: 12%, $green: 24%, $blue: 48%\ + \n );\ + \n}\n" + ), + "a {\ + \n b: color(display-p3 0.296 0.62 0.844);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(display-p3 0.2 0.5 0.7),\ + \n $red: 12%, $green: 24%, $blue: 48%, $alpha: -70%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(display-p3 0.296 0.62 0.844 / 0.3);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(display-p3 0.2 0.5 0.7 / 0.3),\ + \n $red: 12%, $green: 24%, $blue: 48%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(display-p3 0.296 0.62 0.844 / 0.3);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $blue: 42%)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 0.826);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $blue: -16%)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 0.588);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $blue: 100%)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $blue: -100%)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $blue: 0%)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 0.7);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $green: 12%)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.56 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $green: -86%)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.07 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $green: 100%)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 1 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $green: -100%)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $green: 0%)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 0.7);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n $color: color(display-p3 0.2 0.5 0.7),\ + \n $red: 12%, $green: 24%, $blue: 48%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(display-p3 0.296 0.62 0.844);\ + \n}\n" + ); +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $red: 86%)}\n" + ), + "a {\ + \n b: color(display-p3 0.888 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $red: -33%)}\n" + ), + "a {\ + \n b: color(display-p3 0.134 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $red: 100%)}\n" + ), + "a {\ + \n b: color(display-p3 1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $red: -100%)}\n" + ), + "a {\ + \n b: color(display-p3 0 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $red: 0%)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/args.rs b/rsass/tests/spec/core_functions/color/scale/error/args.rs new file mode 100644 index 000000000..55f2c2b51 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/args.rs @@ -0,0 +1,72 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/args.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("args") +} + +#[test] +fn too_few() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale()}\n" + ), + "Error: Missing argument $color.\ + \n ,--> input.scss\ + \n2 | a {b: color.scale()}\ + \n | ^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function scale($color, $kwargs...) {\ + \n | ========================= declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn too_many() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, 1)}\n" + ), + "Error: Only one positional argument is allowed. All other arguments must be passed by name.\ + \n ,\ + \n2 | a {b: color.scale(red, 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn unknown() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $hue: 10%)}\n" + ), + "Error: $hue: Channel isn\'t scalable.\ + \n ,\ + \n2 | a {b: color.scale(red, $hue: 10%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale-color(#abcdef, $red: 10%)}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: color.scale-color(#abcdef, $red: 10%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/bounds.rs b/rsass/tests/spec/core_functions/color/scale/error/bounds.rs new file mode 100644 index 000000000..5ff034067 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/bounds.rs @@ -0,0 +1,79 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/bounds.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("bounds") +} + +mod legacy { + #[allow(unused)] + use super::runner; + + #[test] + fn too_high() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $whiteness: 100.001%)}\n" + ), + "Error: $whiteness: Expected 100.001% to be within -100% and 100%.\ + \n ,\ + \n2 | a {b: color.scale(red, $whiteness: 100.001%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + fn too_low() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $saturation: -100.001%)}\n" + ), + "Error: $saturation: Expected -100.001% to be within -100% and 100%.\ + \n ,\ + \n2 | a {b: color.scale(red, $saturation: -100.001%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn too_high() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lab(50% -70 60), $b: 100.001%)}\n" + ), + "Error: $b: Expected 100.001% to be within -100% and 100%.\ + \n ,\ + \n2 | a {b: color.scale(lab(50% -70 60), $b: 100.001%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn too_low() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lab(50% -70 60), $a: -100.001%)}\n" + ), + "Error: $a: Expected -100.001% to be within -100% and 100%.\ + \n ,\ + \n2 | a {b: color.scale(lab(50% -70 60), $a: -100.001%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/incompatible_channel.rs b/rsass/tests/spec/core_functions/color/scale/error/incompatible_channel.rs new file mode 100644 index 000000000..b3dbd850e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/incompatible_channel.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/incompatible_channel.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("incompatible_channel") +} + +#[test] +#[ignore] // wrong error +fn legacy_channel() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $whiteness: 50%)}\n" + ), + "Error: $whiteness: Color space srgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.scale(color(srgb 0.2 0.5 0.7), $whiteness: 50%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn legacy_space() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $chroma: 50%)}\n" + ), + "Error: $chroma: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.scale(red, $chroma: 50%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn modern_both() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $chroma: 50%)}\n" + ), + "Error: $chroma: Color space srgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.scale(color(srgb 0.2 0.5 0.7), $chroma: 50%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/missing.rs b/rsass/tests/spec/core_functions/color/scale/error/missing.rs new file mode 100644 index 000000000..7b790b653 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/missing.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/missing.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("missing") +} + +#[test] +#[ignore] // wrong error +fn alpha() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(rgb(0 0 0 / none), $alpha: 10%)}\n" + ), + "Error: $alpha: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: rgb(0 0 0 / none)).\ + \n ,\ + \n2 | a {b: color.scale(rgb(0 0 0 / none), $alpha: 10%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn legacy() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(rgb(none 0 0), $red: 10%)}\n" + ), + "Error: $red: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: rgb(none 0 0)).\ + \n ,\ + \n2 | a {b: color.scale(rgb(none 0 0), $red: 10%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn modern() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lab(none 0 0), $lightness: 10%, $space: lab)}\n" + ), + "Error: $lightness: Because the CSS working group is still deciding on the best behavior, Sass doesn\'t currently support modifying missing channels (color: lab(none 0 0)).\ + \n ,\ + \n2 | a {b: color.scale(lab(none 0 0), $lightness: 10%, $space: lab)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/mixed_formats.rs b/rsass/tests/spec/core_functions/color/scale/error/mixed_formats.rs new file mode 100644 index 000000000..1aed22e36 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/mixed_formats.rs @@ -0,0 +1,119 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/mixed_formats.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("mixed_formats") +} + +#[test] +#[ignore] // wrong error +fn blue_and_lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $blue: 1%, $lightness: 1%)}\n" + ), + "Error: $lightness: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.scale(red, $blue: 1%, $lightness: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green_and_saturation() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $green: 1%, $saturation: 1%)}\n" + ), + "Error: $saturation: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.scale(red, $green: 1%, $saturation: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn green_and_whiteness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $green: 1%, $whiteness: 1%)}\n" + ), + "Error: $whiteness: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.scale(red, $green: 1%, $whiteness: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn lightness_and_whiteness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $lightness: 1%, $whiteness: 1%)}\n" + ), + "Error: $whiteness: Color space hsl doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.scale(red, $lightness: 1%, $whiteness: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red_and_blackness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $red: 1%, $blackness: 1%)}\n" + ), + "Error: $blackness: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.scale(red, $red: 1%, $blackness: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn red_and_saturation() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $red: 1%, $saturation: 1%)}\n" + ), + "Error: $saturation: Color space rgb doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.scale(red, $red: 1%, $saturation: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn saturation_and_blackness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $saturation: 1%, $blackness: 1%)}\n" + ), + "Error: $blackness: Color space hsl doesn\'t have a channel with this name.\ + \n ,\ + \n2 | a {b: color.scale(red, $saturation: 1%, $blackness: 1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/mod.rs b/rsass/tests/spec/core_functions/color/scale/error/mod.rs new file mode 100644 index 000000000..64c360f7f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/mod.rs @@ -0,0 +1,24 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("error") +} + +mod args; + +mod bounds; + +mod incompatible_channel; + +mod missing; + +mod mixed_formats; + +mod polar; + +mod space; + +mod test_type; + +mod units; diff --git a/rsass/tests/spec/core_functions/color/scale/error/polar.rs b/rsass/tests/spec/core_functions/color/scale/error/polar.rs new file mode 100644 index 000000000..bd6f483d1 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/polar.rs @@ -0,0 +1,55 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/polar.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("polar") +} + +#[test] +#[ignore] // wrong error +fn lch() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lch(50% 30% 180deg), $hue: 10%)}\n" + ), + "Error: $hue: Channel isn\'t scalable.\ + \n ,\ + \n2 | a {b: color.scale(lch(50% 30% 180deg), $hue: 10%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn legacy() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(white, $hue: 10%)}\n" + ), + "Error: $hue: Channel isn\'t scalable.\ + \n ,\ + \n2 | a {b: color.scale(white, $hue: 10%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn oklch() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lch(50% 30% 180deg), $hue: 10%)}\n" + ), + "Error: $hue: Channel isn\'t scalable.\ + \n ,\ + \n2 | a {b: color.scale(lch(50% 30% 180deg), $hue: 10%)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/space.rs b/rsass/tests/spec/core_functions/color/scale/error/space.rs new file mode 100644 index 000000000..07c86f3d0 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/space.rs @@ -0,0 +1,39 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/space.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("space") +} + +#[test] +#[ignore] // wrong error +fn quoted() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $space: \"lab\")}\n" + ), + "Error: $space: Expected \"lab\" to be an unquoted string.\ + \n ,\ + \n2 | a {b: color.scale(red, $space: \"lab\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn unknown() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $space: c)}\n" + ), + "Error: $space: Unknown color space \"c\".\ + \n ,\ + \n2 | a {b: color.scale(red, $space: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/test_type.rs b/rsass/tests/spec/core_functions/color/scale/error/test_type.rs new file mode 100644 index 000000000..bdf2c663e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/test_type.rs @@ -0,0 +1,173 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/type.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("type") +} + +#[test] +fn alpha() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $alpha: c)}\n" + ), + "Error: $alpha: c is not a number.\ + \n ,\ + \n2 | a {b: color.scale(red, $alpha: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn blackness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $blackness: c)}\n" + ), + "Error: $blackness: c is not a number.\ + \n ,\ + \n2 | a {b: color.scale(red, $blackness: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $blue: c)}\n" + ), + "Error: $blue: c is not a number.\ + \n ,\ + \n2 | a {b: color.scale(red, $blue: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn color() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(1)}\n" + ), + "Error: $color: 1 is not a color.\ + \n ,\ + \n2 | a {b: color.scale(1)}\ + \n | ^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $green: c)}\n" + ), + "Error: $green: c is not a number.\ + \n ,\ + \n2 | a {b: color.scale(red, $green: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $lightness: c)}\n" + ), + "Error: $lightness: c is not a number.\ + \n ,\ + \n2 | a {b: color.scale(red, $lightness: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn none() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $alpha: none)}\n" + ), + "Error: $alpha: none is not a number.\ + \n ,\ + \n2 | a {b: color.scale(red, $alpha: none)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $red: c)}\n" + ), + "Error: $red: c is not a number.\ + \n ,\ + \n2 | a {b: color.scale(red, $red: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn saturation() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $saturation: c)}\n" + ), + "Error: $saturation: c is not a number.\ + \n ,\ + \n2 | a {b: color.scale(red, $saturation: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn space() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $space: 1)}\n" + ), + "Error: $space: 1 is not a string.\ + \n ,\ + \n2 | a {b: color.scale(red, $space: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn whiteness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(red, $whiteness: c)}\n" + ), + "Error: $whiteness: c is not a number.\ + \n ,\ + \n2 | a {b: color.scale(red, $whiteness: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/units/a98_rgb.rs b/rsass/tests/spec/core_functions/color/scale/error/units/a98_rgb.rs new file mode 100644 index 000000000..a3a4b01b8 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/units/a98_rgb.rs @@ -0,0 +1,113 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/units/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +mod none { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $blue: 1)}\n" + ), + "Error: $blue: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $blue: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $green: 1)}\n" + ), + "Error: $green: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $green: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $red: 1)}\n" + ), + "Error: $red: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $red: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod wrong { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $blue: 1px)}\n" + ), + "Error: $blue: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $blue: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $green: 1px)}\n" + ), + "Error: $green: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $green: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $red: 1px)}\n" + ), + "Error: $red: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(a98-rgb 0.2 0.5 0.7), $red: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/units/display_p3.rs b/rsass/tests/spec/core_functions/color/scale/error/units/display_p3.rs new file mode 100644 index 000000000..dd25a179f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/units/display_p3.rs @@ -0,0 +1,113 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/units/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod none { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $blue: 1)}\n" + ), + "Error: $blue: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(display-p3 0.2 0.5 0.7), $blue: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $green: 1)}\n" + ), + "Error: $green: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(display-p3 0.2 0.5 0.7), $green: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $red: 1)}\n" + ), + "Error: $red: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(display-p3 0.2 0.5 0.7), $red: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod wrong { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $blue: 1px)}\n" + ), + "Error: $blue: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(display-p3 0.2 0.5 0.7), $blue: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $green: 1px)}\n" + ), + "Error: $green: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(display-p3 0.2 0.5 0.7), $green: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(display-p3 0.2 0.5 0.7), $red: 1px)}\n" + ), + "Error: $red: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(display-p3 0.2 0.5 0.7), $red: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/units/hsl.rs b/rsass/tests/spec/core_functions/color/scale/error/units/hsl.rs new file mode 100644 index 000000000..7b8d3ba15 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/units/hsl.rs @@ -0,0 +1,77 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/units/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod none { + #[allow(unused)] + use super::runner; + + #[test] + fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(white, $lightness: 1)}\n" + ), + "Error: $lightness: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(white, $lightness: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + fn saturation() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(white, $saturation: 1)}\n" + ), + "Error: $saturation: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(white, $saturation: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod wrong { + #[allow(unused)] + use super::runner; + + #[test] + fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(white, $lightness: 1px)}\n" + ), + "Error: $lightness: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(white, $lightness: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + fn saturation() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(white, $saturation: 1px)}\n" + ), + "Error: $saturation: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(white, $saturation: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/units/hwb.rs b/rsass/tests/spec/core_functions/color/scale/error/units/hwb.rs new file mode 100644 index 000000000..20ce33eb9 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/units/hwb.rs @@ -0,0 +1,77 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/units/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod none { + #[allow(unused)] + use super::runner; + + #[test] + fn blackness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(white, $blackness: 1)}\n" + ), + "Error: $blackness: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(white, $blackness: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + fn whiteness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(white, $whiteness: 1)}\n" + ), + "Error: $whiteness: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(white, $whiteness: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod wrong { + #[allow(unused)] + use super::runner; + + #[test] + fn blackness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(white, $blackness: 1px)}\n" + ), + "Error: $blackness: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(white, $blackness: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + fn whiteness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(white, $whiteness: 1px)}\n" + ), + "Error: $whiteness: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(white, $whiteness: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/units/lab.rs b/rsass/tests/spec/core_functions/color/scale/error/units/lab.rs new file mode 100644 index 000000000..6ff49de21 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/units/lab.rs @@ -0,0 +1,113 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/units/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod none { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn a() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lab(50% 40% -20%), $a: 1)}\n" + ), + "Error: $a: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(lab(50% 40% -20%), $a: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn b() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lab(50% 40% -20%), $b: 1)}\n" + ), + "Error: $b: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(lab(50% 40% -20%), $b: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lab(50% 40% -20%), $lightness: 1)}\n" + ), + "Error: $lightness: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(lab(50% 40% -20%), $lightness: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod wrong { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn a() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lab(50% 40% -20%), $a: 1px)}\n" + ), + "Error: $a: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(lab(50% 40% -20%), $a: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn b() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lab(50% 40% -20%), $b: 1px)}\n" + ), + "Error: $b: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(lab(50% 40% -20%), $b: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lab(50% 40% -20%), $lightness: 1px)}\n" + ), + "Error: $lightness: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(lab(50% 40% -20%), $lightness: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/units/lch.rs b/rsass/tests/spec/core_functions/color/scale/error/units/lch.rs new file mode 100644 index 000000000..02bb22088 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/units/lch.rs @@ -0,0 +1,81 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/units/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod none { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn chroma() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lch(30% 70% 200deg), $chroma: 1)}\n" + ), + "Error: $chroma: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(lch(30% 70% 200deg), $chroma: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lch(30% 70% 200deg), $lightness: 1)}\n" + ), + "Error: $lightness: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(lch(30% 70% 200deg), $lightness: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod wrong { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn chroma() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lch(30% 70% 200deg), $chroma: 1px)}\n" + ), + "Error: $chroma: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(lch(30% 70% 200deg), $chroma: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lch(30% 70% 200deg), $lightness: 1px)}\n" + ), + "Error: $lightness: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(lch(30% 70% 200deg), $lightness: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/units/mod.rs b/rsass/tests/spec/core_functions/color/scale/error/units/mod.rs new file mode 100644 index 000000000..265accb67 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/units/mod.rs @@ -0,0 +1,36 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/units" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("units") +} + +mod a98_rgb; + +mod display_p3; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb; + +mod srgb_linear; + +mod xyz_d50; + +mod xyz_d65; diff --git a/rsass/tests/spec/core_functions/color/scale/error/units/oklab.rs b/rsass/tests/spec/core_functions/color/scale/error/units/oklab.rs new file mode 100644 index 000000000..5e85b738c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/units/oklab.rs @@ -0,0 +1,113 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/units/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod none { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn a() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(oklab(50% 40% -20%), $a: 1)}\n" + ), + "Error: $a: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(oklab(50% 40% -20%), $a: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn b() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(oklab(50% 40% -20%), $b: 1)}\n" + ), + "Error: $b: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(oklab(50% 40% -20%), $b: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(oklab(50% 40% -20%), $lightness: 1)}\n" + ), + "Error: $lightness: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(oklab(50% 40% -20%), $lightness: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod wrong { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn a() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(oklab(50% 40% -20%), $a: 1px)}\n" + ), + "Error: $a: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(oklab(50% 40% -20%), $a: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn b() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(oklab(50% 40% -20%), $b: 1px)}\n" + ), + "Error: $b: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(oklab(50% 40% -20%), $b: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(oklab(50% 40% -20%), $lightness: 1px)}\n" + ), + "Error: $lightness: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(oklab(50% 40% -20%), $lightness: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/units/oklch.rs b/rsass/tests/spec/core_functions/color/scale/error/units/oklch.rs new file mode 100644 index 000000000..3f0d9be32 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/units/oklch.rs @@ -0,0 +1,81 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/units/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod none { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn chroma() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lch(30% 70% 200deg), $chroma: 1)}\n" + ), + "Error: $chroma: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(lch(30% 70% 200deg), $chroma: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lch(30% 70% 200deg), $lightness: 1)}\n" + ), + "Error: $lightness: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(lch(30% 70% 200deg), $lightness: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod wrong { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn chroma() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lch(30% 70% 200deg), $chroma: 1px)}\n" + ), + "Error: $chroma: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(lch(30% 70% 200deg), $chroma: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn lightness() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(lch(30% 70% 200deg), $lightness: 1px)}\n" + ), + "Error: $lightness: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(lch(30% 70% 200deg), $lightness: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/units/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/scale/error/units/prophoto_rgb.rs new file mode 100644 index 000000000..275406410 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/units/prophoto_rgb.rs @@ -0,0 +1,113 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/units/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod none { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $blue: 1)}\n" + ), + "Error: $blue: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $blue: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $green: 1)}\n" + ), + "Error: $green: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $green: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $red: 1)}\n" + ), + "Error: $red: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $red: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod wrong { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $blue: 1px)}\n" + ), + "Error: $blue: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $blue: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $green: 1px)}\n" + ), + "Error: $green: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $green: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $red: 1px)}\n" + ), + "Error: $red: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $red: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/units/rec2020.rs b/rsass/tests/spec/core_functions/color/scale/error/units/rec2020.rs new file mode 100644 index 000000000..44ee9d6fd --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/units/rec2020.rs @@ -0,0 +1,113 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/units/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod none { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $blue: 1)}\n" + ), + "Error: $blue: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(rec2020 0.2 0.5 0.7), $blue: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $green: 1)}\n" + ), + "Error: $green: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(rec2020 0.2 0.5 0.7), $green: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $red: 1)}\n" + ), + "Error: $red: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(rec2020 0.2 0.5 0.7), $red: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod wrong { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $blue: 1px)}\n" + ), + "Error: $blue: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(rec2020 0.2 0.5 0.7), $blue: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $green: 1px)}\n" + ), + "Error: $green: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(rec2020 0.2 0.5 0.7), $green: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $red: 1px)}\n" + ), + "Error: $red: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(rec2020 0.2 0.5 0.7), $red: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/units/rgb.rs b/rsass/tests/spec/core_functions/color/scale/error/units/rgb.rs new file mode 100644 index 000000000..9f0968809 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/units/rgb.rs @@ -0,0 +1,107 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/units/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod none { + #[allow(unused)] + use super::runner; + + #[test] + fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(white, $blue: 1)}\n" + ), + "Error: $blue: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(white, $blue: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(white, $green: 1)}\n" + ), + "Error: $green: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(white, $green: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(white, $red: 1)}\n" + ), + "Error: $red: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(white, $red: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod wrong { + #[allow(unused)] + use super::runner; + + #[test] + fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(white, $blue: 1px)}\n" + ), + "Error: $blue: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(white, $blue: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(white, $green: 1px)}\n" + ), + "Error: $green: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(white, $green: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(white, $red: 1px)}\n" + ), + "Error: $red: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(white, $red: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/units/srgb.rs b/rsass/tests/spec/core_functions/color/scale/error/units/srgb.rs new file mode 100644 index 000000000..24e8275b2 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/units/srgb.rs @@ -0,0 +1,113 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/units/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod none { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $blue: 1)}\n" + ), + "Error: $blue: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(srgb 0.2 0.5 0.7), $blue: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $green: 1)}\n" + ), + "Error: $green: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(srgb 0.2 0.5 0.7), $green: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $red: 1)}\n" + ), + "Error: $red: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(srgb 0.2 0.5 0.7), $red: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod wrong { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $blue: 1px)}\n" + ), + "Error: $blue: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(srgb 0.2 0.5 0.7), $blue: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $green: 1px)}\n" + ), + "Error: $green: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(srgb 0.2 0.5 0.7), $green: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $red: 1px)}\n" + ), + "Error: $red: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(srgb 0.2 0.5 0.7), $red: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/units/srgb_linear.rs b/rsass/tests/spec/core_functions/color/scale/error/units/srgb_linear.rs new file mode 100644 index 000000000..6aa140bf8 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/units/srgb_linear.rs @@ -0,0 +1,113 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/units/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod none { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $blue: 1)}\n" + ), + "Error: $blue: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $blue: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $green: 1)}\n" + ), + "Error: $green: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $green: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $red: 1)}\n" + ), + "Error: $red: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $red: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod wrong { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn blue() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $blue: 1px)}\n" + ), + "Error: $blue: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $blue: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn green() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $green: 1px)}\n" + ), + "Error: $green: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $green: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn red() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $red: 1px)}\n" + ), + "Error: $red: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $red: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/units/xyz_d50.rs b/rsass/tests/spec/core_functions/color/scale/error/units/xyz_d50.rs new file mode 100644 index 000000000..4e952c196 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/units/xyz_d50.rs @@ -0,0 +1,113 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/units/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod none { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn x() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $x: 1)}\n" + ), + "Error: $x: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $x: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn y() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $y: 1)}\n" + ), + "Error: $y: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $y: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn z() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $z: 1)}\n" + ), + "Error: $z: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $z: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod wrong { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn x() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $x: 1px)}\n" + ), + "Error: $x: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $x: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn y() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $y: 1px)}\n" + ), + "Error: $y: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $y: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn z() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $z: 1px)}\n" + ), + "Error: $z: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $z: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/error/units/xyz_d65.rs b/rsass/tests/spec/core_functions/color/scale/error/units/xyz_d65.rs new file mode 100644 index 000000000..d6852332d --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/error/units/xyz_d65.rs @@ -0,0 +1,113 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/error/units/xyz_d65.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d65") +} + +mod none { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn x() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $x: 1)}\n" + ), + "Error: $x: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $x: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn y() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $y: 1)}\n" + ), + "Error: $y: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $y: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn z() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $z: 1)}\n" + ), + "Error: $z: Expected 1 to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $z: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod wrong { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn x() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $x: 1px)}\n" + ), + "Error: $x: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $x: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn y() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $y: 1px)}\n" + ), + "Error: $y: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $y: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn z() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $z: 1px)}\n" + ), + "Error: $z: Expected 1px to have unit \"%\".\ + \n ,\ + \n2 | a {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $z: 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/global.rs b/rsass/tests/spec/core_functions/color/scale/global.rs new file mode 100644 index 000000000..56932db91 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/global.rs @@ -0,0 +1,28 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/global.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("global") +} + +#[test] +#[ignore] // wrong result +fn legacy() { + assert_eq!( + runner().ok("a {b: scale-color(pink, $blue: 20%)}\n"), + "a {\ + \n b: rgb(255, 192, 213.4);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn non_legacy() { + assert_eq!( + runner() + .ok("a {b: scale-color(pink, $chroma: -10%, $space: oklch)}\n"), + "a {\ + \n b: rgb(250.9720040643, 194.0861924561, 203.8303793932);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/scale/hsl.rs b/rsass/tests/spec/core_functions/color/scale/hsl.rs new file mode 100644 index 000000000..ed416867f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/hsl.rs @@ -0,0 +1,174 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +#[test] +#[ignore] // wrong result +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(turquoise, $saturation: 24%, $lightness: -48%)}\n" + ), + "a {\ + \n b: rgb(15.8934486486, 133.8665513514, 122.0692410811);\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(turquoise, $saturation: 24%, $lightness: -48%, $alpha: -70%)}\n" + ), + "a {\ + \n b: rgba(15.8934486486, 133.8665513514, 122.0692410811, 0.3);\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(rgba(turquoise, 0.7), $saturation: 24%, $lightness: -48%)}\n" + ), + "a {\ + \n b: rgba(15.8934486486, 133.8665513514, 122.0692410811, 0.7);\ + \n}\n" + ); +} +mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(red, $lightness: 94%)}\n"), + "a {\ + \n b: rgb(255, 239.7, 239.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(red, $lightness: -14%)}\n"), + "a {\ + \n b: rgb(219.3, 0, 0);\ + \n}\n" + ); + } + #[test] + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(red, $lightness: 100%)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(red, $lightness: -100%)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } + #[test] + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(red, $lightness: 0%)}\n"), + "a {\ + \n b: red;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // wrong result +fn named() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale($color: turquoise, $saturation: 24%, $lightness: -48%)}\n" + ), + "a {\ + \n b: rgb(15.8934486486, 133.8665513514, 122.0692410811);\ + \n}\n" + ); +} +mod saturation { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(plum, $saturation: 67%)}\n"), + "a {\ + \n b: rgb(243.78, 137.22, 243.78);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(plum, $saturation: -43%)}\n"), + "a {\ + \n b: rgb(207.885, 173.115, 207.885);\ + \n}\n" + ); + } + #[test] + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(plum, $saturation: 100%)}\n"), + "a {\ + \n b: #ff7eff;\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(plum, $saturation: -100%)}\n"), + "a {\ + \n b: rgb(190.5, 190.5, 190.5);\ + \n}\n" + ); + } + #[test] + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(plum, $saturation: 0%)}\n"), + "a {\ + \n b: plum;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/hwb.rs b/rsass/tests/spec/core_functions/color/scale/hwb.rs new file mode 100644 index 000000000..cbea8f444 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/hwb.rs @@ -0,0 +1,175 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +#[test] +#[ignore] // wrong result +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(#66cc99, $whiteness: -50%, $blackness: 50%)}\n" + ), + "a {\ + \n b: rgb(51, 102, 76.5);\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(#66cc99, $whiteness: -50%, $blackness: 50%, $alpha: -70%)}\n" + ), + "a {\ + \n b: rgba(51, 102, 76.5, 0.3);\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(rgba(#66cc99, 0.7), $whiteness: -50%, $blackness: 50%)}\n" + ), + "a {\ + \n b: rgba(51, 102, 76.5, 0.7);\ + \n}\n" + ); +} +mod blackness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(#33cc80, $blackness: 50%)}\n"), + "a {\ + \n b: rgb(51, 102, 76.6666666667);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(#339966, $blackness: -50%)}\n"), + "a {\ + \n b: rgb(51, 204, 127.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(#339966, $blackness: 100%)}\n"), + "a {\ + \n b: rgb(42.5, 42.5, 42.5);\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(#339966, $blackness: -100%)}\n"), + "a {\ + \n b: #33ff99;\ + \n}\n" + ); + } + #[test] + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(#339966, $blackness: 0%)}\n"), + "a {\ + \n b: #339966;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // wrong result +fn named() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale($color: #66cc99, $whiteness: -50%, $blackness: 50%)}\n" + ), + "a {\ + \n b: rgb(51, 102, 76.5);\ + \n}\n" + ); +} +mod whiteness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(#33cc80, $whiteness: 50%)}\n"), + "a {\ + \n b: rgb(153, 204, 178.6666666667);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(#66cc99, $whiteness: -50%)}\n"), + "a {\ + \n b: rgb(51, 204, 127.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(#66cc99, $whiteness: 100%)}\n"), + "a {\ + \n b: rgb(212.5, 212.5, 212.5);\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(#66cc99, $whiteness: -100%)}\n"), + "a {\ + \n b: #00cc66;\ + \n}\n" + ); + } + #[test] + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(#66cc99, $whiteness: 0%)}\n"), + "a {\ + \n b: #66cc99;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/lab.rs b/rsass/tests/spec/core_functions/color/scale/lab.rs new file mode 100644 index 000000000..1d271c816 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/lab.rs @@ -0,0 +1,248 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod a { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lab(70% 100 -60), $a: 12%)}\n"), + "a {\ + \n b: lab(70% 103 -60);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lab(70% 100 -60), $a: -86%)}\n"), + "a {\ + \n b: lab(70% -93.5 -60);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lab(70% 100 -60), $a: 100%)}\n"), + "a {\ + \n b: lab(70% 125 -60);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lab(70% 100 -60), $a: -100%)}\n"), + "a {\ + \n b: lab(70% -125 -60);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lab(70% 100 -60), $a: 0%)}\n"), + "a {\ + \n b: lab(70% 100 -60);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale(lab(70% 100 -60), $lightness: 12%, $a: 24%, $b: 48%);\ + \n}\n" + ), + "a {\ + \n b: lab(73.6% 106 28.8);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n lab(70% 100 -60),\ + \n $lightness: 12%, $a: 24%, $b: 48%, $alpha: -70%\ + \n );\ + \n}\n"), + "a {\ + \n b: lab(73.6% 106 28.8 / 0.3);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale(lab(70% 100 -60 / 0.3), $lightness: 12%, $a: 24%, $b: 48%);\ + \n}\n" + ), + "a {\ + \n b: lab(73.6% 106 28.8 / 0.3);\ + \n}\n" + ); +} +mod b { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lab(70% 100 -60), $b: 42%)}\n"), + "a {\ + \n b: lab(70% 100 17.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lab(70% 100 -60), $b: -16%)}\n"), + "a {\ + \n b: lab(70% 100 -70.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lab(70% 100 -60), $b: 100%)}\n"), + "a {\ + \n b: lab(70% 100 125);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lab(70% 100 -60), $b: -100%)}\n"), + "a {\ + \n b: lab(70% 100 -125);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lab(70% 100 -60), $b: 0%)}\n"), + "a {\ + \n b: lab(70% 100 -60);\ + \n}\n" + ); + } +} +mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lab(70% 100 -60), $lightness: 86%)}\n"), + "a {\ + \n b: lab(95.8% 100 -60);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lab(70% 100 -60), $lightness: -33%)}\n"), + "a {\ + \n b: lab(46.9% 100 -60);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lab(70% 100 -60), $lightness: 100%)}\n"), + "a {\ + \n b: lab(100% 100 -60);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lab(70% 100 -60), $lightness: -100%)}\n"), + "a {\ + \n b: lab(0% 100 -60);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lab(70% 100 -60), $lightness: 0%)}\n"), + "a {\ + \n b: lab(70% 100 -60);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale($color: lab(70% 100 -60), $lightness: 12%, $a: 24%, $b: 48%);\ + \n}\n" + ), + "a {\ + \n b: lab(73.6% 106 28.8);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/scale/lch.rs b/rsass/tests/spec/core_functions/color/scale/lch.rs new file mode 100644 index 000000000..1e0d0545d --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/lch.rs @@ -0,0 +1,184 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(lch(70% 20% 80deg), $lightness: 12%, $chroma: 24%)}\n" + ), + "a {\ + \n b: lch(73.6% 58.8 80deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n lch(70% 20% 80deg),\ + \n $lightness: 12%, $chroma: 24%, $alpha: -70%\ + \n );\ + \n}\n"), + "a {\ + \n b: lch(73.6% 58.8 80deg / 0.3);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale(lch(70% 20% 80deg / 0.3), $lightness: 12%, $chroma: 24%);\ + \n}\n" + ), + "a {\ + \n b: lch(73.6% 58.8 80deg / 0.3);\ + \n}\n" + ); +} +mod chroma { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lch(70% 20% 80deg), $chroma: 12%)}\n"), + "a {\ + \n b: lch(70% 44.4 80deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lch(70% 20% 80deg), $chroma: -86%)}\n"), + "a {\ + \n b: lch(70% 4.2 80deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lch(70% 20% 80deg), $chroma: 100%)}\n"), + "a {\ + \n b: lch(70% 150 80deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lch(70% 20% 80deg), $chroma: -100%)}\n"), + "a {\ + \n b: lch(70% 0 80deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lch(70% 20% 80deg), $chroma: 0%)}\n"), + "a {\ + \n b: lch(70% 30 80deg);\ + \n}\n" + ); + } +} +mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lch(70% 20% 80deg), $lightness: 86%)}\n"), + "a {\ + \n b: lch(95.8% 30 80deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lch(70% 20% 80deg), $lightness: -33%)}\n"), + "a {\ + \n b: lch(46.9% 30 80deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lch(70% 20% 80deg), $lightness: 100%)}\n"), + "a {\ + \n b: lch(100% 30 80deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lch(70% 20% 80deg), $lightness: -100%)}\n"), + "a {\ + \n b: lch(0% 30 80deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lch(70% 20% 80deg), $lightness: 0%)}\n"), + "a {\ + \n b: lch(70% 30 80deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale($color: lch(70% 20% 80deg), $lightness: 12%, $chroma: 24%)}\n" + ), + "a {\ + \n b: lch(73.6% 58.8 80deg);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/scale/mod.rs b/rsass/tests/spec/core_functions/color/scale/mod.rs new file mode 100644 index 000000000..379945a7e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/mod.rs @@ -0,0 +1,46 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("scale") +} + +mod a98_rgb; + +mod display_p3; + +mod error; + +mod global; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod no_channels; + +mod no_space; + +mod oklab; + +mod out_of_gamut; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod space; + +mod srgb; + +mod srgb_linear; + +mod xyz_d50; + +mod xyz_d65; diff --git a/rsass/tests/spec/core_functions/color/scale/no_channels.rs b/rsass/tests/spec/core_functions/color/scale/no_channels.rs new file mode 100644 index 000000000..6fc375178 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/no_channels.rs @@ -0,0 +1,40 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/no_channels.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("no_channels") +} + +#[test] +#[ignore] // unexepected error +fn identical() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(oklch(50% 0.2 0deg), $space: lab)}\n"), + "a {\ + \n b: oklch(50% 0.2 0deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn missing() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(rgb(none none none))}\n"), + "a {\ + \n b: rgb(none none none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn powerless() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(oklch(50% 0 0deg), $space: lab)}\n"), + "a {\ + \n b: oklch(50% 0 none);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/scale_color/no_rgb_hsl.rs b/rsass/tests/spec/core_functions/color/scale/no_space.rs similarity index 56% rename from rsass/tests/spec/core_functions/color/scale_color/no_rgb_hsl.rs rename to rsass/tests/spec/core_functions/color/scale/no_space.rs index 34b2cea6a..1be0423f1 100644 --- a/rsass/tests/spec/core_functions/color/scale_color/no_rgb_hsl.rs +++ b/rsass/tests/spec/core_functions/color/scale/no_space.rs @@ -1,8 +1,8 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale_color/no_rgb_hsl.hrx" +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/no_space.hrx" #[allow(unused)] fn runner() -> crate::TestRunner { - super::runner().with_cwd("no_rgb_hsl") + super::runner().with_cwd("no_space") } mod alpha { @@ -12,7 +12,8 @@ mod alpha { #[test] fn high() { assert_eq!( - runner().ok("a {b: scale-color(rgba(red, 0.5), $alpha: 14%)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(rgba(red, 0.5), $alpha: 14%)}\n"), "a {\ \n b: rgba(255, 0, 0, 0.57);\ \n}\n" @@ -21,7 +22,8 @@ mod alpha { #[test] fn low() { assert_eq!( - runner().ok("a {b: scale-color(rgba(red, 0.3), $alpha: -36%)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(rgba(red, 0.3), $alpha: -36%)}\n"), "a {\ \n b: rgba(255, 0, 0, 0.192);\ \n}\n" @@ -30,7 +32,8 @@ mod alpha { #[test] fn max() { assert_eq!( - runner().ok("a {b: scale-color(rgba(red, 0.5), $alpha: 100%)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(rgba(red, 0.5), $alpha: 100%)}\n"), "a {\ \n b: red;\ \n}\n" @@ -39,8 +42,8 @@ mod alpha { #[test] fn min() { assert_eq!( - runner() - .ok("a {b: scale-color(rgba(red, 0.5), $alpha: -100%)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(rgba(red, 0.5), $alpha: -100%)}\n"), "a {\ \n b: rgba(255, 0, 0, 0);\ \n}\n" @@ -49,7 +52,8 @@ mod alpha { #[test] fn zero() { assert_eq!( - runner().ok("a {b: scale-color(rgba(red, 0.5), $alpha: 0%)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(rgba(red, 0.5), $alpha: 0%)}\n"), "a {\ \n b: rgba(255, 0, 0, 0.5);\ \n}\n" @@ -59,7 +63,8 @@ mod alpha { #[test] fn named() { assert_eq!( - runner().ok("a {b: scale-color($color: red)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.scale($color: red)}\n"), "a {\ \n b: red;\ \n}\n" @@ -68,7 +73,8 @@ fn named() { #[test] fn positional() { assert_eq!( - runner().ok("a {b: scale-color(red)}\n"), + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(red)}\n"), "a {\ \n b: red;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/color/scale/oklab.rs b/rsass/tests/spec/core_functions/color/scale/oklab.rs new file mode 100644 index 000000000..52522936c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/oklab.rs @@ -0,0 +1,250 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod a { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(oklab(70% 0.3 -0.25), $a: 12%)}\n"), + "a {\ + \n b: oklab(70% 0.312 -0.25);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(oklab(70% 0.3 -0.25), $a: -86%)}\n"), + "a {\ + \n b: oklab(70% -0.302 -0.25);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(oklab(70% 0.3 -0.25), $a: 100%)}\n"), + "a {\ + \n b: oklab(70% 0.4 -0.25);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(oklab(70% 0.3 -0.25), $a: -100%)}\n"), + "a {\ + \n b: oklab(70% -0.4 -0.25);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(oklab(70% 0.3 -0.25), $a: 0%)}\n"), + "a {\ + \n b: oklab(70% 0.3 -0.25);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale(oklab(70% 0.3 -0.25), $lightness: 12%, $a: 24%, $b: 48%);\ + \n}\n" + ), + "a {\ + \n b: oklab(73.6% 0.324 0.062);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n oklab(70% 0.3 -0.25),\ + \n $lightness: 12%, $a: 24%, $b: 48%, $alpha: -70%\ + \n );\ + \n}\n"), + "a {\ + \n b: oklab(73.6% 0.324 0.062 / 0.3);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale(oklab(70% 0.3 -0.25 / 0.3), $lightness: 12%, $a: 24%, $b: 48%);\ + \n}\n" + ), + "a {\ + \n b: oklab(73.6% 0.324 0.062 / 0.3);\ + \n}\n" + ); +} +mod b { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(oklab(70% 0.3 -0.25), $b: 42%)}\n"), + "a {\ + \n b: oklab(70% 0.3 0.023);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(oklab(70% 0.3 -0.25), $b: -16%)}\n"), + "a {\ + \n b: oklab(70% 0.3 -0.274);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(oklab(70% 0.3 -0.25), $b: 100%)}\n"), + "a {\ + \n b: oklab(70% 0.3 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(oklab(70% 0.3 -0.25), $b: -100%)}\n"), + "a {\ + \n b: oklab(70% 0.3 -0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(oklab(70% 0.3 -0.25), $b: 0%)}\n"), + "a {\ + \n b: oklab(70% 0.3 -0.25);\ + \n}\n" + ); + } +} +mod lightness { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(oklab(70% 0.3 -0.25), $lightness: 86%)}\n"), + "a {\ + \n b: oklab(95.8% 0.3 -0.25);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(oklab(70% 0.3 -0.25), $lightness: -33%)}\n"), + "a {\ + \n b: oklab(46.9% 0.3 -0.25);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(oklab(70% 0.3 -0.25), $lightness: 100%)}\n"), + "a {\ + \n b: oklab(100% 0.3 -0.25);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(oklab(70% 0.3 -0.25), $lightness: -100%)}\n" + ), + "a {\ + \n b: oklab(0% 0.3 -0.25);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(oklab(70% 0.3 -0.25), $lightness: 0%)}\n"), + "a {\ + \n b: oklab(70% 0.3 -0.25);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale($color: oklab(70% 0.3 -0.25), $lightness: 12%, $a: 24%, $b: 48%);\ + \n}\n" + ), + "a {\ + \n b: oklab(73.6% 0.324 0.062);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/scale/out_of_gamut.rs b/rsass/tests/spec/core_functions/color/scale/out_of_gamut.rs new file mode 100644 index 000000000..6b3c3869f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/out_of_gamut.rs @@ -0,0 +1,61 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/out_of_gamut.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("out_of_gamut") +} + +mod above_gamut { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn down() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb 1.2 0.5 0.7), $red: -10%)}\n"), + "a {\ + \n b: color(srgb 1.08 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn up() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb 1.2 0.5 0.7), $red: 10%)}\n"), + "a {\ + \n b: color(srgb 1.2 0.5 0.7);\ + \n}\n" + ); + } +} +mod below_gamut { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn down() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb -0.5 0.5 0.7), $red: -10%)}\n"), + "a {\ + \n b: color(srgb -0.5 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn up() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb -0.5 0.5 0.7), $red: 10%)}\n"), + "a {\ + \n b: color(srgb -0.35 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/scale/prophoto_rgb.rs new file mode 100644 index 000000000..75f093cc4 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/prophoto_rgb.rs @@ -0,0 +1,282 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(prophoto-rgb 0.2 0.5 0.7), $red: 12%, $green: 24%, $blue: 48%\ + \n );\ + \n}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.296 0.62 0.844);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(prophoto-rgb 0.2 0.5 0.7),\ + \n $red: 12%, $green: 24%, $blue: 48%, $alpha: -70%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(prophoto-rgb 0.296 0.62 0.844 / 0.3);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(prophoto-rgb 0.2 0.5 0.7 / 0.3),\ + \n $red: 12%, $green: 24%, $blue: 48%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(prophoto-rgb 0.296 0.62 0.844 / 0.3);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $blue: 42%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 0.826);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $blue: -16%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 0.588);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $blue: 100%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $blue: -100%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $blue: 0%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 0.7);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $green: 12%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.56 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $green: -86%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.07 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $green: 100%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 1 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $green: -100%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $green: 0%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 0.7);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n $color: color(prophoto-rgb 0.2 0.5 0.7),\ + \n $red: 12%, $green: 24%, $blue: 48%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(prophoto-rgb 0.296 0.62 0.844);\ + \n}\n" + ); +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $red: 86%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.888 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $red: -33%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.134 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $red: 100%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $red: -100%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(prophoto-rgb 0.2 0.5 0.7), $red: 0%)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/rec2020.rs b/rsass/tests/spec/core_functions/color/scale/rec2020.rs new file mode 100644 index 000000000..7fd46a373 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/rec2020.rs @@ -0,0 +1,268 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(rec2020 0.2 0.5 0.7), $red: 12%, $green: 24%, $blue: 48%\ + \n );\ + \n}\n" + ), + "a {\ + \n b: color(rec2020 0.296 0.62 0.844);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(rec2020 0.2 0.5 0.7),\ + \n $red: 12%, $green: 24%, $blue: 48%, $alpha: -70%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(rec2020 0.296 0.62 0.844 / 0.3);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(rec2020 0.2 0.5 0.7 / 0.3),\ + \n $red: 12%, $green: 24%, $blue: 48%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(rec2020 0.296 0.62 0.844 / 0.3);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $blue: 42%)}\n"), + "a {\ + \n b: color(rec2020 0.2 0.5 0.826);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $blue: -16%)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.5 0.588);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $blue: 100%)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.5 1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $blue: -100%)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.5 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $blue: 0%)}\n"), + "a {\ + \n b: color(rec2020 0.2 0.5 0.7);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $green: 12%)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.56 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $green: -86%)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.07 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $green: 100%)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 1 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $green: -100%)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $green: 0%)}\n"), + "a {\ + \n b: color(rec2020 0.2 0.5 0.7);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n $color: color(rec2020 0.2 0.5 0.7),\ + \n $red: 12%, $green: 24%, $blue: 48%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(rec2020 0.296 0.62 0.844);\ + \n}\n" + ); +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $red: 86%)}\n"), + "a {\ + \n b: color(rec2020 0.888 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $red: -33%)}\n"), + "a {\ + \n b: color(rec2020 0.134 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $red: 100%)}\n"), + "a {\ + \n b: color(rec2020 1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $red: -100%)}\n" + ), + "a {\ + \n b: color(rec2020 0 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(rec2020 0.2 0.5 0.7), $red: 0%)}\n"), + "a {\ + \n b: color(rec2020 0.2 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/rgb.rs b/rsass/tests/spec/core_functions/color/scale/rgb.rs new file mode 100644 index 000000000..41b62673d --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/rgb.rs @@ -0,0 +1,230 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +#[test] +#[ignore] // wrong result +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(sienna, $red: 12%, $green: 24%, $blue: 48%)}\n" + ), + "a {\ + \n b: rgb(171.4, 123.52, 145.8);\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn alpha_arg() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(sienna, $red: 12%, $green: 24%, $blue: 48%, $alpha: -70%)}\n" + ), + "a {\ + \n b: rgba(171.4, 123.52, 145.8, 0.3);\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(rgba(sienna, 0.3), $red: 12%, $green: 24%, $blue: 48%)}\n" + ), + "a {\ + \n b: rgba(171.4, 123.52, 145.8, 0.3);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(salmon, $blue: 42%)}\n"), + "a {\ + \n b: rgb(250, 128, 173.22);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(slategray, $blue: -16%)}\n"), + "a {\ + \n b: rgb(112, 128, 120.96);\ + \n}\n" + ); + } + #[test] + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(black, $blue: 100%)}\n"), + "a {\ + \n b: blue;\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(blue, $blue: -100%)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } + #[test] + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(black, $blue: 0%)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(cadetblue, $green: 12%)}\n"), + "a {\ + \n b: rgb(95, 169.64, 160);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(seagreen, $green: -86%)}\n"), + "a {\ + \n b: rgb(46, 19.46, 87);\ + \n}\n" + ); + } + #[test] + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(black, $green: 100%)}\n"), + "a {\ + \n b: lime;\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lime, $green: -100%)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } + #[test] + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(black, $green: 0%)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // wrong result +fn named() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale($color: sienna, $red: 12%, $green: 24%, $blue: 48%)}\n" + ), + "a {\ + \n b: rgb(171.4, 123.52, 145.8);\ + \n}\n" + ); +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(turquoise, $red: 86%)}\n"), + "a {\ + \n b: rgb(228.26, 224, 208);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(lightcoral, $red: -33%)}\n"), + "a {\ + \n b: rgb(160.8, 128, 128);\ + \n}\n" + ); + } + #[test] + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(black, $red: 100%)}\n"), + "a {\ + \n b: red;\ + \n}\n" + ); + } + #[test] + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(red, $red: -100%)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } + #[test] + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(black, $red: 0%)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/space.rs b/rsass/tests/spec/core_functions/color/scale/space.rs new file mode 100644 index 000000000..b4407e8f0 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/space.rs @@ -0,0 +1,205 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/space.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("space") +} + +mod legacy { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn to_legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(red, $saturation: -10%, $space: hsl)}\n"), + "a {\ + \n b: rgb(242.25, 12.75, 12.75);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_modern() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(red, $a: 10%, $space: lab)}\n"), + "a {\ + \n b: hsl(352.5777091359, 128.657405446%, 44.6392534152%);\ + \n}\n" + ); + } +} +mod missing { + #[allow(unused)] + use super::runner; + + mod legacy { + #[allow(unused)] + use super::runner; + + mod analogous { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(hsl(none 50% 50%), $space: hwb)}\n"), + "a {\ + \n b: hsl(0, 50%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn modern() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(rgb(none none none), $space: display-p3)}\n" + ), + "a {\ + \n b: black;\ + \n}\n" + ); + } + } + mod same { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn explicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(rgb(none none none), $space: rgb)}\n"), + "a {\ + \n b: rgb(none none none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn implicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(rgb(none none none))}\n"), + "a {\ + \n b: rgb(none none none);\ + \n}\n" + ); + } + } + } + mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn analogous() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb none none none), $space: display-p3)}\n" + ), + "a {\ + \n b: color(srgb none none none);\ + \n}\n" + ); + } + mod same { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn explicit() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb none none none), $space: srgb)}\n" + ), + "a {\ + \n b: color(srgb none none none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn implicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb none none none))}\n"), + "a {\ + \n b: color(srgb none none none);\ + \n}\n" + ); + } + } + } +} +mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn to_legacy() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(lab(50% 10 -20), $saturation: -20%, $space: hsl)}\n" + ), + "a {\ + \n b: lab(51.1280465895% 7.8762091679 -15.9907381545);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_modern() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(lab(50% 10 -20), $chroma: 20%, $space: oklch)}\n" + ), + "a {\ + \n b: lab(48.9487508713% 24.2085150873 -41.732226413);\ + \n}\n" + ); + } +} +mod powerless { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn legacy() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(hsl(0deg 0% 50%), $space: lab)}\n"), + "a {\ + \n b: hsl(0, 0%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn modern() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(oklch(50% 0 0deg), $space: lab)}\n"), + "a {\ + \n b: oklch(50% 0 none);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/srgb.rs b/rsass/tests/spec/core_functions/color/scale/srgb.rs new file mode 100644 index 000000000..9f57bb35a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/srgb.rs @@ -0,0 +1,250 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale(color(srgb 0.2 0.5 0.7), $red: 12%, $green: 24%, $blue: 48%);\ + \n}\n" + ), + "a {\ + \n b: color(srgb 0.296 0.62 0.844);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(srgb 0.2 0.5 0.7),\ + \n $red: 12%, $green: 24%, $blue: 48%, $alpha: -70%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(srgb 0.296 0.62 0.844 / 0.3);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(srgb 0.2 0.5 0.7 / 0.3),\ + \n $red: 12%, $green: 24%, $blue: 48%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(srgb 0.296 0.62 0.844 / 0.3);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $blue: 42%)}\n"), + "a {\ + \n b: color(srgb 0.2 0.5 0.826);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $blue: -16%)}\n"), + "a {\ + \n b: color(srgb 0.2 0.5 0.588);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $blue: 100%)}\n"), + "a {\ + \n b: color(srgb 0.2 0.5 1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $blue: -100%)}\n"), + "a {\ + \n b: color(srgb 0.2 0.5 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $blue: 0%)}\n"), + "a {\ + \n b: color(srgb 0.2 0.5 0.7);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $green: 12%)}\n"), + "a {\ + \n b: color(srgb 0.2 0.56 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $green: -86%)}\n"), + "a {\ + \n b: color(srgb 0.2 0.07 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $green: 100%)}\n"), + "a {\ + \n b: color(srgb 0.2 1 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $green: -100%)}\n"), + "a {\ + \n b: color(srgb 0.2 0 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $green: 0%)}\n"), + "a {\ + \n b: color(srgb 0.2 0.5 0.7);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n $color: color(srgb 0.2 0.5 0.7),\ + \n $red: 12%, $green: 24%, $blue: 48%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(srgb 0.296 0.62 0.844);\ + \n}\n" + ); +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $red: 86%)}\n"), + "a {\ + \n b: color(srgb 0.888 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $red: -33%)}\n"), + "a {\ + \n b: color(srgb 0.134 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $red: 100%)}\n"), + "a {\ + \n b: color(srgb 1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $red: -100%)}\n"), + "a {\ + \n b: color(srgb 0 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(srgb 0.2 0.5 0.7), $red: 0%)}\n"), + "a {\ + \n b: color(srgb 0.2 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/srgb_linear.rs b/rsass/tests/spec/core_functions/color/scale/srgb_linear.rs new file mode 100644 index 000000000..f86dc42cf --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/srgb_linear.rs @@ -0,0 +1,282 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(srgb-linear 0.2 0.5 0.7), $red: 12%, $green: 24%, $blue: 48%\ + \n );\ + \n}\n" + ), + "a {\ + \n b: color(srgb-linear 0.296 0.62 0.844);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(srgb-linear 0.2 0.5 0.7),\ + \n $red: 12%, $green: 24%, $blue: 48%, $alpha: -70%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(srgb-linear 0.296 0.62 0.844 / 0.3);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(srgb-linear 0.2 0.5 0.7 / 0.3),\ + \n $red: 12%, $green: 24%, $blue: 48%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(srgb-linear 0.296 0.62 0.844 / 0.3);\ + \n}\n" + ); +} +mod blue { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $blue: 42%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 0.826);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $blue: -16%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 0.588);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $blue: 100%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $blue: -100%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $blue: 0%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 0.7);\ + \n}\n" + ); + } +} +mod green { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $green: 12%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.56 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $green: -86%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.07 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $green: 100%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 1 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $green: -100%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $green: 0%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 0.7);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n $color: color(srgb-linear 0.2 0.5 0.7),\ + \n $red: 12%, $green: 24%, $blue: 48%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(srgb-linear 0.296 0.62 0.844);\ + \n}\n" + ); +} +mod red { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $red: 86%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.888 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $red: -33%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.134 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $red: 100%)}\n" + ), + "a {\ + \n b: color(srgb-linear 1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $red: -100%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.scale(color(srgb-linear 0.2 0.5 0.7), $red: 0%)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/xyz_d50.rs b/rsass/tests/spec/core_functions/color/scale/xyz_d50.rs new file mode 100644 index 000000000..b97de4c19 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/xyz_d50.rs @@ -0,0 +1,248 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale(color(xyz-d50 0.2 0.5 0.7), $x: 12%, $y: 24%, $z: 48%);\ + \n}\n" + ), + "a {\ + \n b: color(xyz-d50 0.296 0.62 0.844);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(xyz-d50 0.2 0.5 0.7),\ + \n $x: 12%, $y: 24%, $z: 48%, $alpha: -70%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(xyz-d50 0.296 0.62 0.844 / 0.3);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale(color(xyz-d50 0.2 0.5 0.7 / 0.3), $x: 12%, $y: 24%, $z: 48%);\ + \n}\n" + ), + "a {\ + \n b: color(xyz-d50 0.296 0.62 0.844 / 0.3);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale($color: color(xyz-d50 0.2 0.5 0.7), $x: 12%, $y: 24%, $z: 48%);\ + \n}\n" + ), + "a {\ + \n b: color(xyz-d50 0.296 0.62 0.844);\ + \n}\n" + ); +} +mod x { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $x: 86%)}\n"), + "a {\ + \n b: color(xyz-d50 0.888 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $x: -33%)}\n"), + "a {\ + \n b: color(xyz-d50 0.134 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $x: 100%)}\n"), + "a {\ + \n b: color(xyz-d50 1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $x: -100%)}\n"), + "a {\ + \n b: color(xyz-d50 0 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $x: 0%)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.5 0.7);\ + \n}\n" + ); + } +} +mod y { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $y: 12%)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.56 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $y: -86%)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.07 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $y: 100%)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 1 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $y: -100%)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $y: 0%)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.5 0.7);\ + \n}\n" + ); + } +} +mod z { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $z: 42%)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.5 0.826);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $z: -16%)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.5 0.588);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $z: 100%)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.5 1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $z: -100%)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.5 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d50 0.2 0.5 0.7), $z: 0%)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale/xyz_d65.rs b/rsass/tests/spec/core_functions/color/scale/xyz_d65.rs new file mode 100644 index 000000000..3a6f7e75d --- /dev/null +++ b/rsass/tests/spec/core_functions/color/scale/xyz_d65.rs @@ -0,0 +1,248 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale/xyz_d65.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d65") +} + +#[test] +#[ignore] // unexepected error +fn all() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale(color(xyz-d65 0.2 0.5 0.7), $x: 12%, $y: 24%, $z: 48%);\ + \n}\n" + ), + "a {\ + \n b: color(xyz 0.296 0.62 0.844);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_arg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.scale(\ + \n color(xyz-d65 0.2 0.5 0.7),\ + \n $x: 12%, $y: 24%, $z: 48%, $alpha: -70%\ + \n );\ + \n}\n"), + "a {\ + \n b: color(xyz 0.296 0.62 0.844 / 0.3);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn alpha_input() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale(color(xyz-d65 0.2 0.5 0.7 / 0.3), $x: 12%, $y: 24%, $z: 48%);\ + \n}\n" + ), + "a {\ + \n b: color(xyz 0.296 0.62 0.844 / 0.3);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn named() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.scale($color: color(xyz-d65 0.2 0.5 0.7), $x: 12%, $y: 24%, $z: 48%);\ + \n}\n" + ), + "a {\ + \n b: color(xyz 0.296 0.62 0.844);\ + \n}\n" + ); +} +mod x { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $x: 86%)}\n"), + "a {\ + \n b: color(xyz 0.888 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $x: -33%)}\n"), + "a {\ + \n b: color(xyz 0.134 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $x: 100%)}\n"), + "a {\ + \n b: color(xyz 1 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $x: -100%)}\n"), + "a {\ + \n b: color(xyz 0 0.5 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $x: 0%)}\n"), + "a {\ + \n b: color(xyz 0.2 0.5 0.7);\ + \n}\n" + ); + } +} +mod y { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $y: 12%)}\n"), + "a {\ + \n b: color(xyz 0.2 0.56 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $y: -86%)}\n"), + "a {\ + \n b: color(xyz 0.2 0.07 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $y: 100%)}\n"), + "a {\ + \n b: color(xyz 0.2 1 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $y: -100%)}\n"), + "a {\ + \n b: color(xyz 0.2 0 0.7);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $y: 0%)}\n"), + "a {\ + \n b: color(xyz 0.2 0.5 0.7);\ + \n}\n" + ); + } +} +mod z { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn high() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $z: 42%)}\n"), + "a {\ + \n b: color(xyz 0.2 0.5 0.826);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn low() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $z: -16%)}\n"), + "a {\ + \n b: color(xyz 0.2 0.5 0.588);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn max() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $z: 100%)}\n"), + "a {\ + \n b: color(xyz 0.2 0.5 1);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn min() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $z: -100%)}\n"), + "a {\ + \n b: color(xyz 0.2 0.5 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn zero() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(color(xyz-d65 0.2 0.5 0.7), $z: 0%)}\n"), + "a {\ + \n b: color(xyz 0.2 0.5 0.7);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/scale_color/error/args.rs b/rsass/tests/spec/core_functions/color/scale_color/error/args.rs deleted file mode 100644 index cc1f50a4c..000000000 --- a/rsass/tests/spec/core_functions/color/scale_color/error/args.rs +++ /dev/null @@ -1,49 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale_color/error/args.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("args") -} - -#[test] -fn too_few() { - assert_eq!( - runner().err("a {b: scale-color()}\n"), - "Error: Missing argument $color.\ - \n ,--> input.scss\ - \n1 | a {b: scale-color()}\ - \n | ^^^^^^^^^^^^^ invocation\ - \n \'\ - \n ,--> sass:color\ - \n1 | @function scale($color, $kwargs...) {\ - \n | ========================= declaration\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn too_many() { - assert_eq!( - runner().err( - "a {b: scale-color(red, 1)}\n" - ), - "Error: Only one positional argument is allowed. All other arguments must be passed by name.\ - \n ,\ - \n1 | a {b: scale-color(red, 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn unknown() { - assert_eq!( - runner().err("a {b: scale-color(red, $hue: 10%)}\n"), - "Error: No argument named $hue.\ - \n ,\ - \n1 | a {b: scale-color(red, $hue: 10%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} diff --git a/rsass/tests/spec/core_functions/color/scale_color/error/bounds.rs b/rsass/tests/spec/core_functions/color/scale_color/error/bounds.rs deleted file mode 100644 index 6da604626..000000000 --- a/rsass/tests/spec/core_functions/color/scale_color/error/bounds.rs +++ /dev/null @@ -1,255 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale_color/error/bounds.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("bounds") -} - -mod alpha { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: scale-color(red, $alpha: 100.001%)}\n"), - "Error: $alpha: Expected 100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: scale-color(red, $alpha: 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: scale-color(red, $alpha: -100.001%)}\n"), - "Error: $alpha: Expected -100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: scale-color(red, $alpha: -100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } -} -mod blackness { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err( - "a {b: scale-color(red, $blackness: 100.001%)}\n" - ), - "Error: $blackness: Expected 100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: scale-color(red, $blackness: 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err( - "a {b: scale-color(red, $blackness: -100.001%)}\n" - ), - "Error: $blackness: Expected -100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: scale-color(red, $blackness: -100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } -} -mod blue { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: scale-color(blue, $blue: 100.001%)}\n"), - "Error: $blue: Expected 100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: scale-color(blue, $blue: 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: scale-color(blue, $blue: -100.001%)}\n"), - "Error: $blue: Expected -100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: scale-color(blue, $blue: -100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } -} -mod green { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: scale-color(green, $green: 100.001%)}\n"), - "Error: $green: Expected 100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: scale-color(green, $green: 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: scale-color(green, $green: -100.001%)}\n"), - "Error: $green: Expected -100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: scale-color(green, $green: -100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } -} -mod lightness { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err( - "a {b: scale-color(red, $lightness: 100.001%)}\n" - ), - "Error: $lightness: Expected 100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: scale-color(red, $lightness: 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err( - "a {b: scale-color(red, $lightness: -100.001%)}\n" - ), - "Error: $lightness: Expected -100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: scale-color(red, $lightness: -100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } -} -mod red { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err("a {b: scale-color(red, $red: 100.001%)}\n"), - "Error: $red: Expected 100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: scale-color(red, $red: 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err("a {b: scale-color(red, $red: -100.001%)}\n"), - "Error: $red: Expected -100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: scale-color(red, $red: -100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } -} -mod saturation { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err( - "a {b: scale-color(red, $saturation: 100.001%)}\n" - ), - "Error: $saturation: Expected 100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: scale-color(red, $saturation: 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err( - "a {b: scale-color(red, $saturation: -100.001%)}\n" - ), - "Error: $saturation: Expected -100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: scale-color(red, $saturation: -100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } -} -mod whiteness { - #[allow(unused)] - use super::runner; - - #[test] - fn too_high() { - assert_eq!( - runner().err( - "a {b: scale-color(red, $whiteness: 100.001%)}\n" - ), - "Error: $whiteness: Expected 100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: scale-color(red, $whiteness: 100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn too_low() { - assert_eq!( - runner().err( - "a {b: scale-color(red, $whiteness: -100.001%)}\n" - ), - "Error: $whiteness: Expected -100.001% to be within -100% and 100%.\ - \n ,\ - \n1 | a {b: scale-color(red, $whiteness: -100.001%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } -} diff --git a/rsass/tests/spec/core_functions/color/scale_color/error/mixed_formats.rs b/rsass/tests/spec/core_functions/color/scale_color/error/mixed_formats.rs deleted file mode 100644 index 0e6071841..000000000 --- a/rsass/tests/spec/core_functions/color/scale_color/error/mixed_formats.rs +++ /dev/null @@ -1,95 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale_color/error/mixed_formats.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("mixed_formats") -} - -#[test] -fn blue_and_lightness() { - assert_eq!( - runner().err("a {b: scale-color(red, $blue: 1%, $lightness: 1%)}\n"), - "Error: RGB parameters may not be passed along with HSL parameters.\ - \n ,\ - \n1 | a {b: scale-color(red, $blue: 1%, $lightness: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn green_and_saturation() { - assert_eq!( - runner() - .err("a {b: scale-color(red, $green: 1%, $saturation: 1%)}\n"), - "Error: RGB parameters may not be passed along with HSL parameters.\ - \n ,\ - \n1 | a {b: scale-color(red, $green: 1%, $saturation: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn green_and_whiteness() { - assert_eq!( - runner().err("a {b: scale-color(red, $green: 1%, $whiteness: 1%)}\n"), - "Error: RGB parameters may not be passed along with HWB parameters.\ - \n ,\ - \n1 | a {b: scale-color(red, $green: 1%, $whiteness: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn lightness_and_whiteness() { - assert_eq!( - runner() - .err("a {b: scale-color(red, $lightness: 1%, $whiteness: 1%)}\n"), - "Error: HSL parameters may not be passed along with HWB parameters.\ - \n ,\ - \n1 | a {b: scale-color(red, $lightness: 1%, $whiteness: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn red_and_blackness() { - assert_eq!( - runner().err("a {b: scale-color(red, $red: 1%, $blackness: 1%)}\n"), - "Error: RGB parameters may not be passed along with HWB parameters.\ - \n ,\ - \n1 | a {b: scale-color(red, $red: 1%, $blackness: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn red_and_saturation() { - assert_eq!( - runner().err("a {b: scale-color(red, $red: 1%, $saturation: 1%)}\n"), - "Error: RGB parameters may not be passed along with HSL parameters.\ - \n ,\ - \n1 | a {b: scale-color(red, $red: 1%, $saturation: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn saturation_and_blackness() { - assert_eq!( - runner().err( - "a {b: scale-color(red, $saturation: 1%, $blackness: 1%)}\n" - ), - "Error: HSL parameters may not be passed along with HWB parameters.\ - \n ,\ - \n1 | a {b: scale-color(red, $saturation: 1%, $blackness: 1%)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} diff --git a/rsass/tests/spec/core_functions/color/scale_color/error/test_type.rs b/rsass/tests/spec/core_functions/color/scale_color/error/test_type.rs deleted file mode 100644 index 491872b7e..000000000 --- a/rsass/tests/spec/core_functions/color/scale_color/error/test_type.rs +++ /dev/null @@ -1,115 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale_color/error/type.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("type") -} - -#[test] -fn alpha() { - assert_eq!( - runner().err("a {b: scale-color(red, $alpha: c)}\n"), - "Error: $alpha: c is not a number.\ - \n ,\ - \n1 | a {b: scale-color(red, $alpha: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn blackness() { - assert_eq!( - runner().err("a {b: scale-color(red, $blackness: c)}\n"), - "Error: $blackness: c is not a number.\ - \n ,\ - \n1 | a {b: scale-color(red, $blackness: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn blue() { - assert_eq!( - runner().err("a {b: scale-color(red, $blue: c)}\n"), - "Error: $blue: c is not a number.\ - \n ,\ - \n1 | a {b: scale-color(red, $blue: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn color() { - assert_eq!( - runner().err("a {b: scale-color(1)}\n"), - "Error: $color: 1 is not a color.\ - \n ,\ - \n1 | a {b: scale-color(1)}\ - \n | ^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn green() { - assert_eq!( - runner().err("a {b: scale-color(red, $green: c)}\n"), - "Error: $green: c is not a number.\ - \n ,\ - \n1 | a {b: scale-color(red, $green: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn lightness() { - assert_eq!( - runner().err("a {b: scale-color(red, $lightness: c)}\n"), - "Error: $lightness: c is not a number.\ - \n ,\ - \n1 | a {b: scale-color(red, $lightness: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn red() { - assert_eq!( - runner().err("a {b: scale-color(red, $red: c)}\n"), - "Error: $red: c is not a number.\ - \n ,\ - \n1 | a {b: scale-color(red, $red: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn saturation() { - assert_eq!( - runner().err("a {b: scale-color(red, $saturation: c)}\n"), - "Error: $saturation: c is not a number.\ - \n ,\ - \n1 | a {b: scale-color(red, $saturation: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} -#[test] -fn whiteness() { - assert_eq!( - runner().err("a {b: scale-color(red, $whiteness: c)}\n"), - "Error: $whiteness: c is not a number.\ - \n ,\ - \n1 | a {b: scale-color(red, $whiteness: c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); -} diff --git a/rsass/tests/spec/core_functions/color/scale_color/error/units.rs b/rsass/tests/spec/core_functions/color/scale_color/error/units.rs deleted file mode 100644 index 4e63ee6c5..000000000 --- a/rsass/tests/spec/core_functions/color/scale_color/error/units.rs +++ /dev/null @@ -1,209 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale_color/error/units.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("units") -} - -mod none { - #[allow(unused)] - use super::runner; - - #[test] - fn alpha() { - assert_eq!( - runner().err("a {b: scale-color(red, $alpha: 1)}\n"), - "Error: $alpha: Expected 1 to have unit \"%\".\ - \n ,\ - \n1 | a {b: scale-color(red, $alpha: 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn blackness() { - assert_eq!( - runner().err("a {b: scale-color(black, $blackness: 1)}\n"), - "Error: $blackness: Expected 1 to have unit \"%\".\ - \n ,\ - \n1 | a {b: scale-color(black, $blackness: 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn blue() { - assert_eq!( - runner().err("a {b: scale-color(blue, $blue: 1)}\n"), - "Error: $blue: Expected 1 to have unit \"%\".\ - \n ,\ - \n1 | a {b: scale-color(blue, $blue: 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn green() { - assert_eq!( - runner().err("a {b: scale-color(green, $green: 1)}\n"), - "Error: $green: Expected 1 to have unit \"%\".\ - \n ,\ - \n1 | a {b: scale-color(green, $green: 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn lightness() { - assert_eq!( - runner().err("a {b: scale-color(red, $lightness: 1)}\n"), - "Error: $lightness: Expected 1 to have unit \"%\".\ - \n ,\ - \n1 | a {b: scale-color(red, $lightness: 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn red() { - assert_eq!( - runner().err("a {b: scale-color(red, $red: 1px)}\n"), - "Error: $red: Expected 1px to have unit \"%\".\ - \n ,\ - \n1 | a {b: scale-color(red, $red: 1px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn saturation() { - assert_eq!( - runner().err("a {b: scale-color(red, $saturation: 1)}\n"), - "Error: $saturation: Expected 1 to have unit \"%\".\ - \n ,\ - \n1 | a {b: scale-color(red, $saturation: 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn whiteness() { - assert_eq!( - runner().err("a {b: scale-color(white, $whiteness: 1)}\n"), - "Error: $whiteness: Expected 1 to have unit \"%\".\ - \n ,\ - \n1 | a {b: scale-color(white, $whiteness: 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } -} -mod wrong { - #[allow(unused)] - use super::runner; - - #[test] - fn alpha() { - assert_eq!( - runner().err("a {b: scale-color(red, $alpha: 1px)}\n"), - "Error: $alpha: Expected 1px to have unit \"%\".\ - \n ,\ - \n1 | a {b: scale-color(red, $alpha: 1px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn blackness() { - assert_eq!( - runner().err("a {b: scale-color(black, $blackness: 1px)}\n"), - "Error: $blackness: Expected 1px to have unit \"%\".\ - \n ,\ - \n1 | a {b: scale-color(black, $blackness: 1px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn blue() { - assert_eq!( - runner().err("a {b: scale-color(blue, $blue: 1px)}\n"), - "Error: $blue: Expected 1px to have unit \"%\".\ - \n ,\ - \n1 | a {b: scale-color(blue, $blue: 1px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn green() { - assert_eq!( - runner().err("a {b: scale-color(green, $green: 1px)}\n"), - "Error: $green: Expected 1px to have unit \"%\".\ - \n ,\ - \n1 | a {b: scale-color(green, $green: 1px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn lightness() { - assert_eq!( - runner().err("a {b: scale-color(red, $lightness: 1px)}\n"), - "Error: $lightness: Expected 1px to have unit \"%\".\ - \n ,\ - \n1 | a {b: scale-color(red, $lightness: 1px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn red() { - assert_eq!( - runner().err("a {b: scale-color(red, $red: 1px)}\n"), - "Error: $red: Expected 1px to have unit \"%\".\ - \n ,\ - \n1 | a {b: scale-color(red, $red: 1px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn saturation() { - assert_eq!( - runner().err("a {b: scale-color(red, $saturation: 1px)}\n"), - "Error: $saturation: Expected 1px to have unit \"%\".\ - \n ,\ - \n1 | a {b: scale-color(red, $saturation: 1px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } - #[test] - fn whiteness() { - assert_eq!( - runner().err("a {b: scale-color(white, $whiteness: 1px)}\n"), - "Error: $whiteness: Expected 1px to have unit \"%\".\ - \n ,\ - \n1 | a {b: scale-color(white, $whiteness: 1px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 1:7 root stylesheet", - ); - } -} diff --git a/rsass/tests/spec/core_functions/color/scale_color/hsl.rs b/rsass/tests/spec/core_functions/color/scale_color/hsl.rs deleted file mode 100644 index eb8fbfc7e..000000000 --- a/rsass/tests/spec/core_functions/color/scale_color/hsl.rs +++ /dev/null @@ -1,151 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale_color/hsl.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("hsl") -} - -#[test] -fn all() { - assert_eq!( - runner().ok( - "a {b: scale-color(turquoise, $saturation: 24%, $lightness: -48%)}\n" - ), - "a {\ - \n b: #10867a;\ - \n}\n" - ); -} -#[test] -fn alpha_arg() { - assert_eq!( - runner().ok( - "a {b: scale-color(turquoise, $saturation: 24%, $lightness: -48%, $alpha: -70%)}\n" - ), - "a {\ - \n b: rgba(16, 134, 122, 0.3);\ - \n}\n" - ); -} -#[test] -fn alpha_input() { - assert_eq!( - runner().ok( - "a {b: scale-color(rgba(turquoise, 0.7), $saturation: 24%, $lightness: -48%)}\n" - ), - "a {\ - \n b: rgba(16, 134, 122, 0.7);\ - \n}\n" - ); -} -mod lightness { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: scale-color(red, $lightness: 94%)}\n"), - "a {\ - \n b: #fff0f0;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: scale-color(red, $lightness: -14%)}\n"), - "a {\ - \n b: #db0000;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: scale-color(red, $lightness: 100%)}\n"), - "a {\ - \n b: white;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: scale-color(red, $lightness: -100%)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } - #[test] - fn zero() { - assert_eq!( - runner().ok("a {b: scale-color(red, $lightness: 0%)}\n"), - "a {\ - \n b: red;\ - \n}\n" - ); - } -} -#[test] -fn named() { - assert_eq!( - runner().ok( - "a {b: scale-color($color: turquoise, $saturation: 24%, $lightness: -48%)}\n" - ), - "a {\ - \n b: #10867a;\ - \n}\n" - ); -} -mod saturation { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: scale-color(plum, $saturation: 67%)}\n"), - "a {\ - \n b: #f489f4;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: scale-color(plum, $saturation: -43%)}\n"), - "a {\ - \n b: #d0add0;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: scale-color(plum, $saturation: 100%)}\n"), - "a {\ - \n b: #ff7eff;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: scale-color(plum, $saturation: -100%)}\n"), - "a {\ - \n b: #bfbfbf;\ - \n}\n" - ); - } - #[test] - fn zero() { - assert_eq!( - runner().ok("a {b: scale-color(plum, $saturation: 0%)}\n"), - "a {\ - \n b: plum;\ - \n}\n" - ); - } -} diff --git a/rsass/tests/spec/core_functions/color/scale_color/hwb.rs b/rsass/tests/spec/core_functions/color/scale_color/hwb.rs deleted file mode 100644 index 4bfaeb1c3..000000000 --- a/rsass/tests/spec/core_functions/color/scale_color/hwb.rs +++ /dev/null @@ -1,151 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale_color/hwb.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("hwb") -} - -#[test] -fn all() { - assert_eq!( - runner().ok( - "a {b: scale-color(#66cc99, $whiteness: -50%, $blackness: 50%)}\n" - ), - "a {\ - \n b: #33664d;\ - \n}\n" - ); -} -#[test] -fn alpha_arg() { - assert_eq!( - runner().ok( - "a {b: scale-color(#66cc99, $whiteness: -50%, $blackness: 50%, $alpha: -70%)}\n" - ), - "a {\ - \n b: rgba(51, 102, 77, 0.3);\ - \n}\n" - ); -} -#[test] -fn alpha_input() { - assert_eq!( - runner().ok( - "a {b: scale-color(rgba(#66cc99, 0.7), $whiteness: -50%, $blackness: 50%)}\n" - ), - "a {\ - \n b: rgba(51, 102, 77, 0.7);\ - \n}\n" - ); -} -mod blackness { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: scale-color(#33cc80, $blackness: 50%)}\n"), - "a {\ - \n b: #33664d;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: scale-color(#339966, $blackness: -50%)}\n"), - "a {\ - \n b: #33cc80;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: scale-color(#339966, $blackness: 100%)}\n"), - "a {\ - \n b: #2b2b2b;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: scale-color(#339966, $blackness: -100%)}\n"), - "a {\ - \n b: #33ff99;\ - \n}\n" - ); - } - #[test] - fn zero() { - assert_eq!( - runner().ok("a {b: scale-color(#339966, $blackness: 0%)}\n"), - "a {\ - \n b: #339966;\ - \n}\n" - ); - } -} -#[test] -fn named() { - assert_eq!( - runner().ok( - "a {b: scale-color($color: #66cc99, $whiteness: -50%, $blackness: 50%)}\n" - ), - "a {\ - \n b: #33664d;\ - \n}\n" - ); -} -mod whiteness { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: scale-color(#33cc80, $whiteness: 50%)}\n"), - "a {\ - \n b: #99ccb3;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: scale-color(#66cc99, $whiteness: -50%)}\n"), - "a {\ - \n b: #33cc80;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: scale-color(#66cc99, $whiteness: 100%)}\n"), - "a {\ - \n b: #d5d5d5;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: scale-color(#66cc99, $whiteness: -100%)}\n"), - "a {\ - \n b: #00cc66;\ - \n}\n" - ); - } - #[test] - fn zero() { - assert_eq!( - runner().ok("a {b: scale-color(#66cc99, $whiteness: 0%)}\n"), - "a {\ - \n b: #66cc99;\ - \n}\n" - ); - } -} diff --git a/rsass/tests/spec/core_functions/color/scale_color/rgb.rs b/rsass/tests/spec/core_functions/color/scale_color/rgb.rs deleted file mode 100644 index 5e7b15c1d..000000000 --- a/rsass/tests/spec/core_functions/color/scale_color/rgb.rs +++ /dev/null @@ -1,201 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/color/scale_color/rgb.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("rgb") -} - -#[test] -fn all() { - assert_eq!( - runner().ok( - "a {b: scale-color(sienna, $red: 12%, $green: 24%, $blue: 48%)}\n" - ), - "a {\ - \n b: #ab7c92;\ - \n}\n" - ); -} -#[test] -fn alpha_arg() { - assert_eq!( - runner().ok( - "a {b: scale-color(sienna, $red: 12%, $green: 24%, $blue: 48%, $alpha: -70%)}\n" - ), - "a {\ - \n b: rgba(171, 124, 146, 0.3);\ - \n}\n" - ); -} -#[test] -fn alpha_input() { - assert_eq!( - runner().ok( - "a {b: scale-color(rgba(sienna, 0.3), $red: 12%, $green: 24%, $blue: 48%)}\n" - ), - "a {\ - \n b: rgba(171, 124, 146, 0.3);\ - \n}\n" - ); -} -mod blue { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: scale-color(salmon, $blue: 42%)}\n"), - "a {\ - \n b: #fa80ad;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: scale-color(slategray, $blue: -16%)}\n"), - "a {\ - \n b: #708079;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: scale-color(black, $blue: 100%)}\n"), - "a {\ - \n b: blue;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: scale-color(blue, $blue: -100%)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } - #[test] - fn zero() { - assert_eq!( - runner().ok("a {b: scale-color(black, $blue: 0%)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } -} -mod green { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: scale-color(cadetblue, $green: 12%)}\n"), - "a {\ - \n b: #5faaa0;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: scale-color(seagreen, $green: -86%)}\n"), - "a {\ - \n b: #2e1357;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: scale-color(black, $green: 100%)}\n"), - "a {\ - \n b: lime;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: scale-color(lime, $green: -100%)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } - #[test] - fn zero() { - assert_eq!( - runner().ok("a {b: scale-color(black, $green: 0%)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } -} -#[test] -fn named() { - assert_eq!( - runner().ok( - "a {b: scale-color($color: sienna, $red: 12%, $green: 24%, $blue: 48%)}\n" - ), - "a {\ - \n b: #ab7c92;\ - \n}\n" - ); -} -mod red { - #[allow(unused)] - use super::runner; - - #[test] - fn high() { - assert_eq!( - runner().ok("a {b: scale-color(turquoise, $red: 86%)}\n"), - "a {\ - \n b: #e4e0d0;\ - \n}\n" - ); - } - #[test] - fn low() { - assert_eq!( - runner().ok("a {b: scale-color(lightcoral, $red: -33%)}\n"), - "a {\ - \n b: #a18080;\ - \n}\n" - ); - } - #[test] - fn max() { - assert_eq!( - runner().ok("a {b: scale-color(black, $red: 100%)}\n"), - "a {\ - \n b: red;\ - \n}\n" - ); - } - #[test] - fn min() { - assert_eq!( - runner().ok("a {b: scale-color(red, $red: -100%)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } - #[test] - fn zero() { - assert_eq!( - runner().ok("a {b: scale-color(black, $red: 0%)}\n"), - "a {\ - \n b: black;\ - \n}\n" - ); - } -} diff --git a/rsass/tests/spec/core_functions/color/space.rs b/rsass/tests/spec/core_functions/color/space.rs new file mode 100644 index 000000000..23cbb0ea9 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/space.rs @@ -0,0 +1,309 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/space.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner() + .with_cwd("space") + .mock_file("error/too_few_args/error ", "") +} + +#[test] +#[ignore] // unexepected error +fn a98_rgb() { + let runner = runner().with_cwd("a98-rgb"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.space(color(a98-rgb 0 1 0))}\n"), + "a {\ + \n b: a98-rgb;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn display_p3() { + let runner = runner().with_cwd("display-p3"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.space(color(display-p3 0.515 0.35 0.3 / 1))}\n"), + "a {\ + \n b: display-p3;\ + \n}\n" + ); +} +mod error { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("error") + } + + #[test] + #[ignore] // wrong error + fn too_few_args() { + let runner = runner().with_cwd("too_few_args"); + assert_eq!( + runner.err( + "@use \"sass:color\";\ + \na {b: color.space()}\n" + ), + "Error: Missing argument $color.\ + \n ,--> input.scss\ + \n2 | a {b: color.space()}\ + \n | ^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function space($color) {\ + \n | ============= declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn too_many_args() { + let runner = runner().with_cwd("too_many_args"); + assert_eq!( + runner.err( + "@use \"sass:color\";\ + \na {b: color.space(rgb(0 255 0), a)}\n" + ), + "Error: Only 1 argument allowed, but 2 were passed.\ + \n ,--> input.scss\ + \n2 | a {b: color.space(rgb(0 255 0), a)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function space($color) {\ + \n | ============= declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn test_type() { + let runner = runner().with_cwd("type"); + assert_eq!( + runner.err( + "@use \"sass:color\";\ + \na {b: color.space(1)}\n" + ), + "Error: $color: 1 is not a color.\ + \n ,\ + \n2 | a {b: color.space(1)}\ + \n | ^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +#[test] +#[ignore] // unexepected error +fn hex() { + let runner = runner().with_cwd("hex"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.space(#f2ece4)}\n"), + "a {\ + \n b: rgb;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn hsl() { + let runner = runner().with_cwd("hsl"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.space(hsl(110 31% 32%))}\n"), + "a {\ + \n b: hsl;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn hwb() { + let runner = runner().with_cwd("hwb"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.space(hwb(0 50% 0%))}\n"), + "a {\ + \n b: hwb;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn lab() { + let runner = runner().with_cwd("lab"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.space(lab(5 110 115))}\n"), + "a {\ + \n b: lab;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn lch() { + let runner = runner().with_cwd("lch"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.space(lch(90.6 52.8 197))}\n"), + "a {\ + \n b: lch;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn named() { + let runner = runner().with_cwd("named"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.space($color: midnightblue)}\n"), + "a {\ + \n b: rgb;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn oklab() { + let runner = runner().with_cwd("oklab"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.space(oklab(0.44027 0.08818 -0.13386))}\n"), + "a {\ + \n b: oklab;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn oklch() { + let runner = runner().with_cwd("oklch"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.space(oklch(70% 0.1 200))}\n"), + "a {\ + \n b: oklch;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn prophoto_rgb() { + let runner = runner().with_cwd("prophoto-rgb"); + assert_eq!( + runner.ok( + "@use \"sass:color\";\ + \na {b: color.space(color(prophoto-rgb 0.42444 0.934918 0.190922))}\n" + ), + "a {\ + \n b: prophoto-rgb;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn rec2020() { + let runner = runner().with_cwd("rec2020"); + assert_eq!( + runner.ok( + "@use \"sass:color\";\ + \na {b: color.space(color(rec2020 0.42053 0.979780 0.00579))}\n" + ), + "a {\ + \n b: rec2020;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn rgb() { + let runner = runner().with_cwd("rgb"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.space(rgb(0 255 0))}\n"), + "a {\ + \n b: rgb;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn rgba() { + let runner = runner().with_cwd("rgba"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.space(rgba(72 122 180 / .2))}\n"), + "a {\ + \n b: rgb;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn srgb_linear() { + let runner = runner().with_cwd("srgb-linear"); + assert_eq!( + runner.ok( + "@use \"sass:color\";\ + \na {b: color.space(color(srgb-linear 0.45098 0.07843 0.823530))}\n" + ), + "a {\ + \n b: srgb-linear;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn srgb() { + let runner = runner().with_cwd("srgb"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.space(color(srgb 0.45098 0.07843 0.823530))}\n"), + "a {\ + \n b: srgb;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn xyz_d50() { + let runner = runner().with_cwd("xyz-d50"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.space(color(xyz-d50 0.2005 0.14089 0.4472))}\n"), + "a {\ + \n b: xyz-d50;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn xyz_d65() { + let runner = runner().with_cwd("xyz-d65"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.space(color(xyz-d65 0.21661 0.14602 0.59452))}\n"), + "a {\ + \n b: xyz;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn xyz() { + let runner = runner().with_cwd("xyz"); + assert_eq!( + runner.ok("@use \"sass:color\";\ + \na {b: color.space(color(xyz 0.0426 0.0442 0.0364))}\n"), + "a {\ + \n b: xyz;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/a98_rgb.rs b/rsass/tests/spec/core_functions/color/to_gamut/a98_rgb.rs new file mode 100644 index 000000000..ce511234a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/a98_rgb.rs @@ -0,0 +1,95 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +mod clip { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(a98-rgb 0.2 0.5 0.8), $method: clip)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.5 0.8);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(a98-rgb 1.5 0.5 0.8), $method: clip)}\n" + ), + "a {\ + \n b: color(a98-rgb 1 0.5 0.8);\ + \n}\n" + ); + } +} +mod local_minde { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(a98-rgb 0.2 0.5 0.8), $method: local-minde)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2 0.5 0.8);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(a98-rgb 1.1 0.5 0.8), $method: local-minde)}\n" + ), + "a {\ + \n b: color(a98-rgb 1 0.5850609654 0.8001989835);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(a98-rgb 0 -0.05 -0.05), $method: local-minde)}\n" + ), + "a {\ + \n b: color(a98-rgb 0 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(a98-rgb 0.8 1.1 1.4), $method: local-minde)}\n" + ), + "a {\ + \n b: color(a98-rgb 1 1 1);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/display_p3.rs b/rsass/tests/spec/core_functions/color/to_gamut/display_p3.rs new file mode 100644 index 000000000..9146696cd --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/display_p3.rs @@ -0,0 +1,95 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod clip { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(display-p3 0.2 0.5 0.8), $method: clip)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 0.8);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(display-p3 1.5 0.5 0.8), $method: clip)}\n" + ), + "a {\ + \n b: color(display-p3 1 0.5 0.8);\ + \n}\n" + ); + } +} +mod local_minde { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(display-p3 0.2 0.5 0.8), $method: local-minde)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.5 0.8);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(display-p3 1.5 0.5 0.8), $method: local-minde)}\n" + ), + "a {\ + \n b: color(display-p3 1 0.9080382844 0.9302909848);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(display-p3 0 -0.05 -0.05), $method: local-minde)}\n" + ), + "a {\ + \n b: color(display-p3 0 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(display-p3 0.8 1.1 1.4), $method: local-minde)}\n" + ), + "a {\ + \n b: color(display-p3 1 1 1);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/error.rs b/rsass/tests/spec/core_functions/color/to_gamut/error.rs new file mode 100644 index 000000000..c09ca1191 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/error.rs @@ -0,0 +1,208 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/error.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("error") +} + +mod color { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn test_type() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.to-gamut(c, $method: local-minde)}\n" + ), + "Error: $color: c is not a color.\ + \n ,\ + \n2 | a {b: color.to-gamut(c, $method: local-minde)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod method { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn absent() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.to-gamut(pink)}\n" + ), + "Error: $method: color.to-gamut() requires a $method argument for forwards-compatibility with changes in the CSS spec. Suggestion:\n\ + \n$method: local-minde\ + \n ,\ + \n2 | a {b: color.to-gamut(pink)}\ + \n | ^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn null() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.to-gamut(pink, $method: null)}\n" + ), + "Error: $method: color.to-gamut() requires a $method argument for forwards-compatibility with changes in the CSS spec. Suggestion:\n\ + \n$method: local-minde\ + \n ,\ + \n2 | a {b: color.to-gamut(pink, $method: null)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn quoted() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.to-gamut(pink, $method: \"clip\")}\n" + ), + "Error: $method: Expected \"clip\" to be an unquoted string.\ + \n ,\ + \n2 | a {b: color.to-gamut(pink, $method: \"clip\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn test_type() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.to-gamut(pink, $method: 1)}\n" + ), + "Error: $method: 1 is not a string.\ + \n ,\ + \n2 | a {b: color.to-gamut(pink, $method: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn unknown() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.to-gamut(pink, $method: c)}\n" + ), + "Error: Unknown gamut map method \"c\".\ + \n ,\ + \n2 | a {b: color.to-gamut(pink, $method: c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +mod space { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn quoted() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.to-gamut(pink, $space: \"rgb\", $method: local-minde)}\n" + ), + "Error: $space: Expected \"rgb\" to be an unquoted string.\ + \n ,\ + \n2 | a {b: color.to-gamut(pink, $space: \"rgb\", $method: local-minde)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn test_type() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.to-gamut(pink, $space: red, $method: local-minde)}\n" + ), + "Error: $space: red is not a string.\ + \n ,\ + \n2 | a {b: color.to-gamut(pink, $space: red, $method: local-minde)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn unknown() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.to-gamut(pink, $space: c, $method: local-minde)}\n" + ), + "Error: $space: Unknown color space \"c\".\ + \n ,\ + \n2 | a {b: color.to-gamut(pink, $space: c, $method: local-minde)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +#[test] +#[ignore] // wrong error +fn too_few_args() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.to-gamut()}\n" + ), + "Error: Missing argument $color.\ + \n ,--> input.scss\ + \n2 | a {b: color.to-gamut()}\ + \n | ^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function to-gamut($color, $space: null, $method: null) {\ + \n | ============================================= declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn too_many_args() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.to-gamut(red, rgb, clip, c)}\n" + ), + "Error: Only 3 arguments allowed, but 4 were passed.\ + \n ,--> input.scss\ + \n2 | a {b: color.to-gamut(red, rgb, clip, c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function to-gamut($color, $space: null, $method: null) {\ + \n | ============================================= declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/hsl.rs b/rsass/tests/spec/core_functions/color/to_gamut/hsl.rs new file mode 100644 index 000000000..12045fe9b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/hsl.rs @@ -0,0 +1,105 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod clip { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-gamut(hsl(70deg 50% 50%), $method: clip)}\n"), + "a {\ + \n b: hsl(70, 50%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color.change(hsl(70deg 50% 50%), $saturation: 200%),\ + \n $method: clip\ + \n );\ + \n}\n"), + "a {\ + \n b: hsl(70, 100%, 50%);\ + \n}\n" + ); + } +} +mod local_minde { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(hsl(70deg 50% 50%), $method: local-minde)}\n" + ), + "a {\ + \n b: hsl(70, 50%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color.change(hsl(70deg 50% 50%), $saturation: 107%),\ + \n $method: local-minde\ + \n );\ + \n}\n"), + "a {\ + \n b: hsl(73.5850781672, 100%, 67.4750294398%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color.change(hsl(70deg 100% 50%), $lightness: -1%),\ + \n $method: local-minde\ + \n );\ + \n}\n"), + "a {\ + \n b: hsl(none 0% 0%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color.change(hsl(70deg 50% 50%), $saturation: 120%),\ + \n $method: local-minde\ + \n );\ + \n}\n"), + "a {\ + \n b: hsl(none 0% 100%);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/hwb.rs b/rsass/tests/spec/core_functions/color/to_gamut/hwb.rs new file mode 100644 index 000000000..dd5d6e720 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/hwb.rs @@ -0,0 +1,91 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod clip { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-gamut(hwb(70deg 30% 30%), $method: clip)}\n"), + "a {\ + \n b: hsl(70, 40%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-gamut(hwb(70deg 200% -50%), $method: clip)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); + } +} +mod local_minde { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(hwb(70deg 30% 30%), $method: local-minde)}\n" + ), + "a {\ + \n b: hsl(70, 40%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(hwb(70deg -5% -5%), $method: local-minde)}\n" + ), + "a {\ + \n b: hsl(75.7157487534, 100%, 75.8982992248%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(hwb(70deg -2% 100%), $method: local-minde)}\n" + ), + "a {\ + \n b: hwb(none 0% 100%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(hwb(70deg -10% -10%), $method: local-minde)}\n" + ), + "a {\ + \n b: hwb(none 100% 0%);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/lab.rs b/rsass/tests/spec/core_functions/color/to_gamut/lab.rs new file mode 100644 index 000000000..4c5dcf17b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/lab.rs @@ -0,0 +1,43 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +#[test] +#[ignore] // unexepected error +fn clip() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color.change(lab(50% 500 -999999), $lightness: 150%),\ + \n $method: clip\ + \n );\ + \n}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz 6530020637.921538 2172031124.122868 137328815479.04425) 100%, black);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn local_minde() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color.change(lab(50% 500 -999999), $lightness: 150%),\ + \n $method: local-minde\ + \n );\ + \n}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz 6530020637.921538 2172031124.122868 137328815479.04425) 100%, black);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/lch.rs b/rsass/tests/spec/core_functions/color/to_gamut/lch.rs new file mode 100644 index 000000000..588af8166 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/lch.rs @@ -0,0 +1,43 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +#[test] +#[ignore] // unexepected error +fn clip() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color.change(lch(50% 200% 70deg), $lightness: 150%),\ + \n $method: clip\ + \n );\ + \n}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz 3.9677504831 2.839747694 -0.024493753) 100%, black);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn local_minde() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color.change(lch(50% 200% 70deg), $lightness: 150%),\ + \n $method: local-minde\ + \n );\ + \n}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz 3.9677504831 2.839747694 -0.024493753) 100%, black);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/mod.rs b/rsass/tests/spec/core_functions/color/to_gamut/mod.rs new file mode 100644 index 000000000..e22eab4fb --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/mod.rs @@ -0,0 +1,44 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("to_gamut") +} + +mod a98_rgb; + +mod display_p3; + +mod error; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod named; + +mod oklab; + +mod oklch; + +mod positional; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod space; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_gamut/named.rs b/rsass/tests/spec/core_functions/color/to_gamut/named.rs new file mode 100644 index 000000000..fa7f65c19 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/named.rs @@ -0,0 +1,20 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/named.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("named") +} + +#[test] +#[ignore] // unexepected error +fn test() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut($color: pink, $space: rgb, $method: local-minde)}\n" + ), + "a {\ + \n b: pink;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/oklab.rs b/rsass/tests/spec/core_functions/color/to_gamut/oklab.rs new file mode 100644 index 000000000..1695c3d56 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/oklab.rs @@ -0,0 +1,43 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +#[test] +#[ignore] // unexepected error +fn clip() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color.change(oklab(50% 500 -999999), $lightness: 150%),\ + \n $method: clip\ + \n );\ + \n}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz 593644537356868864 -153762261215017152 3418717280664545280) 100%, black);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn local_minde() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color.change(oklab(50% 500 -999999), $lightness: 150%),\ + \n $method: local-minde\ + \n );\ + \n}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz 593644537356868864 -153762261215017152 3418717280664545280) 100%, black);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/oklch.rs b/rsass/tests/spec/core_functions/color/to_gamut/oklch.rs new file mode 100644 index 000000000..d48b42937 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/oklch.rs @@ -0,0 +1,43 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +#[test] +#[ignore] // unexepected error +fn clip() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color.change(oklch(50% 200% 70deg), $lightness: 150%),\ + \n $method: clip\ + \n );\ + \n}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz 5.2395754107 2.9713210909 -1.434870419) 100%, black);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn local_minde() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color.change(oklch(50% 200% 70deg), $lightness: 150%),\ + \n $method: local-minde\ + \n );\ + \n}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz 5.2395754107 2.9713210909 -1.434870419) 100%, black);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/positional.rs b/rsass/tests/spec/core_functions/color/to_gamut/positional.rs new file mode 100644 index 000000000..18a4b93e9 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/positional.rs @@ -0,0 +1,18 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/positional.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("positional") +} + +#[test] +#[ignore] // unexepected error +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-gamut(pink, rgb, local-minde)}\n"), + "a {\ + \n b: pink;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/to_gamut/prophoto_rgb.rs new file mode 100644 index 000000000..3d5c7ee01 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/prophoto_rgb.rs @@ -0,0 +1,95 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod clip { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(prophoto-rgb 0.2 0.5 0.8), $method: clip)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 0.8);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(prophoto-rgb 1.5 0.5 0.8), $method: clip)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 1 0.5 0.8);\ + \n}\n" + ); + } +} +mod local_minde { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(prophoto-rgb 0.2 0.5 0.8), $method: local-minde)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.5 0.8);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(prophoto-rgb 1.1 0.5 0.8), $method: local-minde)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 1 0.5625312196 0.7939519528);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(prophoto-rgb 0 -0.05 -0.05), $method: local-minde)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(prophoto-rgb 0.8 1.1 1.4), $method: local-minde)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 1 1 1);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/rec2020.rs b/rsass/tests/spec/core_functions/color/to_gamut/rec2020.rs new file mode 100644 index 000000000..5cc6651cd --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/rec2020.rs @@ -0,0 +1,95 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod clip { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(rec2020 0.2 0.5 0.8), $method: clip)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.5 0.8);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(rec2020 1.5 0.5 0.8), $method: clip)}\n" + ), + "a {\ + \n b: color(rec2020 1 0.5 0.8);\ + \n}\n" + ); + } +} +mod local_minde { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(rec2020 0.2 0.5 0.8), $method: local-minde)}\n" + ), + "a {\ + \n b: color(rec2020 0.2 0.5 0.8);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(rec2020 1.1 0.5 0.8), $method: local-minde)}\n" + ), + "a {\ + \n b: color(rec2020 1 0.5720949845 0.7959438083);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(rec2020 0 -0.05 -0.05), $method: local-minde)}\n" + ), + "a {\ + \n b: color(rec2020 0 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(rec2020 0.8 1.1 1.4), $method: local-minde)}\n" + ), + "a {\ + \n b: color(rec2020 1 1 1);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/rgb.rs b/rsass/tests/spec/core_functions/color/to_gamut/rgb.rs new file mode 100644 index 000000000..c0123e23f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/rgb.rs @@ -0,0 +1,97 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod clip { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-gamut(#abcdef, $method: clip)}\n"), + "a {\ + \n b: #abcdef;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color.change(#abcdef, $red: 300), $method: clip)}\n" + ), + "a {\ + \n b: #ffcdef;\ + \n}\n" + ); + } +} +mod local_minde { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-gamut(#abcdef, $method: local-minde)}\n"), + "a {\ + \n b: #abcdef;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color.change(#abcdef, $red: 300), $method: local-minde)}\n" + ), + "a {\ + \n b: rgb(255, 222.6637652053, 237.9231180222);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color.change(black, $red: -5, $green: -5),\ + \n $method: local-minde\ + \n );\ + \n}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color.change(#e6ff00, $green: 280, $blue: -25),\ + \n $method: local-minde\ + \n );\ + \n}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/space.rs b/rsass/tests/spec/core_functions/color/to_gamut/space.rs new file mode 100644 index 000000000..d357ba89c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/space.rs @@ -0,0 +1,543 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/space.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("space") +} + +mod clip { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(oklch(60% 0.13 240deg), $space: rgb, $method: clip)}\n" + ), + "a {\ + \n b: oklch(60% 0.13 240deg);\ + \n}\n" + ); + } + mod missing { + #[allow(unused)] + use super::runner; + + mod legacy { + #[allow(unused)] + use super::runner; + + mod analogous { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn legacy() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(hsl(none 50% 50%), $space: hwb, $method: clip)}\n" + ), + "a {\ + \n b: hsl(0, 50%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn modern() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(rgb(none none none), $space: display-p3, $method: clip)}\n" + ), + "a {\ + \n b: black;\ + \n}\n" + ); + } + } + mod same { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn explicit() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(rgb(none none none), $space: rgb, $method: clip)}\n" + ), + "a {\ + \n b: rgb(none none none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn implicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-gamut(rgb(none none none), $method: clip)}\n"), + "a {\ + \n b: rgb(none none none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn with_mapping() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color.change(rgb(none 0 none), $green: 300),\ + \n $method: clip\ + \n );\ + \n}\n"), + "a {\ + \n b: rgb(none 255 none);\ + \n}\n" + ); + } + } + } + mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn analogous() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color(srgb none none none),\ + \n $space: display-p3,\ + \n $method: clip\ + \n );\ + \n}\n"), + "a {\ + \n b: color(srgb none none none);\ + \n}\n" + ); + } + mod same { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn explicit() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(srgb none none none), $space: srgb, $method: clip)}\n" + ), + "a {\ + \n b: color(srgb none none none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn implicit() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(srgb none none none), $method: clip)}\n" + ), + "a {\ + \n b: color(srgb none none none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn with_mapping() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(srgb none 1.2 none), $method: clip)}\n" + ), + "a {\ + \n b: color(srgb none 1 none);\ + \n}\n" + ); + } + } + } + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(oklch(60% 0.15 240deg), $space: rgb, $method: clip)}\n" + ), + "a {\ + \n b: oklch(60.4068473688% 0.1443906201 242.3895382399deg);\ + \n}\n" + ); + } + mod powerless { + #[allow(unused)] + use super::runner; + + mod legacy { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn no_mapping() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(hsl(0deg 0% 20%), $space: srgb, $method: clip)}\n" + ), + "a {\ + \n b: hsl(0, 0%, 20%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn with_mapping() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(hsl(0deg 10% 1000%), $space: srgb, $method: clip)}\n" + ), + "a {\ + \n b: hsl(0, 0%, 100%);\ + \n}\n" + ); + } + } + mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn no_mapping() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(oklch(10% 0% 0deg), $space: srgb, $method: clip)}\n" + ), + "a {\ + \n b: oklch(10% 0 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn with_mapping() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(lch(1000% 10% 0deg), $space: hsl, $method: clip)}\n" + ), + "a {\ + \n b: lch(100% 0 none);\ + \n}\n" + ); + } + } + } +} +mod local_minde { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(oklch(60% 0.13 240deg), $space: rgb, $method: local-minde)}\n" + ), + "a {\ + \n b: oklch(60% 0.13 240deg);\ + \n}\n" + ); + } + mod missing { + #[allow(unused)] + use super::runner; + + mod legacy { + #[allow(unused)] + use super::runner; + + mod analogous { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn legacy() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(hsl(none 50% 50%), $space: hwb, $method: local-minde)}\n" + ), + "a {\ + \n b: hsl(0, 50%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn modern() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n rgb(none none none),\ + \n $space: display-p3,\ + \n $method: local-minde\ + \n );\ + \n}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } + } + mod same { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn explicit() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(rgb(none none none), $space: rgb, $method: local-minde)}\n" + ), + "a {\ + \n b: rgb(none none none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn implicit() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(rgb(none none none), $method: local-minde)}\n" + ), + "a {\ + \n b: rgb(none none none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn with_mapping() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color.change(rgb(none 0 none), $green: 300),\ + \n $method: local-minde\ + \n );\ + \n}\n"), + "a {\ + \n b: rgb(220.0210985908, 255, 215.6454599021);\ + \n}\n" + ); + } + } + } + mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn analogous() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color(srgb none none none),\ + \n $space: display-p3,\ + \n $method: local-minde\ + \n );\ + \n}\n"), + "a {\ + \n b: color(srgb none none none);\ + \n}\n" + ); + } + mod same { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn explicit() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {\ + \n b: color.to-gamut(\ + \n color(srgb none none none),\ + \n $space: srgb,\ + \n $method: local-minde\ + \n );\ + \n}\n"), + "a {\ + \n b: color(srgb none none none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn implicit() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(srgb none none none), $method: local-minde)}\n" + ), + "a {\ + \n b: color(srgb none none none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn with_mapping() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(srgb none 1.2 none), $method: local-minde)}\n" + ), + "a {\ + \n b: color(srgb 0.9249489323 1 0.9135716721);\ + \n}\n" + ); + } + } + } + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(oklch(60% 0.15 240deg), $space: rgb, $method: local-minde)}\n" + ), + "a {\ + \n b: oklch(60.4068473688% 0.1443906201 242.3895382399deg);\ + \n}\n" + ); + } + mod powerless { + #[allow(unused)] + use super::runner; + + mod legacy { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn no_mapping() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(hsl(0deg 0% 20%), $space: srgb, $method: local-minde)}\n" + ), + "a {\ + \n b: hsl(0, 0%, 20%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn with_mapping() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(hsl(0deg 10% 1000%), $space: srgb, $method: local-minde)}\n" + ), + "a {\ + \n b: hsl(0, 0%, 100%);\ + \n}\n" + ); + } + } + mod modern { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn no_mapping() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(oklch(10% 0% 0deg), $space: srgb, $method: local-minde)}\n" + ), + "a {\ + \n b: oklch(10% 0 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn with_mapping() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(lch(1000% 10% 0deg), $space: srgb, $method: local-minde)}\n" + ), + "a {\ + \n b: lch(100% 0 none);\ + \n}\n" + ); + } + } + } + #[test] + #[ignore] // unexepected error + fn to_black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(oklch(0% 0.13 240deg), $space: rgb, $method: local-minde)}\n" + ), + "a {\ + \n b: oklch(0% 0 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(oklch(100% 0.13 240deg), $space: rgb, $method: local-minde)}\n" + ), + "a {\ + \n b: oklch(99.9999993474% 0.0000000373 89.8755630959deg);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/srgb.rs b/rsass/tests/spec/core_functions/color/to_gamut/srgb.rs new file mode 100644 index 000000000..a18803f7d --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/srgb.rs @@ -0,0 +1,95 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod clip { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(srgb 0.2 0.5 0.8), $method: clip)}\n" + ), + "a {\ + \n b: color(srgb 0.2 0.5 0.8);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(srgb 1.5 0.5 0.8), $method: clip)}\n" + ), + "a {\ + \n b: color(srgb 1 0.5 0.8);\ + \n}\n" + ); + } +} +mod local_minde { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(srgb 0.2 0.5 0.8), $method: local-minde)}\n" + ), + "a {\ + \n b: color(srgb 0.2 0.5 0.8);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(srgb 1.5 0.5 0.8), $method: local-minde)}\n" + ), + "a {\ + \n b: color(srgb 1 0.8660162103 0.8987034234);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(srgb 0 -0.05 -0.05), $method: local-minde)}\n" + ), + "a {\ + \n b: color(srgb 0 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(srgb 0.9 1.1 -0.1), $method: local-minde)}\n" + ), + "a {\ + \n b: color(srgb 1 1 1);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/srgb_linear.rs b/rsass/tests/spec/core_functions/color/to_gamut/srgb_linear.rs new file mode 100644 index 000000000..453d0348e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/srgb_linear.rs @@ -0,0 +1,95 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod clip { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(srgb-linear 0.2 0.5 0.8), $method: clip)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 0.8);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(srgb-linear 1.5 0.5 0.8), $method: clip)}\n" + ), + "a {\ + \n b: color(srgb-linear 1 0.5 0.8);\ + \n}\n" + ); + } +} +mod local_minde { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn in_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(srgb-linear 0.2 0.5 0.8), $method: local-minde)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.5 0.8);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn out_of_gamut() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(srgb-linear 1.5 0.5 0.8), $method: local-minde)}\n" + ), + "a {\ + \n b: color(srgb-linear 1 0.6455185586 0.7900912983);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(srgb-linear 0 -0.05 -0.05), $method: local-minde)}\n" + ), + "a {\ + \n b: color(srgb-linear 0 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn to_white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(srgb-linear 0.9 1.2 1.6), $method: local-minde)}\n" + ), + "a {\ + \n b: color(srgb-linear 1 1 1);\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/xyz.rs b/rsass/tests/spec/core_functions/color/to_gamut/xyz.rs new file mode 100644 index 000000000..881efca72 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/xyz.rs @@ -0,0 +1,33 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +#[test] +#[ignore] // unexepected error +fn clip() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(xyz 123 -456 999999), $method: clip)}\n" + ), + "a {\ + \n b: color(xyz 123 -456 999999);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn local_minde() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(xyz 123 -456 999999), $method: local-minde)}\n" + ), + "a {\ + \n b: color(xyz 123 -456 999999);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_gamut/xyz_d50.rs b/rsass/tests/spec/core_functions/color/to_gamut/xyz_d50.rs new file mode 100644 index 000000000..e82d3c38e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_gamut/xyz_d50.rs @@ -0,0 +1,33 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_gamut/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +#[test] +#[ignore] // unexepected error +fn clip() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(xyz-d50 123 -456 999999), $method: clip)}\n" + ), + "a {\ + \n b: color(xyz-d50 123 -456 999999);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn local_minde() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-gamut(color(xyz-d50 123 -456 999999), $method: local-minde)}\n" + ), + "a {\ + \n b: color(xyz-d50 123 -456 999999);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/a98_rgb/a98_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/a98_rgb.rs new file mode 100644 index 000000000..5acfbf1aa --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/a98_rgb.rs @@ -0,0 +1,73 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/a98_rgb/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +#[test] +#[ignore] // unexepected error +fn in_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.2 0.4 0.8), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.2 0.4 0.8);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 none), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1 0.2 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 none 0.3), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1 none 0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb none 0.2 0.3), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb none 0.2 0.3);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -1 0.4 2), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb -1 0.4 2);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/a98_rgb/display_p3.rs b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/display_p3.rs new file mode 100644 index 000000000..a9373def4 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/display_p3.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/a98_rgb/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.4), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.0376331272 0.1827194825 0.2895249614 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.0376331272 0.1827194825 0.2895249614 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0 0 0), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.5 0.5 0.5), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.5039928958 0.5039928958 0.5039928958);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.2 0.4 0.8), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.1198075605 0.3936533835 0.7891199167);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 none), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.0376331272 0.1827194825 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 none 0.3), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.080586652 none 0.2878991958);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb none 0.2 0.3), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 none 0.1816774074 0.2892067467);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -999999 0 0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -352050.1162090242 -92416.3092975226 -70070.8047882944);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -1 0.4 2), display-p3)}\n"), + "a {\ + \n b: color(display-p3 -1.0713648823 0.3146416114 1.8898918553);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 1 1 1), display-p3)}\n"), + "a {\ + \n b: color(display-p3 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/a98_rgb/hsl.rs b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/hsl.rs new file mode 100644 index 000000000..97298f1b2 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/hsl.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/a98_rgb/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.4), hsl)}\n" + ), + "a {\ + \n b: hsla(200.1785406812, 126.7161502744%, 13.1753745837%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.0), hsl)}\n" + ), + "a {\ + \n b: hsla(200.1785406812, 126.7161502744%, 13.1753745837%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0 0 0), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 0%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.5 0.5 0.5), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 50.3992895764%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.2 0.4 0.8), hsl)}\n"), + "a {\ + \n b: hsl(206.798941326, 132.7737671841%, 35.0907131834%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 none), hsl)}\n"), + "a {\ + \n b: hsl(125.1711076789, 146.5566174361%, 7.5605855126%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 none 0.3), hsl)}\n"), + "a {\ + \n b: hsl(258.3433021907, 100%, 15.0612047755%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb none 0.2 0.3), hsl)}\n"), + "a {\ + \n b: hsl(196.5051304863, 215.7701724503%, 9.4596338244%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -999999 0 0), hsl)}\n"), + "a {\ + \n b: hsl(0, 100%, -19096022.06943802%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -1 0.4 2), hsl)}\n"), + "a {\ + \n b: hsl(209.922630637, 396.8439205726%, 39.6562294521%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 1 1 1), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 100%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/a98_rgb/hwb.rs b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/hwb.rs new file mode 100644 index 000000000..cb2ad9383 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/hwb.rs @@ -0,0 +1,194 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/a98_rgb/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.4), hwb));\n" + ), + "a {\ + \n value: hsla(200.1785406812, 126.7161502744%, 13.1753745837%, 0.4);\ + \n space: hwb;\ + \n channels: 200.1785406812deg -3.519952873% 70.1292979595% / 0.4;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.0), hwb));\n" + ), + "a {\ + \n value: hsla(200.1785406812, 126.7161502744%, 13.1753745837%, 0);\ + \n space: hwb;\ + \n channels: 200.1785406812deg -3.519952873% 70.1292979595% / 0;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(a98-rgb 0 0 0), hwb));\n" + ), + "a {\ + \n value: black;\ + \n space: hwb;\ + \n channels: 0deg 0% 100% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(a98-rgb 0.5 0.5 0.5), hwb));\n" + ), + "a {\ + \n value: hsl(0, 0%, 50.3992895764%);\ + \n space: hwb;\ + \n channels: 0deg 50.3992895764% 49.6007104236% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(a98-rgb 0.2 0.4 0.8), hwb));\n" + ), + "a {\ + \n value: hsl(206.798941326, 132.7737671841%, 35.0907131834%);\ + \n space: hwb;\ + \n channels: 206.798941326deg -11.500548642% 18.3180249912% / 1;\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 none), hwb)}\n"), + "a {\ + \n b: hsl(125.1711076789, 146.5566174361%, 7.5605855126%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(a98-rgb 0.1 none 0.3), hwb));\n" + ), + "a {\ + \n value: hsl(258.3433021907, 100%, 15.0612047755%);\ + \n space: hwb;\ + \n channels: 258.3433021907deg 0% 69.8775904491% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(a98-rgb none 0.2 0.3), hwb));\n" + ), + "a {\ + \n value: hsl(196.5051304863, 215.7701724503%, 9.4596338244%);\ + \n space: hwb;\ + \n channels: 196.5051304863deg -10.9514343917% 70.1292979595% / 1;\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(a98-rgb -999999 0 0), hwb));\n" + ), + "a {\ + \n value: hsl(0, 100%, -19096022.06943802%);\ + \n space: hwb;\ + \n channels: 180deg -38192044.13887604% 100% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(a98-rgb -1 0.4 2), hwb));\n" + ), + "a {\ + \n value: hsl(209.922630637, 396.8439205726%, 39.6562294521%);\ + \n space: hwb;\ + \n channels: 209.922630637deg -117.7171062569% -97.0295651612% / 1;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(a98-rgb 1 1 1), hwb));\n" + ), + "a {\ + \n value: white;\ + \n space: hwb;\ + \n channels: 0deg 100% 0% / 1;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/a98_rgb/lab.rs b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/lab.rs new file mode 100644 index 000000000..cedf0a345 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/lab.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/a98_rgb/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.4), lab)}\n" + ), + "a {\ + \n b: lab(17.7387491045% -7.186319424 -22.7371258976 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.0), lab)}\n" + ), + "a {\ + \n b: lab(17.7387491045% -7.186319424 -22.7371258976 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0 0 0), lab)}\n"), + "a {\ + \n b: lab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.5 0.5 0.5), lab)}\n"), + "a {\ + \n b: lab(53.7880481926% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.2 0.4 0.8), lab)}\n"), + "a {\ + \n b: lab(42.9339299516% 6.5030561424 -63.5427502212);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 none), lab)}\n"), + "a {\ + \n b: lab(15.5541953165% -27.655552781 23.2496799552);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 none 0.3), lab)}\n"), + "a {\ + \n b: lab(5.8200823344% 29.1326658037 -42.4044732971);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb none 0.2 0.3), lab)}\n"), + "a {\ + \n b: lab(16.8147782656% -12.534270074 -24.2693697193);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -999999 0 0), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz -9041452038524.754 -4661998707364.328 -423818064305.84766) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -1 0.4 2), lab)}\n"), + "a {\ + \n b: lab(30.0623308533% 38.5823326773 -241.4998540297);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 1 1 1), lab)}\n"), + "a {\ + \n b: lab(100% 0 0);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/a98_rgb/lch.rs b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/lch.rs new file mode 100644 index 000000000..0b69a68fd --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/lch.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/a98_rgb/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.4), lch)}\n" + ), + "a {\ + \n b: lch(17.7387491045% 23.8457560364 252.4602846081deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.0), lch)}\n" + ), + "a {\ + \n b: lch(17.7387491045% 23.8457560364 252.4602846081deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0 0 0), lch)}\n"), + "a {\ + \n b: lch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.5 0.5 0.5), lch)}\n"), + "a {\ + \n b: lch(53.7880481926% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.2 0.4 0.8), lch)}\n"), + "a {\ + \n b: lch(42.9339299516% 63.8746494696 275.8433881087deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 none), lch)}\n"), + "a {\ + \n b: lch(15.5541953165% 36.1300043959 139.9466505913deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 none 0.3), lch)}\n"), + "a {\ + \n b: lch(5.8200823344% 51.4475613847 304.4897928318deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb none 0.2 0.3), lch)}\n"), + "a {\ + \n b: lch(16.8147782656% 27.3150184488 242.6852480988deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -999999 0 0), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz -9041452038524.758 -4661998707364.329 -423818064305.86096) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -1 0.4 2), lch)}\n"), + "a {\ + \n b: lch(30.0623308533% 244.5624171683 279.0769417748deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 1 1 1), lch)}\n"), + "a {\ + \n b: lch(100% 0 none);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/a98_rgb/mod.rs b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/mod.rs new file mode 100644 index 000000000..f79d6023f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/mod.rs @@ -0,0 +1,36 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/a98_rgb" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +mod a98_rgb; + +mod display_p3; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_space/a98_rgb/oklab.rs b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/oklab.rs new file mode 100644 index 000000000..169ad48d2 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/oklab.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/a98_rgb/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.4), oklab)}\n" + ), + "a {\ + \n b: oklab(29.182543438% -0.0383089973 -0.0634618836 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.0), oklab)}\n" + ), + "a {\ + \n b: oklab(29.182543438% -0.0383089973 -0.0634618836 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0 0 0), oklab)}\n"), + "a {\ + \n b: oklab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.5 0.5 0.5), oklab)}\n"), + "a {\ + \n b: oklab(60.1621101182% 0 0.0000000224);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.2 0.4 0.8), oklab)}\n"), + "a {\ + \n b: oklab(52.1495256905% -0.0513578757 -0.1793591779);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 none), oklab)}\n"), + "a {\ + \n b: oklab(26.2341469735% -0.0807607241 0.059543982);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 none 0.3), oklab)}\n"), + "a {\ + \n b: oklab(20.9471844335% 0.0293694057 -0.1198702832);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb none 0.2 0.3), oklab)}\n"), + "a {\ + \n b: oklab(28.2216457589% -0.0592406629 -0.068029159);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -999999 0 0), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz -9041452038524.754 -4661998707364.326 -423818064305.84424) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -1 0.4 2), oklab)}\n"), + "a {\ + \n b: oklab(38.583187128% -2.2710957934 -0.6509941262);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 1 1 1), oklab)}\n"), + "a {\ + \n b: oklab(99.9999993474% 0.0000000001 0.0000000373);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/a98_rgb/oklch.rs b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/oklch.rs new file mode 100644 index 000000000..e0f904474 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/oklch.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/a98_rgb/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.4), oklch)}\n" + ), + "a {\ + \n b: oklch(29.182543438% 0.0741281994 238.8825662829deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.0), oklch)}\n" + ), + "a {\ + \n b: oklch(29.182543438% 0.0741281994 238.8825662829deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0 0 0), oklch)}\n"), + "a {\ + \n b: oklch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.5 0.5 0.5), oklch)}\n"), + "a {\ + \n b: oklch(60.1621101182% 0.0000000224 89.8755628523deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.2 0.4 0.8), oklch)}\n"), + "a {\ + \n b: oklch(52.1495256905% 0.1865672696 254.0214147055deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 none), oklch)}\n"), + "a {\ + \n b: oklch(26.2341469735% 0.1003383295 143.5990619106deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 none 0.3), oklch)}\n"), + "a {\ + \n b: oklch(20.9471844335% 0.1234157477 283.7668356322deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb none 0.2 0.3), oklch)}\n"), + "a {\ + \n b: oklch(28.2216457589% 0.0902076638 228.9502345148deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -999999 0 0), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz -9041452038524.746 -4661998707364.325 -423818064305.8496) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -1 0.4 2), oklch)}\n"), + "a {\ + \n b: oklch(38.583187128% 2.3625557042 195.9945889447deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 1 1 1), oklch)}\n"), + "a {\ + \n b: oklch(99.9999993474% 0.0000000373 89.8755630959deg);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/a98_rgb/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/prophoto_rgb.rs new file mode 100644 index 000000000..86f61935a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/prophoto_rgb.rs @@ -0,0 +1,161 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/a98_rgb/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.4), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1084709661 0.1348055136 0.2212739372 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1084709661 0.1348055136 0.2212739372 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0 0 0), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.5 0.5 0.5), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.4287509597 0.4287509597 0.4287509597);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.2 0.4 0.8), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.3168388393 0.3260606848 0.726820787);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 none), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.0682396395 0.1289630742 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 none 0.3), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.0971986374 none 0.2172679015);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb none 0.2 0.3), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb none 0.1323881901 0.2209968271);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -999999 0 0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -18118318.905084856 -7113714.776888951 -2671576.7208059593);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -1 0.4 2), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -0.1930208925 0.2909921381 2.199240452);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 1 1 1), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/a98_rgb/rec2020.rs b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/rec2020.rs new file mode 100644 index 000000000..670d4b7b0 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/rec2020.rs @@ -0,0 +1,155 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/a98_rgb/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.4), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.0494709718 0.1182706557 0.2275848731 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.0), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.0494709718 0.1182706557 0.2275848731 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0 0 0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.5 0.5 0.5), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.4543095825 0.4543095825 0.4543095825);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.2 0.4 0.8), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.2185447527 0.3379568627 0.7598138887);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 none), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.0350776367 0.1152389042 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 none 0.3), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.0393483967 none 0.2248497454);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb none 0.2 0.3), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 none 0.116069056 0.2272691007);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -999999 0 0), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 -898316.3792876494 -332882.1030921165 -174225.0344960701);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -1 0.4 2), rec2020)}\n"), + "a {\ + \n b: color(rec2020 -0.8122496028 0.2467395561 2.013750701);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 1 1 1), rec2020)}\n"), + "a {\ + \n b: color(rec2020 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/a98_rgb/rgb.rs b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/rgb.rs new file mode 100644 index 000000000..7472757cc --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/rgb.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/a98_rgb/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.4), rgb)}\n" + ), + "a {\ + \n b: hsla(200.1785406812, 126.7161502744%, 13.1753745837%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.0), rgb)}\n" + ), + "a {\ + \n b: hsla(200.1785406812, 126.7161502744%, 13.1753745837%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0 0 0), rgb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.5 0.5 0.5), rgb)}\n"), + "a {\ + \n b: rgb(128.5181884199, 128.5181884199, 128.5181884199);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.2 0.4 0.8), rgb)}\n"), + "a {\ + \n b: hsl(206.798941326, 132.7737671841%, 35.0907131834%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 none), rgb)}\n"), + "a {\ + \n b: hsl(129.5300952459, 146.5566174361%, 7.5605855126%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 none 0.3), rgb)}\n"), + "a {\ + \n b: rgb(23.4831395969, 0, 76.8121443549);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb none 0.2 0.3), rgb)}\n"), + "a {\ + \n b: rgb(0, 47.5348659402, 76.1702902033);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -999999 0 0), rgb)}\n"), + "a {\ + \n b: hsl(0, 100%, -19096022.06943802%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -1 0.4 2), rgb)}\n"), + "a {\ + \n b: hsl(209.922630637, 396.8439205726%, 39.6562294521%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 1 1 1), rgb)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/a98_rgb/srgb.rs b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/srgb.rs new file mode 100644 index 000000000..f2ba8c0fd --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/srgb.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/a98_rgb/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.4), srgb)}\n" + ), + "a {\ + \n b: color(srgb -0.0351995287 0.186411239 0.2987070204 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.0), srgb)}\n" + ), + "a {\ + \n b: color(srgb -0.0351995287 0.186411239 0.2987070204 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0 0 0), srgb)}\n"), + "a {\ + \n b: color(srgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.5 0.5 0.5), srgb)}\n"), + "a {\ + \n b: color(srgb 0.5039928958 0.5039928958 0.5039928958);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.2 0.4 0.8), srgb)}\n"), + "a {\ + \n b: color(srgb -0.1150054864 0.4006209194 0.8168197501);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 none), srgb)}\n"), + "a {\ + \n b: color(srgb -0.0351995287 0.186411239 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 none 0.3), srgb)}\n"), + "a {\ + \n b: color(srgb 0.0920907435 none 0.3012240955);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb none 0.2 0.3), srgb)}\n"), + "a {\ + \n b: color(srgb none 0.186411239 0.2987070204);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -999999 0 0), srgb)}\n"), + "a {\ + \n b: color(srgb -381920.4413887605 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -1 0.4 2), srgb)}\n"), + "a {\ + \n b: color(srgb -1.1771710626 0.4006209194 1.9702956516);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 1 1 1), srgb)}\n"), + "a {\ + \n b: color(srgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/a98_rgb/srgb_linear.rs b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/srgb_linear.rs new file mode 100644 index 000000000..5aebe31b0 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/srgb_linear.rs @@ -0,0 +1,161 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/a98_rgb/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.4), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.0027244217 0.0290276622 0.0726003858 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.0027244217 0.0290276622 0.0726003858 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0 0 0), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.5 0.5 0.5), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2177555281 0.2177555281 0.2177555281);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.2 0.4 0.8), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.012511378 0.1333039049 0.6327296478);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 none), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.0027244217 0.0290276622 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 none 0.3), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0088389143 none 0.073846514);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb none 0.2 0.3), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear none 0.0290276622 0.0726003858);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -999999 0 0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -21924475654205.21 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -1 0.4 2), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -1.4514581202 0.1333039049 4.7837263649);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 1 1 1), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/a98_rgb/xyz.rs b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/xyz.rs new file mode 100644 index 000000000..474c46761 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/xyz.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/a98_rgb/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.4), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.0223592858 0.0254215465 0.0724162815 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.0), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.0223592858 0.0254215465 0.0724162815 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0 0 0), xyz)}\n"), + "a {\ + \n b: color(xyz 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.5 0.5 0.5), xyz)}\n"), + "a {\ + \n b: color(xyz 0.2069670324 0.2177555281 0.2371483457);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.2 0.4 0.8), xyz)}\n"), + "a {\ + \n b: color(xyz 0.1567033573 0.1383525888 0.6170771483);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 none), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0090314088 0.0200903956 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 none 0.3), xyz)}\n"), + "a {\ + \n b: color(xyz 0.016972964 none 0.0703643493);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb none 0.2 0.3), xyz)}\n"), + "a {\ + \n b: color(xyz none 0.0235420485 0.072245418);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -999999 0 0), xyz)}\n" + ), + "a {\ + \n b: color(xyz -9041452038524.758 -4661998707364.328 -423818064305.84784);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -1 0.4 2), xyz)}\n"), + "a {\ + \n b: color(xyz 0.3124701203 0.1320464482 4.5349169732);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 1 1 1), xyz)}\n"), + "a {\ + \n b: color(xyz 0.9504559271 1 1.0890577508);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/a98_rgb/xyz_d50.rs b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/xyz_d50.rs new file mode 100644 index 000000000..2e70f8c48 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/a98_rgb/xyz_d50.rs @@ -0,0 +1,155 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/a98_rgb/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.4), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0203795694 0.0246044104 0.054623998 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 0.3 / 0.0), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0203795694 0.0246044104 0.054623998 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0 0 0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.5 0.5 0.5), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.2099807143 0.2177555281 0.1796710885);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.2 0.4 0.8), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.1364163751 0.1311360929 0.4645989467);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 0.2 none), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0098137269 0.0201278488 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 0.1 none 0.3), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0144201903 none 0.0528568205);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb none 0.2 0.3), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 none 0.0226378123 0.0545009257);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -999999 0 0), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 -9560512850977.73 -4878046244787.3545 -305274677130.3227);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb -1 0.4 2), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.1028590408 0.062612892 3.4087872511);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(a98-rgb 1 1 1), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.9642956764 1 0.8251046025);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/display_p3/a98_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/display_p3/a98_rgb.rs new file mode 100644 index 000000000..02428f221 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/display_p3/a98_rgb.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/display_p3/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.4), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1395855294 0.2151252811 0.3095213638 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.0), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1395855294 0.2151252811 0.3095213638 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0 0 0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.5 0.5 0.5), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.4961036984 0.4961036984 0.4961036984);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.2 0.4 0.8), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2482053529 0.4050915621 0.8110198535);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 none), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1395855294 0.2151252811 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 none 0.3), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1153904633 none 0.3115106155);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 none 0.2 0.3), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb none 0.2163312901 0.3099034883);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -999999 0 0), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb -3115569.9464425035 788230.9760095418 569282.1313176785);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -1 0.4 2), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb -0.9267440317 0.459123582 2.1223637667);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 1 1 1), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/display_p3/display_p3.rs b/rsass/tests/spec/core_functions/color/to_space/display_p3/display_p3.rs new file mode 100644 index 000000000..65ccee11c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/display_p3/display_p3.rs @@ -0,0 +1,77 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/display_p3/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +#[test] +#[ignore] // unexepected error +fn in_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.2 0.4 0.8), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.2 0.4 0.8);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 none), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.1 0.2 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 none 0.3), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.1 none 0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 none 0.2 0.3), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 none 0.2 0.3);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -1 0.4 2), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -1 0.4 2);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/display_p3/hsl.rs b/rsass/tests/spec/core_functions/color/to_space/display_p3/hsl.rs new file mode 100644 index 000000000..6f6d7417a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/display_p3/hsl.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/display_p3/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.4), hsl)}\n" + ), + "a {\ + \n b: hsla(205.417452683, 67.7488400949%, 18.4043245596%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.0), hsl)}\n" + ), + "a {\ + \n b: hsla(205.417452683, 67.7488400949%, 18.4043245596%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0 0 0), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 0%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.5 0.5 0.5), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 50%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.2 0.4 0.8), hsl)}\n"), + "a {\ + \n b: hsl(214.974668252, 77.667451385%, 46.5940983001%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 none), hsl)}\n"), + "a {\ + \n b: hsl(96.0435532608, 143.3480015017%, 8.3456369204%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 none 0.3), hsl)}\n"), + "a {\ + \n b: hsl(262.3902012265, 103.5328302701%, 15.4158592357%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 none 0.2 0.3), hsl)}\n"), + "a {\ + \n b: hsl(196.0636856013, 172.1527011916%, 11.3581215767%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -999999 0 0), hsl)}\n"), + "a {\ + \n b: hsl(356.7852726724, 165.043052964%, -41057989.10847678%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -1 0.4 2), hsl)}\n"), + "a {\ + \n b: hsl(210.5153182162, 325.7395089334%, 48.9349840904%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 1 1 1), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 100%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/display_p3/hwb.rs b/rsass/tests/spec/core_functions/color/to_space/display_p3/hwb.rs new file mode 100644 index 000000000..92bbb7ce9 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/display_p3/hwb.rs @@ -0,0 +1,194 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/display_p3/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(display-p3 0.1 0.2 0.3 / 0.4), hwb));\n" + ), + "a {\ + \n value: hsla(205.417452683, 67.7488400949%, 18.4043245596%, 0.4);\ + \n space: hwb;\ + \n channels: 205.417452683deg 5.9356081432% 69.1269590239% / 0.4;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(display-p3 0.1 0.2 0.3 / 0.0), hwb));\n" + ), + "a {\ + \n value: hsla(205.417452683, 67.7488400949%, 18.4043245596%, 0);\ + \n space: hwb;\ + \n channels: 205.417452683deg 5.9356081432% 69.1269590239% / 0;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(display-p3 0 0 0), hwb));\n" + ), + "a {\ + \n value: black;\ + \n space: hwb;\ + \n channels: 0deg 0% 100% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(display-p3 0.5 0.5 0.5), hwb));\n" + ), + "a {\ + \n value: hsl(0, 0%, 50%);\ + \n space: hwb;\ + \n channels: 0deg 50% 50% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(display-p3 0.2 0.4 0.8), hwb));\n" + ), + "a {\ + \n value: hsl(214.974668252, 77.667451385%, 46.5940983001%);\ + \n space: hwb;\ + \n channels: 214.974668252deg 10.4056496546% 17.2174530544% / 1;\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \na {b: color.to-space(color(display-p3 0.1 0.2 none), hwb)}\n"), + "a {\ + \n b: hsl(96.0435532608, 143.3480015017%, 8.3456369204%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(display-p3 0.1 none 0.3), hwb));\n" + ), + "a {\ + \n value: hsl(262.3902012265, 103.5328302701%, 15.4158592357%);\ + \n space: hwb;\ + \n channels: 262.3902012265deg -0.5446161415% 68.6236653872% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(display-p3 none 0.2 0.3), hwb));\n" + ), + "a {\ + \n value: hsl(196.0636856013, 172.1527011916%, 11.3581215767%);\ + \n space: hwb;\ + \n channels: 196.0636856013deg -8.1951915222% 69.0885653244% / 1;\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(display-p3 -999999 0 0), hwb));\n" + ), + "a {\ + \n value: hsl(356.7852726724, 165.043052964%, -41057989.10847679%);\ + \n space: hwb;\ + \n channels: 176.7852726724deg -108821347.81871557% -26705269.601762004% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(display-p3 -1 0.4 2), hwb));\n" + ), + "a {\ + \n value: hsl(210.5153182162, 325.7395089334%, 48.9349840904%);\ + \n space: hwb;\ + \n channels: 210.5153182162deg -110.4655927824% -108.3355609633% / 1;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(display-p3 1 1 1), hwb));\n" + ), + "a {\ + \n value: white;\ + \n space: hwb;\ + \n channels: 0deg 100% 0% / 1;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/display_p3/lab.rs b/rsass/tests/spec/core_functions/color/to_space/display_p3/lab.rs new file mode 100644 index 000000000..a431b98d9 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/display_p3/lab.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/display_p3/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.4), lab)}\n" + ), + "a {\ + \n b: lab(20.127570568% -5.1428777609 -20.6370940019 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.0), lab)}\n" + ), + "a {\ + \n b: lab(20.127570568% -5.1428777609 -20.6370940019 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0 0 0), lab)}\n"), + "a {\ + \n b: lab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.5 0.5 0.5), lab)}\n"), + "a {\ + \n b: lab(53.3889647411% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.2 0.4 0.8), lab)}\n"), + "a {\ + \n b: lab(44.25592932% 9.6200905548 -62.9637824368);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 none), lab)}\n"), + "a {\ + \n b: lab(18.0687084518% -22.5066779572 28.5560007052);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 none 0.3), lab)}\n"), + "a {\ + \n b: lab(6.5882355616% 31.9260289697 -43.3240229048);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 none 0.2 0.3), lab)}\n"), + "a {\ + \n b: lab(19.1369530209% -11.4360315052 -22.3500016909);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -999999 0 0), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz -107482877956690.4 -50580177881913.99 3039800.685913086) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -1 0.4 2), lab)}\n"), + "a {\ + \n b: lab(49.5672259701% 56.9674744357 -222.3639264513);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 1 1 1), lab)}\n"), + "a {\ + \n b: lab(100% 0 0);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/display_p3/lch.rs b/rsass/tests/spec/core_functions/color/to_space/display_p3/lch.rs new file mode 100644 index 000000000..2edf7c93e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/display_p3/lch.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/display_p3/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.4), lch)}\n" + ), + "a {\ + \n b: lch(20.127570568% 21.268258991 256.0066071682deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.0), lch)}\n" + ), + "a {\ + \n b: lch(20.127570568% 21.268258991 256.0066071682deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0 0 0), lch)}\n"), + "a {\ + \n b: lch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.5 0.5 0.5), lch)}\n"), + "a {\ + \n b: lch(53.3889647411% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.2 0.4 0.8), lch)}\n"), + "a {\ + \n b: lch(44.25592932% 63.6944584797 278.686909273deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 none), lch)}\n"), + "a {\ + \n b: lch(18.0687084518% 36.3592591914 128.2437408357deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 none 0.3), lch)}\n"), + "a {\ + \n b: lch(6.5882355616% 53.8167472672 306.386978589deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 none 0.2 0.3), lch)}\n"), + "a {\ + \n b: lch(19.1369530209% 25.1058836166 242.9021173179deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -999999 0 0), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz -107482896009634.61 -50580183886727.57 -376620475.52490234) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -1 0.4 2), lch)}\n"), + "a {\ + \n b: lch(49.5672259701% 229.5452219725 284.3695672545deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 1 1 1), lch)}\n"), + "a {\ + \n b: lch(100% 0 none);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/display_p3/mod.rs b/rsass/tests/spec/core_functions/color/to_space/display_p3/mod.rs new file mode 100644 index 000000000..1b4c7d14b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/display_p3/mod.rs @@ -0,0 +1,36 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/display_p3" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod a98_rgb; + +mod display_p3; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_space/display_p3/oklab.rs b/rsass/tests/spec/core_functions/color/to_space/display_p3/oklab.rs new file mode 100644 index 000000000..313585c1f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/display_p3/oklab.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/display_p3/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.4), oklab)}\n" + ), + "a {\ + \n b: oklab(31.275110206% -0.0275076842 -0.0572559178 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.0), oklab)}\n" + ), + "a {\ + \n b: oklab(31.275110206% -0.0275076842 -0.0572559178 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0 0 0), oklab)}\n"), + "a {\ + \n b: oklab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.5 0.5 0.5), oklab)}\n" + ), + "a {\ + \n b: oklab(59.8180726623% 0 0.0000000223);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.2 0.4 0.8), oklab)}\n" + ), + "a {\ + \n b: oklab(53.396034367% -0.0363375257 -0.1775421972);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 none), oklab)}\n" + ), + "a {\ + \n b: oklab(28.5078223716% -0.0706258662 0.0690953652);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 none 0.3), oklab)}\n" + ), + "a {\ + \n b: oklab(21.8336364075% 0.0395324831 -0.121787855);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 none 0.2 0.3), oklab)}\n" + ), + "a {\ + \n b: oklab(30.2321904625% -0.0504866606 -0.0622983016);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -999999 0 0), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz -107482878101233.5 -50580177929992.28 0.0234375) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -1 0.4 2), oklab)}\n"), + "a {\ + \n b: oklab(48.9249793468% -2.2018228016 -0.629877265);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 1 1 1), oklab)}\n"), + "a {\ + \n b: oklab(99.9999993474% 0.0000000001 0.0000000373);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/display_p3/oklch.rs b/rsass/tests/spec/core_functions/color/to_space/display_p3/oklch.rs new file mode 100644 index 000000000..05a00be06 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/display_p3/oklch.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/display_p3/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.4), oklch)}\n" + ), + "a {\ + \n b: oklch(31.275110206% 0.0635209636 244.3387920511deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.0), oklch)}\n" + ), + "a {\ + \n b: oklch(31.275110206% 0.0635209636 244.3387920511deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0 0 0), oklch)}\n"), + "a {\ + \n b: oklch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.5 0.5 0.5), oklch)}\n" + ), + "a {\ + \n b: oklch(59.8180726623% 0.0000000223 89.8755628286deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.2 0.4 0.8), oklch)}\n" + ), + "a {\ + \n b: oklch(53.396034367% 0.1812226464 258.4330310876deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 none), oklch)}\n" + ), + "a {\ + \n b: oklch(28.5078223716% 0.0988037573 135.6275906956deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 none 0.3), oklch)}\n" + ), + "a {\ + \n b: oklch(21.8336364075% 0.1280433475 287.9834922303deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 none 0.2 0.3), oklch)}\n" + ), + "a {\ + \n b: oklch(30.2321904625% 0.0801871641 230.9786265053deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -999999 0 0), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz -107482878101233.53 -50580177929992.31 0.078125) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -1 0.4 2), oklch)}\n"), + "a {\ + \n b: oklch(48.9249793468% 2.2901460693 195.9642805578deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 1 1 1), oklch)}\n"), + "a {\ + \n b: oklch(99.9999993474% 0.0000000373 89.8755630959deg);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/display_p3/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/display_p3/prophoto_rgb.rs new file mode 100644 index 000000000..59a3759a3 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/display_p3/prophoto_rgb.rs @@ -0,0 +1,165 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/display_p3/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.4), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1280122112 0.1488387497 0.2305514968 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1280122112 0.1488387497 0.2305514968 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0 0 0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.5 0.5 0.5), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.4246723949 0.4246723949 0.4246723949);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.2 0.4 0.8), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.3388390747 0.3342960169 0.7393352444);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 none), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.0911473149 0.1429690366 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 none 0.3), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1061223268 none 0.2275163591);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 none 0.2 0.3), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb none 0.1466998342 0.2305744173);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -999999 0 0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -72137964.95638128 -23392436.47544621 2293597.437985952);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -1 0.4 2), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.363190311 0.3948251642 2.3672559908);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 1 1 1), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/display_p3/rec2020.rs b/rsass/tests/spec/core_functions/color/to_space/display_p3/rec2020.rs new file mode 100644 index 000000000..da24cfeec --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/display_p3/rec2020.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/display_p3/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.4), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.0792630187 0.1360787348 0.2384262851 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.0), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.0792630187 0.1360787348 0.2384262851 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0 0 0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.5 0.5 0.5), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.4500400319 0.4500400319 0.4500400319);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.2 0.4 0.8), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.2536165098 0.3459256961 0.7717684009);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 none), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.0635852545 0.1330813978 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 none 0.3), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.0496776807 none 0.237203952);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 none 0.2 0.3), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 none 0.1345809807 0.2384516749);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -999999 0 0), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 -2759152.3635634547 -781900.5819995644 152514.0918455245);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -1 0.4 2), rec2020)}\n"), + "a {\ + \n b: color(rec2020 -0.699464711 0.3562683997 2.1433011781);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 1 1 1), rec2020)}\n"), + "a {\ + \n b: color(rec2020 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/display_p3/rgb.rs b/rsass/tests/spec/core_functions/color/to_space/display_p3/rgb.rs new file mode 100644 index 000000000..e37581842 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/display_p3/rgb.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/display_p3/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.4), rgb)}\n" + ), + "a {\ + \n b: rgba(15.1358007651, 51.7877986787, 78.726254489, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.0), rgb)}\n" + ), + "a {\ + \n b: rgba(15.1358007651, 51.7877986787, 78.726254489, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0 0 0), rgb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.5 0.5 0.5), rgb)}\n"), + "a {\ + \n b: rgb(127.5, 127.5, 127.5);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.2 0.4 0.8), rgb)}\n"), + "a {\ + \n b: rgb(26.5344066192, 103.5127809071, 211.0954947112);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 none), rgb)}\n"), + "a {\ + \n b: rgb(15.1358007651, 51.7877986787, 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 none 0.3), rgb)}\n"), + "a {\ + \n b: rgb(28.9866805453, 0, 80.0096532626);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 none 0.2 0.3), rgb)}\n"), + "a {\ + \n b: rgb(0, 52.1258051255, 78.8241584227);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -999999 0 0), rgb)}\n"), + "a {\ + \n b: hsl(356.7852726724, 165.043052964%, -41057989.10847678%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -1 0.4 2), rgb)}\n"), + "a {\ + \n b: hsl(210.5153182162, 325.7395089334%, 48.9349840904%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 1 1 1), rgb)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/display_p3/srgb.rs b/rsass/tests/spec/core_functions/color/to_space/display_p3/srgb.rs new file mode 100644 index 000000000..dba040d2f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/display_p3/srgb.rs @@ -0,0 +1,155 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/display_p3/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.4), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.0593560814 0.2030894066 0.3087304098 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.0), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.0593560814 0.2030894066 0.3087304098 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0 0 0), srgb)}\n"), + "a {\ + \n b: color(srgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.5 0.5 0.5), srgb)}\n"), + "a {\ + \n b: color(srgb 0.5 0.5 0.5);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.2 0.4 0.8), srgb)}\n"), + "a {\ + \n b: color(srgb 0.1040564965 0.4059324741 0.8278254695);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 none), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.0593560814 0.2030894066 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 none 0.3), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.113673257 none 0.3137633461);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 none 0.2 0.3), srgb)}\n" + ), + "a {\ + \n b: color(srgb none 0.2044149221 0.3091143468);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -999999 0 0), srgb)}\n" + ), + "a {\ + \n b: color(srgb -1088213.4781871557 267053.69601762 194440.1223316972);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -1 0.4 2), srgb)}\n"), + "a {\ + \n b: color(srgb -1.1046559278 0.4619691673 2.0833556096);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 1 1 1), srgb)}\n"), + "a {\ + \n b: color(srgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/display_p3/srgb_linear.rs b/rsass/tests/spec/core_functions/color/to_space/display_p3/srgb_linear.rs new file mode 100644 index 000000000..0d2bcfb4c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/display_p3/srgb_linear.rs @@ -0,0 +1,165 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/display_p3/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.4), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0048307697 0.0340755227 0.07763636 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0048307697 0.0340755227 0.07763636 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0 0 0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.5 0.5 0.5), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2140411405 0.2140411405 0.2140411405);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.2 0.4 0.8), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0106639349 0.1370640729 0.6520692893);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 none), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0048307697 0.0340755227 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 none 0.3), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0122773617 none 0.080239588);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 none 0.2 0.3), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear none 0.0344970522 0.0778331838);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -999999 0 0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -270587662527413.8 9290325591630.637 4337909799389.2847);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -1 0.4 2), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -1.2548276 0.1805133132 5.4498673233);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 1 1 1), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/display_p3/xyz.rs b/rsass/tests/spec/core_functions/color/to_space/display_p3/xyz.rs new file mode 100644 index 000000000..5a4a9fc8e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/display_p3/xyz.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/display_p3/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.4), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.0281889097 0.0310017052 0.0779508635 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.0), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.0281889097 0.0310017052 0.0779508635 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0 0 0), xyz)}\n"), + "a {\ + \n b: color(xyz 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.5 0.5 0.5), xyz)}\n"), + "a {\ + \n b: color(xyz 0.2034366706 0.2140411405 0.233103163);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.2 0.4 0.8), xyz)}\n"), + "a {\ + \n b: color(xyz 0.171095654 0.1473658922 0.6363562895);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 none), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0136716827 0.0251948144 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 none 0.3), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0193940428 none 0.0764573956);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 none 0.2 0.3), xyz)}\n"), + "a {\ + \n b: color(xyz none 0.0287067331 0.0779508635);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -999999 0 0), xyz)}\n"), + "a {\ + \n b: color(xyz -107482878101233.7 -50580177929992.33 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -1 0.4 2), xyz)}\n"), + "a {\ + \n b: color(xyz 0.5306657282 0.2557107148 5.1775335161);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 1 1 1), xyz)}\n"), + "a {\ + \n b: color(xyz 0.9504559271 1 1.0890577508);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/display_p3/xyz_d50.rs b/rsass/tests/spec/core_functions/color/to_space/display_p3/xyz_d50.rs new file mode 100644 index 000000000..683826525 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/display_p3/xyz_d50.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/display_p3/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.4), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0263388599 0.0302094144 0.0588154349 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 0.3 / 0.0), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0263388599 0.0302094144 0.0588154349 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0 0 0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.5 0.5 0.5), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.2063989463 0.2140411405 0.1766063301);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.2 0.4 0.8), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.1507376549 0.1401604229 0.4790971056);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 0.2 none), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0148301452 0.0253333744 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 0.1 none 0.3), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0166719376 none 0.0574290645);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 none 0.2 0.3), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 none 0.0277919056 0.0588259602);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -999999 0 0), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 -113795166948730.92 -53280831691639.766 231974346711.36108);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 -1 0.4 2), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.3020960462 0.1805869911 3.8917991009);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(display-p3 1 1 1), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.9642956764 1 0.8251046025);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/error.rs b/rsass/tests/spec/core_functions/color/to_space/error.rs new file mode 100644 index 000000000..f6eb5cc36 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/error.rs @@ -0,0 +1,116 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/error.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("error") +} + +#[test] +#[ignore] // wrong error +fn quoted_space() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.to-space(#abc, \"hsl\")}\n" + ), + "Error: $space: Expected \"hsl\" to be an unquoted string.\ + \n ,\ + \n2 | a {b: color.to-space(#abc, \"hsl\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn too_few_args() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.to-space(#abc)}\n" + ), + "Error: Missing argument $space.\ + \n ,--> input.scss\ + \n2 | a {b: color.to-space(#abc)}\ + \n | ^^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function to-space($color, $space) {\ + \n | ======================== declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +#[ignore] // wrong error +fn too_many_args() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.to-space(#abc, rgb, hsl)}\n" + ), + "Error: Only 2 arguments allowed, but 3 were passed.\ + \n ,--> input.scss\ + \n2 | a {b: color.to-space(#abc, rgb, hsl)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n \'\ + \n ,--> sass:color\ + \n1 | @function to-space($color, $space) {\ + \n | ======================== declaration\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} +mod test_type { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong error + fn color() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.to-space(1, rgb)}\n" + ), + "Error: $color: 1 is not a color.\ + \n ,\ + \n2 | a {b: color.to-space(1, rgb)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + #[ignore] // wrong error + fn space() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.to-space(#abc, #def)}\n" + ), + "Error: $space: #def is not a string.\ + \n ,\ + \n2 | a {b: color.to-space(#abc, #def)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } +} +#[test] +#[ignore] // wrong error +fn undefined_space() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.to-space(#abc, c)}\n" + ), + "Error: $space: Unknown color space \"c\".\ + \n ,\ + \n2 | a {b: color.to-space(#abc, c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hsl/a98_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/hsl/a98_rgb.rs new file mode 100644 index 000000000..969cbae65 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hsl/a98_rgb.rs @@ -0,0 +1,158 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hsl/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.4), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.3376779392 0.2673823092 0.2497033225 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.3376779392 0.2673823092 0.2497033225 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 0%), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20.123456789deg 30.987654321% 60.192837465%), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.6777775446 0.5562111042 0.4789015947);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 50%), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.4961036984 0.4961036984 0.4961036984);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(80deg 30% 60%), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.6581397554 0.7142002384 0.4892168037);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(none 20% 30%), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.333838384 0.2489105042 0.2489105042);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% none), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg none 30%), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.3046424286 0.3046424286 0.3046424286);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 999999% 50%), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 8698.1693722094 -3093.7862337018 -10082.3258830858);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 200% -50%), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb -1.3133426101 -0.1822173447 0.4856606142);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 100%), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hsl/display_p3.rs b/rsass/tests/spec/core_functions/color/to_space/hsl/display_p3.rs new file mode 100644 index 000000000..1064945a3 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hsl/display_p3.rs @@ -0,0 +1,162 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hsl/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.4), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.3447505085 0.2640504184 0.244140094 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.3447505085 0.2640504184 0.244140094 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 0%), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20.123456789deg 30.987654321% 60.192837465%), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.6997472063 0.5677618984 0.490693255);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 50%), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.5 0.5 0.5);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(80deg 30% 60%), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.655133397 0.7175281483 0.505602812);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(none 20% 30%), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.3423085422 0.2451135243 0.2426469173);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% none), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg none 30%), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.3 0.3 0.3);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 999999% 50%), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 4579.6059857545 -1251.0810767168 -4781.6821693604);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 200% -50%), display-p3)}\n"), + "a {\ + \n b: color(display-p3 -1.3795832908 -0.3608862783 0.4233635373);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 100%), display-p3)}\n"), + "a {\ + \n b: color(display-p3 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hsl/hsl.rs b/rsass/tests/spec/core_functions/color/to_space/hsl/hsl.rs new file mode 100644 index 000000000..743ce6cea --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hsl/hsl.rs @@ -0,0 +1,67 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hsl/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +#[test] +#[ignore] // unexepected error +fn in_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 20% 40%), hsl)}\n"), + "a {\ + \n b: hsl(0, 20%, 40%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(none 20% 30%), hsl)}\n"), + "a {\ + \n b: hsl(none 20% 30%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% none), hsl)}\n"), + "a {\ + \n b: hsl(10deg 20% none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg none 30%), hsl)}\n"), + "a {\ + \n b: hsl(10deg none 30%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 200% -50%), hsl)}\n"), + "a {\ + \n b: hsl(20, 200%, -50%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hsl/hwb.rs b/rsass/tests/spec/core_functions/color/to_space/hsl/hwb.rs new file mode 100644 index 000000000..d866fd5f5 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hsl/hwb.rs @@ -0,0 +1,156 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hsl/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.4), hwb)}\n"), + "a {\ + \n b: hsla(10, 20%, 30%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.0), hwb)}\n"), + "a {\ + \n b: hsla(10, 20%, 30%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 0%), hwb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20.123456789deg 30.987654321% 60.192837465%), hwb)}\n" + ), + "a {\ + \n b: hsl(20.123456789, 30.987654321%, 60.192837465%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 50%), hwb)}\n"), + "a {\ + \n b: hsl(0, 0%, 50%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(80deg 30% 60%), hwb)}\n"), + "a {\ + \n b: hsl(80, 30%, 60%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(none 20% 30%), hwb)}\n"), + "a {\ + \n b: hsl(0, 20%, 30%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% none), hwb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg none 30%), hwb)}\n"), + "a {\ + \n b: hsl(0, 0%, 30%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 999999% 50%), hwb)}\n"), + "a {\ + \n b: hsl(20, 999999%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 200% -50%), hwb)}\n"), + "a {\ + \n b: hsl(20, 200%, -50%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 100%), hwb)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hsl/lab.rs b/rsass/tests/spec/core_functions/color/to_space/hsl/lab.rs new file mode 100644 index 000000000..1e1b94c12 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hsl/lab.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hsl/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.4), lab)}\n"), + "a {\ + \n b: lab(30.8688486066% 10.7899742234 7.6662278505 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.0), lab)}\n"), + "a {\ + \n b: lab(30.8688486066% 10.7899742234 7.6662278505 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 0%), lab)}\n"), + "a {\ + \n b: lab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20.123456789deg 30.987654321% 60.192837465%), lab)}\n" + ), + "a {\ + \n b: lab(63.0942649983% 14.1332827511 17.6588648805);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 50%), lab)}\n"), + "a {\ + \n b: lab(53.3889647411% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(80deg 30% 60%), lab)}\n"), + "a {\ + \n b: lab(71.9297767616% -15.056348508 28.7197360328);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(none 20% 30%), lab)}\n"), + "a {\ + \n b: lab(29.467709003% 13.8451863493 5.7231513228);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% none), lab)}\n"), + "a {\ + \n b: lab(none 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg none 30%), lab)}\n"), + "a {\ + \n b: lab(32.5331750598% 0 0);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 999999% 50%), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz 136956388.39988723 59264689.52803929 -623200798.6169883) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 200% -50%), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz -1.0161268876 -0.540961491 0.1515884565) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 100%), lab)}\n"), + "a {\ + \n b: lab(100% 0 0);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hsl/lch.rs b/rsass/tests/spec/core_functions/color/to_space/hsl/lch.rs new file mode 100644 index 000000000..46d22ce6c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hsl/lch.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hsl/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.4), lch)}\n"), + "a {\ + \n b: lch(30.8688486066% 13.2361094434 35.393621554deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.0), lch)}\n"), + "a {\ + \n b: lch(30.8688486066% 13.2361094434 35.393621554deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 0%), lch)}\n"), + "a {\ + \n b: lch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20.123456789deg 30.987654321% 60.192837465%), lch)}\n" + ), + "a {\ + \n b: lch(63.0942649983% 22.6182490522 51.3279458157deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 50%), lch)}\n"), + "a {\ + \n b: lch(53.3889647411% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(80deg 30% 60%), lch)}\n"), + "a {\ + \n b: lch(71.9297767616% 32.4271008292 117.6658176085deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(none 20% 30%), lch)}\n"), + "a {\ + \n b: lch(29.467709003% 14.981443392 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% none), lch)}\n"), + "a {\ + \n b: lch(none 0 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg none 30%), lch)}\n"), + "a {\ + \n b: lch(32.5331750598% none none);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 999999% 50%), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz 136956388.67576775 59264689.51984791 -623200798.6134329) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 200% -50%), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz -1.0161268876 -0.540961491 0.1515884565) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 100%), lch)}\n"), + "a {\ + \n b: lch(100% 0 none);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hsl/mod.rs b/rsass/tests/spec/core_functions/color/to_space/hsl/mod.rs new file mode 100644 index 000000000..ba67f8492 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hsl/mod.rs @@ -0,0 +1,36 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hsl" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod a98_rgb; + +mod display_p3; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_space/hsl/oklab.rs b/rsass/tests/spec/core_functions/color/to_space/hsl/oklab.rs new file mode 100644 index 000000000..0a349b90e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hsl/oklab.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hsl/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.4), oklab)}\n"), + "a {\ + \n b: oklab(40.6685296273% 0.0313239047 0.0191932237 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.0), oklab)}\n"), + "a {\ + \n b: oklab(40.6685296273% 0.0313239047 0.0191932237 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 0%), oklab)}\n"), + "a {\ + \n b: oklab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20.123456789deg 30.987654321% 60.192837465%), oklab)}\n" + ), + "a {\ + \n b: oklab(68.4523446414% 0.0396042277 0.0440734803);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 50%), oklab)}\n"), + "a {\ + \n b: oklab(59.8180726623% 0 0.0000000223);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(80deg 30% 60%), oklab)}\n"), + "a {\ + \n b: oklab(75.0578295808% -0.0474046375 0.0717748467);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(none 20% 30%), oklab)}\n"), + "a {\ + \n b: oklab(39.5815064245% 0.0409008812 0.014221487);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% none), oklab)}\n"), + "a {\ + \n b: oklab(none 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg none 30%), oklab)}\n"), + "a {\ + \n b: oklab(41.838943744% 0 0.0000000156);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 999999% 50%), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz 136956388.3998871 59264689.52803931 -623200798.6169885) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 200% -50%), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz -1.0161268876 -0.540961491 0.1515884565) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 100%), oklab)}\n"), + "a {\ + \n b: oklab(99.9999993474% 0.0000000001 0.0000000373);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hsl/oklch.rs b/rsass/tests/spec/core_functions/color/to_space/hsl/oklch.rs new file mode 100644 index 000000000..3fcbf2c3b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hsl/oklch.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hsl/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.4), oklch)}\n"), + "a {\ + \n b: oklch(40.6685296273% 0.0367364512 31.4972209471deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.0), oklch)}\n"), + "a {\ + \n b: oklch(40.6685296273% 0.0367364512 31.4972209471deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 0%), oklch)}\n"), + "a {\ + \n b: oklch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20.123456789deg 30.987654321% 60.192837465%), oklch)}\n" + ), + "a {\ + \n b: oklch(68.4523446414% 0.0592534093 48.0572806164deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 50%), oklch)}\n"), + "a {\ + \n b: oklch(59.8180726623% 0.0000000223 89.8755628286deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(80deg 30% 60%), oklch)}\n"), + "a {\ + \n b: oklch(75.0578295808% 0.0860164419 123.4432897448deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(none 20% 30%), oklch)}\n"), + "a {\ + \n b: oklch(39.5815064245% 0.0433028033 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% none), oklch)}\n"), + "a {\ + \n b: oklch(none 0 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg none 30%), oklch)}\n"), + "a {\ + \n b: oklch(41.838943744% none 89.8755626743deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 999999% 50%), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz 136956388.39988703 59264689.52803931 -623200798.6169883) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 200% -50%), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz -1.0161268876 -0.540961491 0.1515884565) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 100%), oklch)}\n"), + "a {\ + \n b: oklch(99.9999993474% 0.0000000373 89.8755630959deg);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hsl/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/hsl/prophoto_rgb.rs new file mode 100644 index 000000000..88cd1776c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hsl/prophoto_rgb.rs @@ -0,0 +1,162 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hsl/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.4), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2477526404 0.2091534142 0.1870234357 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2477526404 0.2091534142 0.1870234357 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 0%), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20.123456789deg 30.987654321% 60.192837465%), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.5797795588 0.5061830996 0.4192105931);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 50%), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.4246723949 0.4246723949 0.4246723949);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(80deg 30% 60%), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.583675038 0.6482529636 0.4440565473);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(none 20% 30%), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.2432349971 0.1951926314 0.1850133783);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% none), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg none 30%), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.2340459828 0.2340459828 0.2340459828);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 999999% 50%), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 45494.0440115899 5344.0720850434 -73058.7852099565);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 200% -50%), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb -1.16705518 -0.4773670849 0.334978827);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 100%), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hsl/rec2020.rs b/rsass/tests/spec/core_functions/color/to_space/hsl/rec2020.rs new file mode 100644 index 000000000..b57235df5 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hsl/rec2020.rs @@ -0,0 +1,158 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hsl/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.4), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.2670145784 0.2070036582 0.18272592 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.2670145784 0.2070036582 0.18272592 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 0%), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20.123456789deg 30.987654321% 60.192837465%), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.6312163333 0.5293329902 0.4413441586);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 50%), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.4500400319 0.4500400319 0.4500400319);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(80deg 30% 60%), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.6252433371 0.6805013998 0.4608722597);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(none 20% 30%), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.2619751449 0.1889937521 0.1808798805);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% none), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg none 30%), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.2397416118 0.2397416118 0.2397416118);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 999999% 50%), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 7903.4152677186 -1170.118178736 -9706.8206181475);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 200% -50%), rec2020)}\n"), + "a {\ + \n b: color(rec2020 -1.2552227887 -0.4270321041 0.3660380417);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 100%), rec2020)}\n"), + "a {\ + \n b: color(rec2020 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hsl/rgb.rs b/rsass/tests/spec/core_functions/color/to_space/hsl/rgb.rs new file mode 100644 index 000000000..2a97d4816 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hsl/rgb.rs @@ -0,0 +1,156 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hsl/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.4), rgb)}\n"), + "a {\ + \n b: rgba(91.8, 66.3, 61.2, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.0), rgb)}\n"), + "a {\ + \n b: rgba(91.8, 66.3, 61.2, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 0%), rgb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20.123456789deg 30.987654321% 60.192837465%), rgb)}\n" + ), + "a {\ + \n b: rgb(184.9467656352, 143.1361700697, 122.0367054363);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 50%), rgb)}\n"), + "a {\ + \n b: rgb(127.5, 127.5, 127.5);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(80deg 30% 60%), rgb)}\n"), + "a {\ + \n b: rgb(163.2, 183.6, 122.4);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(none 20% 30%), rgb)}\n"), + "a {\ + \n b: rgb(91.8, 61.2, 61.2);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% none), rgb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg none 30%), rgb)}\n"), + "a {\ + \n b: rgb(76.5, 76.5, 76.5);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 999999% 50%), rgb)}\n"), + "a {\ + \n b: hsl(20, 999999%, 50%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 200% -50%), rgb)}\n"), + "a {\ + \n b: hsl(20, 200%, -50%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 100%), rgb)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hsl/srgb.rs b/rsass/tests/spec/core_functions/color/to_space/hsl/srgb.rs new file mode 100644 index 000000000..f9b86a05b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hsl/srgb.rs @@ -0,0 +1,156 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hsl/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.4), srgb)}\n"), + "a {\ + \n b: color(srgb 0.36 0.26 0.24 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.0), srgb)}\n"), + "a {\ + \n b: color(srgb 0.36 0.26 0.24 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 0%), srgb)}\n"), + "a {\ + \n b: color(srgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20.123456789deg 30.987654321% 60.192837465%), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.7252814339 0.561318314 0.4785753154);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 50%), srgb)}\n"), + "a {\ + \n b: color(srgb 0.5 0.5 0.5);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(80deg 30% 60%), srgb)}\n"), + "a {\ + \n b: color(srgb 0.64 0.72 0.48);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(none 20% 30%), srgb)}\n"), + "a {\ + \n b: color(srgb 0.36 0.24 0.24);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% none), srgb)}\n"), + "a {\ + \n b: color(srgb 0 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg none 30%), srgb)}\n"), + "a {\ + \n b: color(srgb 0.3 0.3 0.3);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 999999% 50%), srgb)}\n"), + "a {\ + \n b: color(srgb 5000.495 -1666.165 -4999.495);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 200% -50%), srgb)}\n"), + "a {\ + \n b: color(srgb -1.5 -0.1666666667 0.5);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 100%), srgb)}\n"), + "a {\ + \n b: color(srgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hsl/srgb_linear.rs b/rsass/tests/spec/core_functions/color/to_space/hsl/srgb_linear.rs new file mode 100644 index 000000000..2746e0d76 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hsl/srgb_linear.rs @@ -0,0 +1,162 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hsl/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.4), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.106539224 0.0549717327 0.0469642007 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.106539224 0.0549717327 0.0469642007 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 0%), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20.123456789deg 30.987654321% 60.192837465%), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.4848385603 0.2752493311 0.1947438934);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 50%), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.2140411405 0.2140411405 0.2140411405);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(80deg 30% 60%), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.3672464682 0.4769997846 0.1959941793);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(none 20% 30%), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.106539224 0.0469642007 0.0469642007);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% none), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg none 30%), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.0732389559 0.0732389559 0.0732389559);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 999999% 50%), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 663493625.4651376 -47462621.32578329 -663175228.1293004);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 200% -50%), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear -2.5371552394 -0.0236523902 0.2140411405);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 100%), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hsl/xyz.rs b/rsass/tests/spec/core_functions/color/to_space/hsl/xyz.rs new file mode 100644 index 000000000..9efed6529 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hsl/xyz.rs @@ -0,0 +1,158 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hsl/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.4), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0720689624 0.0653589105 0.0532528168 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.0), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0720689624 0.0653589105 0.0532528168 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 0%), xyz)}\n"), + "a {\ + \n b: color(xyz 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20.123456789deg 30.987654321% 60.192837465%), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.333515343 0.3140043025 0.2272909419);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 50%), xyz)}\n"), + "a {\ + \n b: color(xyz 0.2034366706 0.2140411405 0.233103163);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(80deg 30% 60%), xyz)}\n"), + "a {\ + \n b: color(xyz 0.3573899014 0.4333755032 0.2502538283);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(none 20% 30%), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0692055944 0.0596321744 0.0522983607);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% none), xyz)}\n"), + "a {\ + \n b: color(xyz 0 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg none 30%), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0696103997 0.0732389559 0.0797614526);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 999999% 50%), xyz)}\n" + ), + "a {\ + \n b: color(xyz 136956388.39988744 59264689.52803937 -623200798.6169885);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 200% -50%), xyz)}\n"), + "a {\ + \n b: color(xyz -1.0161268876 -0.540961491 0.1515884565);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 100%), xyz)}\n"), + "a {\ + \n b: color(xyz 0.9504559271 1 1.0890577508);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hsl/xyz_d50.rs b/rsass/tests/spec/core_functions/color/to_space/hsl/xyz_d50.rs new file mode 100644 index 000000000..ea629d162 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hsl/xyz_d50.rs @@ -0,0 +1,158 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hsl/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.4), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0743501157 0.0659597326 0.0403572779 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% 30% / 0.0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0743501157 0.0659597326 0.0403572779 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 0%), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20.123456789deg 30.987654321% 60.192837465%), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.3452978329 0.3170012803 0.1725389126);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 50%), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.2063989463 0.2140411405 0.1766063301);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(80deg 30% 60%), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.37190333 0.4355459142 0.1913805991);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(none 20% 30%), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0712660027 0.0602192369 0.0395798961);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg 20% none), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn saturation() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(10deg none 30%), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0706240085 0.0732389559 0.0604297996);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 999999% 50%), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 176160479.28127974 73395911.69654827 -468942304.8608692);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(20deg 200% -50%), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 -1.08485158 -0.5684806881 0.1152232851);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hsl(0deg 0% 100%), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.9642956764 1 0.8251046025);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hwb/a98_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/hwb/a98_rgb.rs new file mode 100644 index 000000000..79b43c407 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hwb/a98_rgb.rs @@ -0,0 +1,158 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hwb/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.4), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.6114401635 0.2890681375 0.2161347988 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.6114401635 0.2890681375 0.2161347988 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 0% 100%), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20.123456789deg 30.987654321% 40.192837465%), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.5470366266 0.4056690546 0.3183176738);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 50% 50%), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.4961036984 0.4961036984 0.4961036984);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(80deg 20% 40%), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.505098443 0.5944145344 0.24376153);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% none), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.8725825543 0.3359890414 0.2191164159);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(none 20% 30%), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.6038713799 0.2123166098 0.2123166098);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg none 30%), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.5990338556 0.1378605656 0.0323177975);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 999999% -999950%), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 21869.1993352833 21868.6190794601 21868.2300804636);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 200% -125%), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 2.295663911 2.1618962385 2.073992407);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 100% 0%), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hwb/display_p3.rs b/rsass/tests/spec/core_functions/color/to_space/hwb/display_p3.rs new file mode 100644 index 000000000..df2316f87 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hwb/display_p3.rs @@ -0,0 +1,162 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hwb/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.4), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.6499865104 0.3093627099 0.2280296402 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.6499865104 0.3093627099 0.2280296402 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 0% 100%), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20.123456789deg 30.987654321% 40.192837465%), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.5699167279 0.4147338146 0.3256408713);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 50% 50%), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.5 0.5 0.5);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(80deg 20% 40%), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.4937237179 0.5961714385 0.263280729);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% none), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.9253883052 0.3826332802 0.2571893552);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(none 20% 30%), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.6455550546 0.2397703326 0.2214676273);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg none 30%), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.6427370384 0.1801457354 0.0902798862);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 999999% -999950%), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 10000.4396382509 10000.1712862873 10000.0110201331);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 200% -125%), display-p3)}\n"), + "a {\ + \n b: color(display-p3 2.221649714 2.0891595287 2.0108056307);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 100% 0%), display-p3)}\n"), + "a {\ + \n b: color(display-p3 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hwb/hsl.rs b/rsass/tests/spec/core_functions/color/to_space/hwb/hsl.rs new file mode 100644 index 000000000..6546624dc --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hwb/hsl.rs @@ -0,0 +1,156 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hwb/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.4), hsl)}\n"), + "a {\ + \n b: hsla(10, 55.5555555556%, 45%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.0), hsl)}\n"), + "a {\ + \n b: hsla(10, 55.5555555556%, 45%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 0% 100%), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 0%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20.123456789deg 30.987654321% 40.192837465%), hsl)}\n" + ), + "a {\ + \n b: hsl(20.123456789, 31.7413583858%, 45.397408428%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 50% 50%), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 50%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(80deg 20% 40%), hsl)}\n"), + "a {\ + \n b: hsl(80, 50%, 40%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% none), hsl)}\n"), + "a {\ + \n b: hsl(10, 100%, 60%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(none 20% 30%), hsl)}\n"), + "a {\ + \n b: hsl(0, 55.5555555556%, 45%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg none 30%), hsl)}\n"), + "a {\ + \n b: hsl(10, 100%, 35%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 999999% -999950%), hsl)}\n"), + "a {\ + \n b: hsl(200, 0.0025501925%, 1000024.4999999999%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 200% -125%), hsl)}\n"), + "a {\ + \n b: hsl(200, 11.1111111111%, 212.5%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 100% 0%), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 100%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hwb/hwb.rs b/rsass/tests/spec/core_functions/color/to_space/hwb/hwb.rs new file mode 100644 index 000000000..d8527000c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hwb/hwb.rs @@ -0,0 +1,67 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hwb/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +#[test] +#[ignore] // unexepected error +fn in_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 20% 30%), hwb)}\n"), + "a {\ + \n b: hsl(0, 55.5555555556%, 45%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% none), hsl)}\n"), + "a {\ + \n b: hsl(10, 100%, 60%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(none 20% 30%), hsl)}\n"), + "a {\ + \n b: hsl(0, 55.5555555556%, 45%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg none 30%), hsl)}\n"), + "a {\ + \n b: hsl(10, 100%, 35%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 200% -125%), hwb)}\n"), + "a {\ + \n b: hsl(200, 11.1111111111%, 212.5%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hwb/lab.rs b/rsass/tests/spec/core_functions/color/to_space/hwb/lab.rs new file mode 100644 index 000000000..a6e5d7375 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hwb/lab.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hwb/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.4), lab)}\n"), + "a {\ + \n b: lab(45.4228859316% 43.1656753022 35.3539928676 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.0), lab)}\n"), + "a {\ + \n b: lab(45.4228859316% 43.1656753022 35.3539928676 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 0% 100%), lab)}\n"), + "a {\ + \n b: lab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20.123456789deg 30.987654321% 40.192837465%), lab)}\n" + ), + "a {\ + \n b: lab(48.7209664558% 18.0179342003 22.2207931535);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 50% 50%), lab)}\n"), + "a {\ + \n b: lab(53.3889647411% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(80deg 20% 40%), lab)}\n"), + "a {\ + \n b: lab(59.1049141497% -23.929516442 47.3632808755);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% none), lab)}\n"), + "a {\ + \n b: lab(60.7483623827% 64.2863186591 55.7098309346);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(none 20% 30%), lab)}\n"), + "a {\ + \n b: lab(42.0638915398% 51.8940588399 31.6507145358);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg none 30%), lab)}\n"), + "a {\ + \n b: lab(39.3870160342% 57.3703400949 53.7905111747);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 999999% -999950%), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz 3327825161.664072 3501247104.3035965 3812875110.896886) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 200% -125%), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz 5.5338099778 5.6426521513 5.4845096668) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 100% 0%), lab)}\n"), + "a {\ + \n b: lab(100% 0 0);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hwb/lch.rs b/rsass/tests/spec/core_functions/color/to_space/hwb/lch.rs new file mode 100644 index 000000000..15a890002 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hwb/lch.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hwb/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.4), lch)}\n"), + "a {\ + \n b: lch(45.4228859316% 55.7958809947 39.3185127962deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.0), lch)}\n"), + "a {\ + \n b: lch(45.4228859316% 55.7958809947 39.3185127962deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 0% 100%), lch)}\n"), + "a {\ + \n b: lch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20.123456789deg 30.987654321% 40.192837465%), lch)}\n" + ), + "a {\ + \n b: lch(48.7209664558% 28.6078590813 50.9628149158deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 50% 50%), lch)}\n"), + "a {\ + \n b: lch(53.3889647411% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(80deg 20% 40%), lch)}\n"), + "a {\ + \n b: lch(59.1049141497% 53.0650745071 116.8044348895deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% none), lch)}\n"), + "a {\ + \n b: lch(60.7483623827% 85.0665388358 40.9118491907deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(none 20% 30%), lch)}\n"), + "a {\ + \n b: lch(42.0638915398% 60.7845463379 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg none 30%), lch)}\n"), + "a {\ + \n b: lch(39.3870160342% 78.6433405639 43.1554816825deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 999999% -999950%), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz 3327825161.664072 3501247104.3035965 3812875110.896886) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 200% -125%), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz 5.5338099778 5.6426521513 5.4845096668) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 100% 0%), lch)}\n"), + "a {\ + \n b: lch(100% 0 none);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hwb/mod.rs b/rsass/tests/spec/core_functions/color/to_space/hwb/mod.rs new file mode 100644 index 000000000..826534d2b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hwb/mod.rs @@ -0,0 +1,36 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hwb" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod a98_rgb; + +mod display_p3; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_space/hwb/oklab.rs b/rsass/tests/spec/core_functions/color/to_space/hwb/oklab.rs new file mode 100644 index 000000000..b34fb6dfa --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hwb/oklab.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hwb/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.4), oklab)}\n"), + "a {\ + \n b: oklab(54.0481985043% 0.1200265651 0.0782231914 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.0), oklab)}\n"), + "a {\ + \n b: oklab(54.0481985043% 0.1200265651 0.0782231914 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 0% 100%), oklab)}\n"), + "a {\ + \n b: oklab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20.123456789deg 30.987654321% 40.192837465%), oklab)}\n" + ), + "a {\ + \n b: oklab(56.1528329965% 0.0492061827 0.0538160955);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 50% 50%), oklab)}\n"), + "a {\ + \n b: oklab(59.8180726623% 0 0.0000000223);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(80deg 20% 40%), oklab)}\n"), + "a {\ + \n b: oklab(63.6472338735% -0.0788719974 0.109198804);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% none), oklab)}\n"), + "a {\ + \n b: oklab(67.8199997859% 0.1771510758 0.1158916741);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(none 20% 30%), oklab)}\n"), + "a {\ + \n b: oklab(51.4791394597% 0.1488491412 0.0695742279);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg none 30%), oklab)}\n"), + "a {\ + \n b: oklab(49.2675905721% 0.1574612806 0.0989515664);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 999999% -999950%), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz 3327825161.6640716 3501247104.3035994 3812875110.896889) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 200% -125%), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz 5.5338099778 5.6426521513 5.4845096668) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 100% 0%), oklab)}\n"), + "a {\ + \n b: oklab(99.9999993474% 0.0000000001 0.0000000373);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hwb/oklch.rs b/rsass/tests/spec/core_functions/color/to_space/hwb/oklch.rs new file mode 100644 index 000000000..00822211c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hwb/oklch.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hwb/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.4), oklch)}\n"), + "a {\ + \n b: oklch(54.0481985043% 0.1432663394 33.0929168902deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.0), oklch)}\n"), + "a {\ + \n b: oklch(54.0481985043% 0.1432663394 33.0929168902deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 0% 100%), oklch)}\n"), + "a {\ + \n b: oklch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20.123456789deg 30.987654321% 40.192837465%), oklch)}\n" + ), + "a {\ + \n b: oklch(56.1528329965% 0.0729206456 47.5620912167deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 50% 50%), oklch)}\n"), + "a {\ + \n b: oklch(59.8180726623% 0.0000000223 89.8755628286deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(80deg 20% 40%), oklch)}\n"), + "a {\ + \n b: oklch(63.6472338735% 0.1347040117 125.8397889312deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% none), oklch)}\n"), + "a {\ + \n b: oklch(67.8199997859% 0.2116917187 33.1925848215deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(none 20% 30%), oklch)}\n"), + "a {\ + \n b: oklch(51.4791394597% 0.1643065429 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg none 30%), oklch)}\n"), + "a {\ + \n b: oklch(49.2675905721% 0.1859716843 32.1460100423deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 999999% -999950%), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz 3327825161.6640716 3501247104.3035994 3812875110.896889) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 200% -125%), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz 5.5338099778 5.6426521513 5.4845096668) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 100% 0%), oklch)}\n"), + "a {\ + \n b: oklch(99.9999993474% 0.0000000373 89.8755630959deg);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hwb/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/hwb/prophoto_rgb.rs new file mode 100644 index 000000000..ea2c94fd7 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hwb/prophoto_rgb.rs @@ -0,0 +1,162 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hwb/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.4), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.4764700867 0.2813317076 0.1760974536 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.4764700867 0.2813317076 0.1760974536 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 0% 100%), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20.123456789deg 30.987654321% 40.192837465%), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.4353235123 0.3529407495 0.2611635846);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 50% 50%), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.4246723949 0.4246723949 0.4246723949);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(80deg 20% 40%), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.4173696362 0.5097373596 0.226865426);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% none), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.7274254108 0.3840965619 0.2020562891);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(none 20% 30%), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.4657013132 0.2352440242 0.1674964522);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg none 30%), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.4539567276 0.2001286929 0.0733250158);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 999999% -999950%), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 200609.520572436 200606.1129393156 200601.5646967502);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 200% -125%), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 2.6931467502 2.5889839276 2.4557122588);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 100% 0%), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hwb/rec2020.rs b/rsass/tests/spec/core_functions/color/to_space/hwb/rec2020.rs new file mode 100644 index 000000000..48023f5fc --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hwb/rec2020.rs @@ -0,0 +1,158 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hwb/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.4), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.5439867892 0.2751629629 0.1667560186 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.5439867892 0.2751629629 0.1667560186 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 0% 100%), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20.123456789deg 30.987654321% 40.192837465%), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.4867284206 0.3676626536 0.2677057789);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 50% 50%), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.4500400319 0.4500400319 0.4500400319);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(80deg 20% 40%), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.459214681 0.5459336036 0.2122890002);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% none), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.8117472221 0.3730204781 0.1963814934);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(none 20% 30%), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.5338070059 0.2147334666 0.158678854);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg none 30%), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.5258638966 0.1667450692 0.0381165436);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 999999% -999950%), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 21678.0429642711 21677.6112716515 21677.2173996703);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 200% -125%), rec2020)}\n"), + "a {\ + \n b: color(rec2020 2.3816237298 2.2717034049 2.1734869236);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 100% 0%), rec2020)}\n"), + "a {\ + \n b: color(rec2020 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hwb/rgb.rs b/rsass/tests/spec/core_functions/color/to_space/hwb/rgb.rs new file mode 100644 index 000000000..a43d87beb --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hwb/rgb.rs @@ -0,0 +1,156 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hwb/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.4), rgb)}\n"), + "a {\ + \n b: rgba(178.5, 72.25, 51, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.0), rgb)}\n"), + "a {\ + \n b: rgba(178.5, 72.25, 51, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 0% 100%), rgb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20.123456789deg 30.987654321% 40.192837465%), rgb)}\n" + ), + "a {\ + \n b: rgb(152.5082644643, 103.6663139681, 79.0185185186);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 50% 50%), rgb)}\n"), + "a {\ + \n b: rgb(127.5, 127.5, 127.5);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(80deg 20% 40%), rgb)}\n"), + "a {\ + \n b: #779933;\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% none), rgb)}\n"), + "a {\ + \n b: #ff5533;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(none 20% 30%), rgb)}\n"), + "a {\ + \n b: rgb(178.5, 51, 51);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg none 30%), rgb)}\n"), + "a {\ + \n b: rgb(178.5, 29.75, 0);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 999999% -999950%), rgb)}\n"), + "a {\ + \n b: hsl(200, 0.0025501925%, 1000024.4999999999%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 200% -125%), rgb)}\n"), + "a {\ + \n b: hsl(200, 11.1111111111%, 212.5%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 100% 0%), rgb)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hwb/srgb.rs b/rsass/tests/spec/core_functions/color/to_space/hwb/srgb.rs new file mode 100644 index 000000000..8d05b54de --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hwb/srgb.rs @@ -0,0 +1,156 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hwb/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.4), srgb)}\n"), + "a {\ + \n b: color(srgb 0.7 0.2833333333 0.2 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.0), srgb)}\n"), + "a {\ + \n b: color(srgb 0.7 0.2833333333 0.2 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 0% 100%), srgb)}\n"), + "a {\ + \n b: color(srgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20.123456789deg 30.987654321% 40.192837465%), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.5980716254 0.4065345646 0.3098765432);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 50% 50%), srgb)}\n"), + "a {\ + \n b: color(srgb 0.5 0.5 0.5);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(80deg 20% 40%), srgb)}\n"), + "a {\ + \n b: color(srgb 0.4666666667 0.6 0.2);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% none), srgb)}\n"), + "a {\ + \n b: color(srgb 1 0.3333333333 0.2);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(none 20% 30%), srgb)}\n"), + "a {\ + \n b: color(srgb 0.7 0.2 0.2);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg none 30%), srgb)}\n"), + "a {\ + \n b: color(srgb 0.7 0.1166666667 0);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 999999% -999950%), srgb)}\n"), + "a {\ + \n b: color(srgb 10000.5 10000.16 9999.99);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 200% -125%), srgb)}\n"), + "a {\ + \n b: color(srgb 2.25 2.0833333333 2);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 100% 0%), srgb)}\n"), + "a {\ + \n b: color(srgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hwb/srgb_linear.rs b/rsass/tests/spec/core_functions/color/to_space/hwb/srgb_linear.rs new file mode 100644 index 000000000..bb4fa6364 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hwb/srgb_linear.rs @@ -0,0 +1,162 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hwb/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.4), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.4479884124 0.0652561709 0.0331047666 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.4479884124 0.0652561709 0.0331047666 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 0% 100%), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20.123456789deg 30.987654321% 40.192837465%), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.316300627 0.1374941598 0.0782247825);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 50% 50%), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.2140411405 0.2140411405 0.2140411405);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(80deg 20% 40%), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.1844749945 0.3185467781 0.0331047666);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% none), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 1 0.0908417112 0.0331047666);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(none 20% 30%), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.4479884124 0.0331047666 0.0331047666);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg none 30%), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.4479884124 0.0128067943 0);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 999999% -999950%), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 3501482364.2479005 3501196665.942984 3501053821.890021);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 200% -125%), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 6.5253577732 5.4497310669 4.9538457516);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 100% 0%), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hwb/xyz.rs b/rsass/tests/spec/core_functions/color/to_space/hwb/xyz.rs new file mode 100644 index 000000000..bbe675dc0 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hwb/xyz.rs @@ -0,0 +1,158 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hwb/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.4), xyz)}\n"), + "a {\ + \n b: color(xyz 0.2140556586 0.14431889 0.0479053227 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.0), xyz)}\n"), + "a {\ + \n b: color(xyz 0.2140556586 0.14431889 0.0479053227 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 0% 100%), xyz)}\n"), + "a {\ + \n b: color(xyz 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20.123456789deg 30.987654321% 40.192837465%), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.1937232971 0.1712365957 0.0968581071);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 50% 50%), xyz)}\n"), + "a {\ + \n b: color(xyz 0.2034366706 0.2140411405 0.233103163);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(80deg 20% 40%), xyz)}\n"), + "a {\ + \n b: color(xyz 0.195957904 0.2694311676 0.0730023108);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% none), xyz)}\n"), + "a {\ + \n b: color(xyz 0.4508491469 0.2799960622 0.0616258215);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(none 20% 30%), xyz)}\n"), + "a {\ + \n b: color(xyz 0.2025588199 0.1213252126 0.0440730432);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg none 30%), xyz)}\n"), + "a {\ + \n b: color(xyz 0.1893258086 0.1044188288 0.0101864858);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 999999% -999950%), xyz)}\n" + ), + "a {\ + \n b: color(xyz 3327825161.6640773 3501247104.3036017 3812875110.896892);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 200% -125%), xyz)}\n"), + "a {\ + \n b: color(xyz 5.5338099778 5.6426521513 5.4845096668);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 100% 0%), xyz)}\n"), + "a {\ + \n b: color(xyz 0.9504559271 1 1.0890577508);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/hwb/xyz_d50.rs b/rsass/tests/spec/core_functions/color/to_space/hwb/xyz_d50.rs new file mode 100644 index 000000000..f52d49fe5 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/hwb/xyz_d50.rs @@ -0,0 +1,158 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/hwb/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.4), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.2252224921 0.1484624713 0.0362130035 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% 30% / 0.0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.2252224921 0.1484624713 0.0362130035 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 0% 100%), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20.123456789deg 30.987654321% 40.192837465%), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.2020762306 0.1736844804 0.0736125271);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 50% 50%), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.2063989463 0.2140411405 0.1766063301);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(80deg 20% 40%), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.2078685764 0.2714132806 0.0571336509);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blackness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg 20% none), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.4757901468 0.2896232248 0.0463830476);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(none 20% 30%), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.2128393302 0.1254135471 0.0330917026);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn whiteness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(10deg none 30%), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.2002849578 0.1088553897 0.007481056);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 999999% -999950%), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 3376292952.6417513 3501251572.6872187 2888755456.5582485);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(20deg 200% -125%), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 5.6532455812 5.6589901967 4.1574637428);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(hwb(0deg 100% 0%), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.9642956764 1 0.8251046025);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lab/a98_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/lab/a98_rgb.rs new file mode 100644 index 000000000..7372ec1c6 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lab/a98_rgb.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lab/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.4), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.2039535001 0.0808226659 -0.1242620432 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.2039535001 0.0808226659 -0.1242620432 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(0% 0 0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 0 0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.4633483808 0.4633483808 0.4633483808);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 50 -75), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.4993446464 0.3405847685 0.9621105751);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% none 30), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.1557107469 0.1271683781 -0.125356279);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 none), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.1862731835 0.0856347366 0.1310611506);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(none 20 30), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.1487894196 -0.0929319593 -0.1737307511);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% -999999 0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb -16.6598712578 12.1485560974 -2.4112643287);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lab(0% -150 150), $lightness: -50%), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb -0.3527883779 -0.1750269182 -0.4390573819);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(100% 0 0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lab/display_p3.rs b/rsass/tests/spec/core_functions/color/to_space/lab/display_p3.rs new file mode 100644 index 000000000..38e92b2b4 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lab/display_p3.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lab/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.4), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.2036678394 0.0627355423 -0.092163728 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.0), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.2036678394 0.0627355423 -0.092163728 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(0% 0 0), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 0 0), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.4663266093 0.4663266093 0.4663266093);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 50 -75), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.5227133162 0.348060966 0.9452485417);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% none 30), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.1411767229 0.1061424169 -0.0944472015);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 none), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.1823778479 0.0651398083 0.1096920557);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(none 20 30), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.1438618115 -0.0552726461 -0.1517242634);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% -999999 0), display-p3)}\n"), + "a {\ + \n b: color(display-p3 -15.0614491889 9.7148006078 -2.8909250239);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lab(0% -150 150), $lightness: -50%), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -0.3704020725 -0.1731154433 -0.4345219765);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(100% 0 0), display-p3)}\n"), + "a {\ + \n b: color(display-p3 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lab/hsl.rs b/rsass/tests/spec/core_functions/color/to_space/lab/hsl.rs new file mode 100644 index 000000000..6fcf7af1e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lab/hsl.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lab/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.4), hsl)}\n"), + "a {\ + \n b: hsla(28.3698264077, 277.3239474447%, 5.9154081349%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.0), hsl)}\n"), + "a {\ + \n b: hsla(28.3698264077, 277.3239474447%, 5.9154081349%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(0% 0 0), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 0%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 0 0), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 46.6326609284%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 50 -75), hsl)}\n"), + "a {\ + \n b: hsl(260.0900301863, 93.9881625698%, 65.88440774%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% none 30), hsl)}\n"), + "a {\ + \n b: hsl(49.7972674498, 639.4765067331%, 2.0005058387%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 none), hsl)}\n"), + "a {\ + \n b: hsl(337.1245847104, 56.1707811732%, 12.7694440441%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(none 20 30), hsl)}\n"), + "a {\ + \n b: hsl(17.5913578322, 6051.6428880588%, 0%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% -999999 0), hsl)}\n"), + "a {\ + \n b: hsl(329.5753543003, 419.147137703%, -324.1554346051%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lab(0% -150 150), $lightness: -50%), hsl)}\n" + ), + "a {\ + \n b: hsl(289.8791142497, 47.7721599837%, -30.374201454%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(100% 0 0), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 100%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lab/hwb.rs b/rsass/tests/spec/core_functions/color/to_space/lab/hwb.rs new file mode 100644 index 000000000..e3462a9b5 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lab/hwb.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lab/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.4), hwb)}\n"), + "a {\ + \n b: hsla(28.3698264077, 277.3239474447%, 5.9154081349%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.0), hwb)}\n"), + "a {\ + \n b: hsla(28.3698264077, 277.3239474447%, 5.9154081349%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(0% 0 0), hwb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 0 0), hwb)}\n"), + "a {\ + \n b: hsl(0, 0%, 46.6326609284%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 50 -75), hwb)}\n"), + "a {\ + \n b: hsl(260.0900301863, 93.9881625698%, 65.88440774%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% none 30), hwb)}\n"), + "a {\ + \n b: hsl(49.7972674498, 639.4765067331%, 2.0005058387%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 none), hwb)}\n"), + "a {\ + \n b: hsl(337.1245847104, 56.1707811732%, 12.7694440441%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(none 20 30), hwb)}\n"), + "a {\ + \n b: hsl(17.5913578322, 6051.6428880587%, 0.2688304082%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% -999999 0), hwb)}\n"), + "a {\ + \n b: hsl(329.5753543003, 419.147137703%, -324.1554346051%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lab(0% -150 150), $lightness: -50%), hwb)}\n" + ), + "a {\ + \n b: hsl(289.8791142497, 47.7721599837%, -30.374201454%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(100% 0 0), hwb)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lab/lab.rs b/rsass/tests/spec/core_functions/color/to_space/lab/lab.rs new file mode 100644 index 000000000..631976f30 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lab/lab.rs @@ -0,0 +1,67 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lab/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +#[test] +#[ignore] // unexepected error +fn in_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 50 -75), lab)}\n"), + "a {\ + \n b: lab(50% 50 -75);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% none 30), lab)}\n"), + "a {\ + \n b: lab(10% none 30);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 none), lab)}\n"), + "a {\ + \n b: lab(10% 20 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(none 20 30), lab)}\n"), + "a {\ + \n b: lab(none 20 30);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% -150 150), lab)}\n"), + "a {\ + \n b: lab(50% -150 150);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lab/lch.rs b/rsass/tests/spec/core_functions/color/to_space/lab/lch.rs new file mode 100644 index 000000000..141a5f424 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lab/lch.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lab/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.4), lch)}\n"), + "a {\ + \n b: lch(10% 36.0555127546 56.309932474deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.0), lch)}\n"), + "a {\ + \n b: lch(10% 36.0555127546 56.309932474deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(0% 0 0), lch)}\n"), + "a {\ + \n b: lch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 0 0), lch)}\n"), + "a {\ + \n b: lch(50% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 50 -75), lch)}\n"), + "a {\ + \n b: lch(50% 90.1387818866 303.690067526deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% none 30), lch)}\n"), + "a {\ + \n b: lch(10% 30 90deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 none), lch)}\n"), + "a {\ + \n b: lch(10% 20 0deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(none 20 30), lch)}\n"), + "a {\ + \n b: lch(none 36.0555127546 56.309932474deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% -999999 0), lch)}\n"), + "a {\ + \n b: lch(50% 999999 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lab(0% -150 150), $lightness: -50%), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz -0.0931334424 -0.0559710307 -0.1664628061) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(100% 0 0), lch)}\n"), + "a {\ + \n b: lch(100% 0 none);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lab/mod.rs b/rsass/tests/spec/core_functions/color/to_space/lab/mod.rs new file mode 100644 index 000000000..87c4e9b63 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lab/mod.rs @@ -0,0 +1,36 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lab" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod a98_rgb; + +mod display_p3; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_space/lab/oklab.rs b/rsass/tests/spec/core_functions/color/to_space/lab/oklab.rs new file mode 100644 index 000000000..ab41644ed --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lab/oklab.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lab/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.4), oklab)}\n"), + "a {\ + \n b: oklab(22.8064235198% -0.061853134 0.2798052355 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.0), oklab)}\n"), + "a {\ + \n b: oklab(22.8064235198% -0.061853134 0.2798052355 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(0% 0 0), oklab)}\n"), + "a {\ + \n b: oklab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 0 0), oklab)}\n"), + "a {\ + \n b: oklab(56.8965513528% 0 0.0000000212);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 50 -75), oklab)}\n"), + "a {\ + \n b: oklab(60.2352362176% 0.0926046157 -0.2110438209);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% none 30), oklab)}\n"), + "a {\ + \n b: oklab(22.1884319419% none 0.2838925277);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 none), oklab)}\n"), + "a {\ + \n b: oklab(23.0834632697% 0.0614345595 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(none 20 30), oklab)}\n"), + "a {\ + \n b: oklab(none 0.4936529727 0.1158908016);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lab(50% -999999 0), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz -236.5825482412 7.2139420412 -2.8507109462) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lab(0% -150 150), $lightness: -50%), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz -0.0931334424 -0.0559710307 -0.1664628061) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(100% 0 0), oklab)}\n"), + "a {\ + \n b: oklab(99.9999993474% 0.0000000001 0.0000000373);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lab/oklch.rs b/rsass/tests/spec/core_functions/color/to_space/lab/oklch.rs new file mode 100644 index 000000000..e6e852cf1 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lab/oklch.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lab/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.4), oklch)}\n"), + "a {\ + \n b: oklch(22.8064235198% 0.2865602554 102.4652159995deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.0), oklch)}\n"), + "a {\ + \n b: oklch(22.8064235198% 0.2865602554 102.4652159995deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(0% 0 0), oklch)}\n"), + "a {\ + \n b: oklch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 0 0), oklch)}\n"), + "a {\ + \n b: oklch(56.8965513528% 0.0000000212 89.8755629589deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 50 -75), oklch)}\n"), + "a {\ + \n b: oklch(60.2352362176% 0.2304671542 293.6915443769deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% none 30), oklch)}\n"), + "a {\ + \n b: oklch(22.1884319419% 0.3083157518 112.9588813999deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 none), oklch)}\n"), + "a {\ + \n b: oklch(23.0834632697% 0.0614385657 359.3456866656deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(none 20 30), oklch)}\n"), + "a {\ + \n b: oklch(none 0.5070738953 13.2116104316deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lab(50% -999999 0), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz -236.5825482412 7.2139420412 -2.8507109462) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lab(0% -150 150), $lightness: -50%), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz -0.0931334424 -0.0559710307 -0.1664628061) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(100% 0 0), oklch)}\n"), + "a {\ + \n b: oklch(99.9999993474% 0.0000000373 89.8755630959deg);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lab/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/lab/prophoto_rgb.rs new file mode 100644 index 000000000..f1db6fbd4 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lab/prophoto_rgb.rs @@ -0,0 +1,151 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lab/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.4), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1181031255 0.0643408567 -0.0693072402 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1181031255 0.0643408567 -0.0693072402 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(0% 0 0), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 0 0), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.3906698633 0.3906698633 0.3906698633);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 50 -75), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.5179210602 0.3284958504 0.9083646327);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% none 30), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.085998245 0.0813505708 -0.0693072402);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 none), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.1155645311 0.0659678734 0.0827038254);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(none 20 30), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.0658841117 -0.0398403518 -0.1114464198);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lab(50% -999999 0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -25.2096957329 15.2674513494 0.3906698633);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lab(0% -150 150), $lightness: -50%), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -0.2802411013 -0.1595613747 -0.3507026734);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(100% 0 0), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lab/rec2020.rs b/rsass/tests/spec/core_functions/color/to_space/lab/rec2020.rs new file mode 100644 index 000000000..21d442d4a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lab/rec2020.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lab/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.4), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.115034011 0.0285101795 -0.0389460082 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.115034011 0.0285101795 -0.0389460082 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(0% 0 0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 0 0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.4141328903 0.4141328903 0.4141328903);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 50 -75), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.4782548936 0.3165685667 0.9316090731);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% none 30), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0677133777 0.0497451668 -0.0398688899);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 none), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.1006265985 0.0294359094 0.0515937784);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(none 20 30), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0535921266 -0.0161333028 -0.0888018246);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% -999999 0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 -16.3406051212 10.9684505106 -2.5677472313);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lab(0% -150 150), $lightness: -50%), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 -0.2868532205 -0.1310027915 -0.3772590396);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(100% 0 0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lab/rgb.rs b/rsass/tests/spec/core_functions/color/to_space/lab/rgb.rs new file mode 100644 index 000000000..97a470b88 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lab/rgb.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lab/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.4), rgb)}\n"), + "a {\ + \n b: hsla(28.3698264077, 277.3239474447%, 5.9154081349%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.0), rgb)}\n"), + "a {\ + \n b: hsla(28.3698264077, 277.3239474447%, 5.9154081349%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(0% 0 0), rgb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 0 0), rgb)}\n"), + "a {\ + \n b: rgb(118.9132853673, 118.9132853673, 118.9132853673);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 50 -75), rgb)}\n"), + "a {\ + \n b: rgb(140.9956907717, 86.2404630336, 249.7700164402);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% none 30), rgb)}\n"), + "a {\ + \n b: hsl(49.7972674498, 639.4765067331%, 2.0005058387%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 none), rgb)}\n"), + "a {\ + \n b: rgb(50.8524583137, 14.2717063113, 28.2183712056);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(none 20 30), rgb)}\n"), + "a {\ + \n b: hsl(17.5913578322, 6051.6428880588%, 0.2688304082%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% -999999 0), rgb)}\n"), + "a {\ + \n b: hsl(329.5753543003, 419.147137703%, -324.1554346051%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lab(0% -150 150), $lightness: -50%), rgb)}\n" + ), + "a {\ + \n b: hsl(289.8791142497, 47.7721599837%, -30.374201454%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(100% 0 0), rgb)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lab/srgb.rs b/rsass/tests/spec/core_functions/color/to_space/lab/srgb.rs new file mode 100644 index 000000000..0eb4e872b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lab/srgb.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lab/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.4), srgb)}\n"), + "a {\ + \n b: color(srgb 0.2232025148 0.0502398339 -0.1048943521 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.0), srgb)}\n"), + "a {\ + \n b: color(srgb 0.2232025148 0.0502398339 -0.1048943521 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(0% 0 0), srgb)}\n"), + "a {\ + \n b: color(srgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 0 0), srgb)}\n"), + "a {\ + \n b: color(srgb 0.4663266093 0.4663266093 0.4663266093);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 50 -75), srgb)}\n"), + "a {\ + \n b: color(srgb 0.5529242775 0.3381978942 0.9794902605);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% none 30), srgb)}\n"), + "a {\ + \n b: color(srgb 0.1479327069 0.1044256541 -0.1079225902);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 none), srgb)}\n"), + "a {\ + \n b: color(srgb 0.1994214052 0.0559674757 0.1106602792);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(none 20 30), srgb)}\n"), + "a {\ + \n b: color(srgb 0.1653748669 -0.0646023407 -0.1599982587);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% -999999 0), srgb)}\n"), + "a {\ + \n b: color(srgb -16.8284366046 10.3453279125 -3.4338747169);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lab(0% -150 150), $lightness: -50%), srgb)}\n" + ), + "a {\ + \n b: color(srgb -0.3998933946 -0.1586378934 -0.4488461357);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(100% 0 0), srgb)}\n"), + "a {\ + \n b: color(srgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lab/srgb_linear.rs b/rsass/tests/spec/core_functions/color/to_space/lab/srgb_linear.rs new file mode 100644 index 000000000..44dd9d2e4 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lab/srgb_linear.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lab/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.4), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.040800043 0.0039575505 -0.01079925 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.0), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.040800043 0.0039575505 -0.01079925 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(0% 0 0), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 0 0), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.1841865185 0.1841865185 0.1841865185);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 50 -75), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.2663378358 0.0935967862 0.9539760505);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% none 30), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.0191354647 0.0107234318 -0.0112966385);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 none), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.0329247775 0.004494318 0.0117575878);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(none 20 30), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.0233229267 -0.0053798396 -0.0219805198);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lab(50% -999999 0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -776.4261256147 242.720788708 -17.6457042383);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lab(0% -150 150), $lightness: -50%), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.1327936201 -0.0216482097 -0.1697106644);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(100% 0 0), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lab/xyz.rs b/rsass/tests/spec/core_functions/color/to_space/lab/xyz.rs new file mode 100644 index 000000000..91807c332 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lab/xyz.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lab/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.4), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0162916633 0.0107263739 -0.0090046167 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.0), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0162916633 0.0107263739 -0.0090046167 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(0% 0 0), xyz)}\n"), + "a {\ + \n b: color(xyz 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 0 0), xyz)}\n"), + "a {\ + \n b: color(xyz 0.1750611682 0.1841865185 0.2005897556);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 50 -75), xyz)}\n"), + "a {\ + \n b: color(xyz 0.3154783677 0.1924410425 0.9230896852);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% none 30), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0096869946 0.0109224783 -0.0090897368);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 none), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0173069918 0.0110640949 0.0123481274);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(none 20 30), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0037273525 -0.0004749534 -0.0210835883);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% -999999 0), xyz)}\n"), + "a {\ + \n b: color(xyz -236.5825482412 7.2139420412 -2.8507109462);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lab(0% -150 150), $lightness: -50%), xyz)}\n" + ), + "a {\ + \n b: color(xyz -0.0931334424 -0.0559710307 -0.1664628061);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(100% 0 0), xyz)}\n"), + "a {\ + \n b: color(xyz 0.9504559271 1 1.0890577508);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lab/xyz_d50.rs b/rsass/tests/spec/core_functions/color/to_space/lab/xyz_d50.rs new file mode 100644 index 000000000..2d5e94d26 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lab/xyz_d50.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lab/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.4), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0177706181 0.0112601993 -0.0067594366 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 30 / 0.0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0177706181 0.0112601993 -0.0067594366 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(0% 0 0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 0 0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.1776102635 0.1841865185 0.1519731441);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% 50 -75), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.2886831368 0.1841865185 0.6940286511);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% none 30), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0108581615 0.0112601993 -0.0067594366);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(10% 20 none), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0177706181 0.0112601993 0.0092908422);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(none 20 30), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0049533381 0 -0.0158938104);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(50% -999999 0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 -247.6132796606 0.1841865185 0.1519731441);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lab(0% -150 150), $lightness: -50%), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 -0.0905265235 -0.055352823 -0.1251409211);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lab(100% 0 0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.9642956764 1 0.8251046025);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lch/a98_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/lch/a98_rgb.rs new file mode 100644 index 000000000..f2929eb76 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lch/a98_rgb.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lch/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.4), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.1855277377 0.0926913904 0.0818650595 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.1855277377 0.0926913904 0.0818650595 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(0% 0 0deg), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10.123456789% 20.987654321 30.192837465deg), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1889263665 0.0909755641 0.0795209428);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(50% 0 0deg), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.4633483808 0.4633483808 0.4633483808);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.1855277377 0.0926913904 0.0818650595);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% none 30deg), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.1300242938 0.1300242938 0.1300242938);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 none), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.1862731835 0.0856347366 0.1310611506);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(none 20 30deg), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.1244563961 -0.084601587 -0.1049078937);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 999999 0deg), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 42562.6792376747 -31021.1046455384 6233.1625417899);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lch(0% 200 0deg), $lightness: -10%), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.4634940567 -0.3642836921 -0.1126427123);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(100% 0 0deg), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lch/display_p3.rs b/rsass/tests/spec/core_functions/color/to_space/lch/display_p3.rs new file mode 100644 index 000000000..02603fe4c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lch/display_p3.rs @@ -0,0 +1,162 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lch/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.4), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.1810277824 0.0722540734 0.0569980019 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.0), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.1810277824 0.0722540734 0.0569980019 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(0% 0 0deg), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10.123456789% 20.987654321 30.192837465deg), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.1852138261 0.0708949536 0.054721162);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(50% 0 0deg), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.4663266093 0.4663266093 0.4663266093);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.1810277824 0.0722540734 0.0569980019);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% none 30deg), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.1077034111 0.1077034111 0.1077034111);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 none), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.1823778479 0.0651398083 0.1096920557);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(none 20 30deg), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.1144797929 -0.0473082464 -0.0747498159);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 999999 0deg), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 20032.6181692902 -12940.6885284751 3928.8140693077);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lch(0% 200 0deg), $lightness: -10%), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.5150813189 -0.3405175977 -0.0725015019);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(100% 0 0deg), display-p3)}\n"), + "a {\ + \n b: color(display-p3 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lch/hsl.rs b/rsass/tests/spec/core_functions/color/to_space/lch/hsl.rs new file mode 100644 index 000000000..cc6724bcc --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lch/hsl.rs @@ -0,0 +1,158 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lch/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.4), hsl)}\n"), + "a {\ + \n b: hsla(5.5048306165, 59.0012292082%, 12.4106897496%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.0), hsl)}\n"), + "a {\ + \n b: hsla(5.5048306165, 59.0012292082%, 12.4106897496%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(0% 0 0deg), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 0%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10.123456789% 20.987654321 30.192837465deg), hsl)}\n" + ), + "a {\ + \n b: hsl(5.5490985392, 61.5887632777%, 12.5078193109%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(50% 0 0deg), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 46.6326609284%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg), hsl)}\n"), + "a {\ + \n b: hsl(5.5048306165, 59.0012292082%, 12.4106897496%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% none 30deg), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 10.7703411095%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 none), hsl)}\n"), + "a {\ + \n b: hsl(0, 56.1707811732%, 12.7694440441%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(none 20 30deg), hsl)}\n"), + "a {\ + \n b: hsl(6.9848409854, 394.5339053958%, 0%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 999999 0deg), hsl)}\n"), + "a {\ + \n b: hsl(149.4283545837, 420.5938588221%, 429851.5077692641%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lch(0% 200 0deg), $lightness: -10%), hsl)}\n" + ), + "a {\ + \n b: hsl(340.1543058221, 427.9584468502%, 11.074503568%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(100% 0 0deg), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 100%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lch/hwb.rs b/rsass/tests/spec/core_functions/color/to_space/lch/hwb.rs new file mode 100644 index 000000000..3469dd557 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lch/hwb.rs @@ -0,0 +1,158 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lch/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.4), hwb)}\n"), + "a {\ + \n b: hsla(5.5048306165, 59.0012292082%, 12.4106897496%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.0), hwb)}\n"), + "a {\ + \n b: hsla(5.5048306165, 59.0012292082%, 12.4106897496%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(0% 0 0deg), hwb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10.123456789% 20.987654321 30.192837465deg), hwb)}\n" + ), + "a {\ + \n b: hsl(5.5490985392, 61.5887632777%, 12.5078193109%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(50% 0 0deg), hwb)}\n"), + "a {\ + \n b: hsl(0, 0%, 46.6326609284%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg), hwb)}\n"), + "a {\ + \n b: hsl(5.5048306165, 59.0012292082%, 12.4106897496%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% none 30deg), hwb)}\n"), + "a {\ + \n b: hsl(0, 0%, 10.7703411095%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 none), hwb)}\n"), + "a {\ + \n b: hsl(0, 56.1707811732%, 12.7694440441%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(none 20 30deg), hwb)}\n"), + "a {\ + \n b: hsl(6.9848409854, 394.5339053958%, 2.7008748146%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 999999 0deg), hwb)}\n"), + "a {\ + \n b: hsl(149.4283545837, 420.5938588221%, 429851.5077692638%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lch(0% 200 0deg), $lightness: -10%), hwb)}\n" + ), + "a {\ + \n b: hsl(340.1543058221, 427.9584468502%, 11.074503568%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(100% 0 0deg), hwb)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lch/lab.rs b/rsass/tests/spec/core_functions/color/to_space/lch/lab.rs new file mode 100644 index 000000000..ff310c9fc --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lch/lab.rs @@ -0,0 +1,158 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lch/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.4), lab)}\n"), + "a {\ + \n b: lab(10% 17.3205080757 10 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.0), lab)}\n"), + "a {\ + \n b: lab(10% 17.3205080757 10 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(0% 0 0deg), lab)}\n"), + "a {\ + \n b: lab(0% none none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10.123456789% 20.987654321 30.192837465deg), lab)}\n" + ), + "a {\ + \n b: lab(10.123456789% 18.1404203948 10.5549411083);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(50% 0 0deg), lab)}\n"), + "a {\ + \n b: lab(50% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg), lab)}\n"), + "a {\ + \n b: lab(10% 17.3205080757 10);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% none 30deg), lab)}\n"), + "a {\ + \n b: lab(10% 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 none), lab)}\n"), + "a {\ + \n b: lab(10% 20 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(none 20 30deg), lab)}\n"), + "a {\ + \n b: lab(none none none);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 999999 0deg), lab)}\n"), + "a {\ + \n b: lab(10% 999999 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lch(0% 200 0deg), $lightness: -10%), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz 0.0846054544 -0.0138950708 -0.0108304931) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(100% 0 0deg), lab)}\n"), + "a {\ + \n b: lab(100% 0 0);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lch/lch.rs b/rsass/tests/spec/core_functions/color/to_space/lch/lch.rs new file mode 100644 index 000000000..e55987490 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lch/lch.rs @@ -0,0 +1,69 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lch/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +#[test] +#[ignore] // unexepected error +fn in_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg), lch)}\n"), + "a {\ + \n b: lch(10% 20 30deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% none 30deg), lch)}\n"), + "a {\ + \n b: lch(10% none 30deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 none), lch)}\n"), + "a {\ + \n b: lch(10% 20 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(none 20 30deg), lch)}\n"), + "a {\ + \n b: lch(none 20 30deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lch(0% 200 0deg), $lightness: -10%), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz 0.0846054544 -0.0138950708 -0.0108304931) 100%, black);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lch/mod.rs b/rsass/tests/spec/core_functions/color/to_space/lch/mod.rs new file mode 100644 index 000000000..1417041ec --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lch/mod.rs @@ -0,0 +1,36 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lch" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod a98_rgb; + +mod display_p3; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_space/lch/oklab.rs b/rsass/tests/spec/core_functions/color/to_space/lch/oklab.rs new file mode 100644 index 000000000..16db45ee5 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lch/oklab.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lch/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.4), oklab)}\n"), + "a {\ + \n b: oklab(22.8705495852% 0.0494077592 0.0263450873 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.0), oklab)}\n"), + "a {\ + \n b: oklab(22.8705495852% 0.0494077592 0.0263450873 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(0% 0 0deg), oklab)}\n"), + "a {\ + \n b: oklab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10.123456789% 20.987654321 30.192837465deg), oklab)}\n" + ), + "a {\ + \n b: oklab(22.9987502615% 0.0516259003 0.0278217212);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(50% 0 0deg), oklab)}\n"), + "a {\ + \n b: oklab(56.8965513528% 0 0.0000000212);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg), oklab)}\n"), + "a {\ + \n b: oklab(22.8705495852% 0.0494077592 0.0263450873);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% none 30deg), oklab)}\n"), + "a {\ + \n b: oklab(22.4137929572% 0 0.0000000084);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 none), oklab)}\n"), + "a {\ + \n b: oklab(23.0834632697% 0.0614345595 -0.0007016084);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(none 20 30deg), oklab)}\n"), + "a {\ + \n b: oklab(none 0.4083922235 0.0807817391);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 999999 0deg), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz 7373327412.161988 -218927236.26953584 95026466.80033648) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lch(0% 200 0deg), $lightness: -10%), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz 0.0846054544 -0.0138950708 -0.0108304931) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(100% 0 0deg), oklab)}\n"), + "a {\ + \n b: oklab(99.9999993474% 0.0000000001 0.0000000373);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lch/oklch.rs b/rsass/tests/spec/core_functions/color/to_space/lch/oklch.rs new file mode 100644 index 000000000..94f86d5ed --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lch/oklch.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lch/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.4), oklch)}\n"), + "a {\ + \n b: oklch(22.8705495852% 0.05599277 28.0673245733deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.0), oklch)}\n"), + "a {\ + \n b: oklch(22.8705495852% 0.05599277 28.0673245733deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(0% 0 0deg), oklch)}\n"), + "a {\ + \n b: oklch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10.123456789% 20.987654321 30.192837465deg), oklch)}\n" + ), + "a {\ + \n b: oklch(22.9987502615% 0.0586453899 28.320677744deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(50% 0 0deg), oklch)}\n"), + "a {\ + \n b: oklch(56.8965513528% 0.0000000212 89.8755629589deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg), oklch)}\n"), + "a {\ + \n b: oklch(22.8705495852% 0.05599277 28.0673245733deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% none 30deg), oklch)}\n"), + "a {\ + \n b: oklch(22.4137929572% none 89.8755627743deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 none), oklch)}\n"), + "a {\ + \n b: oklch(23.0834632697% 0.0614385657 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(none 20 30deg), oklch)}\n"), + "a {\ + \n b: oklch(none 0.4163050536 11.1889160032deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 999999 0deg), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz 7373327412.161987 -218927236.2695358 95026466.80033481) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lch(0% 200 0deg), $lightness: -10%), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz 0.0846054544 -0.0138950708 -0.0108304931) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(100% 0 0deg), oklch)}\n"), + "a {\ + \n b: oklch(99.9999993474% 0.0000000373 89.8755630959deg);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lch/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/lch/prophoto_rgb.rs new file mode 100644 index 000000000..df9c937c2 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lch/prophoto_rgb.rs @@ -0,0 +1,164 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lch/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.4), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1119358598 0.0682122171 0.0505966427 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1119358598 0.0682122171 0.0505966427 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(0% 0 0deg), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10.123456789% 20.987654321 30.192837465deg), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1140986722 0.0679789036 0.0492544884);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(50% 0 0deg), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.3906698633 0.3906698633 0.3906698633);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.1119358598 0.0682122171 0.0505966427);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% none 30deg), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.0827038254 0.0827038254 0.0827038254);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 none), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.1155645311 0.0659678734 0.0827038254);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(none 20 30deg), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.0585320378 -0.0354038244 -0.0605339143);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 999999 0deg), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 367010.4615537181 -222031.7168269293 0.0827038254);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lch(0% 200 0deg), $lightness: -10%), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.3120531174 -0.2195824001 -0.0819271128);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(100% 0 0deg), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lch/rec2020.rs b/rsass/tests/spec/core_functions/color/to_space/lch/rec2020.rs new file mode 100644 index 000000000..7c814dfef --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lch/rec2020.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lch/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.4), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0987940535 0.0323770888 0.0206839256 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0987940535 0.0323770888 0.0206839256 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(0% 0 0deg), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10.123456789% 20.987654321 30.192837465deg), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.1021786723 0.0319354657 0.0196866185);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(50% 0 0deg), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.4141328903 0.4141328903 0.4141328903);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0987940535 0.0323770888 0.0206839256);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% none 30deg), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0506708967 0.0506708967 0.0506708967);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 none), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.1006265985 0.0294359094 0.0515937784);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(none 20 30deg), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0374222506 -0.0134835285 -0.0293129957);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 999999 0deg), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 38725.5976285713 -26052.9381914356 6353.219962186);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lch(0% 200 0deg), $lightness: -10%), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.3729067583 -0.2515671342 -0.0365252061);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(100% 0 0deg), rec2020)}\n"), + "a {\ + \n b: color(rec2020 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lch/rgb.rs b/rsass/tests/spec/core_functions/color/to_space/lch/rgb.rs new file mode 100644 index 000000000..ba8228b00 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lch/rgb.rs @@ -0,0 +1,158 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lch/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.4), rgb)}\n"), + "a {\ + \n b: rgba(50.3195306005, 16.4012435608, 12.9749871225, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.0), rgb)}\n"), + "a {\ + \n b: rgba(50.3195306005, 16.4012435608, 12.9749871225, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(0% 0 0deg), rgb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10.123456789% 20.987654321 30.192837465deg), rgb)}\n" + ), + "a {\ + \n b: rgb(51.5386378704, 15.8847345936, 12.2512406149);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(50% 0 0deg), rgb)}\n"), + "a {\ + \n b: rgb(118.9132853673, 118.9132853673, 118.9132853673);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg), rgb)}\n"), + "a {\ + \n b: rgb(50.3195306005, 16.4012435608, 12.9749871225);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% none 30deg), rgb)}\n"), + "a {\ + \n b: rgb(27.4643698292, 27.4643698292, 27.4643698292);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 none), rgb)}\n"), + "a {\ + \n b: rgb(50.8524583137, 14.2717063113, 28.2183712056);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(none 20 30deg), rgb)}\n"), + "a {\ + \n b: hsl(6.9848409854, 394.5339053958%, 2.7008748146%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 999999 0deg), rgb)}\n"), + "a {\ + \n b: hsl(149.4283545837, 420.5938588221%, 429851.5077692641%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lch(0% 200 0deg), $lightness: -10%), rgb)}\n" + ), + "a {\ + \n b: hsl(340.1543058221, 427.9584468502%, 11.074503568%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(100% 0 0deg), rgb)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lch/srgb.rs b/rsass/tests/spec/core_functions/color/to_space/lch/srgb.rs new file mode 100644 index 000000000..1f6bd2bee --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lch/srgb.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lch/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.4), srgb)}\n"), + "a {\ + \n b: color(srgb 0.1973314926 0.0643186022 0.0508823024 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.0), srgb)}\n"), + "a {\ + \n b: color(srgb 0.1973314926 0.0643186022 0.0508823024 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(0% 0 0deg), srgb)}\n"), + "a {\ + \n b: color(srgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10.123456789% 20.987654321 30.192837465deg), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.2021123054 0.0622930768 0.0480440808);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(50% 0 0deg), srgb)}\n"), + "a {\ + \n b: color(srgb 0.4663266093 0.4663266093 0.4663266093);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg), srgb)}\n"), + "a {\ + \n b: color(srgb 0.1973314926 0.0643186022 0.0508823024);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% none 30deg), srgb)}\n"), + "a {\ + \n b: color(srgb 0.1077034111 0.1077034111 0.1077034111);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 none), srgb)}\n"), + "a {\ + \n b: color(srgb 0.1994214052 0.0559674757 0.1106602792);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(none 20 30deg), srgb)}\n"), + "a {\ + \n b: color(srgb 0.133567417 -0.0547400755 -0.0795499207);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 999999 0deg), srgb)}\n" + ), + "a {\ + \n b: color(srgb 22373.5995764218 -13776.5694210365 4642.9330511282);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lch(0% 200 0deg), $lightness: -10%), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.5846877703 -0.363197699 -0.0496736133);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(100% 0 0deg), srgb)}\n"), + "a {\ + \n b: color(srgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lch/srgb_linear.rs b/rsass/tests/spec/core_functions/color/to_space/lch/srgb_linear.rs new file mode 100644 index 000000000..24209dbc6 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lch/srgb_linear.rs @@ -0,0 +1,164 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lch/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.4), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0322794103 0.0053492596 0.0040157827 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0322794103 0.0053492596 0.0040157827 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(0% 0 0deg), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10.123456789% 20.987654321 30.192837465deg), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.033766727 0.0051339047 0.0037622653);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(50% 0 0deg), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.1841865185 0.1841865185 0.1841865185);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.0322794103 0.0053492596 0.0040157827);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% none 30deg), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.0112601993 0.0112601993 0.0112601993);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 none), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.0329247775 0.004494318 0.0117575878);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(none 20 30deg), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.016044052 -0.0043759334 -0.0071369782);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 999999 0deg), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 24185926345.93111 -7553302222.606848 555275171.9499303);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lch(0% 200 0deg), $lightness: -10%), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.300965983 -0.1085200613 -0.0039066402);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(100% 0 0deg), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lch/xyz.rs b/rsass/tests/spec/core_functions/color/to_space/lch/xyz.rs new file mode 100644 index 000000000..b514ca80d --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lch/xyz.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lch/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.4), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0159493149 0.0109793933 0.0050787218 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.0), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0159493149 0.0109793933 0.0050787218 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(0% 0 0deg), xyz)}\n"), + "a {\ + \n b: color(xyz 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10.123456789% 20.987654321 30.192837465deg), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.0164399081 0.0111233378 0.0048408272);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(50% 0 0deg), xyz)}\n"), + "a {\ + \n b: color(xyz 0.1750611682 0.1841865185 0.2005897556);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0159493149 0.0109793933 0.0050787218);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% none 30deg), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0107023231 0.0112601993 0.0122630073);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 none), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0173069918 0.0110640949 0.0123481274);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(none 20 30deg), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0037635667 -0.0002331742 -0.006995371);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 999999 0deg), xyz)}\n" + ), + "a {\ + \n b: color(xyz 7373327412.161998 -218927236.2695362 95026466.80033655);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lch(0% 200 0deg), $lightness: -10%), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.0846054544 -0.0138950708 -0.0108304931);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(100% 0 0deg), xyz)}\n"), + "a {\ + \n b: color(xyz 0.9504559271 1 1.0890577508);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/lch/xyz_d50.rs b/rsass/tests/spec/core_functions/color/to_space/lch/xyz_d50.rs new file mode 100644 index 000000000..44e1f4f44 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/lch/xyz_d50.rs @@ -0,0 +1,158 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/lch/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.4), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0167107924 0.0112601993 0.003836437 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg / 0.0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0167107924 0.0112601993 0.003836437 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(0% 0 0deg), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(lch(10.123456789% 20.987654321 30.192837465deg), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0172401432 0.0114213638 0.0036552028);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(50% 0 0deg), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.1776102635 0.1841865185 0.1519731441);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 30deg), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0167107924 0.0112601993 0.003836437);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% none 30deg), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0108581615 0.0112601993 0.0092908422);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 20 none), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0177706181 0.0112601993 0.0092908422);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(none 20 30deg), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0042897166 0 -0.0052979368);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(10% 999999 0deg), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 7716936176.70525 0.0112601993 0.0092908422);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(lch(0% 200 0deg), $lightness: -10%), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0888853348 -0.0110705646 -0.0091343738);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(lch(100% 0 0deg), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.9642956764 1 0.8251046025);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/mod.rs b/rsass/tests/spec/core_functions/color/to_space/mod.rs new file mode 100644 index 000000000..f1ad55320 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/mod.rs @@ -0,0 +1,38 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("to_space") +} + +mod a98_rgb; + +mod display_p3; + +mod error; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_space/oklab/a98_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/oklab/a98_rgb.rs new file mode 100644 index 000000000..539c82d52 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklab/a98_rgb.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklab/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.4), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2172671914 -0.1122840454 -0.2493572785 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.2172671914 -0.1122840454 -0.2493572785 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(0% 0 0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0 0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.3884711027 0.388471114 0.3884711549);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0.2 -0.3), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.4723956119 -0.3075477289 0.9952387413);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% none 0.3), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.1171245434 0.0794773258 -0.2290203701);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 none), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.1433510554 -0.0992363406 0.0248601585);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(none 0.2 0.3), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.0734724303 0.1640446338 -0.3638546832);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% -999999 0), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb -66665446.96678426 49015676.54589439 12422985.883539313);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklab(0% -2 2), $lightness: -50%), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb -1.6915317691 2.7130844081 -5.3317336738);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(100% 0 0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.9999999799 1.000000009 1.0000001143);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklab/display_p3.rs b/rsass/tests/spec/core_functions/color/to_space/oklab/display_p3.rs new file mode 100644 index 000000000..fb91a1d96 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklab/display_p3.rs @@ -0,0 +1,151 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklab/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.4), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.2245541345 -0.0715469676 -0.2325234092 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.2245541345 -0.0715469676 -0.2325234092 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(0% 0 0), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0 0), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.3885728491 0.3885728621 0.3885729031);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0.2 -0.3), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.5192153014 -0.2770640957 0.9741963252);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% none 0.3), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.0980260328 0.0512840259 -0.2115516265);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 none), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.1380887377 -0.0636630597 0.0058108376);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(none 0.2 0.3), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.011277471 0.1430562743 -0.3528893187);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% -999999 0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -16964712.17081906 11051276.299069608 2566313.802188239);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklab(0% -2 2), $lightness: -50%), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -2.0082801891 2.5077633347 -4.7222178033);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(100% 0 0), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.9999999764 1.0000000074 1.0000001047);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklab/hsl.rs b/rsass/tests/spec/core_functions/color/to_space/oklab/hsl.rs new file mode 100644 index 000000000..d1ee5ed02 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklab/hsl.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklab/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.4), hsl)}\n"), + "a {\ + \n b: hsla(19.0047457513, 6337.7067481883%, 0.3924710109%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.0), hsl)}\n"), + "a {\ + \n b: hsla(19.0047457513, 6337.7067481883%, 0.3924710109%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(0% 0 0), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 0%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0 0), hsl)}\n"), + "a {\ + \n b: hsl(223.8135972091, 0.0000078676%, 38.8572876766%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0.2 -0.3), hsl)}\n"), + "a {\ + \n b: hsl(280.3037191595, 185.1123260276%, 35.6118905417%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% none 0.3), hsl)}\n"), + "a {\ + \n b: hsl(229.5442945473, 280.5312633728%, -5.8764819359%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 none), hsl)}\n"), + "a {\ + \n b: hsl(339.4567046558, 263.6331199652%, 4.40110336%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(none 0.2 0.3), hsl)}\n"), + "a {\ + \n b: hsl(261.4365788529, 230.0242883505%, 0%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% -999999 0), hsl)}\n"), + "a {\ + \n b: hsl(340.1123890362, 426.4426890198%, -360094010.73043364%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklab(0% -2 2), $lightness: -50%), hsl)}\n" + ), + "a {\ + \n b: hsl(280.1786410944, 318.2272126608%, -118.134272113%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(100% 0 0), hsl)}\n"), + "a {\ + \n b: hsl(43.8135971986, 172.5242105081%, 100.0000042145%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklab/hwb.rs b/rsass/tests/spec/core_functions/color/to_space/oklab/hwb.rs new file mode 100644 index 000000000..d80809280 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklab/hwb.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklab/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.4), hwb)}\n"), + "a {\ + \n b: hsla(19.0047457513, 6337.7067481883%, 0.3924710109%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.0), hwb)}\n"), + "a {\ + \n b: hsla(19.0047457513, 6337.7067481883%, 0.3924710109%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(0% 0 0), hwb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0 0), hwb)}\n"), + "a {\ + \n b: hsl(223.8135972091, 0.0000078676%, 38.8572876766%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0.2 -0.3), hwb)}\n"), + "a {\ + \n b: hsl(280.3037191595, 185.1123260276%, 35.6118905417%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% none 0.3), hwb)}\n"), + "a {\ + \n b: hsl(229.5442945473, 280.5312633728%, -5.8764819359%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 none), hwb)}\n"), + "a {\ + \n b: hsl(339.4567046558, 263.6331199652%, 4.40110336%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(none 0.2 0.3), hwb)}\n"), + "a {\ + \n b: hsl(261.4365788529, 230.0242883505%, -11.2533870657%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% -999999 0), hwb)}\n"), + "a {\ + \n b: hsl(340.1123890362, 426.4426890198%, -360094010.73043364%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklab(0% -2 2), $lightness: -50%), hwb)}\n" + ), + "a {\ + \n b: hsl(280.1786410944, 318.2272126608%, -118.134272113%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(100% 0 0), hwb)}\n"), + "a {\ + \n b: hsl(43.8135971652, 172.5242119439%, 100.0000042145%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklab/lab.rs b/rsass/tests/spec/core_functions/color/to_space/oklab/lab.rs new file mode 100644 index 000000000..29ffe179b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklab/lab.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklab/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.4), lab)}\n"), + "a {\ + \n b: lab(2.4858192097% 37.8559749186 70.2237149791 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.0), lab)}\n"), + "a {\ + \n b: lab(2.4858192097% 37.8559749186 70.2237149791 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(0% 0 0), lab)}\n"), + "a {\ + \n b: lab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0 0), lab)}\n"), + "a {\ + \n b: lab(42.0000002803% 0.0000000582 -0.0000070926);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0.2 -0.3), lab)}\n"), + "a {\ + \n b: lab(33.0422497851% 107.2195839075 -107.9836652126);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% none 0.3), lab)}\n"), + "a {\ + \n b: lab(2.4372581534% none 58.4055225293);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 none), lab)}\n"), + "a {\ + \n b: lab(0.4263319128% 27.5478510774 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(none 0.2 0.3), lab)}\n"), + "a {\ + \n b: lab(none -64.726469561 159.0711423642);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% -999999 0), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz -76837326254677664 3783159310641774 5396110649242741) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklab(0% -2 2), $lightness: -50%), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz -7.6342507319 1.7017043263 -38.7847424885) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(100% 0 0), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz 0.9504559526 1.0000000182 1.0890580001) 100%, black);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklab/lch.rs b/rsass/tests/spec/core_functions/color/to_space/oklab/lch.rs new file mode 100644 index 000000000..ea60289a0 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklab/lch.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklab/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.4), lch)}\n"), + "a {\ + \n b: lch(2.4858192097% 79.7774716477 61.6719233557deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.0), lch)}\n"), + "a {\ + \n b: lch(2.4858192097% 79.7774716477 61.6719233557deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(0% 0 0), lch)}\n"), + "a {\ + \n b: lch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0 0), lch)}\n"), + "a {\ + \n b: lch(42.0000002803% 0.0000070929 270.4699000403deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0.2 -0.3), lch)}\n"), + "a {\ + \n b: lch(33.0422497851% 152.1726359305 314.7965716122deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% none 0.3), lch)}\n"), + "a {\ + \n b: lch(2.4372581534% 59.0755529992 98.6375851746deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 none), lch)}\n"), + "a {\ + \n b: lch(0.4263319128% 27.5527624534 1.0818401525deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(none 0.2 0.3), lch)}\n"), + "a {\ + \n b: lch(none 171.7356811932 112.1415379531deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% -999999 0), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz -76842638588973744 3781392309267311 5284390240038480) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklab(0% -2 2), $lightness: -50%), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz -7.6342507319 1.7017043263 -38.7847424885) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(100% 0 0), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz 0.9504559526 1.0000000182 1.0890580001) 100%, black);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklab/mod.rs b/rsass/tests/spec/core_functions/color/to_space/oklab/mod.rs new file mode 100644 index 000000000..f43c41ed4 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklab/mod.rs @@ -0,0 +1,36 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklab" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod a98_rgb; + +mod display_p3; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_space/oklab/oklab.rs b/rsass/tests/spec/core_functions/color/to_space/oklab/oklab.rs new file mode 100644 index 000000000..45247218e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklab/oklab.rs @@ -0,0 +1,69 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklab/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +#[test] +#[ignore] // unexepected error +fn in_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0.2 -0.3), oklab)}\n"), + "a {\ + \n b: oklab(50% 0.2 -0.3);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% none 0.3), oklab)}\n"), + "a {\ + \n b: oklab(10% none 0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 none), oklab)}\n"), + "a {\ + \n b: oklab(10% 0.2 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(none 0.2 0.3), oklab)}\n"), + "a {\ + \n b: oklab(none 0.2 0.3);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklab(0% -2 2), $lightness: -50%), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz -7.6342507319 1.7017043263 -38.7847424885) 100%, black);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklab/oklch.rs b/rsass/tests/spec/core_functions/color/to_space/oklab/oklch.rs new file mode 100644 index 000000000..2507395cb --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklab/oklch.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklab/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.4), oklch)}\n"), + "a {\ + \n b: oklch(10% 0.3605551275 56.309932474deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.0), oklch)}\n"), + "a {\ + \n b: oklch(10% 0.3605551275 56.309932474deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(0% 0 0), oklch)}\n"), + "a {\ + \n b: oklch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0 0), oklch)}\n"), + "a {\ + \n b: oklch(50% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0.2 -0.3), oklch)}\n"), + "a {\ + \n b: oklch(50% 0.3605551275 303.690067526deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% none 0.3), oklch)}\n"), + "a {\ + \n b: oklch(10% 0.3 90deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 none), oklch)}\n"), + "a {\ + \n b: oklch(10% 0.2 0deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(none 0.2 0.3), oklch)}\n"), + "a {\ + \n b: oklch(none 0.3605551275 56.309932474deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% -999999 0), oklch)}\n"), + "a {\ + \n b: oklch(50% 999999 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklab(0% -2 2), $lightness: -50%), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz -7.6342507319 1.7017043263 -38.7847424885) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(100% 0 0), oklch)}\n"), + "a {\ + \n b: oklch(100% 0 none);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklab/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/oklab/prophoto_rgb.rs new file mode 100644 index 000000000..a7c5f0da2 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklab/prophoto_rgb.rs @@ -0,0 +1,151 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklab/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.4), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1071252394 -0.0424411714 -0.1726130102 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1071252394 -0.0424411714 -0.1726130102 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(0% 0 0), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0 0), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.3149802636 0.3149802656 0.3149803022);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0.2 -0.3), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.4918881954 -0.0624904068 0.9386035712);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% none 0.3), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.0211561039 0.0415370447 -0.1548071681);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 none), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.0759873356 -0.0414646645 0.0022071932);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(none 0.2 0.3), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb -0.0831372042 0.0891975511 -0.2723906896);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% -999999 0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -2922133015.648196 1810415223.5562131 574653584.8087448);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklab(0% -2 2), $lightness: -50%), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -2.9829710472 2.6753284297 -7.2338243089);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(100% 0 0), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 1.0000000036 1.0000000099 1.0000001263);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklab/rec2020.rs b/rsass/tests/spec/core_functions/color/to_space/oklab/rec2020.rs new file mode 100644 index 000000000..c577268e4 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklab/rec2020.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklab/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.4), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.1199235027 -0.0200899821 -0.1691453887 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.1199235027 -0.0200899821 -0.1691453887 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(0% 0 0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0 0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.3319485728 0.3319485809 0.3319486233);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0.2 -0.3), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.4424432787 -0.1481489957 0.9623483669);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% none 0.3), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.028710049 0.0171073657 -0.1474743881);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 none), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.052988574 -0.0188512434 0.0014800891);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(none 0.2 0.3), rec2020)}\n"), + "a {\ + \n b: color(rec2020 -0.002787099 0.0709375609 -0.2911317053);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% -999999 0), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 -56131669.11203061 38257478.199239716 10955271.878602052);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklab(0% -2 2), $lightness: -50%), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 -1.92504049 2.5779941201 -5.465676751);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(100% 0 0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.9999999872 1.0000000081 1.0000001161);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklab/rgb.rs b/rsass/tests/spec/core_functions/color/to_space/oklab/rgb.rs new file mode 100644 index 000000000..9ad773983 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklab/rgb.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklab/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.4), rgb)}\n"), + "a {\ + \n b: hsla(19.0047457513, 6337.7067481883%, 0.3924710109%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.0), rgb)}\n"), + "a {\ + \n b: hsla(19.0047457513, 6337.7067481883%, 0.3924710109%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(0% 0 0), rgb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0 0), rgb)}\n"), + "a {\ + \n b: rgb(99.0860757797, 99.0860799859, 99.0860913711);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0.2 -0.3), rgb)}\n"), + "a {\ + \n b: hsl(280.3037191595, 185.1123260276%, 35.6118905417%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% none 0.3), rgb)}\n"), + "a {\ + \n b: hsl(229.5442945473, 280.5312633728%, -5.8764819359%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 none), rgb)}\n"), + "a {\ + \n b: hsl(339.4567046558, 263.6331199652%, 4.40110336%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(none 0.2 0.3), rgb)}\n"), + "a {\ + \n b: hsl(261.4365788529, 230.0242883505%, -11.2533870657%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% -999999 0), rgb)}\n"), + "a {\ + \n b: hsl(340.1123890362, 426.4426890198%, -360094010.73043364%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklab(0% -2 2), $lightness: -50%), rgb)}\n" + ), + "a {\ + \n b: hsl(280.1786410944, 318.2272126608%, -118.134272113%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(100% 0 0), rgb)}\n"), + "a {\ + \n b: hsl(43.8135971986, 172.5242105081%, 100.0000042145%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklab/srgb.rs b/rsass/tests/spec/core_functions/color/to_space/oklab/srgb.rs new file mode 100644 index 000000000..871b45e6d --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklab/srgb.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklab/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.4), srgb)}\n"), + "a {\ + \n b: color(srgb 0.2526613275 -0.0872393682 -0.2448119073 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.0), srgb)}\n"), + "a {\ + \n b: color(srgb 0.2526613275 -0.0872393682 -0.2448119073 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(0% 0 0), srgb)}\n"), + "a {\ + \n b: color(srgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0 0), srgb)}\n"), + "a {\ + \n b: color(srgb 0.3885728462 0.3885728627 0.3885729073);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0.2 -0.3), srgb)}\n"), + "a {\ + \n b: color(srgb 0.5825328265 -0.3031010838 1.0153388947);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% none 0.3), srgb)}\n"), + "a {\ + \n b: color(srgb 0.1060888708 0.0486334832 -0.2236185095);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 none), srgb)}\n"), + "a {\ + \n b: color(srgb 0.1600386946 -0.0720166274 0.0074363895);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(none 0.2 0.3), srgb)}\n"), + "a {\ + \n b: color(srgb -0.0386443242 0.1463213645 -0.3713891058);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% -999999 0), srgb)}\n" + ), + "a {\ + \n b: color(srgb -18956885.930884026 11755005.716275353 1575236.4989373833);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklab(0% -2 2), $lightness: -50%), srgb)}\n" + ), + "a {\ + \n b: color(srgb -2.4568465628 2.5780112923 -4.9406967346);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(100% 0 0), srgb)}\n"), + "a {\ + \n b: color(srgb 0.9999999694 1.0000000087 1.0000001149);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklab/srgb_linear.rs b/rsass/tests/spec/core_functions/color/to_space/oklab/srgb_linear.rs new file mode 100644 index 000000000..d6ad096c2 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklab/srgb_linear.rs @@ -0,0 +1,151 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklab/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.4), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0519480297 -0.0081553321 -0.0488237803 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0519480297 -0.0081553321 -0.0488237803 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(0% 0 0), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0 0), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.1249999913 0.1250000025 0.1250000327);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0.2 -0.3), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.2985384134 -0.074783816 1.0352499891);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% none 0.3), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.01099389 0.0038141198 -0.0409466157);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 none), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.0219904427 -0.0062152626 0.0005755719);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(none 0.2 0.3), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear -0.0029910468 0.0187728311 -0.1136916938);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% -999999 0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -257534189123413888 81795409108779168 657391329523393.8);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklab(0% -2 2), $lightness: -50%), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -8.0200588156 8.9800887523 -41.7661704476);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(100% 0 0), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.9999999305 1.0000000197 1.0000002613);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklab/xyz.rs b/rsass/tests/spec/core_functions/color/to_space/oklab/xyz.rs new file mode 100644 index 000000000..f7c3588c3 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklab/xyz.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklab/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.4), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0096949161 0.0016890376 -0.046376448 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.0), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0096949161 0.0016890376 -0.046376448 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(0% 0 0), xyz)}\n"), + "a {\ + \n b: color(xyz 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0 0), xyz)}\n"), + "a {\ + \n b: color(xyz 0.1188069941 0.1250000023 0.13613225);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0.2 -0.3), xyz)}\n"), + "a {\ + \n b: color(xyz 0.2832157077 0.0847349623 0.9808955517);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% none 0.3), xyz)}\n"), + "a {\ + \n b: color(xyz -0.0014924289 0.0021094378 -0.0382539306);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 none), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0069500554 0.0002726166 0.000231366);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(none 0.2 0.3), xyz)}\n"), + "a {\ + \n b: color(xyz -0.0150397763 0.004582061 -0.1058878063);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% -999999 0), xyz)}\n" + ), + "a {\ + \n b: color(xyz -76837326254677680 3783159310641777.5 5396110649242756);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklab(0% -2 2), $lightness: -50%), xyz)}\n" + ), + "a {\ + \n b: color(xyz -7.6342507319 1.7017043263 -38.7847424885);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(100% 0 0), xyz)}\n"), + "a {\ + \n b: color(xyz 0.9504559526 1.0000000182 1.0890580001);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklab/xyz_d50.rs b/rsass/tests/spec/core_functions/color/to_space/oklab/xyz_d50.rs new file mode 100644 index 000000000..60f23bff0 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklab/xyz_d50.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklab/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.4), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0125260886 0.0027519422 -0.0349334402 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 0.3 / 0.0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0125260886 0.0027519422 -0.0349334402 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(0% 0 0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0 0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.1205369614 0.1250000018 0.1031380988);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% 0.2 -0.3), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.2495012093 0.0755678711 0.7361680649);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn a() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% none 0.3), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0004044958 0.0026981824 -0.028716594);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn b() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(10% 0.2 none), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.007277813 0.0004719735 0.0001138228);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(none 0.2 0.3), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 -0.0103407367 0.0059005425 -0.0794063212);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklab(50% -999999 0), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 -80704154717242816 1378317505528979.2 4824363534483794);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklab(0% -2 2), $lightness: -50%), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 -6.0144158738 2.1214433281 -29.0650672146);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklab(100% 0 0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.9642956911 1.0000000145 0.82510479);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklch/a98_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/oklch/a98_rgb.rs new file mode 100644 index 000000000..182a864e6 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklch/a98_rgb.rs @@ -0,0 +1,162 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklch/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.4), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1027766441 -0.0609172248 -0.0321025971 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.1027766441 -0.0609172248 -0.0321025971 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(0% 0 0deg), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10.123456789% 0.198765432 30.192837465deg), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1569345546 -0.1088588794 -0.038585035);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(50% 0 0deg), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.3884711027 0.388471114 0.3884711549);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.1027766441 -0.0609172248 -0.0321025971);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% none 30deg), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.0432393553 0.0432393565 0.0432393611);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 none), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.0964961637 -0.0571048143 0.0359545033);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(none 0.1 30deg), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.0213511879 0.0047462167 -0.0347458469);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 999999 0deg), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 66665577.100123584 -49015761.348732136 -12422991.362568038);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklch(0% 1 0deg), $lightness: -10%), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.3172861934 -0.2637782471 -0.1086210387);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(100% 0 0deg), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.9999999799 1.000000009 1.0000001143);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklch/display_p3.rs b/rsass/tests/spec/core_functions/color/to_space/oklch/display_p3.rs new file mode 100644 index 000000000..5aaa6d9dc --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklch/display_p3.rs @@ -0,0 +1,164 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklch/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.4), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.0863974377 -0.022155665 -0.0050290551 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.0863974377 -0.022155665 -0.0050290551 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(0% 0 0deg), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10.123456789% 0.198765432 30.192837465deg), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.1548116084 -0.0741945938 -0.0069035722);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(50% 0 0deg), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.3885728491 0.3885728621 0.3885729031);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.0863974377 -0.022155665 -0.0050290551);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% none 30deg), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.0129199993 0.0129200002 0.0129200031);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 none), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.0784514548 -0.0192081243 0.0093493065);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(none 0.1 30deg), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.0031329176 0.0002226378 -0.0075165654);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 999999 0deg), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 16964742.301441267 -11051293.581589133 -2566311.5001529297);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklch(0% 1 0deg), $lightness: -10%), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.3493925785 -0.240514802 -0.0760588329);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(100% 0 0deg), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.9999999764 1.0000000074 1.0000001047);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklch/hsl.rs b/rsass/tests/spec/core_functions/color/to_space/oklch/hsl.rs new file mode 100644 index 000000000..9d3fcadaa --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklch/hsl.rs @@ -0,0 +1,158 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklch/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.4), hsl)}\n"), + "a {\ + \n b: hsla(349.9222383971, 174.3087628098%, 3.6948783654%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.0), hsl)}\n"), + "a {\ + \n b: hsla(349.9222383971, 174.3087628098%, 3.6948783654%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(0% 0 0deg), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 0%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10.123456789% 0.198765432 30.192837465deg), hsl)}\n" + ), + "a {\ + \n b: hsl(342.3640346721, 274.4922188663%, 4.7714615434%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(50% 0 0deg), hsl)}\n"), + "a {\ + \n b: hsl(223.8135972091, 0.0000078676%, 38.8572876766%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg), hsl)}\n"), + "a {\ + \n b: hsl(349.9222383971, 174.3087628098%, 3.6948783654%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% none 30deg), hsl)}\n"), + "a {\ + \n b: hsl(223.8135982915, 0%, 1.2920001239%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 none), hsl)}\n"), + "a {\ + \n b: hsl(0, 169.3005035983%, 3.4369836375%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(none 0.1 30deg), hsl)}\n"), + "a {\ + \n b: hsl(221.7487183642, 266.6061391496%, 0%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 999999 0deg), hsl)}\n"), + "a {\ + \n b: hsl(160.1123681644, 426.4426548179%, 360094749.97600085%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklch(0% 1 0deg), $lightness: -10%), hsl)}\n" + ), + "a {\ + \n b: hsl(342.6995890373, 454.6290714992%, 7.2218303523%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(100% 0 0deg), hsl)}\n"), + "a {\ + \n b: hsl(43.8135971986, 172.5242105081%, 100.0000042145%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklch/hwb.rs b/rsass/tests/spec/core_functions/color/to_space/oklch/hwb.rs new file mode 100644 index 000000000..dc6438ac1 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklch/hwb.rs @@ -0,0 +1,158 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklch/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.4), hwb)}\n"), + "a {\ + \n b: hsla(349.9222383971, 174.3087628098%, 3.6948783654%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.0), hwb)}\n"), + "a {\ + \n b: hsla(349.9222383971, 174.3087628098%, 3.6948783654%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(0% 0 0deg), hwb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10.123456789% 0.198765432 30.192837465deg), hwb)}\n" + ), + "a {\ + \n b: hsl(342.3640346721, 274.4922188663%, 4.7714615434%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(50% 0 0deg), hwb)}\n"), + "a {\ + \n b: hsl(223.8135972091, 0.0000078676%, 38.8572876766%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg), hwb)}\n"), + "a {\ + \n b: hsl(349.9222383971, 174.3087628098%, 3.6948783654%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% none 30deg), hwb)}\n"), + "a {\ + \n b: hsl(223.813598298, 0.0000165409%, 1.2920001239%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 none), hwb)}\n"), + "a {\ + \n b: hsl(0, 169.3005035983%, 3.4369836375%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(none 0.1 30deg), hwb)}\n"), + "a {\ + \n b: hsl(221.7487183642, 266.6061391496%, -0.2273359503%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 999999 0deg), hwb)}\n"), + "a {\ + \n b: hsl(160.1123681644, 426.4426548179%, 360094749.9760007%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklch(0% 1 0deg), $lightness: -10%), hwb)}\n" + ), + "a {\ + \n b: hsl(342.6995890373, 454.6290714992%, 7.2218303523%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(100% 0 0deg), hwb)}\n"), + "a {\ + \n b: hsl(43.8135971652, 172.5242119439%, 100.0000042145%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklch/lab.rs b/rsass/tests/spec/core_functions/color/to_space/oklch/lab.rs new file mode 100644 index 000000000..dbad4b7fe --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklch/lab.rs @@ -0,0 +1,162 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklch/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.4), lab)}\n"), + "a {\ + \n b: lab(0.6560445641% 11.6264793014 1.8588166268 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.0), lab)}\n"), + "a {\ + \n b: lab(0.6560445641% 11.6264793014 1.8588166268 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(0% 0 0deg), lab)}\n"), + "a {\ + \n b: lab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10.123456789% 0.198765432 30.192837465deg), lab)}\n" + ), + "a {\ + \n b: lab(0.4361236096% 33.2605943231 2.095776706);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(50% 0 0deg), lab)}\n"), + "a {\ + \n b: lab(42.0000002803% 0.0000000582 -0.0000070926);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg), lab)}\n"), + "a {\ + \n b: lab(0.6560445641% 11.6264793014 1.8588166268);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% none 30deg), lab)}\n"), + "a {\ + \n b: lab(0.9032963094% 0.0000000027 -0.0000003314);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 none), lab)}\n"), + "a {\ + \n b: lab(0.6385915087% 10.5093876004 0.1611873791);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(none 0.1 30deg), lab)}\n"), + "a {\ + \n b: lab(none 0.0322037834 0.9096922188);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 999999 0deg), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz 76838084844227696 -3783161942592645 -5396112427214629) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklch(0% 1 0deg), $lightness: -10%), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz 0.0348582183 -0.010229465 -0.0091226442) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(100% 0 0deg), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz 0.9504559526 1.0000000182 1.0890580001) 100%, black);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklch/lch.rs b/rsass/tests/spec/core_functions/color/to_space/oklch/lch.rs new file mode 100644 index 000000000..eecb4f513 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklch/lch.rs @@ -0,0 +1,162 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklch/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.4), lch)}\n"), + "a {\ + \n b: lch(0.6560445641% 11.7741335222 9.0834533485deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.0), lch)}\n"), + "a {\ + \n b: lch(0.6560445641% 11.7741335222 9.0834533485deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(0% 0 0deg), lch)}\n"), + "a {\ + \n b: lch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10.123456789% 0.198765432 30.192837465deg), lch)}\n" + ), + "a {\ + \n b: lch(0.4361236096% 33.3265571988 3.6054863359deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(50% 0 0deg), lch)}\n"), + "a {\ + \n b: lch(42.0000002803% 0.0000070929 270.4699000403deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg), lch)}\n"), + "a {\ + \n b: lch(0.6560445641% 11.7741335222 9.0834533485deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% none 30deg), lch)}\n"), + "a {\ + \n b: lch(0.9032963094% none 270.4698988243deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 none), lch)}\n"), + "a {\ + \n b: lch(0.6385915087% 10.5106236307 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(none 0.1 30deg), lch)}\n"), + "a {\ + \n b: lch(none 0.9102620593 87.9725333167deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 999999 0deg), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz 76837027122572336 -3783130536950956 -5396126058991186) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklch(0% 1 0deg), $lightness: -10%), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz 0.0348582183 -0.010229465 -0.0091226442) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(100% 0 0deg), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz 0.9504559526 1.0000000182 1.0890580001) 100%, black);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklch/mod.rs b/rsass/tests/spec/core_functions/color/to_space/oklch/mod.rs new file mode 100644 index 000000000..9710004dc --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklch/mod.rs @@ -0,0 +1,36 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklch" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod a98_rgb; + +mod display_p3; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_space/oklch/oklab.rs b/rsass/tests/spec/core_functions/color/to_space/oklch/oklab.rs new file mode 100644 index 000000000..ab7559961 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklch/oklab.rs @@ -0,0 +1,158 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklch/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.4), oklab)}\n"), + "a {\ + \n b: oklab(10% 0.0866025404 0.05 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.0), oklab)}\n"), + "a {\ + \n b: oklab(10% 0.0866025404 0.05 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(0% 0 0deg), oklab)}\n"), + "a {\ + \n b: oklab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10.123456789% 0.198765432 30.192837465deg), oklab)}\n" + ), + "a {\ + \n b: oklab(10.123456789% 0.1718004519 0.099961501);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(50% 0 0deg), oklab)}\n"), + "a {\ + \n b: oklab(50% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg), oklab)}\n"), + "a {\ + \n b: oklab(10% 0.0866025404 0.05);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% none 30deg), oklab)}\n"), + "a {\ + \n b: oklab(10% 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 none), oklab)}\n"), + "a {\ + \n b: oklab(10% 0.1 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(none 0.1 30deg), oklab)}\n"), + "a {\ + \n b: oklab(none 0.0866025404 0.05);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 999999 0deg), oklab)}\n"), + "a {\ + \n b: oklab(10% 999998.9999999994 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklch(0% 1 0deg), $lightness: -10%), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz 0.0348582183 -0.010229465 -0.0091226442) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(100% 0 0deg), oklab)}\n"), + "a {\ + \n b: oklab(100% 0 0);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklch/oklch.rs b/rsass/tests/spec/core_functions/color/to_space/oklch/oklch.rs new file mode 100644 index 000000000..087708f3a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklch/oklch.rs @@ -0,0 +1,69 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklch/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +#[test] +#[ignore] // unexepected error +fn in_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg), oklch)}\n"), + "a {\ + \n b: oklch(10% 0.1 30deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% none 30deg), oklch)}\n"), + "a {\ + \n b: oklch(10% none 30deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 none), oklch)}\n"), + "a {\ + \n b: oklch(10% 0.1 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(none 0.1 30deg), oklch)}\n"), + "a {\ + \n b: oklch(none 0.1 30deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklch(0% 1 0deg), $lightness: -10%), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz 0.0348582183 -0.010229465 -0.0091226442) 100%, black);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklch/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/oklch/prophoto_rgb.rs new file mode 100644 index 000000000..b329bbeb1 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklch/prophoto_rgb.rs @@ -0,0 +1,164 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklch/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.4), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.0506096466 -0.0137951641 -0.0074760688 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.0506096466 -0.0137951641 -0.0074760688 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(0% 0 0deg), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10.123456789% 0.198765432 30.192837465deg), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.0841896026 -0.0467124006 -0.013805913);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(50% 0 0deg), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.3149802636 0.3149802656 0.3149803022);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.0506096466 -0.0137951641 -0.0074760688);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% none 30deg), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.0160000001 0.0160000003 0.0160000036);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 none), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.0479066375 -0.0113980141 0.0096553537);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(none 0.1 30deg), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.0010727238 0.000279135 -0.0088387805);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 999999 0deg), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 2922140081.0303516 -1810418807.7705455 -574654139.8912412);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklch(0% 1 0deg), $lightness: -10%), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1937443943 -0.1519484627 -0.0725277832);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(100% 0 0deg), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 1.0000000036 1.0000000099 1.0000001263);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklch/rec2020.rs b/rsass/tests/spec/core_functions/color/to_space/oklch/rec2020.rs new file mode 100644 index 000000000..cb1a83822 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklch/rec2020.rs @@ -0,0 +1,162 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklch/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.4), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.0256576867 -0.0056343197 -0.0019025127 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0256576867 -0.0056343197 -0.0019025127 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(0% 0 0deg), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10.123456789% 0.198765432 30.192837465deg), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.064418765 -0.0232002216 -0.0029907849);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(50% 0 0deg), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.3319485728 0.3319485809 0.3319486233);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0256576867 -0.0056343197 -0.0019025127);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% none 30deg), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0044999999 0.0045000001 0.0045000011);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 none), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0225650026 -0.0048194756 0.0030470892);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(none 0.1 30deg), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0007134353 0.0000902745 -0.002575042);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 999999 0deg), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 56131778.24188723 -38257541.3895273 -10955273.518136343);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklch(0% 1 0deg), $lightness: -10%), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.2237639493 -0.1587187375 -0.0339392569);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(100% 0 0deg), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.9999999872 1.0000000081 1.0000001161);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklch/rgb.rs b/rsass/tests/spec/core_functions/color/to_space/oklch/rgb.rs new file mode 100644 index 000000000..9eeed09fe --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklch/rgb.rs @@ -0,0 +1,158 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklch/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.4), rgb)}\n"), + "a {\ + \n b: hsla(349.9222383971, 174.3087628098%, 3.6948783654%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.0), rgb)}\n"), + "a {\ + \n b: hsla(349.9222383971, 174.3087628098%, 3.6948783654%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(0% 0 0deg), rgb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10.123456789% 0.198765432 30.192837465deg), rgb)}\n" + ), + "a {\ + \n b: hsl(342.3640346721, 274.4922188663%, 4.7714615434%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(50% 0 0deg), rgb)}\n"), + "a {\ + \n b: rgb(99.0860757797, 99.0860799859, 99.0860913711);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg), rgb)}\n"), + "a {\ + \n b: hsl(349.9222383971, 174.3087628098%, 3.6948783654%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% none 30deg), rgb)}\n"), + "a {\ + \n b: rgb(3.2945997709, 3.2946000649, 3.2946008608);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 none), rgb)}\n"), + "a {\ + \n b: hsl(342.5627231518, 169.3005035983%, 3.4369836375%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(none 0.1 30deg), rgb)}\n"), + "a {\ + \n b: hsl(221.7487183642, 266.6061391496%, -0.2273359503%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 999999 0deg), rgb)}\n"), + "a {\ + \n b: hsl(160.1123681644, 426.4426548179%, 360094749.97600085%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklch(0% 1 0deg), $lightness: -10%), rgb)}\n" + ), + "a {\ + \n b: hsl(342.6995890373, 454.6290714992%, 7.2218303523%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(100% 0 0deg), rgb)}\n"), + "a {\ + \n b: hsl(43.8135971986, 172.5242105081%, 100.0000042145%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklch/srgb.rs b/rsass/tests/spec/core_functions/color/to_space/oklch/srgb.rs new file mode 100644 index 000000000..010a9baf4 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklch/srgb.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklch/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.4), srgb)}\n"), + "a {\ + \n b: color(srgb 0.1013537513 -0.027456184 -0.0058209203 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.0), srgb)}\n"), + "a {\ + \n b: color(srgb 0.1013537513 -0.027456184 -0.0058209203 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(0% 0 0deg), srgb)}\n"), + "a {\ + \n b: color(srgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10.123456789% 0.198765432 30.192837465deg), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.1786875221 -0.0832582912 -0.0062638365);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(50% 0 0deg), srgb)}\n"), + "a {\ + \n b: color(srgb 0.3885728462 0.3885728627 0.3885729073);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg), srgb)}\n"), + "a {\ + \n b: color(srgb 0.1013537513 -0.027456184 -0.0058209203);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% none 30deg), srgb)}\n"), + "a {\ + \n b: color(srgb 0.0129199991 0.0129200003 0.0129200034);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 none), srgb)}\n"), + "a {\ + \n b: color(srgb 0.0925581424 -0.0238184697 0.0100030504);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(none 0.1 30deg), srgb)}\n"), + "a {\ + \n b: color(srgb 0.0037875565 0.0001002403 -0.0083342755);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 999999 0deg), srgb)}\n" + ), + "a {\ + \n b: color(srgb 18956919.35191059 -11755024.352390574 -1575227.1966261775);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklch(0% 1 0deg), $lightness: -10%), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.4005437063 -0.2561070992 -0.066768286);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(100% 0 0deg), srgb)}\n"), + "a {\ + \n b: color(srgb 0.9999999694 1.0000000087 1.0000001149);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklch/srgb_linear.rs b/rsass/tests/spec/core_functions/color/to_space/oklch/srgb_linear.rs new file mode 100644 index 000000000..8db04f69a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklch/srgb_linear.rs @@ -0,0 +1,164 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklch/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.4), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0102342031 -0.0021250916 -0.0004505356 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0102342031 -0.0021250916 -0.0004505356 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(0% 0 0deg), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10.123456789% 0.198765432 30.192837465deg), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0268484583 -0.00761821 -0.0004848171);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(50% 0 0deg), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.1249999913 0.1250000025 0.1250000327);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.0102342031 -0.0021250916 -0.0004505356);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% none 30deg), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.0009999999 0.001 0.0010000003);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 none), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.0089064724 -0.0018435348 0.0007742299);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(none 0.1 30deg), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.0002931545 0.0000077585 -0.0006450678);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 999999 0deg), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 257535278804612064 -81795720332859872 -657382012471774.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklch(0% 1 0deg), $lightness: -10%), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.1332496936 -0.0533553421 -0.0056166345);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(100% 0 0deg), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.9999999305 1.0000000197 1.0000002613);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklch/xyz.rs b/rsass/tests/spec/core_functions/color/to_space/oklch/xyz.rs new file mode 100644 index 000000000..4f5dbc7e7 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklch/xyz.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklch/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.4), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0033792787 0.0006238666 -0.0004837129 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.0), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0033792787 0.0006238666 -0.0004837129 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(0% 0 0deg), xyz)}\n"), + "a {\ + \n b: color(xyz 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10.123456789% 0.198765432 30.192837465deg), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.0082604044 0.0002257242 -0.0008498824);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(50% 0 0deg), xyz)}\n"), + "a {\ + \n b: color(xyz 0.1188069941 0.1250000023 0.13613225);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0033792787 0.0006238666 -0.0004837129);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% none 30deg), xyz)}\n"), + "a {\ + \n b: color(xyz 0.000950456 0.001 0.001089058);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 none), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0031534617 0.0006313185 0.0006883601);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(none 0.1 30deg), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0000072462 0.0000213158 -0.000606566);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 999999 0deg), xyz)}\n" + ), + "a {\ + \n b: color(xyz 76837666021869456 -3783149507010139 -5396117824941693);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklch(0% 1 0deg), $lightness: -10%), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.0348582183 -0.010229465 -0.0091226442);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(100% 0 0deg), xyz)}\n"), + "a {\ + \n b: color(xyz 0.9504559526 1.0000000182 1.0890580001);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/oklch/xyz_d50.rs b/rsass/tests/spec/core_functions/color/to_space/oklch/xyz_d50.rs new file mode 100644 index 000000000..bd2c6b237 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/oklch/xyz_d50.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/oklch/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.4), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0035798412 0.0007262784 -0.0003855337 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg / 0.0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0035798412 0.0007262784 -0.0003855337 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(0% 0 0deg), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10.123456789% 0.198765432 30.192837465deg), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0087041611 0.0004828135 -0.0007119576);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(50% 0 0deg), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.1205369614 0.1250000018 0.1031380988);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 30deg), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0035798412 0.0007262784 -0.0003855337);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn chroma() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% none 30deg), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0009642957 0.001 0.0008251048);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn hue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 0.1 none), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0032845429 0.0007069569 0.0004979173);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn lightness() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(none 0.1 30deg), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0000385276 0.000031683 -0.0004558074);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(oklch(10% 999999 0deg), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 80704511354532880 -1378297606600871.2 -4824371922593688);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(oklch(0% 1 0deg), $lightness: -10%), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0367521174 -0.0089430834 -0.007335284);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(oklch(100% 0 0deg), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.9642956911 1.0000000145 0.82510479);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/a98_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/a98_rgb.rs new file mode 100644 index 000000000..cc6e52197 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/a98_rgb.rs @@ -0,0 +1,161 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/prophoto_rgb/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.4), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb -0.1365499745 0.2865616306 0.3841343378 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.0), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb -0.1365499745 0.2865616306 0.3841343378 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0 0 0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.5 0.5 0.5), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.5670420112 0.5670420112 0.5670420112);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.2 0.4 0.8), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb -0.3560951477 0.5045482124 0.8644762739);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 none), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1371997596 0.2872404522 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 none 0.3), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb -0.0732568776 none 0.3916546985);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb none 0.2 0.3), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb none 0.2938324337 0.384534187);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -999999 0 0), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb -94583.3572201015 41648.2618143793 12982.0175899086);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -1 0.4 2), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb -1.4279386159 0.6992982312 1.851989355);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 1 1 1), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/display_p3.rs b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/display_p3.rs new file mode 100644 index 000000000..a978e59bd --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/display_p3.rs @@ -0,0 +1,165 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/prophoto_rgb/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.4), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -0.1681406496 0.272751421 0.3768280764 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -0.1681406496 0.272751421 0.3768280764 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0 0 0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.5 0.5 0.5), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.5723067532 0.5723067532 0.5723067532);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.2 0.4 0.8), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -0.4263141523 0.4923548598 0.8503908535);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 none), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.0601855627 0.2760901066 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 none 0.3), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -0.0396944837 none 0.3821042494);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb none 0.2 0.3), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 none 0.278189942 0.3765750961);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -999999 0 0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -40921.237624831 15288.5098255533 -4976.1422545962);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -1 0.4 2), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -1.5123725709 0.6119230865 1.7528266609);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 1 1 1), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/hsl.rs b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/hsl.rs new file mode 100644 index 000000000..a2a53e033 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/hsl.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/prophoto_rgb/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.4), hsl)}\n" + ), + "a {\ + \n b: hsla(190.4112342736, 389.9464516401%, 7.9139613859%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.0), hsl)}\n" + ), + "a {\ + \n b: hsla(190.4112342736, 389.9464516401%, 7.9139613859%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0 0 0), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 0%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.5 0.5 0.5), hsl)}\n" + ), + "a {\ + \n b: hsl(0, 0%, 57.2306753164%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.2 0.4 0.8), hsl)}\n" + ), + "a {\ + \n b: hsl(195.9034030348, 388.9813639336%, 17.9876851056%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 none), hsl)}\n" + ), + "a {\ + \n b: hsl(119.2084673976, 194.643672602%, 9.5495891256%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 none 0.3), hsl)}\n" + ), + "a {\ + \n b: hsl(241.7396943935, 128.7470611392%, 17.4883701258%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb none 0.2 0.3), hsl)}\n" + ), + "a {\ + \n b: hsl(188.6270203536, 825.3071653223%, 4.1925835467%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -999999 0 0), hsl)}\n" + ), + "a {\ + \n b: hsl(347.1631207662, 234.6485806965%, -1340219.8783108443%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -1 0.4 2), hsl)}\n"), + "a {\ + \n b: hsl(199.2935266227, 2154.1559841675%, 8.1167706475%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 1 1 1), hsl)}\n"), + "a {\ + \n b: hsl(180, 50%, 100%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/hwb.rs b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/hwb.rs new file mode 100644 index 000000000..bcc53608f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/hwb.rs @@ -0,0 +1,196 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/prophoto_rgb/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.4), hwb));\n" + ), + "a {\ + \n value: hsla(190.4112342736, 389.9464516401%, 7.9139613859%, 0.4);\ + \n space: hwb;\ + \n channels: 190.4112342736deg -22.9462502225% 61.2258270058% / 0.4;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.0), hwb));\n" + ), + "a {\ + \n value: hsla(190.4112342736, 389.9464516401%, 7.9139613859%, 0);\ + \n space: hwb;\ + \n channels: 190.4112342736deg -22.9462502225% 61.2258270058% / 0;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(prophoto-rgb 0 0 0), hwb));\n" + ), + "a {\ + \n value: black;\ + \n space: hwb;\ + \n channels: 0deg 0% 100% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(prophoto-rgb 0.5 0.5 0.5), hwb));\n" + ), + "a {\ + \n value: hsl(0, 0%, 57.2306753164%);\ + \n space: hwb;\ + \n channels: 0deg 57.2306753164% 42.7693246836% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(prophoto-rgb 0.2 0.4 0.8), hwb));\n" + ), + "a {\ + \n value: hsl(195.9034030348, 388.9813639336%, 17.9876851056%);\ + \n space: hwb;\ + \n channels: 195.9034030348deg -51.9810577583% 12.0435720304% / 1;\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 none), hwb)}\n" + ), + "a {\ + \n b: hsl(119.2084673976, 194.643672602%, 9.5495891256%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(prophoto-rgb 0.1 none 0.3), hwb));\n" + ), + "a {\ + \n value: hsl(241.7396943935, 128.7470611392%, 17.4883701258%);\ + \n space: hwb;\ + \n channels: 241.7396943935deg -5.0273924523% 59.9958672962% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(prophoto-rgb none 0.2 0.3), hwb));\n" + ), + "a {\ + \n value: hsl(188.6270203536, 825.3071653223%, 4.1925835467%);\ + \n space: hwb;\ + \n channels: 188.6270203536deg -30.409108876% 61.2057240306% / 1;\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(prophoto-rgb -999999 0 0), hwb));\n" + ), + "a {\ + \n value: hsl(347.1631207662, 234.6485806965%, -1340219.878310844%);\ + \n space: hwb;\ + \n channels: 167.1631207662deg -4485026.800979206% -1804487.0443575173% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(prophoto-rgb -1 0.4 2), hwb));\n" + ), + "a {\ + \n value: hsl(199.2935266227, 2154.1559841675%, 8.1167706475%);\ + \n space: hwb;\ + \n channels: 199.2935266227deg -166.731129976% -82.9646712709% / 1;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(prophoto-rgb 1 1 1), hwb));\n" + ), + "a {\ + \n value: white;\ + \n space: hwb;\ + \n channels: 0deg 100% 0% / 1;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/lab.rs b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/lab.rs new file mode 100644 index 000000000..ddeb9931c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/lab.rs @@ -0,0 +1,161 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/prophoto_rgb/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.4), lab)}\n" + ), + "a {\ + \n b: lab(24.9090529931% -30.9723221547 -26.5858249779 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.0), lab)}\n" + ), + "a {\ + \n b: lab(24.9090529931% -30.9723221547 -26.5858249779 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0 0 0), lab)}\n"), + "a {\ + \n b: lab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.5 0.5 0.5), lab)}\n" + ), + "a {\ + \n b: lab(60.5314588248% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.2 0.4 0.8), lab)}\n" + ), + "a {\ + \n b: lab(46.0098211673% -39.6566664112 -68.0244470598);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 none), lab)}\n" + ), + "a {\ + \n b: lab(24.9058511193% -38.7042406064 42.9411226195);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 none 0.3), lab)}\n" + ), + "a {\ + \n b: lab(4.1334625643% 41.362651194 -62.4058084759);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb none 0.2 0.3), lab)}\n" + ), + "a {\ + \n b: lab(23.4372923288% -57.2633255164 -29.1233433646);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -999999 0 0), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz -47674467013.1876 -16929933315.113932 -247080732.77775204) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -1 0.4 2), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz -0.4478815578 -0.0732156915 3.8173184875) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 1 1 1), lab)}\n"), + "a {\ + \n b: lab(100% 0 0);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/lch.rs b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/lch.rs new file mode 100644 index 000000000..3a0d21f3e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/lch.rs @@ -0,0 +1,161 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/prophoto_rgb/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.4), lch)}\n" + ), + "a {\ + \n b: lch(24.9090529931% 40.8177758998 220.6419219413deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.0), lch)}\n" + ), + "a {\ + \n b: lch(24.9090529931% 40.8177758998 220.6419219413deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0 0 0), lch)}\n"), + "a {\ + \n b: lch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.5 0.5 0.5), lch)}\n" + ), + "a {\ + \n b: lch(60.5314588248% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.2 0.4 0.8), lch)}\n" + ), + "a {\ + \n b: lch(46.0098211673% 78.7399300777 239.7588117754deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 none), lch)}\n" + ), + "a {\ + \n b: lch(24.9058511193% 57.8096726572 132.0293732633deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 none 0.3), lch)}\n" + ), + "a {\ + \n b: lch(4.1334625643% 74.8689110735 303.5364691761deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb none 0.2 0.3), lch)}\n" + ), + "a {\ + \n b: lch(23.4372923288% 64.2437357096 206.9572653738deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -999999 0 0), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz -47674467013.187614 -16929933315.113934 -247080732.77789402) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -1 0.4 2), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz -0.4478815578 -0.0732156915 3.8173184875) 100%, black);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 1 1 1), lch)}\n"), + "a {\ + \n b: lch(100% 0 none);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/mod.rs b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/mod.rs new file mode 100644 index 000000000..27bcc7bf1 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/mod.rs @@ -0,0 +1,36 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/prophoto_rgb" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod a98_rgb; + +mod display_p3; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/oklab.rs b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/oklab.rs new file mode 100644 index 000000000..50d78790e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/oklab.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/prophoto_rgb/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.4), oklab)}\n" + ), + "a {\ + \n b: oklab(34.6066204299% -0.1151566731 -0.0744029999 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.0), oklab)}\n" + ), + "a {\ + \n b: oklab(34.6066204299% -0.1151566731 -0.0744029999 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0 0 0), oklab)}\n"), + "a {\ + \n b: oklab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.5 0.5 0.5), oklab)}\n" + ), + "a {\ + \n b: oklab(65.9753951081% 0.0000000001 0.0000000246);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.2 0.4 0.8), oklab)}\n" + ), + "a {\ + \n b: oklab(52.9739863521% -0.23472674 -0.1933931965);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 none), oklab)}\n" + ), + "a {\ + \n b: oklab(33.9153744238% -0.1155256021 0.0932618247);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 none 0.3), oklab)}\n" + ), + "a {\ + \n b: oklab(20.6577507967% -0.042480718 -0.1739784043);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb none 0.2 0.3), oklab)}\n" + ), + "a {\ + \n b: oklab(32.493750959% -0.2028589632 -0.0824787667);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -999999 0 0), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz -47674467013.18752 -16929933315.11392 -247080732.77775192) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -1 0.4 2), oklab)}\n"), + "a {\ + \n b: oklab(9.4597839538% -2.2223701334 -0.8062107579);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 1 1 1), oklab)}\n"), + "a {\ + \n b: oklab(99.9999993474% 0.0000000001 0.0000000373);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/oklch.rs b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/oklch.rs new file mode 100644 index 000000000..ff52c4616 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/oklch.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/prophoto_rgb/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.4), oklch)}\n" + ), + "a {\ + \n b: oklch(34.6066204299% 0.1371016621 212.8665983723deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.0), oklch)}\n" + ), + "a {\ + \n b: oklch(34.6066204299% 0.1371016621 212.8665983723deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0 0 0), oklch)}\n"), + "a {\ + \n b: oklch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.5 0.5 0.5), oklch)}\n" + ), + "a {\ + \n b: oklch(65.9753951081% 0.0000000246 89.875562502deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.2 0.4 0.8), oklch)}\n" + ), + "a {\ + \n b: oklch(52.9739863521% 0.3041341331 219.4853767353deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 none), oklch)}\n" + ), + "a {\ + \n b: oklch(33.9153744238% 0.1484719929 141.0866609821deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 none 0.3), oklch)}\n" + ), + "a {\ + \n b: oklch(20.6577507967% 0.1790896327 256.2784427934deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb none 0.2 0.3), oklch)}\n" + ), + "a {\ + \n b: oklch(32.493750959% 0.2189851728 202.1257651897deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -999999 0 0), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz -47674467013.18753 -16929933315.11391 -247080732.777771) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -1 0.4 2), oklch)}\n"), + "a {\ + \n b: oklch(9.4597839538% 2.3640864612 199.9392877927deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 1 1 1), oklch)}\n"), + "a {\ + \n b: oklch(99.9999993474% 0.0000000373 89.8755630959deg);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/prophoto_rgb.rs new file mode 100644 index 000000000..a2735ab39 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/prophoto_rgb.rs @@ -0,0 +1,77 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/prophoto_rgb/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +#[test] +#[ignore] // unexepected error +fn in_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.2 0.4 0.8), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2 0.4 0.8);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 none), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1 0.2 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 none 0.3), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1 none 0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb none 0.2 0.3), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb none 0.2 0.3);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -1 0.4 2), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -1 0.4 2);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/rec2020.rs b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/rec2020.rs new file mode 100644 index 000000000..95e31cbc3 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/rec2020.rs @@ -0,0 +1,161 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/prophoto_rgb/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.4), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 -0.0023957954 0.2043088925 0.318295884 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.0), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 -0.0023957954 0.2043088925 0.318295884 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0 0 0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.5 0.5 0.5), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.5277221397 0.5277221397 0.5277221397);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.2 0.4 0.8), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 -0.1605692199 0.4295080587 0.8280670897);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 none), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.0713341527 0.2072064033 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 none 0.3), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.0119013078 none 0.3219111049);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb none 0.2 0.3), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 none 0.2069376666 0.3181540374);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -999999 0 0), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 -86467.5261196395 24057.1232097426 -7686.7078341848);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -1 0.4 2), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 -1.3001703326 0.4795529651 1.8550030977);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 1 1 1), rec2020)}\n"), + "a {\ + \n b: color(rec2020 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/rgb.rs b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/rgb.rs new file mode 100644 index 000000000..8eb1ad5f6 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/rgb.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/prophoto_rgb/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.4), rgb)}\n" + ), + "a {\ + \n b: hsla(190.4112342736, 389.9464516401%, 7.9139613859%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.0), rgb)}\n" + ), + "a {\ + \n b: hsla(190.4112342736, 389.9464516401%, 7.9139613859%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0 0 0), rgb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.5 0.5 0.5), rgb)}\n" + ), + "a {\ + \n b: rgb(145.9382220568, 145.9382220568, 145.9382220568);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.2 0.4 0.8), rgb)}\n" + ), + "a {\ + \n b: hsl(195.9034030348, 388.9813639336%, 17.9876851056%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 none), rgb)}\n" + ), + "a {\ + \n b: hsl(133.9801165671, 187.2672802248%, 9.7948015855%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 none 0.3), rgb)}\n" + ), + "a {\ + \n b: hsl(234.8931237502, 120.5152085415%, 18.1412125578%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb none 0.2 0.3), rgb)}\n" + ), + "a {\ + \n b: rgb(0, 73.552095814, 98.9254037219);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -999999 0 0), rgb)}\n" + ), + "a {\ + \n b: hsl(347.1631207662, 234.6485806965%, -1340219.8783108443%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -1 0.4 2), rgb)}\n"), + "a {\ + \n b: hsl(199.2935266227, 2154.1559841675%, 8.1167706475%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 1 1 1), rgb)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/srgb.rs b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/srgb.rs new file mode 100644 index 000000000..dcc16d68f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/srgb.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/prophoto_rgb/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.4), srgb)}\n" + ), + "a {\ + \n b: color(srgb -0.2294625022 0.280644099 0.3877417299 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.0), srgb)}\n" + ), + "a {\ + \n b: color(srgb -0.2294625022 0.280644099 0.3877417299 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0 0 0), srgb)}\n"), + "a {\ + \n b: color(srgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.5 0.5 0.5), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.5723067532 0.5723067532 0.5723067532);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.2 0.4 0.8), srgb)}\n" + ), + "a {\ + \n b: color(srgb -0.5198105776 0.5086505738 0.8795642797);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 none), srgb)}\n" + ), + "a {\ + \n b: color(srgb -0.0854765695 0.2813726012 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 none 0.3), srgb)}\n" + ), + "a {\ + \n b: color(srgb -0.0372170759 none 0.400041327);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb none 0.2 0.3), srgb)}\n" + ), + "a {\ + \n b: color(srgb none 0.2884395914 0.3879427597);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -999999 0 0), srgb)}\n" + ), + "a {\ + \n b: color(srgb -44850.2680097921 18045.8704435752 4589.3682169335);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -1 0.4 2), srgb)}\n"), + "a {\ + \n b: color(srgb -1.6673112998 0.7051691708 1.8296467127);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 1 1 1), srgb)}\n"), + "a {\ + \n b: color(srgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/srgb_linear.rs b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/srgb_linear.rs new file mode 100644 index 000000000..ea7267301 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/srgb_linear.rs @@ -0,0 +1,165 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/prophoto_rgb/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.4), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.0430382059 0.0640182408 0.1244386226 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.0430382059 0.0640182408 0.1244386226 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0 0 0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.5 0.5 0.5), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2871745887 0.2871745887 0.2871745887);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.2 0.4 0.8), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.232837807 0.2221355079 0.7475773304);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 none), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.0079148637 0.0643522253 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 none 0.3), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.0028805786 none 0.1328972872);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb none 0.2 0.3), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear none 0.0676448843 0.1245742709);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -999999 0 0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -128360522797.99591 14437901609.733408 540024616.0904481);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -1 0.4 2), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -3.2423661674 0.4553849808 4.0248155294);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 1 1 1), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/xyz.rs b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/xyz.rs new file mode 100644 index 000000000..c0f063e4d --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/xyz.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/prophoto_rgb/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.4), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.0276021409 0.0456157517 0.1250815881 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.0), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.0276021409 0.0456157517 0.1250815881 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0 0 0), xyz)}\n"), + "a {\ + \n b: color(xyz 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.5 0.5 0.5), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.27294679 0.2871745887 0.3127497117);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.2 0.4 0.8), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.1183353555 0.1633232963 0.7325727364);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 none), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.0181962227 0.0437192439 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 none 0.3), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.0213812245 none 0.1257953743);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb none 0.2 0.3), xyz)}\n" + ), + "a {\ + \n b: color(xyz none 0.041363137 0.1250195241);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -999999 0 0), xyz)}\n" + ), + "a {\ + \n b: color(xyz -47674467013.18759 -16929933315.113932 -247080732.7777534);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -1 0.4 2), xyz)}\n"), + "a {\ + \n b: color(xyz -0.4478815578 -0.0732156915 3.8173184875);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 1 1 1), xyz)}\n"), + "a {\ + \n b: color(xyz 0.9504559271 1 1.0890577508);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/xyz_d50.rs b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/xyz_d50.rs new file mode 100644 index 000000000..5f9ff26ac --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/prophoto_rgb/xyz_d50.rs @@ -0,0 +1,161 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/prophoto_rgb/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.4), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0236937162 0.0438615839 0.0944772554 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 0.3 / 0.0), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0236937162 0.0438615839 0.0944772554 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0 0 0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.5 0.5 0.5), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.2769212143 0.2871745887 0.2369490749);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.2 0.4 0.8), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0909854172 0.1527592329 0.5521676847);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 0.2 none), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0201042951 0.0438512858 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 0.1 none 0.3), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0162331704 none 0.0944772554);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb none 0.2 0.3), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 none 0.0392959056 0.0944772554);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -999999 0 0), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 -50335581773.96425 -18176260183.033443 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb -1 0.4 2), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 -0.662628365 -0.1509612194 2.873181106);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(prophoto-rgb 1 1 1), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.9642956764 1 0.8251046025);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rec2020/a98_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/rec2020/a98_rgb.rs new file mode 100644 index 000000000..6ce4d0b14 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rec2020/a98_rgb.rs @@ -0,0 +1,155 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rec2020/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.4), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1470288666 0.2765731567 0.3660737554 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.0), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1470288666 0.2765731567 0.3660737554 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0 0 0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.5 0.5 0.5), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.5417153213 0.5417153213 0.5417153213);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.2 0.4 0.8), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.13489511 0.4629710676 0.8371559205);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 none), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1707192347 0.278433765 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 none 0.3), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1694794184 none 0.3702410451);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 none 0.2 0.3), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb none 0.2824471442 0.3668416445);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -999999 0 0), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb -1119831.7269648165 407249.8039869511 187156.9941916847);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -1 0.4 2), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb -1.1646526275 0.5655440386 1.9874528803);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 1 1 1), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rec2020/display_p3.rs b/rsass/tests/spec/core_functions/color/to_space/rec2020/display_p3.rs new file mode 100644 index 000000000..61e35cec1 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rec2020/display_p3.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rec2020/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.4), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.0867047731 0.2651407977 0.3592704962 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.0867047731 0.2651407977 0.3592704962 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0 0 0), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.5 0.5 0.5), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.5465835909 0.5465835909 0.5465835909);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.2 0.4 0.8), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -0.1207745932 0.4564097151 0.8252565585);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 none), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.1260425103 0.2677058987 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 none 0.3), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.1670371089 none 0.3610354836);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 none 0.2 0.3), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 none 0.2685429813 0.3591672285);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -999999 0 0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -392808.6781006625 111415.2873247036 -30092.3347141782);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -1 0.4 2), display-p3)}\n"), + "a {\ + \n b: color(display-p3 -1.2450966031 0.4927082146 1.877624028);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 1 1 1), display-p3)}\n"), + "a {\ + \n b: color(display-p3 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rec2020/hsl.rs b/rsass/tests/spec/core_functions/color/to_space/rec2020/hsl.rs new file mode 100644 index 000000000..2e230ef53 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rec2020/hsl.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rec2020/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.4), hsl)}\n" + ), + "a {\ + \n b: hsla(194.5479244469, 123.11735267%, 16.5168092719%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.0), hsl)}\n" + ), + "a {\ + \n b: hsla(194.5479244469, 123.11735267%, 16.5168092719%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0 0 0), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 0%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.5 0.5 0.5), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 54.6583590878%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.2 0.4 0.8), hsl)}\n"), + "a {\ + \n b: hsl(200.8128966593, 189.0732219315%, 29.5081773497%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 none), hsl)}\n"), + "a {\ + \n b: hsl(97.48398538, 169.4637013095%, 10.0907863158%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 none 0.3), hsl)}\n"), + "a {\ + \n b: hsl(273.3326815842, 128.5408000864%, 16.5048029077%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 none 0.2 0.3), hsl)}\n"), + "a {\ + \n b: hsl(189.4362583411, 400.9276505087%, 7.3695655834%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -999999 0 0), hsl)}\n"), + "a {\ + \n b: hsl(351.6022221471, 202.9643125658%, -14161586.907056699%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -1 0.4 2), hsl)}\n"), + "a {\ + \n b: hsl(204.9795970204, 570.1567645938%, 29.20918492%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 1 1 1), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 100%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rec2020/hwb.rs b/rsass/tests/spec/core_functions/color/to_space/rec2020/hwb.rs new file mode 100644 index 000000000..6357a38de --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rec2020/hwb.rs @@ -0,0 +1,194 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rec2020/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(rec2020 0.1 0.2 0.3 / 0.4), hwb));\n" + ), + "a {\ + \n value: hsla(194.5479244469, 123.11735267%, 16.5168092719%, 0.4);\ + \n space: hwb;\ + \n channels: 194.5479244469deg -3.8182490492% 63.148132407% / 0.4;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(rec2020 0.1 0.2 0.3 / 0.0), hwb));\n" + ), + "a {\ + \n value: hsla(194.5479244469, 123.11735267%, 16.5168092719%, 0);\ + \n space: hwb;\ + \n channels: 194.5479244469deg -3.8182490492% 63.148132407% / 0;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(rec2020 0 0 0), hwb));\n" + ), + "a {\ + \n value: black;\ + \n space: hwb;\ + \n channels: 0deg 0% 100% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(rec2020 0.5 0.5 0.5), hwb));\n" + ), + "a {\ + \n value: hsl(0, 0%, 54.6583590878%);\ + \n space: hwb;\ + \n channels: 0deg 54.6583590878% 45.3416409122% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(rec2020 0.2 0.4 0.8), hwb));\n" + ), + "a {\ + \n value: hsl(200.8128966593, 189.0732219315%, 29.5081773497%);\ + \n space: hwb;\ + \n channels: 200.8128966593deg -26.2838842987% 14.6997610019% / 1;\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \na {b: color.to-space(color(rec2020 0.1 0.2 none), hwb)}\n"), + "a {\ + \n b: hsl(97.48398538, 169.4637013095%, 10.0907863158%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(rec2020 0.1 none 0.3), hwb));\n" + ), + "a {\ + \n value: hsl(273.3326815842, 128.5408000864%, 16.5048029077%);\ + \n space: hwb;\ + \n channels: 273.3326815842deg -4.7106028025% 62.2797913821% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(rec2020 none 0.2 0.3), hwb));\n" + ), + "a {\ + \n value: hsl(189.4362583411, 400.9276505087%, 7.3695655834%);\ + \n space: hwb;\ + \n channels: 189.4362583411deg -22.1770605629% 63.0838082703% / 1;\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(rec2020 -999999 0 0), hwb));\n" + ), + "a {\ + \n value: hsl(351.6022221471, 202.9643125658%, -14161586.907056702%);\ + \n space: hwb;\ + \n channels: 171.6022221471deg -42904554.421379425% -14581280.607266026% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(rec2020 -1 0.4 2), hwb));\n" + ), + "a {\ + \n value: hsl(204.9795970204, 570.1567645938%, 29.20918492%);\ + \n space: hwb;\ + \n channels: 204.9795970204deg -137.3289587842% -95.7473286243% / 1;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(rec2020 1 1 1), hwb));\n" + ), + "a {\ + \n value: white;\ + \n space: hwb;\ + \n channels: 0deg 100% 0% / 1;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rec2020/lab.rs b/rsass/tests/spec/core_functions/color/to_space/rec2020/lab.rs new file mode 100644 index 000000000..71b3b784e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rec2020/lab.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rec2020/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.4), lab)}\n" + ), + "a {\ + \n b: lab(26.3242106967% -12.9991476228 -20.999464924 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.0), lab)}\n" + ), + "a {\ + \n b: lab(26.3242106967% -12.9991476228 -20.999464924 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0 0 0), lab)}\n"), + "a {\ + \n b: lab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.5 0.5 0.5), lab)}\n"), + "a {\ + \n b: lab(58.0104094495% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.2 0.4 0.8), lab)}\n"), + "a {\ + \n b: lab(47.1831278283% -5.7697476711 -62.0090026934);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 none), lab)}\n"), + "a {\ + \n b: lab(24.8794631126% -29.5241312368 39.836355697);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 none 0.3), lab)}\n"), + "a {\ + \n b: lab(9.8621057796% 42.7961734552 -48.7693303375);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 none 0.2 0.3), lab)}\n"), + "a {\ + \n b: lab(24.4167376804% -31.5965927959 -24.304113724);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -999999 0 0), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz -11119280450344.598 -4585917925394.642 -119556.2596893311) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -1 0.4 2), lab)}\n"), + "a {\ + \n b: lab(20.0233737121% -563.3455911654 -257.3742149404);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 1 1 1), lab)}\n"), + "a {\ + \n b: lab(100% 0 0);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rec2020/lch.rs b/rsass/tests/spec/core_functions/color/to_space/rec2020/lch.rs new file mode 100644 index 000000000..2c4a09450 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rec2020/lch.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rec2020/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.4), lch)}\n" + ), + "a {\ + \n b: lch(26.3242106967% 24.6972744653 238.2415478893deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.0), lch)}\n" + ), + "a {\ + \n b: lch(26.3242106967% 24.6972744653 238.2415478893deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0 0 0), lch)}\n"), + "a {\ + \n b: lch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.5 0.5 0.5), lch)}\n"), + "a {\ + \n b: lch(58.0104094495% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.2 0.4 0.8), lch)}\n"), + "a {\ + \n b: lch(47.1831278283% 62.2768528686 264.6841092292deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 none), lch)}\n"), + "a {\ + \n b: lch(24.8794631126% 49.5843681064 126.5434514525deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 none 0.3), lch)}\n"), + "a {\ + \n b: lch(9.8621057796% 64.8842048882 311.267672367deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 none 0.2 0.3), lch)}\n"), + "a {\ + \n b: lch(24.4167376804% 39.8626971017 217.5675010071deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -999999 0 0), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz -11119280261600.67 -4585917862614.184 3849800.247779846) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -1 0.4 2), lch)}\n"), + "a {\ + \n b: lch(20.0233737121% 619.3542940851 204.5541138043deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 1 1 1), lch)}\n"), + "a {\ + \n b: lch(100% 0 none);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rec2020/mod.rs b/rsass/tests/spec/core_functions/color/to_space/rec2020/mod.rs new file mode 100644 index 000000000..528b64fb1 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rec2020/mod.rs @@ -0,0 +1,36 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rec2020" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod a98_rgb; + +mod display_p3; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_space/rec2020/oklab.rs b/rsass/tests/spec/core_functions/color/to_space/rec2020/oklab.rs new file mode 100644 index 000000000..06b6be8be --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rec2020/oklab.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rec2020/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.4), oklab)}\n" + ), + "a {\ + \n b: oklab(36.3512304678% -0.050217455 -0.0580072349 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.0), oklab)}\n" + ), + "a {\ + \n b: oklab(36.3512304678% -0.050217455 -0.0580072349 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0 0 0), oklab)}\n"), + "a {\ + \n b: oklab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.5 0.5 0.5), oklab)}\n"), + "a {\ + \n b: oklab(63.8020766953% 0.0000000001 0.0000000238);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.2 0.4 0.8), oklab)}\n"), + "a {\ + \n b: oklab(55.2815992148% -0.0857471824 -0.1749134266);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 none), oklab)}\n"), + "a {\ + \n b: oklab(34.13560351% -0.0917726115 0.0859786399);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 none 0.3), oklab)}\n"), + "a {\ + \n b: oklab(25.3247541535% 0.0750438961 -0.1364735034);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 none 0.2 0.3), oklab)}\n"), + "a {\ + \n b: oklab(34.1361541836% -0.1128551253 -0.067830888);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -999999 0 0), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz -11119280444659.65 -4585917923503.701 0.0024414063) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -1 0.4 2), oklab)}\n"), + "a {\ + \n b: oklab(33.9832655696% -2.4377896861 -0.667787683);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 1 1 1), oklab)}\n"), + "a {\ + \n b: oklab(99.9999993474% 0.0000000001 0.0000000373);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rec2020/oklch.rs b/rsass/tests/spec/core_functions/color/to_space/rec2020/oklch.rs new file mode 100644 index 000000000..8b48975f2 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rec2020/oklch.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rec2020/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.4), oklch)}\n" + ), + "a {\ + \n b: oklch(36.3512304678% 0.0767243904 229.1169268509deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.0), oklch)}\n" + ), + "a {\ + \n b: oklch(36.3512304678% 0.0767243904 229.1169268509deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0 0 0), oklch)}\n"), + "a {\ + \n b: oklch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.5 0.5 0.5), oklch)}\n"), + "a {\ + \n b: oklch(63.8020766953% 0.0000000238 89.8755631672deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.2 0.4 0.8), oklch)}\n"), + "a {\ + \n b: oklch(55.2815992148% 0.1948006317 243.8846858979deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 none), oklch)}\n"), + "a {\ + \n b: oklch(34.13560351% 0.1257558697 136.866949571deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 none 0.3), oklch)}\n"), + "a {\ + \n b: oklch(25.3247541535% 0.155745316 298.8054651649deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 none 0.2 0.3), oklch)}\n"), + "a {\ + \n b: oklch(34.1361541836% 0.1316712143 211.0077162465deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -999999 0 0), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz -11119280444659.652 -4585917923503.7 -0.009765625) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -1 0.4 2), oklch)}\n"), + "a {\ + \n b: oklch(33.9832655696% 2.5275994429 195.319325973deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 1 1 1), oklch)}\n"), + "a {\ + \n b: oklch(99.9999993474% 0.0000000373 89.8755622419deg);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rec2020/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/rec2020/prophoto_rgb.rs new file mode 100644 index 000000000..6df32b841 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rec2020/prophoto_rgb.rs @@ -0,0 +1,161 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rec2020/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.4), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1520851228 0.1987719462 0.283976665 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1520851228 0.1987719462 0.283976665 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0 0 0), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.5 0.5 0.5), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.4728514184 0.4728514184 0.4728514184);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.2 0.4 0.8), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.3205854039 0.3793783564 0.7698022311);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 none), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1184473522 0.1951112391 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 none 0.3), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1451585947 none 0.2808956158);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 none 0.2 0.3), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb none 0.1963011404 0.2840567616);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -999999 0 0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -20568106.26542821 -4493352.638848251 785798.3189394);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -1 0.4 2), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -0.5478493377 0.3839894918 2.1828841348);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 1 1 1), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rec2020/rec2020.rs b/rsass/tests/spec/core_functions/color/to_space/rec2020/rec2020.rs new file mode 100644 index 000000000..f83978b13 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rec2020/rec2020.rs @@ -0,0 +1,73 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rec2020/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +#[test] +#[ignore] // unexepected error +fn in_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.2 0.4 0.8), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.2 0.4 0.8);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 none), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.1 0.2 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 none 0.3), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.1 none 0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 none 0.2 0.3), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 none 0.2 0.3);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -1 0.4 2), rec2020)}\n"), + "a {\ + \n b: color(rec2020 -1 0.4 2);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rec2020/rgb.rs b/rsass/tests/spec/core_functions/color/to_space/rec2020/rgb.rs new file mode 100644 index 000000000..ee32abc22 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rec2020/rgb.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rec2020/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.4), rgb)}\n" + ), + "a {\ + \n b: hsla(194.5479244469, 123.11735267%, 16.5168092719%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.0), rgb)}\n" + ), + "a {\ + \n b: hsla(194.5479244469, 123.11735267%, 16.5168092719%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0 0 0), rgb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.5 0.5 0.5), rgb)}\n"), + "a {\ + \n b: rgb(139.3788156739, 139.3788156739, 139.3788156739);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.2 0.4 0.8), rgb)}\n"), + "a {\ + \n b: hsl(200.8128966593, 189.0732219315%, 29.5081773497%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 none), rgb)}\n"), + "a {\ + \n b: rgb(14.8533924164, 69.337066059, 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 none 0.3), rgb)}\n"), + "a {\ + \n b: rgb(48.0971037271, 0, 96.1865319755);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 none 0.2 0.3), rgb)}\n"), + "a {\ + \n b: rgb(0, 70.4374731297, 94.1362889109);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -999999 0 0), rgb)}\n"), + "a {\ + \n b: hsl(351.6022221471, 202.9643125658%, -14161586.907056699%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -1 0.4 2), rgb)}\n"), + "a {\ + \n b: hsl(204.9795970204, 570.1567645938%, 29.20918492%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 1 1 1), rgb)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rec2020/srgb.rs b/rsass/tests/spec/core_functions/color/to_space/rec2020/srgb.rs new file mode 100644 index 000000000..6fe9f607c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rec2020/srgb.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rec2020/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.4), srgb)}\n" + ), + "a {\ + \n b: color(srgb -0.0381824905 0.2699077119 0.3685186759 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.0), srgb)}\n" + ), + "a {\ + \n b: color(srgb -0.0381824905 0.2699077119 0.3685186759 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0 0 0), srgb)}\n"), + "a {\ + \n b: color(srgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.5 0.5 0.5), srgb)}\n"), + "a {\ + \n b: color(srgb 0.5465835909 0.5465835909 0.5465835909);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.2 0.4 0.8), srgb)}\n"), + "a {\ + \n b: color(srgb -0.262838843 0.4659375855 0.85300239);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 none), srgb)}\n"), + "a {\ + \n b: color(srgb 0.0582485977 0.271910063 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 none 0.3), srgb)}\n"), + "a {\ + \n b: color(srgb 0.188616093 none 0.3772020862);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 none 0.2 0.3), srgb)}\n"), + "a {\ + \n b: color(srgb none 0.2762253848 0.3691619173);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -999999 0 0), srgb)}\n" + ), + "a {\ + \n b: color(srgb -429045.5442137942 145813.8060726603 65354.787400083);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -1 0.4 2), srgb)}\n"), + "a {\ + \n b: color(srgb -1.3732895878 0.5707880468 1.9574732862);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 1 1 1), srgb)}\n"), + "a {\ + \n b: color(srgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rec2020/srgb_linear.rs b/rsass/tests/spec/core_functions/color/to_space/rec2020/srgb_linear.rs new file mode 100644 index 000000000..99280a7fe --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rec2020/srgb_linear.rs @@ -0,0 +1,161 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rec2020/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.4), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.0029553011 0.0592131472 0.111863462 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.0029553011 0.0592131472 0.111863462 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0 0 0), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.5 0.5 0.5), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2597194371 0.2597194371 0.2597194371);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.2 0.4 0.8), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.0561682415 0.1838568265 0.6975942253);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 none), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.004719249 0.0600927379 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 none 0.3), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0296680112 none 0.1174471704);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 none 0.2 0.3), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear none 0.0620141462 0.1122716521);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -999999 0 0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -28986940627436.953 2174258821934.0952 316855134441.09607);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -1 0.4 2), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -2.0689650071 0.28550882 4.7113611346);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 1 1 1), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rec2020/xyz.rs b/rsass/tests/spec/core_functions/color/to_space/rec2020/xyz.rs new file mode 100644 index 000000000..78d92afb5 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rec2020/xyz.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rec2020/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.4), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.0401441609 0.0497946582 0.1133305869 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.0), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.0401441609 0.0497946582 0.1133305869 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0 0 0), xyz)}\n"), + "a {\ + \n b: color(xyz 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.5 0.5 0.5), xyz)}\n"), + "a {\ + \n b: color(xyz 0.2468518784 0.2597194371 0.282849466);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.2 0.4 0.8), xyz)}\n"), + "a {\ + \n b: color(xyz 0.1684834116 0.1699060269 0.6839147362);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 none), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0223529743 0.0435473713 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 none 0.3), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0321156515 none 0.1117721115);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 none 0.2 0.3), xyz)}\n"), + "a {\ + \n b: color(xyz none 0.0438868281 0.1133305869);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -999999 0 0), xyz)}\n"), + "a {\ + \n b: color(xyz -11119280444659.668 -4585917923503.705 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -1 0.4 2), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0991815219 0.1043683721 4.4723366127);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 1 1 1), xyz)}\n"), + "a {\ + \n b: color(xyz 0.9504559271 1 1.0890577508);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rec2020/xyz_d50.rs b/rsass/tests/spec/core_functions/color/to_space/rec2020/xyz_d50.rs new file mode 100644 index 000000000..2733c8740 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rec2020/xyz_d50.rs @@ -0,0 +1,155 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rec2020/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.4), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0375225748 0.0485727436 0.0855889676 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 0.3 / 0.0), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0375225748 0.0485727436 0.0855889676 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0 0 0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.5 0.5 0.5), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.2504463303 0.2597194371 0.2142957029);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.2 0.4 0.8), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.1461303676 0.1615955499 0.5152185696);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 0.2 none), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0243454002 0.0437664763 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 0.1 none 0.3), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0283237743 none 0.0839247274);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 none 0.2 0.3), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 none 0.0422970228 0.0856324257);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -999999 0 0), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 -11757457714802.084 -4871490904380.732 33734088609.397465);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 -1 0.4 2), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 -0.1181465111 0.0299487833 3.363289424);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(rec2020 1 1 1), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.9642956764 1 0.8251046025);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rgb/a98_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/rgb/a98_rgb.rs new file mode 100644 index 000000000..1fd5a8a18 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rgb/a98_rgb.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rgb/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.4), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.0827079329 0.1047180692 0.1375163198 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.0827079329 0.1047180692 0.1375163198 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#000, a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(50.123456789 100.987654321 200.192837465), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.2781926905 0.395603604 0.7684686532);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#aaa, a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.660735938 0.660735938 0.660735938);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#28d, a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.3199480242 0.5287075634 0.8521762133);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 none), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.0827079329 0.1047180692 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 none 30), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.0615069668 none 0.1360938515);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(none 20 30), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb none 0.1047180692 0.1375163198);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(black, $red: -999999), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb -6760.0211192379 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(rgb(0, 100, 0), $red: -50, $blue: 400), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1411766693 0.3918977213 1.5718485866);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#fff, a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rgb/display_p3.rs b/rsass/tests/spec/core_functions/color/to_space/rgb/display_p3.rs new file mode 100644 index 000000000..014de1b3b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rgb/display_p3.rs @@ -0,0 +1,162 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rgb/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.4), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.0477705982 0.0773808537 0.1142571507 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.0), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.0477705982 0.0773808537 0.1142571507 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#000, display-p3)}\n"), + "a {\ + \n b: color(display-p3 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(50.123456789 100.987654321 200.192837465), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.2464159945 0.3912935228 0.7592218197);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#aaa, display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.6666666667 0.6666666667 0.6666666667);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#28d, display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.2644791221 0.525654809 0.8414340148);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 none), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.0477705982 0.0773808537 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 none 30), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.0322534105 none 0.1113368327);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(none 20 30), display-p3)}\n"), + "a {\ + \n b: color(display-p3 none 0.0765677073 0.1139614092);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(black, $red: -999999), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -3614.8515104566 -948.8907591358 -719.4436054746);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(rgb(0, 100, 0), $red: -50, $blue: 400), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -0.0462648785 0.3843286419 1.5086360967);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#fff, display-p3)}\n"), + "a {\ + \n b: color(display-p3 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rgb/hsl.rs b/rsass/tests/spec/core_functions/color/to_space/rgb/hsl.rs new file mode 100644 index 000000000..304f76925 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rgb/hsl.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rgb/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.4), hsl)}\n"), + "a {\ + \n b: hsla(210, 50%, 7.8431372549%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.0), hsl)}\n"), + "a {\ + \n b: hsla(210, 50%, 7.8431372549%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#000, hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 0%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(50.123456789 100.987654321 200.192837465), hsl)}\n" + ), + "a {\ + \n b: hsl(219.6637272829, 59.9519025013%, 49.0816263243%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#aaa, hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 66.6666666667%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#28d, hsl)}\n"), + "a {\ + \n b: hsl(207.2727272727, 73.3333333333%, 50%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 none), hsl)}\n"), + "a {\ + \n b: hsl(90, 100%, 3.9215686275%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 none 30), hsl)}\n"), + "a {\ + \n b: hsl(260, 100%, 5.8823529412%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(none 20 30), hsl)}\n"), + "a {\ + \n b: hsl(200, 100%, 5.8823529412%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(black, $red: -999999), hsl)}\n" + ), + "a {\ + \n b: hsl(0, 100%, -196078.2352941177%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(rgb(0, 100, 0), $red: -50, $blue: 400), hsl)}\n" + ), + "a {\ + \n b: hsl(220, 281.25%, 68.6274509804%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#fff, hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 100%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rgb/hwb.rs b/rsass/tests/spec/core_functions/color/to_space/rgb/hwb.rs new file mode 100644 index 000000000..0c8e1bcb8 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rgb/hwb.rs @@ -0,0 +1,204 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rgb/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(rgb(10 20 30 / 0.4), hwb));\n" + ), + "a {\ + \n value: hsla(210, 50%, 7.8431372549%, 0.4);\ + \n space: hwb;\ + \n channels: 210deg 3.9215686275% 88.2352941176% / 0.4;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(rgb(10 20 30 / 0.0), hwb));\n" + ), + "a {\ + \n value: hsla(210, 50%, 7.8431372549%, 0);\ + \n space: hwb;\ + \n channels: 210deg 3.9215686275% 88.2352941176% / 0;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(#000, hwb));\n"), + "a {\ + \n value: black;\ + \n space: hwb;\ + \n channels: 0deg 0% 100% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(\ + \n color.to-space(rgb(50.123456789 100.987654321 200.192837465), hwb)\ + \n);\n" + ), + "a {\ + \n value: hsl(219.6637272829, 59.9519025013%, 49.0816263243%);\ + \n space: hwb;\ + \n channels: 219.6637272829deg 19.6562575643% 21.4930049157% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(#aaa, hwb));\n"), + "a {\ + \n value: #aaaaaa;\ + \n space: hwb;\ + \n channels: 0deg 66.6666666667% 33.3333333333% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(#28d, hwb));\n"), + "a {\ + \n value: #2288dd;\ + \n space: hwb;\ + \n channels: 207.2727272727deg 13.3333333333% 13.3333333333% / 1;\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \na {b: color.to-space(rgb(10 20 none), hwb)}\n"), + "a {\ + \n b: #0a1400;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(rgb(10 none 30), hwb));\n" + ), + "a {\ + \n value: #0a001e;\ + \n space: hwb;\ + \n channels: 260deg 0% 88.2352941176% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(rgb(none 20 30), hwb));\n" + ), + "a {\ + \n value: #00141e;\ + \n space: hwb;\ + \n channels: 200deg 0% 88.2352941176% / 1;\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color.change(black, $red: -999999), hwb));\n" + ), + "a {\ + \n value: hsl(0, 100%, -196078.2352941177%);\ + \n space: hwb;\ + \n channels: 180deg -392156.4705882354% 100% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color.change(rgb(0, 100, 0), $red: -50, $blue: 400), hwb));\n" + ), + "a {\ + \n value: hsl(220, 281.25%, 68.6274509804%);\ + \n space: hwb;\ + \n channels: 220deg -19.6078431373% -56.862745098% / 1;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(#fff, hwb));\n"), + "a {\ + \n value: white;\ + \n space: hwb;\ + \n channels: 0deg 100% 0% / 1;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rgb/lab.rs b/rsass/tests/spec/core_functions/color/to_space/rgb/lab.rs new file mode 100644 index 000000000..f77e9cf4a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rgb/lab.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rgb/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.4), lab)}\n"), + "a {\ + \n b: lab(5.8508980612% -1.4961467566 -8.2549264931 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.0), lab)}\n"), + "a {\ + \n b: lab(5.8508980612% -1.4961467566 -8.2549264931 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#000, lab)}\n"), + "a {\ + \n b: lab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(50.123456789 100.987654321 200.192837465), lab)}\n" + ), + "a {\ + \n b: lab(43.5786666948% 10.234304882 -57.7772280218);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#aaa, lab)}\n"), + "a {\ + \n b: lab(69.61016583% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#28d, lab)}\n"), + "a {\ + \n b: lab(54.4372323192% -5.0725440763 -52.2489046102);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 none), lab)}\n"), + "a {\ + \n b: lab(5.1399777246% -5.9321982521 7.5003938134);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 none 30), lab)}\n"), + "a {\ + \n b: lab(1.3209405601% 7.1508367815 -15.0002069297);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(none 20 30), lab)}\n"), + "a {\ + \n b: lab(5.2408778377% -4.2109320426 -9.2418429616);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(black, $red: -999999), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz -152693379.43919498 -78732523.77333494 -7157502.161212263) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(rgb(0, 100, 0), $red: -50, $blue: 400), lab)}\n" + ), + "a {\ + \n b: lab(57.5459692675% 67.2901769646 -142.8196552841);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#fff, lab)}\n"), + "a {\ + \n b: lab(100% 0 0);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rgb/lch.rs b/rsass/tests/spec/core_functions/color/to_space/rgb/lch.rs new file mode 100644 index 000000000..8e3f6e072 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rgb/lch.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rgb/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.4), lch)}\n"), + "a {\ + \n b: lch(5.8508980612% 8.3894139559 259.7270636253deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.0), lch)}\n"), + "a {\ + \n b: lch(5.8508980612% 8.3894139559 259.7270636253deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#000, lch)}\n"), + "a {\ + \n b: lch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(50.123456789 100.987654321 200.192837465), lch)}\n" + ), + "a {\ + \n b: lch(43.5786666948% 58.6766484583 280.0448319605deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#aaa, lch)}\n"), + "a {\ + \n b: lch(69.61016583% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#28d, lch)}\n"), + "a {\ + \n b: lch(54.4372323192% 52.4945591121 264.454862058deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 none), lch)}\n"), + "a {\ + \n b: lch(5.1399777246% 9.5627863857 128.3411151091deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 none 30), lch)}\n"), + "a {\ + \n b: lch(1.3209405601% 16.6174809948 295.4878788717deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(none 20 30), lch)}\n"), + "a {\ + \n b: lch(5.2408778377% 10.1559642572 245.5042015895deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(black, $red: -999999), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz -152693379.43919504 -78732523.77333494 -7157502.161212466) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(rgb(0, 100, 0), $red: -50, $blue: 400), lch)}\n" + ), + "a {\ + \n b: lch(57.5459692675% 157.8778700497 295.2276977506deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#fff, lch)}\n"), + "a {\ + \n b: lch(100% 0 none);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rgb/mod.rs b/rsass/tests/spec/core_functions/color/to_space/rgb/mod.rs new file mode 100644 index 000000000..5d2af6fc0 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rgb/mod.rs @@ -0,0 +1,36 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rgb" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod a98_rgb; + +mod display_p3; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_space/rgb/oklab.rs b/rsass/tests/spec/core_functions/color/to_space/rgb/oklab.rs new file mode 100644 index 000000000..d452ded0f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rgb/oklab.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rgb/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.4), oklab)}\n"), + "a {\ + \n b: oklab(18.6989144442% -0.0089460528 -0.0237039533 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.0), oklab)}\n"), + "a {\ + \n b: oklab(18.6989144442% -0.0089460528 -0.0237039533 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#000, oklab)}\n"), + "a {\ + \n b: oklab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(50.123456789 100.987654321 200.192837465), oklab)}\n" + ), + "a {\ + \n b: oklab(52.7265723906% -0.0228233564 -0.1626243735);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#aaa, oklab)}\n"), + "a {\ + \n b: oklab(73.8018666132% 0.0000000001 0.0000000275);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#28d, oklab)}\n"), + "a {\ + \n b: oklab(61.3651179384% -0.0551812368 -0.1461735753);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 none), oklab)}\n"), + "a {\ + \n b: oklab(17.4737572915% -0.0289569456 0.036012989);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 none 30), oklab)}\n"), + "a {\ + \n b: oklab(12.5934961979% 0.0296887787 -0.0622382911);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(none 20 30), oklab)}\n"), + "a {\ + \n b: oklab(17.9105838927% -0.0229309101 -0.0273761686);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(black, $red: -999999), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz -152693379.43919483 -78732523.77333483 -7157502.161212221) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(rgb(0, 100, 0), $red: -50, $blue: 400), oklab)}\n" + ), + "a {\ + \n b: oklab(69.4063330454% -0.0570651814 -0.4015686842);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#fff, oklab)}\n"), + "a {\ + \n b: oklab(99.9999993474% 0.0000000001 0.0000000373);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rgb/oklch.rs b/rsass/tests/spec/core_functions/color/to_space/rgb/oklch.rs new file mode 100644 index 000000000..712913eae --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rgb/oklch.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rgb/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.4), oklch)}\n"), + "a {\ + \n b: oklch(18.6989144442% 0.0253359283 249.3231108283deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.0), oklch)}\n"), + "a {\ + \n b: oklch(18.6989144442% 0.0253359283 249.3231108283deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#000, oklch)}\n"), + "a {\ + \n b: oklch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(50.123456789 100.987654321 200.192837465), oklch)}\n" + ), + "a {\ + \n b: oklch(52.7265723906% 0.1642181246 262.0110592016deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#aaa, oklch)}\n"), + "a {\ + \n b: oklch(73.8018666132% 0.0000000275 89.8755625379deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#28d, oklch)}\n"), + "a {\ + \n b: oklch(61.3651179384% 0.1562423854 249.3182340149deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 none), oklch)}\n"), + "a {\ + \n b: oklch(17.4737572915% 0.0462108221 128.8016996944deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 none 30), oklch)}\n"), + "a {\ + \n b: oklch(12.5934961979% 0.0689567144 295.5019774012deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(none 20 30), oklch)}\n"), + "a {\ + \n b: oklch(17.9105838927% 0.0357110801 230.049682151deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(black, $red: -999999), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz -152693379.43919486 -78732523.77333483 -7157502.16121231) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(rgb(0, 100, 0), $red: -50, $blue: 400), oklch)}\n" + ), + "a {\ + \n b: oklch(69.4063330454% 0.405603061 261.9120979439deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#fff, oklch)}\n"), + "a {\ + \n b: oklch(99.9999993474% 0.0000000373 89.8755630959deg);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rgb/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/rgb/prophoto_rgb.rs new file mode 100644 index 000000000..a52e34d0b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rgb/prophoto_rgb.rs @@ -0,0 +1,164 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rgb/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.4), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.0568847736 0.0623636876 0.0861178613 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.0568847736 0.0623636876 0.0861178613 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#000, prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(50.123456789 100.987654321 200.192837465), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.3371488337 0.3261543399 0.6930068512);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#aaa, prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.6027153447 0.6027153447 0.6027153447);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#28d, prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.3990854669 0.4493912175 0.7905294798);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 none), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.0459932777 0.0604706464 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 none 30), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.0427390372 none 0.0828155088);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(none 20 30), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb none 0.0608214606 0.0859153209);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(black, $red: -999999), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -40436.5951245925 -15876.4400699537 -5962.4442405194);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(rgb(0, 100, 0), $red: -50, $blue: 400), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.6182230836 0.3944820605 1.6451734949);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#fff, prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rgb/rec2020.rs b/rsass/tests/spec/core_functions/color/to_space/rgb/rec2020.rs new file mode 100644 index 000000000..b61339a3e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rgb/rec2020.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rgb/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.4), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0214656524 0.0305541381 0.055318427 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0214656524 0.0305541381 0.055318427 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#000, rec2020)}\n"), + "a {\ + \n b: color(rec2020 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(50.123456789 100.987654321 200.192837465), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.2689744026 0.3372277303 0.7270775308);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#aaa, rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.630170586 0.630170586 0.630170586);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#28d, rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.327926145 0.4744067013 0.818404902);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 none), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0189351452 0.0298903102 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 none 30), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0111000377 none 0.0525478256);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(none 20 30), rec2020)}\n"), + "a {\ + \n b: color(rec2020 none 0.029610358 0.055094541);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(black, $red: -999999), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 -6394.9114299566 -2369.6504581671 -1240.1892051013);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(rgb(0, 100, 0), $red: -50, $blue: 400), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.3600781868 0.3645236247 1.5702758315);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#fff, rec2020)}\n"), + "a {\ + \n b: color(rec2020 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rgb/rgb.rs b/rsass/tests/spec/core_functions/color/to_space/rgb/rgb.rs new file mode 100644 index 000000000..0b008c065 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rgb/rgb.rs @@ -0,0 +1,69 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rgb/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +#[test] +#[ignore] // unexepected error +fn in_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#28d, rgb)}\n"), + "a {\ + \n b: #28d;\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 none), rgb)}\n"), + "a {\ + \n b: rgb(10 20 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 none 30), rgb)}\n"), + "a {\ + \n b: rgb(10 none 30);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(none 20 30), rgb)}\n"), + "a {\ + \n b: rgb(none 20 30);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(rgb(0, 100, 0), $red: -50, $blue: 400), rgb)}\n" + ), + "a {\ + \n b: hsl(220, 281.25%, 68.6274509804%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rgb/srgb.rs b/rsass/tests/spec/core_functions/color/to_space/rgb/srgb.rs new file mode 100644 index 000000000..870a66c6f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rgb/srgb.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rgb/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.4), srgb)}\n"), + "a {\ + \n b: color(srgb 0.0392156863 0.0784313725 0.1176470588 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.0), srgb)}\n"), + "a {\ + \n b: color(srgb 0.0392156863 0.0784313725 0.1176470588 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#000, srgb)}\n"), + "a {\ + \n b: color(srgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(50.123456789 100.987654321 200.192837465), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.1965625756 0.3960300169 0.7850699508);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#aaa, srgb)}\n"), + "a {\ + \n b: color(srgb 0.6666666667 0.6666666667 0.6666666667);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#28d, srgb)}\n"), + "a {\ + \n b: color(srgb 0.1333333333 0.5333333333 0.8666666667);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 none), srgb)}\n"), + "a {\ + \n b: color(srgb 0.0392156863 0.0784313725 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 none 30), srgb)}\n"), + "a {\ + \n b: color(srgb 0.0392156863 none 0.1176470588);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(none 20 30), srgb)}\n"), + "a {\ + \n b: color(srgb none 0.0784313725 0.1176470588);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(black, $red: -999999), srgb)}\n" + ), + "a {\ + \n b: color(srgb -3921.5647058824 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(rgb(0, 100, 0), $red: -50, $blue: 400), srgb)}\n" + ), + "a {\ + \n b: color(srgb -0.1960784314 0.3921568627 1.568627451);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#fff, srgb)}\n"), + "a {\ + \n b: color(srgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rgb/srgb_linear.rs b/rsass/tests/spec/core_functions/color/to_space/rgb/srgb_linear.rs new file mode 100644 index 000000000..50544a65e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rgb/srgb_linear.rs @@ -0,0 +1,164 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rgb/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.4), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0030352698 0.0069954102 0.0129830323 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0030352698 0.0069954102 0.0129830323 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#000, srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(50.123456789 100.987654321 200.192837465), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0320438415 0.130102957 0.5788301943);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#aaa, srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.4019777798 0.4019777798 0.4019777798);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#28d, srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.0159962934 0.2462013267 0.7230551289);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 none), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.0030352698 0.0069954102 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 none 30), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.0030352698 none 0.0129830323);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(none 20 30), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear none 0.0069954102 0.0129830323);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(black, $red: -999999), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -370263787.91908944 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(rgb(0, 100, 0), $red: -50, $blue: 400), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.0318960331 0.1274376804 2.8142418811);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#fff, srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rgb/xyz.rs b/rsass/tests/spec/core_functions/color/to_space/rgb/xyz.rs new file mode 100644 index 000000000..fc55da247 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rgb/xyz.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rgb/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.4), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0060963544 0.0065855902 0.0132332803 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.0), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0060963544 0.0065855902 0.0132332803 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#000, xyz)}\n"), + "a {\ + \n b: color(xyz 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(50.123456789 100.987654321 200.192837465), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.1642050952 0.1416464224 0.5663237374);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#aaa, xyz)}\n"), + "a {\ + \n b: color(xyz 0.3820621634 0.4019777798 0.4377770168);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#28d, xyz)}\n"), + "a {\ + \n b: color(xyz 0.2251320227 0.2316759373 0.7169422823);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 none), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0037531665 0.005648315 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 none 30), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0035949053 none 0.0123994639);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(none 20 30), xyz)}\n"), + "a {\ + \n b: color(xyz none 0.0059401734 0.0131746061);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(black, $red: -999999), xyz)}\n" + ), + "a {\ + \n b: color(xyz -152693379.439195 -78732523.77333492 -7157502.1612122655);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(rgb(0, 100, 0), $red: -50, $blue: 400), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.5403326817 0.2875237342 2.689600722);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#fff, xyz)}\n"), + "a {\ + \n b: color(xyz 0.9504559271 1 1.0890577508);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/rgb/xyz_d50.rs b/rsass/tests/spec/core_functions/color/to_space/rgb/xyz_d50.rs new file mode 100644 index 000000000..97b57aec3 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/rgb/xyz_d50.rs @@ -0,0 +1,160 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/rgb/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.4), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0058754618 0.0064772745 0.0099925616 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 30 / 0.0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0058754618 0.0064772745 0.0099925616 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#000, xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn float() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(rgb(50.123456789 100.987654321 200.192837465), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.1469006816 0.1354872326 0.4264190127);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#aaa, xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.3876254351 0.4019777798 0.3316737162);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#28d, xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.2052538337 0.2238890642 0.5404574845);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 20 none), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.00401787 0.0056902455 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(10 none 30), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.003181169 none 0.0093134379);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(rgb(none 20 30), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 none 0.0058019477 0.0099502987);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(black, $red: -999999), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 -161459355.2194338 -82381166.54311071 -5155523.903641009);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color.change(rgb(0, 100, 0), $red: -50, $blue: 400), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.4378313293 0.2548605759 2.0215760182);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(#fff, xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.9642956764 1 0.8251046025);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb/a98_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/srgb/a98_rgb.rs new file mode 100644 index 000000000..79b806c7b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb/a98_rgb.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.4), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1551137687 0.2123166098 0.3014984164 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.0), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.1551137687 0.2123166098 0.3014984164 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0 0 0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.5 0.5 0.5), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.4961036984 0.4961036984 0.4961036984);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.2 0.4 0.8), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.2814316253 0.3994051501 0.7833135189);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 none), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.1551137687 0.2123166098 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 none 0.3), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.1058822156 none 0.2988751674);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb none 0.2 0.3), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb none 0.2123166098 0.3014984164);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -999999 0 0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb -2858844.9973722333 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -1 0.4 2), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb -0.8376211647 0.3994051501 2.0319913216);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 1 1 1), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb/display_p3.rs b/rsass/tests/spec/core_functions/color/to_space/srgb/display_p3.rs new file mode 100644 index 000000000..dd2e2db7e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb/display_p3.rs @@ -0,0 +1,155 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.4), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.1237968384 0.1975241128 0.2918191239 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.1237968384 0.1975241128 0.2918191239 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0 0 0), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.5 0.5 0.5), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.5 0.5 0.5);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.2 0.4 0.8), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.2498513331 0.3952400722 0.77356175);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 none), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.1237968384 0.1975241128 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 none 0.3), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.0878773188 none 0.2867666162);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb none 0.2 0.3), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 none 0.196438359 0.2914615969);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -999999 0 0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -921788.227771966 -241977.733146743 -183469.5263235596);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -1 0.4 2), display-p3)}\n"), + "a {\ + \n b: color(display-p3 -0.9057671336 0.3411005959 1.9199196788);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 1 1 1), display-p3)}\n"), + "a {\ + \n b: color(display-p3 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb/hsl.rs b/rsass/tests/spec/core_functions/color/to_space/srgb/hsl.rs new file mode 100644 index 000000000..4f3b96e2d --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb/hsl.rs @@ -0,0 +1,143 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.4), hsl)}\n"), + "a {\ + \n b: hsla(210, 50%, 20%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.0), hsl)}\n"), + "a {\ + \n b: hsla(210, 50%, 20%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0 0 0), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 0%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.5 0.5 0.5), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 50%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.2 0.4 0.8), hsl)}\n"), + "a {\ + \n b: hsl(220, 60%, 50%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 none), hsl)}\n"), + "a {\ + \n b: hsl(90, 100%, 10%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 none 0.3), hsl)}\n"), + "a {\ + \n b: hsl(260, 100%, 15%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb none 0.2 0.3), hsl)}\n"), + "a {\ + \n b: hsl(200, 100%, 15%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -999999 0 0), hsl)}\n"), + "a {\ + \n b: hsl(0, 100%, -49999950%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -1 0.4 2), hsl)}\n"), + "a {\ + \n b: hsl(212, 300%, 50%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 1 1 1), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 100%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb/hwb.rs b/rsass/tests/spec/core_functions/color/to_space/srgb/hwb.rs new file mode 100644 index 000000000..a6917be10 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb/hwb.rs @@ -0,0 +1,194 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb 0.1 0.2 0.3 / 0.4), hwb));\n" + ), + "a {\ + \n value: hsla(210, 50%, 20%, 0.4);\ + \n space: hwb;\ + \n channels: 210deg 10% 70% / 0.4;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb 0.1 0.2 0.3 / 0.0), hwb));\n" + ), + "a {\ + \n value: hsla(210, 50%, 20%, 0);\ + \n space: hwb;\ + \n channels: 210deg 10% 70% / 0;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb 0 0 0), hwb));\n" + ), + "a {\ + \n value: black;\ + \n space: hwb;\ + \n channels: 0deg 0% 100% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb 0.5 0.5 0.5), hwb));\n" + ), + "a {\ + \n value: hsl(0, 0%, 50%);\ + \n space: hwb;\ + \n channels: 0deg 50% 50% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb 0.2 0.4 0.8), hwb));\n" + ), + "a {\ + \n value: #3366cc;\ + \n space: hwb;\ + \n channels: 220deg 20% 20% / 1;\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \na {b: color.to-space(color(srgb 0.1 0.2 none), hwb)}\n"), + "a {\ + \n b: hsl(90, 100%, 10%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb 0.1 none 0.3), hwb));\n" + ), + "a {\ + \n value: hsl(260, 100%, 15%);\ + \n space: hwb;\ + \n channels: 260deg 0% 70% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb none 0.2 0.3), hwb));\n" + ), + "a {\ + \n value: hsl(200, 100%, 15%);\ + \n space: hwb;\ + \n channels: 200deg 0% 70% / 1;\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb -999999 0 0), hwb));\n" + ), + "a {\ + \n value: hsl(0, 100%, -49999950%);\ + \n space: hwb;\ + \n channels: 180deg -99999900% 100% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb -1 0.4 2), hwb));\n" + ), + "a {\ + \n value: hsl(212, 300%, 50%);\ + \n space: hwb;\ + \n channels: 212deg -100% -100% / 1;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb 1 1 1), hwb));\n" + ), + "a {\ + \n value: white;\ + \n space: hwb;\ + \n channels: 0deg 100% 0% / 1;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb/lab.rs b/rsass/tests/spec/core_functions/color/to_space/srgb/lab.rs new file mode 100644 index 000000000..96c621028 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb/lab.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.4), lab)}\n"), + "a {\ + \n b: lab(20.2042266123% -3.1075752886 -18.9913351297 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.0), lab)}\n"), + "a {\ + \n b: lab(20.2042266123% -3.1075752886 -18.9913351297 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0 0 0), lab)}\n"), + "a {\ + \n b: lab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.5 0.5 0.5), lab)}\n"), + "a {\ + \n b: lab(53.3889647411% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.2 0.4 0.8), lab)}\n"), + "a {\ + \n b: lab(44.1210142293% 10.9543336098 -59.0857381981);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 none), lab)}\n"), + "a {\ + \n b: lab(18.3483752329% -17.6137840535 25.305473968);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 none 0.3), lab)}\n"), + "a {\ + \n b: lab(6.0247531381% 29.4610612512 -41.8404017236);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb none 0.2 0.3), lab)}\n"), + "a {\ + \n b: lab(19.2964565453% -7.7361660103 -20.488348653);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -999999 0 0), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz -91096581353071.61 -46971674760177.555 -4270152250925.234) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -1 0.4 2), lab)}\n"), + "a {\ + \n b: lab(48.6432537296% 68.9299544627 -213.4229545471);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 1 1 1), lab)}\n"), + "a {\ + \n b: lab(100% 0 0);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb/lch.rs b/rsass/tests/spec/core_functions/color/to_space/srgb/lch.rs new file mode 100644 index 000000000..cbb71202a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb/lch.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.4), lch)}\n"), + "a {\ + \n b: lch(20.2042266123% 19.2439038187 260.7069785652deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.0), lch)}\n"), + "a {\ + \n b: lch(20.2042266123% 19.2439038187 260.7069785652deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0 0 0), lch)}\n"), + "a {\ + \n b: lch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.5 0.5 0.5), lch)}\n"), + "a {\ + \n b: lch(53.3889647411% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.2 0.4 0.8), lch)}\n"), + "a {\ + \n b: lch(44.1210142293% 60.0926108873 280.5032243387deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 none), lch)}\n"), + "a {\ + \n b: lch(18.3483752329% 30.8320028773 124.8397077198deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 none 0.3), lch)}\n"), + "a {\ + \n b: lch(6.0247531381% 51.1719976788 305.1505063293deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb none 0.2 0.3), lch)}\n"), + "a {\ + \n b: lch(19.2964565453% 21.9002441782 249.3140373711deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -999999 0 0), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz -91096581353071.64 -46971674760177.555 -4270152250925.3564) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -1 0.4 2), lch)}\n"), + "a {\ + \n b: lch(48.6432537296% 224.278166904 287.899080689deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 1 1 1), lch)}\n"), + "a {\ + \n b: lch(100% 0 none);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb/mod.rs b/rsass/tests/spec/core_functions/color/to_space/srgb/mod.rs new file mode 100644 index 000000000..ce1bc122e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb/mod.rs @@ -0,0 +1,36 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod a98_rgb; + +mod display_p3; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb/oklab.rs b/rsass/tests/spec/core_functions/color/to_space/srgb/oklab.rs new file mode 100644 index 000000000..085be32bd --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb/oklab.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.4), oklab)}\n" + ), + "a {\ + \n b: oklab(31.3834098842% -0.0190902788 -0.0525285242 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.0), oklab)}\n" + ), + "a {\ + \n b: oklab(31.3834098842% -0.0190902788 -0.0525285242 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0 0 0), oklab)}\n"), + "a {\ + \n b: oklab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.5 0.5 0.5), oklab)}\n"), + "a {\ + \n b: oklab(59.8180726623% 0 0.0000000223);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.2 0.4 0.8), oklab)}\n"), + "a {\ + \n b: oklab(53.248255955% -0.0225118457 -0.1663491641);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 none), oklab)}\n"), + "a {\ + \n b: oklab(28.8978411941% -0.0558272225 0.0596397714);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 none 0.3), oklab)}\n"), + "a {\ + \n b: oklab(21.1364004026% 0.0335334923 -0.1181436252);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb none 0.2 0.3), oklab)}\n"), + "a {\ + \n b: oklab(30.4674630654% -0.0359109243 -0.0568929135);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -999999 0 0), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz -91096581353071.4 -46971674760177.49 -4270152250925.199) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -1 0.4 2), oklab)}\n"), + "a {\ + \n b: oklab(49.0997083563% -2.0235857478 -0.6049594977);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 1 1 1), oklab)}\n"), + "a {\ + \n b: oklab(99.9999993474% 0.0000000001 0.0000000373);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb/oklch.rs b/rsass/tests/spec/core_functions/color/to_space/srgb/oklch.rs new file mode 100644 index 000000000..1c44ca807 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb/oklch.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.4), oklch)}\n" + ), + "a {\ + \n b: oklch(31.3834098842% 0.0558899329 250.0274938863deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.0), oklch)}\n" + ), + "a {\ + \n b: oklch(31.3834098842% 0.0558899329 250.0274938863deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0 0 0), oklch)}\n"), + "a {\ + \n b: oklch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.5 0.5 0.5), oklch)}\n"), + "a {\ + \n b: oklch(59.8180726623% 0.0000000223 89.8755628286deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.2 0.4 0.8), oklch)}\n"), + "a {\ + \n b: oklch(53.248255955% 0.1678655044 262.2930469968deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 none), oklch)}\n"), + "a {\ + \n b: oklch(28.8978411941% 0.0816919892 133.1088653771deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 none 0.3), oklch)}\n"), + "a {\ + \n b: oklch(21.1364004026% 0.1228104689 285.8458860201deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb none 0.2 0.3), oklch)}\n"), + "a {\ + \n b: oklch(30.4674630654% 0.0672785114 237.7397947754deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -999999 0 0), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz -91096581353071.39 -46971674760177.49 -4270152250925.1875) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -1 0.4 2), oklch)}\n"), + "a {\ + \n b: oklch(49.0997083563% 2.1120784248 196.6442570354deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 1 1 1), oklch)}\n"), + "a {\ + \n b: oklch(99.9999993474% 0.0000000373 89.8755630959deg);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/srgb/prophoto_rgb.rs new file mode 100644 index 000000000..871e4dd12 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb/prophoto_rgb.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.4), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1331358788 0.1476592872 0.2235807496 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1331358788 0.1476592872 0.2235807496 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0 0 0), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.5 0.5 0.5), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.4246723949 0.4246723949 0.4246723949);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.2 0.4 0.8), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.3437112182 0.3305199405 0.7092276973);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 none), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.1013444503 0.1422873785 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 none 0.3), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.0991241424 none 0.2163131073);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb none 0.2 0.3), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb none 0.1451114907 0.2232691012);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -999999 0 0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -65386295.193253286 -25672329.57753762 -9641319.650744053);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -1 0.4 2), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0.4212484437 0.3577643231 2.2446463591);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 1 1 1), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb/rec2020.rs b/rsass/tests/spec/core_functions/color/to_space/srgb/rec2020.rs new file mode 100644 index 000000000..4687b1472 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb/rec2020.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.4), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.0912836575 0.1341693654 0.2300559367 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.0), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.0912836575 0.1341693654 0.2300559367 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0 0 0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.5 0.5 0.5), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.4500400319 0.4500400319 0.4500400319);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.2 0.4 0.8), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.2739398263 0.3416365439 0.7427746502);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 none), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0773513907 0.1314145084 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 none 0.3), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.0425725358 none 0.2236924669);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb none 0.2 0.3), rec2020)}\n"), + "a {\ + \n b: color(rec2020 none 0.1318794997 0.2297011255);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -999999 0 0), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 -2540376.5945026004 -941367.6801989076 -492696.4947353633);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -1 0.4 2), rec2020)}\n"), + "a {\ + \n b: color(rec2020 -0.6026796755 0.3067863382 2.048941054);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 1 1 1), rec2020)}\n"), + "a {\ + \n b: color(rec2020 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb/rgb.rs b/rsass/tests/spec/core_functions/color/to_space/srgb/rgb.rs new file mode 100644 index 000000000..7af6d5287 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb/rgb.rs @@ -0,0 +1,143 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.4), rgb)}\n"), + "a {\ + \n b: rgba(25.5, 51, 76.5, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.0), rgb)}\n"), + "a {\ + \n b: rgba(25.5, 51, 76.5, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0 0 0), rgb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.5 0.5 0.5), rgb)}\n"), + "a {\ + \n b: rgb(127.5, 127.5, 127.5);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.2 0.4 0.8), rgb)}\n"), + "a {\ + \n b: #3366cc;\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 none), rgb)}\n"), + "a {\ + \n b: rgb(25.5, 51, 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 none 0.3), rgb)}\n"), + "a {\ + \n b: rgb(25.5, 0, 76.5);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb none 0.2 0.3), rgb)}\n"), + "a {\ + \n b: rgb(0, 51, 76.5);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -999999 0 0), rgb)}\n"), + "a {\ + \n b: hsl(0, 100%, -49999950%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -1 0.4 2), rgb)}\n"), + "a {\ + \n b: hsl(212, 300%, 50%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 1 1 1), rgb)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb/srgb.rs b/rsass/tests/spec/core_functions/color/to_space/srgb/srgb.rs new file mode 100644 index 000000000..7a6ae8eef --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb/srgb.rs @@ -0,0 +1,67 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +#[test] +#[ignore] // unexepected error +fn in_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.2 0.4 0.8), srgb)}\n"), + "a {\ + \n b: color(srgb 0.2 0.4 0.8);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 none), srgb)}\n"), + "a {\ + \n b: color(srgb 0.1 0.2 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 none 0.3), srgb)}\n"), + "a {\ + \n b: color(srgb 0.1 none 0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb none 0.2 0.3), srgb)}\n"), + "a {\ + \n b: color(srgb none 0.2 0.3);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -1 0.4 2), srgb)}\n"), + "a {\ + \n b: color(srgb -1 0.4 2);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb/srgb_linear.rs b/rsass/tests/spec/core_functions/color/to_space/srgb/srgb_linear.rs new file mode 100644 index 000000000..9df442e77 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb/srgb_linear.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.4), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0100228256 0.0331047666 0.0732389559 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0100228256 0.0331047666 0.0732389559 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0 0 0), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.5 0.5 0.5), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2140411405 0.2140411405 0.2140411405);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.2 0.4 0.8), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0331047666 0.1328683216 0.6038273389);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 none), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0100228256 0.0331047666 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 none 0.3), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0100228256 none 0.0732389559);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb none 0.2 0.3), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear none 0.0331047666 0.0732389559);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -999999 0 0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -220898675516573.56 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -1 0.4 2), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear -1 0.1328683216 4.9538457516);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 1 1 1), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb/xyz.rs b/rsass/tests/spec/core_functions/color/to_space/srgb/xyz.rs new file mode 100644 index 000000000..101b3455a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb/xyz.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.4), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0291892916 0.0310940256 0.0737556471 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.0), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0291892916 0.0310940256 0.0737556471 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0 0 0), xyz)}\n"), + "a {\ + \n b: color(xyz 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.5 0.5 0.5), xyz)}\n"), + "a {\ + \n b: color(xyz 0.2034366706 0.2140411405 0.233103163);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.2 0.4 0.8), xyz)}\n"), + "a {\ + \n b: color(xyz 0.1701429663 0.1456543203 0.5904344526);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 none), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0159710671 0.0258067358 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 none 0.3), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0173515455 none 0.0698097318);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb none 0.2 0.3), xyz)}\n"), + "a {\ + \n b: color(xyz none 0.028962782 0.0735618977);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -999999 0 0), xyz)}\n" + ), + "a {\ + \n b: color(xyz -91096581353071.61 -46971674760177.55 -4270152250925.2314);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -1 0.4 2), xyz)}\n"), + "a {\ + \n b: color(xyz 0.5291948186 0.2400138509 4.7052960558);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 1 1 1), xyz)}\n"), + "a {\ + \n b: color(xyz 0.9504559271 1 1.0890577508);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb/xyz_d50.rs b/rsass/tests/spec/core_functions/color/to_space/srgb/xyz_d50.rs new file mode 100644 index 000000000..401f220d0 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb/xyz_d50.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.4), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0275998758 0.0304021191 0.0556533029 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 0.3 / 0.0), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0275998758 0.0304021191 0.0556533029 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0 0 0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.5 0.5 0.5), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.2063989463 0.2140411405 0.1766063301);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.2 0.4 0.8), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.152004951 0.1392210573 0.4445526951);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 0.2 none), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0171209617 0.0259623875 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 0.1 none 0.3), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.014849525 none 0.0524394483);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb none 0.2 0.3), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 none 0.0281721088 0.0555137459);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -999999 0 0), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 -96326345922671.53 -49148448135198.27 -3075775809210.909);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb -1 0.4 2), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.3238971106 0.1730595843 3.5365131761);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb 1 1 1), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.9642956764 1 0.8251046025);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb_linear/a98_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/a98_rgb.rs new file mode 100644 index 000000000..7e2eb2444 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/a98_rgb.rs @@ -0,0 +1,161 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb_linear/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.4), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.3933623369 0.4810314783 0.5747978617 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.0), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.3933623369 0.4810314783 0.5747978617 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0 0 0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.5 0.5 0.5), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.7296583818 0.7296583818 0.7296583818);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.2 0.4 0.8), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.5391048013 0.6592557425 0.8950095649);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 none), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.3933623369 0.4810314783 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 none 0.3), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb 0.3013559074 none 0.5674699335);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear none 0.2 0.3), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb none 0.4810314783 0.5747978617);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -999999 0 0), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb -459.2276214951 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -1 0.4 2), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb -0.7934333717 0.6592557425 1.3497959658);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 1 1 1), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb_linear/display_p3.rs b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/display_p3.rs new file mode 100644 index 000000000..84bcf491b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/display_p3.rs @@ -0,0 +1,165 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb_linear/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.4), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.377671895 0.4807798914 0.5742767089 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.377671895 0.4807798914 0.5742767089 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0 0 0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.5 0.5 0.5), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.7353569831 0.7353569831 0.7353569831);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.2 0.4 0.8), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.5225476892 0.6601803521 0.8864121553);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 none), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.377671895 0.4807798914 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 none 0.3), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.3175781541 none 0.5609588905);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear none 0.2 0.3), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 none 0.4769934816 0.5727260345);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -999999 0 0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -307.4724395956 -80.6737432685 -61.1542078437);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -1 0.4 2), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -0.8815767709 0.6290624928 1.3029857539);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 1 1 1), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb_linear/hsl.rs b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/hsl.rs new file mode 100644 index 000000000..7fea44d9e --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/hsl.rs @@ -0,0 +1,153 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb_linear/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.4), hsl)}\n" + ), + "a {\ + \n b: hsla(205.3925362149, 25.148533711%, 46.6510851344%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.0), hsl)}\n" + ), + "a {\ + \n b: hsla(205.3925362149, 25.148533711%, 46.6510851344%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0 0 0), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 0%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.5 0.5 0.5), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 73.5356983052%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.2 0.4 0.8), hsl)}\n"), + "a {\ + \n b: hsl(214.3023060477, 69.2456926348%, 69.5430478913%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 none), hsl)}\n" + ), + "a {\ + \n b: hsl(76.7592364631, 100%, 24.2264602241%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 none 0.3), hsl)}\n" + ), + "a {\ + \n b: hsl(275.8860614996, 100%, 29.191574503%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear none 0.2 0.3), hsl)}\n" + ), + "a {\ + \n b: hsl(190.2052342776, 100%, 29.191574503%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -999999 0 0), hsl)}\n"), + "a {\ + \n b: hsl(0, 100%, -16678.2577069634%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -1 0.4 2), hsl)}\n"), + "a {\ + \n b: hsl(197.5434618594, 666.1615765111%, 17.6628023075%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 1 1 1), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 100%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb_linear/hwb.rs b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/hwb.rs new file mode 100644 index 000000000..28faae2e4 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/hwb.rs @@ -0,0 +1,196 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb_linear/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.4), hwb));\n" + ), + "a {\ + \n value: hsla(205.3925362149, 25.148533711%, 46.6510851344%, 0.4);\ + \n space: hwb;\ + \n channels: 205.3925362149deg 34.9190212628% 41.616850994% / 0.4;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.0), hwb));\n" + ), + "a {\ + \n value: hsla(205.3925362149, 25.148533711%, 46.6510851344%, 0);\ + \n space: hwb;\ + \n channels: 205.3925362149deg 34.9190212628% 41.616850994% / 0;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb-linear 0 0 0), hwb));\n" + ), + "a {\ + \n value: black;\ + \n space: hwb;\ + \n channels: 0deg 0% 100% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb-linear 0.5 0.5 0.5), hwb));\n" + ), + "a {\ + \n value: hsl(0, 0%, 73.5356983052%);\ + \n space: hwb;\ + \n channels: 0deg 73.5356983052% 26.4643016948% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb-linear 0.2 0.4 0.8), hwb));\n" + ), + "a {\ + \n value: hsl(214.3023060477, 69.2456926348%, 69.5430478913%);\ + \n space: hwb;\ + \n channels: 214.3023060477deg 48.4529204482% 9.3668246656% / 1;\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 none), hwb)}\n" + ), + "a {\ + \n b: hsl(76.7592364631, 100%, 24.2264602241%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb-linear 0.1 none 0.3), hwb));\n" + ), + "a {\ + \n value: hsl(275.8860614996, 100%, 29.191574503%);\ + \n space: hwb;\ + \n channels: 275.8860614996deg 0% 41.616850994% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb-linear none 0.2 0.3), hwb));\n" + ), + "a {\ + \n value: hsl(190.2052342776, 100%, 29.191574503%);\ + \n space: hwb;\ + \n channels: 190.2052342776deg 0% 41.616850994% / 1;\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb-linear -999999 0 0), hwb));\n" + ), + "a {\ + \n value: hsl(0, 100%, -16678.2577069634%);\ + \n space: hwb;\ + \n channels: 180deg -33356.5154139268% 100% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb-linear -1 0.4 2), hwb));\n" + ), + "a {\ + \n value: hsl(197.5434618594, 666.1615765111%, 17.6628023075%);\ + \n space: hwb;\ + \n channels: 197.5434618594deg -100% -35.3256046149% / 1;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(srgb-linear 1 1 1), hwb));\n" + ), + "a {\ + \n value: white;\ + \n space: hwb;\ + \n channels: 0deg 100% 0% / 1;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb_linear/lab.rs b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/lab.rs new file mode 100644 index 000000000..8ad8e7f57 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/lab.rs @@ -0,0 +1,155 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb_linear/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.4), lab)}\n" + ), + "a {\ + \n b: lab(49.9553149355% -7.5157058766 -17.8791167699 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.0), lab)}\n" + ), + "a {\ + \n b: lab(49.9553149355% -7.5157058766 -17.8791167699 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0 0 0), lab)}\n"), + "a {\ + \n b: lab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.5 0.5 0.5), lab)}\n"), + "a {\ + \n b: lab(76.0692610142% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.2 0.4 0.8), lab)}\n"), + "a {\ + \n b: lab(68.0021326658% -3.4788867492 -36.298343272);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 none), lab)}\n" + ), + "a {\ + \n b: lab(47.7042083773% -24.5180464109 51.183897624);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 none 0.3), lab)}\n" + ), + "a {\ + \n b: lab(23.8148183096% 52.2336661374 -59.2206654307);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear none 0.2 0.3), lab)}\n" + ), + "a {\ + \n b: lab(47.1789302985% -22.7267758708 -22.4056108481);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -999999 0 0), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz -412390.3868751603 -212638.7932325045 -19330.7993847731) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -1 0.4 2), lab)}\n"), + "a {\ + \n b: lab(50.1566645274% -199.4292910489 -127.4603757066);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 1 1 1), lab)}\n"), + "a {\ + \n b: lab(100% 0 0);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb_linear/lch.rs b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/lch.rs new file mode 100644 index 000000000..def44dedb --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/lch.rs @@ -0,0 +1,155 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb_linear/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.4), lch)}\n" + ), + "a {\ + \n b: lch(49.9553149355% 19.3945521035 247.1999530707deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.0), lch)}\n" + ), + "a {\ + \n b: lch(49.9553149355% 19.3945521035 247.1999530707deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0 0 0), lch)}\n"), + "a {\ + \n b: lch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.5 0.5 0.5), lch)}\n"), + "a {\ + \n b: lch(76.0692610142% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.2 0.4 0.8), lch)}\n"), + "a {\ + \n b: lch(68.0021326658% 36.4646730043 264.5254095776deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 none), lch)}\n" + ), + "a {\ + \n b: lch(47.7042083773% 56.7532023396 115.5952944453deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 none 0.3), lch)}\n" + ), + "a {\ + \n b: lch(23.8148183096% 78.9648218652 311.4128591679deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear none 0.2 0.3), lch)}\n" + ), + "a {\ + \n b: lch(47.1789302985% 31.9142247118 224.5922863586deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -999999 0 0), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz -412390.3868751603 -212638.7932325045 -19330.7993847737) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -1 0.4 2), lch)}\n"), + "a {\ + \n b: lch(50.1566645274% 236.6816205445 212.5836894898deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 1 1 1), lch)}\n"), + "a {\ + \n b: lch(100% 0 none);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb_linear/mod.rs b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/mod.rs new file mode 100644 index 000000000..29d799faa --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/mod.rs @@ -0,0 +1,36 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb_linear" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod a98_rgb; + +mod display_p3; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb_linear/oklab.rs b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/oklab.rs new file mode 100644 index 000000000..c146f10af --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/oklab.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb_linear/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.4), oklab)}\n" + ), + "a {\ + \n b: oklab(56.8480554239% -0.0271159546 -0.0484208297 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.0), oklab)}\n" + ), + "a {\ + \n b: oklab(56.8480554239% -0.0271159546 -0.0484208297 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0 0 0), oklab)}\n"), + "a {\ + \n b: oklab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.5 0.5 0.5), oklab)}\n" + ), + "a {\ + \n b: oklab(79.3700520804% 0.0000000001 0.0000000296);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.2 0.4 0.8), oklab)}\n" + ), + "a {\ + \n b: oklab(72.8143374355% -0.0250833833 -0.0997563344);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 none), oklab)}\n" + ), + "a {\ + \n b: oklab(53.8237207745% -0.0823086169 0.1108579968);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 none 0.3), oklab)}\n" + ), + "a {\ + \n b: oklab(37.7328569492% 0.1076561145 -0.1664592467);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear none 0.2 0.3), oklab)}\n" + ), + "a {\ + \n b: oklab(54.0246595647% -0.0760370977 -0.061145727);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -999999 0 0), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz -412390.3868751598 -212638.7932325045 -19330.799384773) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -1 0.4 2), oklab)}\n"), + "a {\ + \n b: oklab(41.5806830952% -1.9917329546 -0.3816984711);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 1 1 1), oklab)}\n"), + "a {\ + \n b: oklab(99.9999993474% 0.0000000001 0.0000000373);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb_linear/oklch.rs b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/oklch.rs new file mode 100644 index 000000000..dfca6a841 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/oklch.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb_linear/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.4), oklch)}\n" + ), + "a {\ + \n b: oklch(56.8480554239% 0.055496412 240.7509124531deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.0), oklch)}\n" + ), + "a {\ + \n b: oklch(56.8480554239% 0.055496412 240.7509124531deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0 0 0), oklch)}\n"), + "a {\ + \n b: oklch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.5 0.5 0.5), oklch)}\n" + ), + "a {\ + \n b: oklch(79.3700520804% 0.0000000296 89.8755628773deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.2 0.4 0.8), oklch)}\n" + ), + "a {\ + \n b: oklch(72.8143374355% 0.1028615689 255.885778774deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 none), oklch)}\n" + ), + "a {\ + \n b: oklch(53.8237207745% 0.138073183 126.5927383995deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 none 0.3), oklch)}\n" + ), + "a {\ + \n b: oklch(37.7328569492% 0.1982385426 302.8924282818deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear none 0.2 0.3), oklch)}\n" + ), + "a {\ + \n b: oklch(54.0246595647% 0.0975727429 218.8047277574deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -999999 0 0), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz -412390.3868751598 -212638.7932325044 -19330.7993847733) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -1 0.4 2), oklch)}\n"), + "a {\ + \n b: oklch(41.5806830952% 2.0279777823 190.8487076701deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 1 1 1), oklch)}\n"), + "a {\ + \n b: oklch(99.9999993474% 0.0000000373 89.8755630959deg);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb_linear/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/prophoto_rgb.rs new file mode 100644 index 000000000..a4b474a68 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/prophoto_rgb.rs @@ -0,0 +1,165 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb_linear/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.4), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.3626946772 0.4009240289 0.4977561426 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.3626946772 0.4009240289 0.4977561426 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0 0 0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.5 0.5 0.5), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.6803950001 0.6803950001 0.6803950001);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.2 0.4 0.8), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.5584197658 0.5940140048 0.8477459947);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 none), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.3064298164 0.3910752998 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 none 0.3), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2705939482 none 0.4744752789);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear none 0.2 0.3), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb none 0.3894388678 0.4961157804);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -999999 0 0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -1512.946773752 -594.0215467819 -223.0865568571);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -1 0.4 2), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -0.302285213 0.5192197728 1.3694597345);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 1 1 1), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb_linear/rec2020.rs b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/rec2020.rs new file mode 100644 index 000000000..7e07f4d5d --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/rec2020.rs @@ -0,0 +1,161 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb_linear/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.4), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.3568250491 0.4265433858 0.5284543831 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.0), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.3568250491 0.4265433858 0.5284543831 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0 0 0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.5 0.5 0.5), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.7054355531 0.7054355531 0.7054355531);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.2 0.4 0.8), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.5322900823 0.6209100246 0.8693839915);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 none), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.3374893111 0.4223703123 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 none 0.3), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.2448919266 none 0.5108839287);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear none 0.2 0.3), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 none 0.4180412871 0.5268436405);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -999999 0 0), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 -446.5956338945 -165.4289951275 -86.5355205509);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -1 0.4 2), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 -0.6359299305 0.5603508935 1.336426667);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 1 1 1), rec2020)}\n"), + "a {\ + \n b: color(rec2020 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb_linear/rgb.rs b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/rgb.rs new file mode 100644 index 000000000..115321290 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/rgb.rs @@ -0,0 +1,153 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb_linear/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.4), rgb)}\n" + ), + "a {\ + \n b: rgba(89.0435042202, 123.5549471428, 148.8770299654, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.0), rgb)}\n" + ), + "a {\ + \n b: rgba(89.0435042202, 123.5549471428, 148.8770299654, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0 0 0), rgb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.5 0.5 0.5), rgb)}\n"), + "a {\ + \n b: rgb(187.5160306784, 187.5160306784, 187.5160306784);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.2 0.4 0.8), rgb)}\n"), + "a {\ + \n b: rgb(123.5549471428, 169.6221965809, 231.1145971027);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 none), rgb)}\n" + ), + "a {\ + \n b: rgb(89.0435042202, 123.5549471428, 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 none 0.3), rgb)}\n" + ), + "a {\ + \n b: rgb(89.0435042202, 0, 148.8770299654);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear none 0.2 0.3), rgb)}\n" + ), + "a {\ + \n b: rgb(0, 123.5549471428, 148.8770299654);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -999999 0 0), rgb)}\n"), + "a {\ + \n b: hsl(0, 100%, -16678.2577069634%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -1 0.4 2), rgb)}\n"), + "a {\ + \n b: hsl(197.5434618594, 666.1615765111%, 17.6628023075%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 1 1 1), rgb)}\n"), + "a {\ + \n b: white;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb_linear/srgb.rs b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/srgb.rs new file mode 100644 index 000000000..fe0046f8f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/srgb.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb_linear/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.4), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.3491902126 0.4845292045 0.5838314901 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.0), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.3491902126 0.4845292045 0.5838314901 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0 0 0), srgb)}\n"), + "a {\ + \n b: color(srgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.5 0.5 0.5), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.7353569831 0.7353569831 0.7353569831);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.2 0.4 0.8), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.4845292045 0.6651850846 0.9063317533);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 none), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.3491902126 0.4845292045 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 none 0.3), srgb)}\n" + ), + "a {\ + \n b: color(srgb 0.3491902126 none 0.5838314901);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear none 0.2 0.3), srgb)}\n" + ), + "a {\ + \n b: color(srgb none 0.4845292045 0.5838314901);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -999999 0 0), srgb)}\n" + ), + "a {\ + \n b: color(srgb -333.5651541393 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -1 0.4 2), srgb)}\n"), + "a {\ + \n b: color(srgb -1 0.6651850846 1.3532560461);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 1 1 1), srgb)}\n"), + "a {\ + \n b: color(srgb 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb_linear/srgb_linear.rs b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/srgb_linear.rs new file mode 100644 index 000000000..379c6aabd --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/srgb_linear.rs @@ -0,0 +1,77 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb_linear/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +#[test] +#[ignore] // unexepected error +fn in_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.2 0.4 0.8), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.2 0.4 0.8);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 none), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.1 0.2 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 none 0.3), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.1 none 0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear none 0.2 0.3), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear none 0.2 0.3);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn out_of_range() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -1 0.4 2), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -1 0.4 2);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb_linear/xyz.rs b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/xyz.rs new file mode 100644 index 000000000..bfb0c4a04 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/xyz.rs @@ -0,0 +1,155 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb_linear/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.4), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.1669001843 0.1859553309 0.3109316835 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.0), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.1669001843 0.1859553309 0.3109316835 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0 0 0), xyz)}\n"), + "a {\ + \n b: color(xyz 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.5 0.5 0.5), xyz)}\n"), + "a {\ + \n b: color(xyz 0.4752279635 0.5 0.5445288754);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.2 0.4 0.8), xyz)}\n"), + "a {\ + \n b: color(xyz 0.3698965263 0.386349125 0.8119697975);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 none), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.1127559478 0.1642976363 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 none 0.3), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.0953833164 none 0.2870927275);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear none 0.2 0.3), xyz)}\n" + ), + "a {\ + \n b: color(xyz none 0.1646914304 0.3089986016);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -999999 0 0), xyz)}\n" + ), + "a {\ + \n b: color(xyz -412390.3868751602 -212638.7932325045 -19330.7993847731);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -1 0.4 2), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0916045133 0.2178130964 1.9294113977);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 1 1 1), xyz)}\n"), + "a {\ + \n b: color(xyz 0.9504559271 1 1.0890577508);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/srgb_linear/xyz_d50.rs b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/xyz_d50.rs new file mode 100644 index 000000000..d7e2c3c3f --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/srgb_linear/xyz_d50.rs @@ -0,0 +1,161 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/srgb_linear/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.4), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.1635604026 0.1838126633 0.235038464 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 0.3 / 0.0), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.1635604026 0.1838126633 0.235038464 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0 0 0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.5 0.5 0.5), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.4821478382 0.5 0.4125523013);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.2 0.4 0.8), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.3557364892 0.3797492885 0.6128967994);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 0.2 none), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.1206368766 0.1656267203 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 0.1 none 0.3), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0865301007 none 0.2156221992);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear none 0.2 0.3), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 none 0.1615633456 0.2336460719);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -999999 0 0), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 -436065.3108085225 -222492.9546173881 -13923.9075392479);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear -1 0.4 2), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0041516969 0.1855012477 1.4531073219);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(srgb-linear 1 1 1), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.9642956764 1 0.8251046025);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz/a98_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/xyz/a98_rgb.rs new file mode 100644 index 000000000..edbc05f97 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz/a98_rgb.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.4), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb -0.1351623531 0.5702285503 0.5625764827 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.0), a98-rgb)}\n" + ), + "a {\ + \n b: color(a98-rgb -0.1351623531 0.5702285503 0.5625764827 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0 0 0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.5 0.5 0.5), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.7719295678 0.7122496746 0.6991190732);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.2 0.4 0.8), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb -0.3403753886 0.7865601683 0.8866254663);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 none), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.3365194536 0.5589776013 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 none 0.3), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 0.3521663165 none 0.5835625865);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz none 0.2 0.3), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb none 0.6499288625 0.5613563103);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -999999 0 0), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb -739.9221025629 527.3176861205 -75.3831765931);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -1 0.4 2), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb -1.6372044815 1.3072981109 1.360980168);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 1 1 1), a98-rgb)}\n"), + "a {\ + \n b: color(a98-rgb 1.0579328451 0.9761412908 0.9581457442);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz/display_p3.rs b/rsass/tests/spec/core_functions/color/to_space/xyz/display_p3.rs new file mode 100644 index 000000000..5d1324cce --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz/display_p3.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.4), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -0.2665155311 0.5626429938 0.5614732822 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -0.2665155311 0.5626429938 0.5614732822 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0 0 0), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.5 0.5 0.5), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.785596466 0.7209470243 0.7071783379);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.2 0.4 0.8), display-p3)}\n"), + "a {\ + \n b: color(display-p3 -0.4800324283 0.7723805169 0.8767615059);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 none), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.2785701294 0.5560005714 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 none 0.3), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0.3937592636 none 0.575458821);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz none 0.2 0.3), display-p3)}\n"), + "a {\ + \n b: color(display-p3 none 0.6339496775 0.5581173728);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -999999 0 0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -488.1354653538 308.5645035738 -83.3006508571);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -1 0.4 2), display-p3)}\n"), + "a {\ + \n b: color(display-p3 -1.7588549225 1.2221230245 1.3074633625);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 1 1 1), display-p3)}\n"), + "a {\ + \n b: color(display-p3 1.067061664 0.9807650127 0.9623860213);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz/hsl.rs b/rsass/tests/spec/core_functions/color/to_space/xyz/hsl.rs new file mode 100644 index 000000000..dfc212777 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz/hsl.rs @@ -0,0 +1,143 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.4), hsl)}\n"), + "a {\ + \n b: hsla(179.5022543706, 556.250481638%, 8.7700702541%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.0), hsl)}\n"), + "a {\ + \n b: hsla(179.5022543706, 556.250481638%, 8.7700702541%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0 0 0), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 0%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.5 0.5 0.5), hsl)}\n"), + "a {\ + \n b: hsl(8.6326376323, 19.0960524665%, 75.1815938992%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.2 0.4 0.8), hsl)}\n"), + "a {\ + \n b: hsl(183.9973689591, 600.9357681928%, 12.7508937669%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 none), hsl)}\n"), + "a {\ + \n b: hsl(93.2964667331, 215.664278299%, 17.8710983929%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 none 0.3), hsl)}\n"), + "a {\ + \n b: hsl(290.3526254976, 328.3439800543%, 14.0892871543%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz none 0.2 0.3), hsl)}\n"), + "a {\ + \n b: hsl(355.8794204538, 2697.9214173204%, -2.5244914397%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -999999 0 0), hsl)}\n"), + "a {\ + \n b: hsl(330.5196564153, 405.9398117154%, -10761.9459979264%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -1 0.4 2), hsl)}\n"), + "a {\ + \n b: hsl(0.951270101, 523.3395920082%, -31.8043324514%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 1 1 1), hsl)}\n"), + "a {\ + \n b: hsl(188.6326376323, 287.948753728%, 102.1970070346%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz/hwb.rs b/rsass/tests/spec/core_functions/color/to_space/xyz/hwb.rs new file mode 100644 index 000000000..ffcbfad40 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz/hwb.rs @@ -0,0 +1,194 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz 0.1 0.2 0.3 / 0.4), hwb));\n" + ), + "a {\ + \n value: hsla(179.5022543706, 556.250481638%, 8.7700702541%, 0.4);\ + \n space: hwb;\ + \n channels: 179.5022543706deg -40.0134877742% 42.4463717177% / 0.4;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz 0.1 0.2 0.3 / 0.0), hwb));\n" + ), + "a {\ + \n value: hsla(179.5022543706, 556.250481638%, 8.7700702541%, 0);\ + \n space: hwb;\ + \n channels: 179.5022543706deg -40.0134877742% 42.4463717177% / 0;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz 0 0 0), hwb));\n" + ), + "a {\ + \n value: black;\ + \n space: hwb;\ + \n channels: 0deg 0% 100% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz 0.5 0.5 0.5), hwb));\n" + ), + "a {\ + \n value: hsl(8.6326376323, 19.0960524665%, 75.1815938992%);\ + \n space: hwb;\ + \n channels: 8.6326376323deg 70.4422580488% 20.0790702505% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz 0.2 0.4 0.8), hwb));\n" + ), + "a {\ + \n value: hsl(183.9973689591, 600.9357681928%, 12.7508937669%);\ + \n space: hwb;\ + \n channels: 183.9973689591deg -63.8737876426% 10.6244248236% / 1;\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \na {b: color.to-space(color(xyz 0.1 0.2 none), hwb)}\n"), + "a {\ + \n b: hsl(93.2964667331, 215.664278299%, 17.8710983929%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz 0.1 none 0.3), hwb));\n" + ), + "a {\ + \n value: hsl(290.3526254976, 328.3439800543%, 14.0892871543%);\ + \n space: hwb;\ + \n channels: 290.3526254976deg -32.1720390494% 39.6493866421% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz none 0.2 0.3), hwb));\n" + ), + "a {\ + \n value: hsl(355.8794204538, 2697.9214173204%, -2.5244914397%);\ + \n space: hwb;\ + \n channels: 175.8794204538deg -70.6332866707% 34.4156962088% / 1;\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz -999999 0 0), hwb));\n" + ), + "a {\ + \n value: hsl(330.5196564153, 405.9398117154%, -10761.9459979264%);\ + \n space: hwb;\ + \n channels: 150.5196564153deg -54448.9693188225% -32825.0773229696% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz -1 0.4 2), hwb));\n" + ), + "a {\ + \n value: hsl(0.951270101, 523.3395920082%, -31.8043324514%);\ + \n space: hwb;\ + \n channels: 180.951270101deg -198.2489961434% -34.6403312406% / 1;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz 1 1 1), hwb));\n" + ), + "a {\ + \n value: hsl(188.6326376323, 287.948753728%, 102.1970070346%);\ + \n space: hwb;\ + \n channels: 8.6326376323deg 95.8707526592% -8.5232614099% / 1;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz/lab.rs b/rsass/tests/spec/core_functions/color/to_space/xyz/lab.rs new file mode 100644 index 000000000..694f0a01a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz/lab.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.4), lab)}\n"), + "a {\ + \n b: lab(51.373608379% -60.0251143111 -14.0399860293 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.0), lab)}\n"), + "a {\ + \n b: lab(51.373608379% -60.0251143111 -14.0399860293 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0 0 0), lab)}\n"), + "a {\ + \n b: lab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.5 0.5 0.5), lab)}\n"), + "a {\ + \n b: lab(76.1608841835% 7.1944893389 4.6048603909);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.2 0.4 0.8), lab)}\n"), + "a {\ + \n b: lab(68.6381340629% -79.8035401529 -34.4873470111);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 none), lab)}\n"), + "a {\ + \n b: lab(51.9556818936% -50.8750926576 85.6399941916);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 none 0.3), lab)}\n"), + "a {\ + \n b: color-mix(in lab, color(xyz 0.1 0 0.3) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz none 0.2 0.3), lab)}\n"), + "a {\ + \n b: lab(51.0322781723% -262.2343975897 -14.80446365);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -999999 0 0), lab)}\n" + ), + "a {\ + \n b: color-mix(in lab, color(xyz -999999 0 0.000000002) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -1 0.4 2), lab)}\n"), + "a {\ + \n b: lab(64.3546378926% -4876.8569771732 -106.5787284462);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 1 1 1), lab)}\n"), + "a {\ + \n b: color-mix(in lab, color(xyz 1 1 1) 100%, black);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz/lch.rs b/rsass/tests/spec/core_functions/color/to_space/xyz/lch.rs new file mode 100644 index 000000000..6fc6c2f50 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz/lch.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.4), lch)}\n"), + "a {\ + \n b: lch(51.373608379% 61.6452395223 193.1649108151deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.0), lch)}\n"), + "a {\ + \n b: lch(51.373608379% 61.6452395223 193.1649108151deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0 0 0), lch)}\n"), + "a {\ + \n b: lch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.5 0.5 0.5), lch)}\n"), + "a {\ + \n b: lch(76.1608841835% 8.541979634 32.621430668deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.2 0.4 0.8), lch)}\n"), + "a {\ + \n b: lch(68.6381340629% 86.9366558179 203.3717362956deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 none), lch)}\n"), + "a {\ + \n b: lch(51.9556818936% 99.6116642671 120.7127528375deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 none 0.3), lch)}\n"), + "a {\ + \n b: color-mix(in lch, color(xyz 0.1 0 0.3) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz none 0.2 0.3), lch)}\n"), + "a {\ + \n b: lch(51.0322781723% 262.6519587272 183.231207866deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -999999 0 0), lch)}\n" + ), + "a {\ + \n b: color-mix(in lch, color(xyz -999998.9999993658 0.000000211 0.0000133413) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -1 0.4 2), lch)}\n"), + "a {\ + \n b: lch(64.3546378926% 4878.0214227861 181.2519414622deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 1 1 1), lch)}\n"), + "a {\ + \n b: color-mix(in lch, color(xyz 1 1 1) 100%, black);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz/mod.rs b/rsass/tests/spec/core_functions/color/to_space/xyz/mod.rs new file mode 100644 index 000000000..b53b0e4df --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz/mod.rs @@ -0,0 +1,36 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +mod a98_rgb; + +mod display_p3; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz/oklab.rs b/rsass/tests/spec/core_functions/color/to_space/xyz/oklab.rs new file mode 100644 index 000000000..388ec435b --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz/oklab.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.4), oklab)}\n"), + "a {\ + \n b: oklab(56.4079108835% -0.1736338918 -0.037500532 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.0), oklab)}\n"), + "a {\ + \n b: oklab(56.4079108835% -0.1736338918 -0.037500532 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0 0 0), oklab)}\n"), + "a {\ + \n b: oklab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.5 0.5 0.5), oklab)}\n"), + "a {\ + \n b: oklab(79.6276375075% 0.0212390424 0.011797917);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.2 0.4 0.8), oklab)}\n"), + "a {\ + \n b: oklab(70.8952946273% -0.2482574119 -0.0948731015);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 none), oklab)}\n"), + "a {\ + \n b: oklab(56.6867659008% -0.1591393684 0.1508075586);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 none 0.3), oklab)}\n"), + "a {\ + \n b: oklab(26.3423259569% 0.3682063514 -0.2704617545);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz none 0.2 0.3), oklab)}\n"), + "a {\ + \n b: oklab(52.699430823% -0.4922232406 -0.0409679345);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -999999 0 0), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz -999998.9999999991 -0.0000000001 0) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -1 0.4 2), oklab)}\n"), + "a {\ + \n b: oklab(38.0019911648% -3.242940099 -0.3314216345);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 1 1 1), oklab)}\n"), + "a {\ + \n b: color-mix(in oklab, color(xyz 1 1 1) 100%, black);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz/oklch.rs b/rsass/tests/spec/core_functions/color/to_space/xyz/oklch.rs new file mode 100644 index 000000000..0d2b6398c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz/oklch.rs @@ -0,0 +1,145 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.4), oklch)}\n"), + "a {\ + \n b: oklch(56.4079108835% 0.1776373223 192.1872495768deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.0), oklch)}\n"), + "a {\ + \n b: oklch(56.4079108835% 0.1776373223 192.1872495768deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0 0 0), oklch)}\n"), + "a {\ + \n b: oklch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.5 0.5 0.5), oklch)}\n"), + "a {\ + \n b: oklch(79.6276375075% 0.0242958385 29.0514068282deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.2 0.4 0.8), oklch)}\n"), + "a {\ + \n b: oklch(70.8952946273% 0.2657680341 200.9146648791deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 none), oklch)}\n"), + "a {\ + \n b: oklch(56.6867659008% 0.2192447453 136.539820405deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 none 0.3), oklch)}\n"), + "a {\ + \n b: oklch(26.3423259569% 0.4568648354 323.7012836228deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz none 0.2 0.3), oklch)}\n"), + "a {\ + \n b: oklch(52.699430823% 0.4939251868 184.7577843583deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -999999 0 0), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz -999998.9999999985 -0.0000000001 -0.0000000012) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -1 0.4 2), oklch)}\n"), + "a {\ + \n b: oklch(38.0019911648% 3.2598314045 185.8352487879deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 1 1 1), oklch)}\n"), + "a {\ + \n b: color-mix(in oklch, color(xyz 1 1 1) 100%, black);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/xyz/prophoto_rgb.rs new file mode 100644 index 000000000..c00e3bdcf --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz/prophoto_rgb.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.4), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2194696613 0.4617099795 0.489000517 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2194696613 0.4617099795 0.489000517 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0 0 0), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.5 0.5 0.5), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.7095939166 0.6699021515 0.6489253277);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.2 0.4 0.8), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2936039607 0.6811658686 0.8421802859);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 none), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2715690946 0.4564221473 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 none 0.3), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2931451274 none 0.4853966387);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz none 0.2 0.3), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb none 0.5136422936 0.49010255);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -999999 0 0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -2600.5460588084 1508.1151466205 177.670007881);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -1 0.4 2), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb -1.340921335 1.0822677288 1.4036262654);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 1 1 1), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 1.0429146548 0.9845782985 0.953747937);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz/rec2020.rs b/rsass/tests/spec/core_functions/color/to_space/xyz/rec2020.rs new file mode 100644 index 000000000..754c51a68 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz/rec2020.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.4), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.1079117715 0.501698873 0.516462928 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.0), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.1079117715 0.501698873 0.516462928 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0 0 0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.5 0.5 0.5), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.7433125628 0.6928455465 0.6746511829);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.2 0.4 0.8), rec2020)}\n"), + "a {\ + \n b: color(rec2020 -0.0073399546 0.7239127682 0.8607584595);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 none), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.2916789955 0.496779191 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 none 0.3), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.2830292386 none 0.5249837189);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz none 0.2 0.3), rec2020)}\n"), + "a {\ + \n b: color(rec2020 none 0.5663964614 0.5146878151);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -999999 0 0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 -702.5226404146 458.9706861542 -89.4449238228);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -1 0.4 2), rec2020)}\n"), + "a {\ + \n b: color(rec2020 -1.5202475993 1.156770634 1.350426083);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 1 1 1), rec2020)}\n"), + "a {\ + \n b: color(rec2020 1.0517415202 0.9828015442 0.9579473111);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz/rgb.rs b/rsass/tests/spec/core_functions/color/to_space/xyz/rgb.rs new file mode 100644 index 000000000..b4fb3194c --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz/rgb.rs @@ -0,0 +1,143 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.4), rgb)}\n"), + "a {\ + \n b: hsla(179.5022543706, 556.250481638%, 8.7700702541%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.0), rgb)}\n"), + "a {\ + \n b: hsla(179.5022543706, 556.250481638%, 8.7700702541%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0 0 0), rgb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.5 0.5 0.5), rgb)}\n"), + "a {\ + \n b: rgb(203.7983708613, 183.1053603906, 179.6277580244);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.2 0.4 0.8), rgb)}\n"), + "a {\ + \n b: hsl(183.9973689591, 600.9357681928%, 12.7508937669%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 none), rgb)}\n"), + "a {\ + \n b: rgb(34.7719641116, 143.8523181031, 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 none 0.3), rgb)}\n"), + "a {\ + \n b: rgb(115.9585352591, 0, 153.8940640627);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz none 0.2 0.3), rgb)}\n"), + "a {\ + \n b: rgb(0, 167.2399746676, 143.3849194416);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -999999 0 0), rgb)}\n"), + "a {\ + \n b: hsl(330.5196564153, 405.9398117154%, -10761.9459979264%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -1 0.4 2), rgb)}\n"), + "a {\ + \n b: hsl(0.951270101, 523.3395920082%, -31.8043324514%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 1 1 1), rgb)}\n"), + "a {\ + \n b: hsl(188.6326376323, 287.948753728%, 102.1970070346%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz/srgb.rs b/rsass/tests/spec/core_functions/color/to_space/xyz/srgb.rs new file mode 100644 index 000000000..768bd40a4 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz/srgb.rs @@ -0,0 +1,143 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.4), srgb)}\n"), + "a {\ + \n b: color(srgb -0.4001348777 0.5755362828 0.5674423486 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.0), srgb)}\n"), + "a {\ + \n b: color(srgb -0.4001348777 0.5755362828 0.5674423486 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0 0 0), srgb)}\n"), + "a {\ + \n b: color(srgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.5 0.5 0.5), srgb)}\n"), + "a {\ + \n b: color(srgb 0.7992092975 0.7180602368 0.7044225805);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.2 0.4 0.8), srgb)}\n"), + "a {\ + \n b: color(srgb -0.6387378764 0.7916567108 0.8937557518);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 none), srgb)}\n"), + "a {\ + \n b: color(srgb 0.1363606436 0.5641267377 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 none 0.3), srgb)}\n"), + "a {\ + \n b: color(srgb 0.454739354 none 0.6035061336);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz none 0.2 0.3), srgb)}\n"), + "a {\ + \n b: color(srgb none 0.6558430379 0.5622938017);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -999999 0 0), srgb)}\n"), + "a {\ + \n b: color(srgb -544.4896931882 329.2507732297 -100.0520460013);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -1 0.4 2), srgb)}\n"), + "a {\ + \n b: color(srgb -1.9824899614 1.2936253684 1.3464033124);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 1 1 1), srgb)}\n"), + "a {\ + \n b: color(srgb 1.0852326141 0.9769116138 0.9587075266);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz/srgb_linear.rs b/rsass/tests/spec/core_functions/color/to_space/xyz/srgb_linear.rs new file mode 100644 index 000000000..4b6d944ed --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz/srgb_linear.rs @@ -0,0 +1,155 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.4), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.1329628694 0.2907356539 0.2818590705 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.1329628694 0.2907356539 0.2818590705 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0 0 0), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.5 0.5 0.5), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0.602488002 0.4741394613 0.4543123175);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.2 0.4 0.8), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear -0.3656478909 0.5897823193 0.7751124438);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 none), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.0166203587 0.2782691367 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 none 0.3), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.1745137661 none 0.3226544622);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz none 0.2 0.3), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear none 0.3876600175 0.2762960625);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -999999 0 0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -3240966.700934579 969242.6670372436 -55630.0240669139);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -1 0.4 2), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear -4.8531447335 1.8027407517 1.9767221652);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 1 1 1), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 1.204976004 0.9482789226 0.9086246351);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz/xyz.rs b/rsass/tests/spec/core_functions/color/to_space/xyz/xyz.rs new file mode 100644 index 000000000..dd30da4b7 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz/xyz.rs @@ -0,0 +1,67 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +#[test] +#[ignore] // unexepected error +fn in_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.2 0.4 0.8), xyz)}\n"), + "a {\ + \n b: color(xyz 0.2 0.4 0.8);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 none), xyz)}\n"), + "a {\ + \n b: color(xyz 0.1 0.2 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 none 0.3), xyz)}\n"), + "a {\ + \n b: color(xyz 0.1 none 0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz none 0.2 0.3), xyz)}\n"), + "a {\ + \n b: color(xyz none 0.2 0.3);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -1 0.4 2), xyz)}\n"), + "a {\ + \n b: color(xyz -1 0.4 2);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz/xyz_d50.rs b/rsass/tests/spec/core_functions/color/to_space/xyz/xyz_d50.rs new file mode 100644 index 000000000..2c2441db1 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz/xyz_d50.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.4), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0943246735 0.1959275265 0.2276490187 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 0.3 / 0.0), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.0943246735 0.1959275265 0.2276490187 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0 0 0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.5 0.5 0.5), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.5103421984 0.5014942182 0.3788432161);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.2 0.4 0.8), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.1786108937 0.3884402932 0.6056728936);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 0.2 none), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.1093823534 0.2010496662 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 0.1 none 0.3), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.0897352994 none 0.2246379804);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz none 0.2 0.3), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 none 0.1929647456 0.2285733227);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -999999 0 0), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 -1047928.744615204 -29627.7791422469 9243.0314031639);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz -1 0.4 2), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 -1.1391355769 0.3323983638 1.5190136801);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz 1 1 1), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 1.0206843969 1.0029884365 0.7576864323);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz_d50/mod.rs b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/mod.rs new file mode 100644 index 000000000..b2ae9a3d8 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/mod.rs @@ -0,0 +1,8 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz_d50" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/a98_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/a98_rgb.rs new file mode 100644 index 000000000..b3dbf87f3 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/a98_rgb.rs @@ -0,0 +1,73 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz_d50/xyz-d50/a98_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("a98_rgb") +} + +#[test] +#[ignore] // unexepected error +fn in_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.2 0.4 0.8), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.4 0.8);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 none), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.1 0.2 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 none 0.3), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.1 none 0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 none 0.2 0.3), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 none 0.2 0.3);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn out_of_range() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -1 0.4 2), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 -1 0.4 2);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/display_p3.rs b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/display_p3.rs new file mode 100644 index 000000000..a73db4cb6 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/display_p3.rs @@ -0,0 +1,159 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz_d50/xyz-d50/display_p3.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("display_p3") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.4), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -0.3072826123 0.5660777225 0.6401555397 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -0.3072826123 0.5660777225 0.6401555397 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0 0 0), display-p3)}\n"), + "a {\ + \n b: color(display-p3 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.5 0.5 0.5), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.7406962751 0.7263052903 0.8049433314);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.2 0.4 0.8), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -0.520302433 0.7760128678 0.9954240218);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 none), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.2276620199 0.5616123537 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 none 0.3), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 0.3827670965 none 0.655277932);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 none 0.2 0.3), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 none 0.637912978 0.6363418884);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -999999 0 0), display-p3)}\n" + ), + "a {\ + \n b: color(display-p3 -480.7511485906 310.5370514577 -94.2421709039);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -1 0.4 2), display-p3)}\n"), + "a {\ + \n b: color(display-p3 -1.7430526394 1.2261981059 1.4801698042);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 1 1 1), display-p3)}\n"), + "a {\ + \n b: color(display-p3 1.0071270999 0.9879174398 1.092886631);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/hsl.rs b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/hsl.rs new file mode 100644 index 000000000..c616c6ae6 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/hsl.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz_d50/xyz-d50/hsl.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hsl") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.4), hsl)}\n" + ), + "a {\ + \n b: hsla(184.0103843189, 495.2078632431%, 10.9589006248%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.0), hsl)}\n" + ), + "a {\ + \n b: hsla(184.0103843189, 495.2078632431%, 10.9589006248%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0 0 0), hsl)}\n"), + "a {\ + \n b: hsl(0, 0%, 0%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.5 0.5 0.5), hsl)}\n"), + "a {\ + \n b: hsl(252.6622302958, 18.6415390171%, 76.8792521782%);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.2 0.4 0.8), hsl)}\n"), + "a {\ + \n b: hsl(187.9353554297, 490.1229331153%, 17.2918334784%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 none), hsl)}\n"), + "a {\ + \n b: hsl(111.1172729557, 222.5792269318%, 17.6906141138%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 none 0.3), hsl)}\n"), + "a {\ + \n b: hsl(285.6927471827, 282.9980963007%, 17.9207568387%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 none 0.2 0.3), hsl)}\n"), + "a {\ + \n b: hsl(359.4153454139, 2475.3715741602%, -2.7790249918%);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -999999 0 0), hsl)}\n"), + "a {\ + \n b: hsl(329.431996419, 420.4439814741%, -10316.9080915762%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -1 0.4 2), hsl)}\n"), + "a {\ + \n b: hsl(3.9698519642, 796.3834139233%, -21.9385057601%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 1 1 1), hsl)}\n"), + "a {\ + \n b: hsl(72.6622302958, 128.9066481357%, 104.4631089642%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/hwb.rs b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/hwb.rs new file mode 100644 index 000000000..8d7ad45f3 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/hwb.rs @@ -0,0 +1,194 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz_d50/xyz-d50/hwb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hwb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.4), hwb));\n" + ), + "a {\ + \n value: hsla(184.0103843189, 495.2078632431%, 10.9589006248%, 0.4);\ + \n space: hwb;\ + \n channels: 184.0103843189deg -43.310436994% 34.7717617565% / 0.4;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.0), hwb));\n" + ), + "a {\ + \n value: hsla(184.0103843189, 495.2078632431%, 10.9589006248%, 0);\ + \n space: hwb;\ + \n channels: 184.0103843189deg -43.310436994% 34.7717617565% / 0;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz-d50 0 0 0), hwb));\n" + ), + "a {\ + \n value: black;\ + \n space: hwb;\ + \n channels: 0deg 0% 100% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz-d50 0.5 0.5 0.5), hwb));\n" + ), + "a {\ + \n value: hsl(252.6622302958, 18.6415390171%, 76.8792521782%);\ + \n space: hwb;\ + \n channels: 252.6622302958deg 72.569188952% 18.8106845955% / 1;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz-d50 0.2 0.4 0.8), hwb));\n" + ), + "a {\ + \n value: hsl(187.9353554297, 490.1229331153%, 17.2918334784%);\ + \n space: hwb;\ + \n channels: 187.9353554297deg -67.4594079552% -2.043074912% / 1;\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 none), hwb)}\n"), + "a {\ + \n b: hsl(111.1172729557, 222.5792269318%, 17.6906141138%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz-d50 0.1 none 0.3), hwb));\n" + ), + "a {\ + \n value: hsl(285.6927471827, 282.9980963007%, 17.9207568387%);\ + \n space: hwb;\ + \n channels: 285.6927471827deg -32.7946438576% 31.363842465% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz-d50 none 0.2 0.3), hwb));\n" + ), + "a {\ + \n value: hsl(359.4153454139, 2475.3715741602%, -2.7790249918%);\ + \n space: hwb;\ + \n channels: 179.4153454139deg -71.5702196777% 33.9878303059% / 1;\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz-d50 -999999 0 0), hwb));\n" + ), + "a {\ + \n value: hsl(329.431996419, 420.4439814741%, -10316.9080915763%);\ + \n space: hwb;\ + \n channels: 149.431996419deg -53693.7272368212% -32959.9110536687% / 1;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz-d50 -1 0.4 2), hwb));\n" + ), + "a {\ + \n value: hsl(3.9698519642, 796.3834139233%, -21.9385057601%);\ + \n space: hwb;\ + \n channels: 183.9698519642deg -196.6531268961% -52.7761153759% / 1;\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \n@use \'core_functions/color/utils\';\ + \n@include utils.inspect(color.to-space(color(xyz-d50 1 1 1), hwb));\n" + ), + "a {\ + \n value: hsl(72.6622302958, 128.9066481357%, 104.4631089642%);\ + \n space: hwb;\ + \n channels: 252.6622302958deg 98.7098647958% -10.2163531326% / 1;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/lab.rs b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/lab.rs new file mode 100644 index 000000000..c4dc5467a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/lab.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz_d50/xyz-d50/lab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.4), lab)}\n" + ), + "a {\ + \n b: lab(51.8372115265% -57.4926250406 -25.7864288134 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.0), lab)}\n" + ), + "a {\ + \n b: lab(51.8372115265% -57.4926250406 -25.7864288134 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0 0 0), lab)}\n"), + "a {\ + \n b: lab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.5 0.5 0.5), lab)}\n"), + "a {\ + \n b: lab(76.0692610142% 4.8387310772 -10.505341671);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.2 0.4 0.8), lab)}\n"), + "a {\ + \n b: lab(69.4695307685% -72.4361685024 -50.5894155557);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 none), lab)}\n"), + "a {\ + \n b: lab(51.8372115265% -57.4926250406 89.374502632);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 none 0.3), lab)}\n"), + "a {\ + \n b: lab(0% 165.9436315393 -115.1609314454);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 none 0.2 0.3), lab)}\n"), + "a {\ + \n b: lab(51.8372115265% -223.4362565799 -25.7864288134);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -999999 0 0), lab)}\n"), + "a {\ + \n b: lab(0% -4037677156.674863 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -1 0.4 2), lab)}\n"), + "a {\ + \n b: lab(69.4695307685% -4337.1188269787 -121.2991404532);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 1 1 1), lab)}\n"), + "a {\ + \n b: lab(100% 6.096419139 -13.2359011077);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/lch.rs b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/lch.rs new file mode 100644 index 000000000..32c15e028 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/lch.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz_d50/xyz-d50/lch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.4), lch)}\n" + ), + "a {\ + \n b: lch(51.8372115265% 63.0106486636 204.1570528501deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.0), lch)}\n" + ), + "a {\ + \n b: lch(51.8372115265% 63.0106486636 204.1570528501deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0 0 0), lch)}\n"), + "a {\ + \n b: lch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.5 0.5 0.5), lch)}\n"), + "a {\ + \n b: lch(76.0692610142% 11.5661368686 294.7306655583deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.2 0.4 0.8), lch)}\n"), + "a {\ + \n b: lch(69.4695307685% 88.3531973025 214.9304458642deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 none), lch)}\n"), + "a {\ + \n b: lch(51.8372115265% 106.2694860003 122.7522732424deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 none 0.3), lch)}\n"), + "a {\ + \n b: lch(0% 201.988437738 325.2402722247deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 none 0.2 0.3), lch)}\n"), + "a {\ + \n b: lch(51.8372115265% 224.9193203471 186.5832915139deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -999999 0 0), lch)}\n"), + "a {\ + \n b: lch(0% 4037677156.674863 180deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -1 0.4 2), lch)}\n"), + "a {\ + \n b: lch(69.4695307685% 4338.814723033 181.6020122751deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 1 1 1), lch)}\n"), + "a {\ + \n b: lch(100% 14.5724193067 294.7306655583deg);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/mod.rs b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/mod.rs new file mode 100644 index 000000000..7022adec7 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/mod.rs @@ -0,0 +1,36 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz_d50/xyz-d50" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz-d50") +} + +mod a98_rgb; + +mod display_p3; + +mod hsl; + +mod hwb; + +mod lab; + +mod lch; + +mod oklab; + +mod oklch; + +mod prophoto_rgb; + +mod rec2020; + +mod rgb; + +mod srgb; + +mod srgb_linear; + +mod xyz; + +mod xyz_d50; diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/oklab.rs b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/oklab.rs new file mode 100644 index 000000000..b76915431 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/oklab.rs @@ -0,0 +1,151 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz_d50/xyz-d50/oklab.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklab") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.4), oklab)}\n" + ), + "a {\ + \n b: oklab(56.9970926622% -0.1786682028 -0.0706832596 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.0), oklab)}\n" + ), + "a {\ + \n b: oklab(56.9970926622% -0.1786682028 -0.0706832596 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0 0 0), oklab)}\n"), + "a {\ + \n b: oklab(0% 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.5 0.5 0.5), oklab)}\n"), + "a {\ + \n b: oklab(79.6577658839% 0.0133226724 -0.0281100387);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.2 0.4 0.8), oklab)}\n"), + "a {\ + \n b: oklab(71.9979200541% -0.2538804764 -0.1411846084);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 none), oklab)}\n"), + "a {\ + \n b: oklab(56.4114760121% -0.1759135151 0.1541840121);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 none 0.3), oklab)}\n"), + "a {\ + \n b: oklab(29.1994683846% 0.3079984165 -0.2894921466);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 none 0.2 0.3), oklab)}\n"), + "a {\ + \n b: oklab(53.737032336% -0.4814823965 -0.0723240631);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -999999 0 0), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz -955472.4660146529 28369.6809641542 -12314.0025504671) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -1 0.4 2), oklab)}\n"), + "a {\ + \n b: oklab(42.8855772157% -3.2722752803 -0.3756610558);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 1 1 1), oklab)}\n" + ), + "a {\ + \n b: color-mix(in oklab, color(xyz 0.9956342097 1.0026671299 1.3221722918) 100%, black);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/oklch.rs b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/oklch.rs new file mode 100644 index 000000000..f19cc2421 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/oklch.rs @@ -0,0 +1,151 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz_d50/xyz-d50/oklch.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("oklch") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.4), oklch)}\n" + ), + "a {\ + \n b: oklch(56.9970926622% 0.1921417442 201.5843389185deg / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.0), oklch)}\n" + ), + "a {\ + \n b: oklch(56.9970926622% 0.1921417442 201.5843389185deg / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0 0 0), oklch)}\n"), + "a {\ + \n b: oklch(0% 0 none);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.5 0.5 0.5), oklch)}\n"), + "a {\ + \n b: oklch(79.6577658839% 0.0311073605 295.3584786053deg);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.2 0.4 0.8), oklch)}\n"), + "a {\ + \n b: oklch(71.9979200541% 0.2904967986 209.0787246058deg);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 none), oklch)}\n"), + "a {\ + \n b: oklch(56.4114760121% 0.2339193759 138.7662056048deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 none 0.3), oklch)}\n"), + "a {\ + \n b: oklch(29.1994683846% 0.4226922374 316.7740736717deg);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 none 0.2 0.3), oklch)}\n"), + "a {\ + \n b: oklch(53.737032336% 0.4868840398 188.5426015282deg);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -999999 0 0), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz -955472.4660146533 28369.6809641542 -12314.0025504659) 100%, black);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -1 0.4 2), oklch)}\n"), + "a {\ + \n b: oklch(42.8855772157% 3.2937678635 186.548953155deg);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 1 1 1), oklch)}\n" + ), + "a {\ + \n b: color-mix(in oklch, color(xyz 0.9956342097 1.0026671299 1.3221722918) 100%, black);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/prophoto_rgb.rs b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/prophoto_rgb.rs new file mode 100644 index 000000000..356a69342 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/prophoto_rgb.rs @@ -0,0 +1,161 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz_d50/xyz-d50/prophoto_rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("prophoto_rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.4), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2248370109 0.4663680632 0.5700273474 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.2248370109 0.4663680632 0.5700273474 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0 0 0), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.5 0.5 0.5), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.6950534384 0.6743803795 0.7570856195);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.2 0.4 0.8), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.3164433223 0.688517143 0.9829806921);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 none), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.251671286 0.4600356682 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 none 0.3), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb 0.3068439327 none 0.5700273474);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 none 0.2 0.3), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb none 0.5196499466 0.5700273474);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -999999 0 0), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -2540.8942289653 1537.1744596752 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -1 0.4 2), prophoto-rgb)}\n" + ), + "a {\ + \n b: color(prophoto-rgb -1.2757747112 1.1009423845 1.6353953931);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 1 1 1), prophoto-rgb)}\n"), + "a {\ + \n b: color(prophoto-rgb 1.0215440123 0.9911601047 1.1127148486);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/rec2020.rs b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/rec2020.rs new file mode 100644 index 000000000..f7945fb35 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/rec2020.rs @@ -0,0 +1,153 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz_d50/xyz-d50/rec2020.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rec2020") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.4), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.0683739868 0.5055777091 0.6004180325 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.0), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.0683739868 0.5055777091 0.6004180325 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0 0 0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.5 0.5 0.5), rec2020)}\n"), + "a {\ + \n b: color(rec2020 0.7117581507 0.6973714052 0.7808630758);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.2 0.4 0.8), rec2020)}\n"), + "a {\ + \n b: color(rec2020 -0.075615701 0.7287813238 0.9918551161);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 none), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.2651201665 0.5016141545 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 none 0.3), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 0.2799117622 none 0.6111315018);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 none 0.2 0.3), rec2020)}\n" + ), + "a {\ + \n b: color(rec2020 none 0.57127065 0.5978630317);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -999999 0 0), rec2020)}\n"), + "a {\ + \n b: color(rec2020 -689.5826182995 463.8899975273 -113.049587293);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -1 0.4 2), rec2020)}\n"), + "a {\ + \n b: color(rec2020 -1.4925160884 1.1662135588 1.5466705118);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 1 1 1), rec2020)}\n"), + "a {\ + \n b: color(rec2020 1.0086369229 0.9889840495 1.1030370326);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/rgb.rs b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/rgb.rs new file mode 100644 index 000000000..aec03d32d --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/rgb.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz_d50/xyz-d50/rgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("rgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.4), rgb)}\n" + ), + "a {\ + \n b: hsla(184.0103843189, 495.2078632431%, 10.9589006248%, 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.0), rgb)}\n" + ), + "a {\ + \n b: hsla(184.0103843189, 495.2078632431%, 10.9589006248%, 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0 0 0), rgb)}\n"), + "a {\ + \n b: black;\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.5 0.5 0.5), rgb)}\n"), + "a {\ + \n b: rgb(189.6903079461, 185.0514318275, 207.0327542814);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.2 0.4 0.8), rgb)}\n"), + "a {\ + \n b: hsl(187.9353554297, 490.1229331153%, 17.2918334784%);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 none), rgb)}\n"), + "a {\ + \n b: hsl(128.9663541465, 142.6286256266%, 23.5199973212%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 none 0.3), rgb)}\n"), + "a {\ + \n b: rgb(113.3463666573, 0, 175.0222017144);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 none 0.2 0.3), rgb)}\n"), + "a {\ + \n b: rgb(0, 168.3310327198, 164.9124102862);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -999999 0 0), rgb)}\n"), + "a {\ + \n b: hsl(329.431996419, 420.4439814741%, -10316.9080915762%);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -1 0.4 2), rgb)}\n"), + "a {\ + \n b: hsl(3.9698519642, 796.3834139233%, -21.9385057601%);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 1 1 1), rgb)}\n"), + "a {\ + \n b: hsl(72.6622302958, 128.9066481357%, 104.4631089642%);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/srgb.rs b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/srgb.rs new file mode 100644 index 000000000..2f64b312a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/srgb.rs @@ -0,0 +1,147 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz_d50/xyz-d50/srgb.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.4), srgb)}\n" + ), + "a {\ + \n b: color(srgb -0.4331043699 0.5797354156 0.6522823824 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.0), srgb)}\n" + ), + "a {\ + \n b: color(srgb -0.4331043699 0.5797354156 0.6522823824 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0 0 0), srgb)}\n"), + "a {\ + \n b: color(srgb 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.5 0.5 0.5), srgb)}\n"), + "a {\ + \n b: color(srgb 0.7438835606 0.7256918895 0.811893154);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.2 0.4 0.8), srgb)}\n"), + "a {\ + \n b: color(srgb -0.6745940796 0.7962536745 1.0204307491);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 none), srgb)}\n"), + "a {\ + \n b: color(srgb -0.1002625161 0.5706624625 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 none 0.3), srgb)}\n"), + "a {\ + \n b: color(srgb 0.4444955555 none 0.6863615754);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 none 0.2 0.3), srgb)}\n"), + "a {\ + \n b: color(srgb none 0.6601216969 0.6467153345);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -999999 0 0), srgb)}\n"), + "a {\ + \n b: color(srgb -536.9372723682 330.5991105367 -111.3818104512);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -1 0.4 2), srgb)}\n"), + "a {\ + \n b: color(srgb -1.966531269 1.2965640931 1.5277611538);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 1 1 1), srgb)}\n"), + "a {\ + \n b: color(srgb 1.0113816155 0.987098648 1.1021635313);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/srgb_linear.rs b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/srgb_linear.rs new file mode 100644 index 000000000..f7844edb1 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/srgb_linear.rs @@ -0,0 +1,161 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz_d50/xyz-d50/srgb_linear.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("srgb_linear") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.4), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.1572622797 0.2954041898 0.3830159978 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.1572622797 0.2954041898 0.3830159978 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0 0 0), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.5 0.5 0.5), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.5130438185 0.4854508871 0.6241823339);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.2 0.4 0.8), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.412657003 0.5974969544 1.0471092027);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 none), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -0.0100636143 0.2853713278 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 none 0.3), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear 0.1662149199 none 0.4288113498);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 none 0.2 0.3), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear none 0.3932837375 0.3758204586);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -999999 0 0), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -3134132.718764265 978794.4977603011 -71955.3206025548);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -1 0.4 2), srgb-linear)}\n" + ), + "a {\ + \n b: color(srgb-linear -4.7624146879 1.8121829743 2.6472259737);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 1 1 1), srgb-linear)}\n"), + "a {\ + \n b: color(srgb-linear 1.026087637 0.9709017742 1.2483646679);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/xyz.rs b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/xyz.rs new file mode 100644 index 000000000..27b2550a8 --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/xyz.rs @@ -0,0 +1,149 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz_d50/xyz-d50/xyz.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.4), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.1099054241 0.205474541 0.3962396495 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.0), xyz)}\n" + ), + "a {\ + \n b: color(xyz 0.1099054241 0.205474541 0.3962396495 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0 0 0), xyz)}\n"), + "a {\ + \n b: color(xyz 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.5 0.5 0.5), xyz)}\n"), + "a {\ + \n b: color(xyz 0.4978171049 0.501333565 0.6610861459);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.2 0.4 0.8), xyz)}\n"), + "a {\ + \n b: color(xyz 0.2324626969 0.4151573703 1.0585524842);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 none), xyz)}\n"), + "a {\ + \n b: color(xyz 0.0909276512 0.1991621087 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 none 0.3), xyz)}\n"), + "a {\ + \n b: color(xyz 0.1145251151 none 0.4003411794);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 none 0.2 0.3), xyz)}\n"), + "a {\ + \n b: color(xyz none 0.208311512 0.395008248);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -999999 0 0), xyz)}\n" + ), + "a {\ + \n b: color(xyz -955472.4660146538 28369.6809641542 -12314.0025504671);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -1 0.4 2), xyz)}\n"), + "a {\ + \n b: color(xyz -0.8381943171 0.474450751 2.6402147779);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 1 1 1), xyz)}\n"), + "a {\ + \n b: color(xyz 0.9956342097 1.0026671299 1.3221722918);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/xyz_d50.rs b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/xyz_d50.rs new file mode 100644 index 000000000..ebad36c8a --- /dev/null +++ b/rsass/tests/spec/core_functions/color/to_space/xyz_d50/xyz_d50/xyz_d50.rs @@ -0,0 +1,153 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/color/to_space/xyz_d50/xyz-d50/xyz_d50.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("xyz_d50") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn partial() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.4), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.1 0.2 0.3 / 0.4);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn transparent() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 0.3 / 0.0), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.1 0.2 0.3 / 0);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn black() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0 0 0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0 0 0);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn gray() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.5 0.5 0.5), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.5 0.5 0.5);\ + \n}\n" + ); +} +#[test] +#[ignore] // unexepected error +fn middle() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.2 0.4 0.8), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 0.2 0.4 0.8);\ + \n}\n" + ); +} +mod missing { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn blue() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 0.2 none), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.1 0.2 none);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn green() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 0.1 none 0.3), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 0.1 none 0.3);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn red() { + assert_eq!( + runner().ok( + "@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 none 0.2 0.3), xyz-d50)}\n" + ), + "a {\ + \n b: color(xyz-d50 none 0.2 0.3);\ + \n}\n" + ); + } +} +mod out_of_range { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn far() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -999999 0 0), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 -999999 0 0);\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn near() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 -1 0.4 2), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 -1 0.4 2);\ + \n}\n" + ); + } +} +#[test] +#[ignore] // unexepected error +fn white() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.to-space(color(xyz-d50 1 1 1), xyz-d50)}\n"), + "a {\ + \n b: color(xyz-d50 1 1 1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/color/whiteness.rs b/rsass/tests/spec/core_functions/color/whiteness.rs index 43503036b..6c7f82ff0 100644 --- a/rsass/tests/spec/core_functions/color/whiteness.rs +++ b/rsass/tests/spec/core_functions/color/whiteness.rs @@ -9,11 +9,27 @@ mod error { #[allow(unused)] use super::runner; + #[test] + #[ignore] // wrong error + fn non_legacy() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ + \na {b: color.whiteness(color(srgb 1 1 1))}\n" + ), + "Error: color.whiteness() is only supported for legacy colors. Please use color.channel() instead with an explicit $space argument.\ + \n ,\ + \n2 | a {b: color.whiteness(color(srgb 1 1 1))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } #[test] fn too_few_args() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.whiteness()}\n" ), "Error: Missing argument $color.\ @@ -32,7 +48,7 @@ mod error { fn too_many_args() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.whiteness(red, green)}\n" ), "Error: Only 1 argument allowed, but 2 were passed.\ @@ -51,7 +67,7 @@ mod error { fn test_type() { assert_eq!( runner().err( - "@use \'sass:color\';\ + "@use \"sass:color\";\ \na {b: color.whiteness(1)}\n" ), "Error: $color: 1 is not a color.\ @@ -64,19 +80,20 @@ mod error { } } #[test] +#[ignore] // wrong result fn fraction() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.whiteness(color.hwb(0, 0.5%, 0%))}\n"), "a {\ - \n b: 0.3921568627%;\ + \n b: 0.5%;\ \n}\n" ); } #[test] fn max() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.whiteness(white)}\n"), "a {\ \n b: 100%;\ @@ -88,32 +105,35 @@ mod middle { use super::runner; #[test] + #[ignore] // wrong result fn half_blackness() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.whiteness(color.hwb(0, 50%, 50%))}\n"), "a {\ - \n b: 50.1960784314%;\ + \n b: 50%;\ \n}\n" ); } #[test] + #[ignore] // wrong result fn high_blackness() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.whiteness(color.hwb(0, 70%, 70%))}\n"), "a {\ - \n b: 50.1960784314%;\ + \n b: 50%;\ \n}\n" ); } #[test] + #[ignore] // wrong result fn zero_blackness() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.whiteness(color.hwb(0, 50%, 0%))}\n"), "a {\ - \n b: 50.1960784314%;\ + \n b: 50%;\ \n}\n" ); } @@ -121,7 +141,7 @@ mod middle { #[test] fn min() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.whiteness(black)}\n"), "a {\ \n b: 0%;\ @@ -129,12 +149,13 @@ fn min() { ); } #[test] +#[ignore] // wrong result fn named() { assert_eq!( - runner().ok("@use \'sass:color\';\ + runner().ok("@use \"sass:color\";\ \na {b: color.whiteness($color: color.hwb(0, 42%, 0%))}\n"), "a {\ - \n b: 41.9607843137%;\ + \n b: 42%;\ \n}\n" ); } diff --git a/rsass/tests/spec/core_functions/modules/general.rs b/rsass/tests/spec/core_functions/general.rs similarity index 98% rename from rsass/tests/spec/core_functions/modules/general.rs rename to rsass/tests/spec/core_functions/general.rs index eaa74ecfc..a94061c59 100644 --- a/rsass/tests/spec/core_functions/modules/general.rs +++ b/rsass/tests/spec/core_functions/general.rs @@ -1,4 +1,4 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/modules/general.hrx" +//! Tests auto-converted from "sass-spec/spec/core_functions/general.hrx" #[allow(unused)] fn runner() -> crate::TestRunner { diff --git a/rsass/tests/spec/core_functions/global/color/alpha.rs b/rsass/tests/spec/core_functions/global/color/alpha.rs new file mode 100644 index 000000000..beacd5fa5 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/alpha.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/alpha.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("alpha") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("a {b: alpha(#abcdef)}\n"), + "a {\ + \n b: 1;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/blue.rs b/rsass/tests/spec/core_functions/global/color/blue.rs new file mode 100644 index 000000000..fdaf8c0d2 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/blue.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/blue.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("blue") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("a {b: blue(#abcdef)}\n"), + "a {\ + \n b: 239;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/change.rs b/rsass/tests/spec/core_functions/global/color/change.rs new file mode 100644 index 000000000..5ebd39f85 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/change.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/change.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("change") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("a {b: change-color(#abcdef, $red: 10)}\n"), + "a {\ + \n b: #0acdef;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/complement.rs b/rsass/tests/spec/core_functions/global/color/complement.rs new file mode 100644 index 000000000..c444fd112 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/complement.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/complement.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("complement") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("a {b: complement(#abcdef)}\n"), + "a {\ + \n b: #efcdab;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/darken.rs b/rsass/tests/spec/core_functions/global/color/darken.rs new file mode 100644 index 000000000..85d85eaa3 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/darken.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/darken.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("darken") +} + +#[test] +#[ignore] // wrong result +fn test() { + assert_eq!( + runner().ok("a {b: darken(#abcdef, 10%)}\n"), + "a {\ + \n b: rgb(128.16, 179.5, 230.84);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/desaturate.rs b/rsass/tests/spec/core_functions/global/color/desaturate.rs new file mode 100644 index 000000000..4df8e8dff --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/desaturate.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/desaturate.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("desaturate") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("a {b: desaturate(#abcdef, 10%)}\n"), + "a {\ + \n b: #b0cdea;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/error.rs b/rsass/tests/spec/core_functions/global/color/error.rs new file mode 100644 index 000000000..d528d20fe --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/error.rs @@ -0,0 +1,84 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/error.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("error") +} + +mod too_low { + #[allow(unused)] + use super::runner; + + #[test] + fn darken() { + assert_eq!( + runner().err("a {b: darken(red, -0.001)}\n"), + "Error: $amount: Expected -0.001 to be within 0 and 100.\ + \n ,\ + \n1 | a {b: darken(red, -0.001)}\ + \n | ^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + fn desaturate() { + assert_eq!( + runner().err("a {b: desaturate(red, -0.001)}\n"), + "Error: $amount: Expected -0.001 to be within 0 and 100.\ + \n ,\ + \n1 | a {b: desaturate(red, -0.001)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + fn fade_in() { + assert_eq!( + runner().err("a {b: fade-in(red, -0.001)}\n"), + "Error: $amount: Expected -0.001 to be within 0 and 1.\ + \n ,\ + \n1 | a {b: fade-in(red, -0.001)}\ + \n | ^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + fn fade_out() { + assert_eq!( + runner().err("a {b: fade-out(red, -0.001)}\n"), + "Error: $amount: Expected -0.001 to be within 0 and 1.\ + \n ,\ + \n1 | a {b: fade-out(red, -0.001)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + fn lighten() { + assert_eq!( + runner().err("a {b: lighten(red, -0.001)}\n"), + "Error: $amount: Expected -0.001 to be within 0 and 100.\ + \n ,\ + \n1 | a {b: lighten(red, -0.001)}\ + \n | ^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } + #[test] + fn saturate() { + assert_eq!( + runner().err("a {b: saturate(red, -0.001)}\n"), + "Error: $amount: Expected -0.001 to be within 0 and 100.\ + \n ,\ + \n1 | a {b: saturate(red, -0.001)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 1:7 root stylesheet", + ); + } +} diff --git a/rsass/tests/spec/core_functions/global/color/fade_in.rs b/rsass/tests/spec/core_functions/global/color/fade_in.rs new file mode 100644 index 000000000..e2caadc36 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/fade_in.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/fade-in.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("fade-in") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("a {b: fade-in(rgba(red, 0.5), 0.3)}\n"), + "a {\ + \n b: rgba(255, 0, 0, 0.8);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/fade_out.rs b/rsass/tests/spec/core_functions/global/color/fade_out.rs new file mode 100644 index 000000000..a645533e9 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/fade_out.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/fade-out.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("fade-out") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("a {b: fade-out(rgba(red, 0.5), 0.3)}\n"), + "a {\ + \n b: rgba(255, 0, 0, 0.2);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/grayscale.rs b/rsass/tests/spec/core_functions/global/color/grayscale.rs new file mode 100644 index 000000000..b9ed518bf --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/grayscale.rs @@ -0,0 +1,57 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/grayscale.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("grayscale") +} + +#[test] +fn with_calc() { + assert_eq!( + runner().ok("a {b: grayscale(calc(1 + 2))}\n"), + "a {\ + \n b: grayscale(3);\ + \n}\n" + ); +} +#[test] +#[ignore] // wrong result +fn with_color() { + assert_eq!( + runner().ok("a {b: grayscale(red)}\n"), + "a {\ + \n b: rgb(127.5, 127.5, 127.5);\ + \n}\n" + ); +} +#[test] +fn with_css_var() { + assert_eq!( + runner().ok("a {b: grayscale(var(--c))}\n"), + "a {\ + \n b: grayscale(var(--c));\ + \n}\n" + ); +} +#[test] +fn with_number() { + assert_eq!( + runner().ok( + "// A number should produce a plain function string, for CSS filter functions.\ + \na {b: grayscale(15%)}\n" + ), + "a {\ + \n b: grayscale(15%);\ + \n}\n" + ); +} +#[test] +fn with_unquoted_calc() { + assert_eq!( + runner().ok("@use \"sass:string\";\ + \na {b: grayscale(string.unquote(\'calc(1)\'))}\n"), + "a {\ + \n b: grayscale(calc(1));\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/green.rs b/rsass/tests/spec/core_functions/global/color/green.rs new file mode 100644 index 000000000..d0a0a7c18 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/green.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/green.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("green") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("a {b: green(#abcdef)}\n"), + "a {\ + \n b: 205;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/hue.rs b/rsass/tests/spec/core_functions/global/color/hue.rs new file mode 100644 index 000000000..84f058005 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/hue.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/hue.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hue") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("a {b: hue(#abcdef)}\n"), + "a {\ + \n b: 210deg;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/ie_hex_str.rs b/rsass/tests/spec/core_functions/global/color/ie_hex_str.rs new file mode 100644 index 000000000..fa3e89e2f --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/ie_hex_str.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/ie_hex_str.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("ie_hex_str") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("a {b: ie-hex-str(#abcdef)}\n"), + "a {\ + \n b: #FFABCDEF;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/invert.rs b/rsass/tests/spec/core_functions/global/color/invert.rs new file mode 100644 index 000000000..520fd72c1 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/invert.rs @@ -0,0 +1,53 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/invert.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("invert") +} + +#[test] +fn with_calc() { + assert_eq!( + runner().ok("a {b: invert(calc(1 + 2))}\n"), + "a {\ + \n b: invert(3);\ + \n}\n" + ); +} +#[test] +fn with_color() { + assert_eq!( + runner().ok("a {b: invert(#abcdef)}\n"), + "a {\ + \n b: #543210;\ + \n}\n" + ); +} +#[test] +fn with_css_var() { + assert_eq!( + runner().ok("a {b: invert(var(--c))}\n"), + "a {\ + \n b: invert(var(--c));\ + \n}\n" + ); +} +#[test] +fn with_number() { + assert_eq!( + runner().ok("a {b: invert(10%)}\n"), + "a {\ + \n b: invert(10%);\ + \n}\n" + ); +} +#[test] +fn with_unquoted_calc() { + assert_eq!( + runner().ok("@use \"sass:string\";\ + \na {b: invert(string.unquote(\'calc(1)\'))}\n"), + "a {\ + \n b: invert(calc(1));\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/lighten.rs b/rsass/tests/spec/core_functions/global/color/lighten.rs new file mode 100644 index 000000000..42e2e242d --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/lighten.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/lighten.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lighten") +} + +#[test] +#[ignore] // wrong result +fn test() { + assert_eq!( + runner().ok("a {b: lighten(#abcdef, 10%)}\n"), + "a {\ + \n b: rgb(213.84, 230.5, 247.16);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/lightness.rs b/rsass/tests/spec/core_functions/global/color/lightness.rs new file mode 100644 index 000000000..fc9524499 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/lightness.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/lightness.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lightness") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("a {b: lightness(#abcdef)}\n"), + "a {\ + \n b: 80.3921568627%;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/mix.rs b/rsass/tests/spec/core_functions/global/color/mix.rs new file mode 100644 index 000000000..12b5c8852 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/mix.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/mix.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("mix") +} + +#[test] +#[ignore] // wrong result +fn test() { + assert_eq!( + runner().ok("a {b: mix(#abcdef, #daddee)}\n"), + "a {\ + \n b: rgb(194.5, 213, 238.5);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/mod.rs b/rsass/tests/spec/core_functions/global/color/mod.rs new file mode 100644 index 000000000..10e84b505 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/mod.rs @@ -0,0 +1,54 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("color") +} + +mod alpha; + +mod blue; + +mod change; + +mod complement; + +mod darken; + +mod desaturate; + +mod error; + +mod fade_in; + +mod fade_out; + +mod grayscale; + +mod green; + +mod hue; + +mod ie_hex_str; + +mod invert; + +mod lighten; + +mod lightness; + +mod mix; + +mod opacify; + +mod opacity; + +mod red; + +mod saturate; + +mod saturation; + +mod scale; + +mod transparentize; diff --git a/rsass/tests/spec/core_functions/global/color/opacify.rs b/rsass/tests/spec/core_functions/global/color/opacify.rs new file mode 100644 index 000000000..8d35b799e --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/opacify.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/opacify.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("opacify") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("a {b: opacify(rgba(red, 0.5), 0.3)}\n"), + "a {\ + \n b: rgba(255, 0, 0, 0.8);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/opacity.rs b/rsass/tests/spec/core_functions/global/color/opacity.rs new file mode 100644 index 000000000..4b39254f2 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/opacity.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/opacity.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("opacity") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("a {b: opacity(#abcdef)}\n"), + "a {\ + \n b: 1;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/red.rs b/rsass/tests/spec/core_functions/global/color/red.rs new file mode 100644 index 000000000..6068b663f --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/red.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/red.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("red") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("a {b: red(#abcdef)}\n"), + "a {\ + \n b: 171;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/saturate.rs b/rsass/tests/spec/core_functions/global/color/saturate.rs new file mode 100644 index 000000000..99d90c23f --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/saturate.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/saturate.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("saturate") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("a {b: saturate(#abcdef, 10%)}\n"), + "a {\ + \n b: #a6cdf4;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/saturation.rs b/rsass/tests/spec/core_functions/global/color/saturation.rs new file mode 100644 index 000000000..ae16ff855 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/saturation.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/saturation.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("saturation") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("a {b: saturation(#abcdef)}\n"), + "a {\ + \n b: 68%;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/scale.rs b/rsass/tests/spec/core_functions/global/color/scale.rs new file mode 100644 index 000000000..bdb4f89c0 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/scale.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/scale.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("scale") +} + +#[test] +#[ignore] // wrong result +fn test() { + assert_eq!( + runner().ok("a {b: scale-color(#abcdef, $red: 10%)}\n"), + "a {\ + \n b: rgb(179.4, 205, 239);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/color/transparentize.rs b/rsass/tests/spec/core_functions/global/color/transparentize.rs new file mode 100644 index 000000000..0e96e50fe --- /dev/null +++ b/rsass/tests/spec/core_functions/global/color/transparentize.rs @@ -0,0 +1,16 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/color/transparentize.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("transparentize") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("a {b: transparentize(rgba(red, 0.5), 0.3)}\n"), + "a {\ + \n b: rgba(255, 0, 0, 0.2);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/list.rs b/rsass/tests/spec/core_functions/global/list.rs new file mode 100644 index 000000000..ef0e7c0e6 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/list.rs @@ -0,0 +1,88 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/list.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("list") +} + +#[test] +fn append() { + assert_eq!( + runner().ok("a {b: append(c d, e)}\n"), + "a {\ + \n b: c d e;\ + \n}\n" + ); +} +#[test] +fn index() { + assert_eq!( + runner().ok("a {b: index(a b c, b)}\n"), + "a {\ + \n b: 2;\ + \n}\n" + ); +} +#[test] +fn is_bracketed() { + assert_eq!( + runner().ok("a {b: is-bracketed(a b c)}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +fn join() { + assert_eq!( + runner().ok("a {b: join(c d, e f)}\n"), + "a {\ + \n b: c d e f;\ + \n}\n" + ); +} +#[test] +fn length() { + assert_eq!( + runner().ok("a {b: length(a b c)}\n"), + "a {\ + \n b: 3;\ + \n}\n" + ); +} +#[test] +fn list_separator() { + assert_eq!( + runner().ok("a {b: list-separator(a b c)}\n"), + "a {\ + \n b: space;\ + \n}\n" + ); +} +#[test] +fn nth() { + assert_eq!( + runner().ok("a {b: nth(a b c, 3)}\n"), + "a {\ + \n b: c;\ + \n}\n" + ); +} +#[test] +fn set_nth() { + assert_eq!( + runner().ok("a {b: set-nth(c d e, 2, f)}\n"), + "a {\ + \n b: c f e;\ + \n}\n" + ); +} +#[test] +fn zip() { + assert_eq!( + runner().ok("a {b: zip(1 2 3, c d e)}\n"), + "a {\ + \n b: 1 c, 2 d, 3 e;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/map.rs b/rsass/tests/spec/core_functions/global/map.rs new file mode 100644 index 000000000..b692c8ece --- /dev/null +++ b/rsass/tests/spec/core_functions/global/map.rs @@ -0,0 +1,63 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/map.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("map") +} + +#[test] +fn get() { + assert_eq!( + runner().ok("a {b: map-get((c: d), c)}\n"), + "a {\ + \n b: d;\ + \n}\n" + ); +} +#[test] +fn has_key() { + assert_eq!( + runner().ok("a {b: map-has-key((c: d), c)}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +fn keys() { + assert_eq!( + runner().ok("a {b: map-keys((c: d))}\n"), + "a {\ + \n b: c;\ + \n}\n" + ); +} +#[test] +fn merge() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \na {b: meta.inspect(map-merge((c: d), (e: f)))}\n"), + "a {\ + \n b: (c: d, e: f);\ + \n}\n" + ); +} +#[test] +fn remove() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \na {b: meta.inspect(map-remove((c: d), c))}\n"), + "a {\ + \n b: ();\ + \n}\n" + ); +} +#[test] +fn values() { + assert_eq!( + runner().ok("a {b: map-values((c: d))}\n"), + "a {\ + \n b: d;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/math.rs b/rsass/tests/spec/core_functions/global/math.rs new file mode 100644 index 000000000..eed02af0a --- /dev/null +++ b/rsass/tests/spec/core_functions/global/math.rs @@ -0,0 +1,106 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/math.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("math") +} + +#[test] +fn abs() { + assert_eq!( + runner().ok("a {b: abs(-1)}\n"), + "a {\ + \n b: 1;\ + \n}\n" + ); +} +#[test] +fn ceil() { + assert_eq!( + runner().ok("a {b: ceil(0.5)}\n"), + "a {\ + \n b: 1;\ + \n}\n" + ); +} +#[test] +fn comparable() { + assert_eq!( + runner().ok("a {b: comparable(1px, 1in)}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +fn floor() { + assert_eq!( + runner().ok("a {b: floor(0.5)}\n"), + "a {\ + \n b: 0;\ + \n}\n" + ); +} +#[test] +fn max() { + assert_eq!( + runner().ok("a {b: max(1, 2, 3)}\n"), + "a {\ + \n b: 3;\ + \n}\n" + ); +} +#[test] +fn min() { + assert_eq!( + runner().ok("a {b: min(1, 2, 3)}\n"), + "a {\ + \n b: 1;\ + \n}\n" + ); +} +#[test] +fn percentage() { + assert_eq!( + runner().ok("a {b: percentage(0.5)}\n"), + "a {\ + \n b: 50%;\ + \n}\n" + ); +} +#[test] +fn random() { + assert_eq!( + runner().ok("a {b: random(5) <= 5}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} +#[test] +fn round() { + assert_eq!( + runner().ok("a {b: round(0.5)}\n"), + "a {\ + \n b: 1;\ + \n}\n" + ); +} +#[test] +fn unit() { + assert_eq!( + runner().ok("a {b: unit(5px)}\n"), + "a {\ + \n b: \"px\";\ + \n}\n" + ); +} +#[test] +fn unitless() { + assert_eq!( + runner().ok("a {b: unitless(1)}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/modules/meta.rs b/rsass/tests/spec/core_functions/global/meta.rs similarity index 56% rename from rsass/tests/spec/core_functions/modules/meta.rs rename to rsass/tests/spec/core_functions/global/meta.rs index 56bc91ef3..2cfea5ede 100644 --- a/rsass/tests/spec/core_functions/modules/meta.rs +++ b/rsass/tests/spec/core_functions/global/meta.rs @@ -1,4 +1,4 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/modules/meta.hrx" +//! Tests auto-converted from "sass-spec/spec/core_functions/global/meta.hrx" #[allow(unused)] fn runner() -> crate::TestRunner { @@ -9,7 +9,7 @@ fn runner() -> crate::TestRunner { fn call() { assert_eq!( runner().ok("@use \"sass:meta\";\ - \na {b: meta.call(meta.get-function(\"rgb\"), 1, 2, 3)}\n"), + \na {b: call(meta.get-function(\"rgb\"), 1, 2, 3)}\n"), "a {\ \n b: rgb(1, 2, 3);\ \n}\n" @@ -18,9 +18,8 @@ fn call() { #[test] fn content_exists() { assert_eq!( - runner().ok("@use \"sass:meta\";\n\ - \n@mixin print-content-exists {\ - \n a {b: meta.content-exists()}\ + runner().ok("@mixin print-content-exists {\ + \n a {b: content-exists()}\ \n}\n\ \n@include print-content-exists;\n"), "a {\ @@ -31,8 +30,7 @@ fn content_exists() { #[test] fn feature_exists() { assert_eq!( - runner().ok("@use \"sass:meta\";\ - \na {b: meta.feature-exists(at-error)}\n"), + runner().ok("a {b: feature-exists(at-error)}\n"), "a {\ \n b: true;\ \n}\n" @@ -41,8 +39,7 @@ fn feature_exists() { #[test] fn function_exists() { assert_eq!( - runner().ok("@use \"sass:meta\";\ - \na {b: meta.function-exists(c)}\n"), + runner().ok("a {b: function-exists(c)}\n"), "a {\ \n b: false;\ \n}\n" @@ -52,7 +49,7 @@ fn function_exists() { fn get_function() { assert_eq!( runner().ok("@use \"sass:meta\";\ - \na {b: meta.inspect(meta.get-function(rgb))}\n"), + \na {b: meta.inspect(get-function(rgb))}\n"), "a {\ \n b: get-function(\"rgb\");\ \n}\n" @@ -61,8 +58,7 @@ fn get_function() { #[test] fn global_variable_exists() { assert_eq!( - runner().ok("@use \"sass:meta\";\ - \na {b: meta.global-variable-exists(c)}\n"), + runner().ok("a {b: global-variable-exists(c)}\n"), "a {\ \n b: false;\ \n}\n" @@ -71,8 +67,7 @@ fn global_variable_exists() { #[test] fn inspect() { assert_eq!( - runner().ok("@use \"sass:meta\";\ - \na {b: meta.inspect(())}\n"), + runner().ok("a {b: inspect(())}\n"), "a {\ \n b: ();\ \n}\n" @@ -82,10 +77,10 @@ fn inspect() { fn keywords() { assert_eq!( runner().ok("@use \"sass:meta\";\n\ - \n@function keywords($args...) {\ - \n @return meta.keywords($args);\ + \n@function helper($args...) {\ + \n @return keywords($args);\ \n}\n\ - \na {b: meta.inspect(keywords($c: d))}\n"), + \na {b: meta.inspect(helper($c: d))}\n"), "a {\ \n b: (c: d);\ \n}\n" @@ -94,8 +89,7 @@ fn keywords() { #[test] fn mixin_exists() { assert_eq!( - runner().ok("@use \"sass:meta\";\ - \na {b: meta.mixin-exists(c)}\n"), + runner().ok("a {b: mixin-exists(c)}\n"), "a {\ \n b: false;\ \n}\n" @@ -104,8 +98,7 @@ fn mixin_exists() { #[test] fn type_of() { assert_eq!( - runner().ok("@use \"sass:meta\";\ - \na {b: meta.type-of(())}\n"), + runner().ok("a {b: type-of(())}\n"), "a {\ \n b: list;\ \n}\n" @@ -114,8 +107,7 @@ fn type_of() { #[test] fn variable_exists() { assert_eq!( - runner().ok("@use \"sass:meta\";\ - \na {b: meta.variable-exists(c)}\n"), + runner().ok("a {b: variable-exists(c)}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/global/mod.rs b/rsass/tests/spec/core_functions/global/mod.rs new file mode 100644 index 000000000..ef6156ff0 --- /dev/null +++ b/rsass/tests/spec/core_functions/global/mod.rs @@ -0,0 +1,20 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("global") +} + +mod color; + +mod list; + +mod map; + +mod math; + +mod meta; + +mod selector; + +mod string; diff --git a/rsass/tests/spec/core_functions/global/selector.rs b/rsass/tests/spec/core_functions/global/selector.rs new file mode 100644 index 000000000..96150c75b --- /dev/null +++ b/rsass/tests/spec/core_functions/global/selector.rs @@ -0,0 +1,79 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/selector.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("selector") +} + +#[test] +fn append() { + assert_eq!( + runner().ok("a {b: selector-append(c, d)}\n"), + "a {\ + \n b: cd;\ + \n}\n" + ); +} +#[test] +fn extend() { + assert_eq!( + runner().ok("a {b: selector-extend(c, c, d)}\n"), + "a {\ + \n b: c, d;\ + \n}\n" + ); +} +#[test] +fn is_superselector() { + assert_eq!( + runner().ok("a {b: is-superselector(c, d)}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); +} +#[test] +fn nest() { + assert_eq!( + runner().ok("a {b: selector-nest(c, d)}\n"), + "a {\ + \n b: c d;\ + \n}\n" + ); +} +#[test] +fn parse() { + assert_eq!( + runner().ok("a {b: selector-parse(\".c, .d\")}\n"), + "a {\ + \n b: .c, .d;\ + \n}\n" + ); +} +#[test] +fn replace() { + assert_eq!( + runner().ok("a {b: selector-replace(c, c, d)}\n"), + "a {\ + \n b: d;\ + \n}\n" + ); +} +#[test] +fn simple_selectors() { + assert_eq!( + runner().ok("a {b: simple-selectors(\".c.d\")}\n"), + "a {\ + \n b: .c, .d;\ + \n}\n" + ); +} +#[test] +fn unify() { + assert_eq!( + runner().ok("a {b: selector-unify(\".c\", \".d\")}\n"), + "a {\ + \n b: .c.d;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/global/string.rs b/rsass/tests/spec/core_functions/global/string.rs new file mode 100644 index 000000000..0d80f822e --- /dev/null +++ b/rsass/tests/spec/core_functions/global/string.rs @@ -0,0 +1,80 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/global/string.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("string") +} + +#[test] +fn index() { + assert_eq!( + runner().ok("a {b: str-index(\"c\", \"c\")}\n"), + "a {\ + \n b: 1;\ + \n}\n" + ); +} +#[test] +fn insert() { + assert_eq!( + runner().ok("a {b: str-insert(\"c\", \"d\", 1)}\n"), + "a {\ + \n b: \"dc\";\ + \n}\n" + ); +} +#[test] +fn length() { + assert_eq!( + runner().ok("a {b: str-length(\"c\")}\n"), + "a {\ + \n b: 1;\ + \n}\n" + ); +} +#[test] +fn quote() { + assert_eq!( + runner().ok("a {b: quote(c)}\n"), + "a {\ + \n b: \"c\";\ + \n}\n" + ); +} +#[test] +fn slice() { + assert_eq!( + runner().ok("a {b: str-slice(\"c\", 1, 1)}\n"), + "a {\ + \n b: \"c\";\ + \n}\n" + ); +} +#[test] +fn to_upper_case() { + assert_eq!( + runner().ok("a {b: to-upper-case(\"c\")}\n"), + "a {\ + \n b: \"C\";\ + \n}\n" + ); +} +#[test] +fn unique_id() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \na {b: meta.type-of(unique-id())}\n"), + "a {\ + \n b: string;\ + \n}\n" + ); +} +#[test] +fn unquote() { + assert_eq!( + runner().ok("a {b: unquote(\"c\")}\n"), + "a {\ + \n b: c;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/list/append.rs b/rsass/tests/spec/core_functions/list/append.rs index c76253e40..4bf33e763 100644 --- a/rsass/tests/spec/core_functions/list/append.rs +++ b/rsass/tests/spec/core_functions/list/append.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn auto() { assert_eq!( - runner().ok("a {b: append(c d, e, $separator: auto)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.append(c d, e, $separator: auto)}\n"), "a {\ \n b: c d e;\ \n}\n" @@ -17,7 +18,8 @@ fn auto() { #[test] fn bracketed() { assert_eq!( - runner().ok("a {b: append([], 1)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.append([], 1)}\n"), "a {\ \n b: [1];\ \n}\n" @@ -30,7 +32,8 @@ mod comma { #[test] fn default() { assert_eq!( - runner().ok("a {b: append((1, 2, 3), 4)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.append((1, 2, 3), 4)}\n"), "a {\ \n b: 1, 2, 3, 4;\ \n}\n" @@ -39,7 +42,8 @@ mod comma { #[test] fn overridden() { assert_eq!( - runner().ok("a {b: append(1 2 3, 4, $separator: comma)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.append(1 2 3, 4, $separator: comma)}\n"), "a {\ \n b: 1, 2, 3, 4;\ \n}\n" @@ -53,12 +57,14 @@ mod empty { #[test] fn comma() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \n$result: append($empty-comma-list, 1);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.append(utils.$empty-comma-list, 1);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ - \n separator: real-separator($result);\ + \n type: meta.type-of($result);\ + \n separator: utils.real-separator($result);\ \n}\n"), "a {\ \n value: 1;\ @@ -70,12 +76,14 @@ mod empty { #[test] fn space() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \n$result: append($empty-space-list, 1);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.append(utils.$empty-space-list, 1);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ - \n separator: real-separator($result);\ + \n type: meta.type-of($result);\ + \n separator: utils.real-separator($result);\ \n}\n"), "a {\ \n value: 1;\ @@ -87,12 +95,14 @@ mod empty { #[test] fn undecided() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \n$result: append((), 1);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.append((), 1);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ - \n separator: real-separator($result);\ + \n type: meta.type-of($result);\ + \n separator: utils.real-separator($result);\ \n}\n"), "a {\ \n value: 1;\ @@ -109,33 +119,39 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: append(c)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.append(c)}\n" + ), "Error: Missing argument $val.\ \n ,--> input.scss\ - \n1 | a {b: append(c)}\ - \n | ^^^^^^^^^ invocation\ + \n2 | a {b: list.append(c)}\ + \n | ^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function append($list, $val, $separator: auto) {\ \n | ===================================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: append(c, d, comma, e)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.append(c, d, comma, e)}\n" + ), "Error: Only 3 arguments allowed, but 4 were passed.\ \n ,--> input.scss\ - \n1 | a {b: append(c, d, comma, e)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: list.append(c, d, comma, e)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function append($list, $val, $separator: auto) {\ \n | ===================================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod test_type { @@ -145,13 +161,16 @@ mod error { #[test] fn separator() { assert_eq!( - runner().err("a {b: append(c, d, $separator: 1)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.append(c, d, $separator: 1)}\n" + ), "Error: $separator: 1 is not a string.\ \n ,\ - \n1 | a {b: append(c, d, $separator: 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: list.append(c, d, $separator: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -159,14 +178,15 @@ mod error { fn unknown_separator() { assert_eq!( runner().err( - "a {b: append(c, d, $separator: e)}\n" + "@use \"sass:list\";\ + \na {b: list.append(c, d, $separator: e)}\n" ), "Error: $separator: Must be \"space\", \"comma\", \"slash\", or \"auto\".\ \n ,\ - \n1 | a {b: append(c, d, $separator: e)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: list.append(c, d, $separator: e)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -177,12 +197,14 @@ mod map { #[test] fn empty() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \n$result: append($empty-map, 1);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.append(utils.$empty-map, 1);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ - \n separator: real-separator($result);\ + \n type: meta.type-of($result);\ + \n separator: utils.real-separator($result);\ \n}\n"), "a {\ \n value: 1;\ @@ -194,7 +216,8 @@ mod map { #[test] fn non_empty() { assert_eq!( - runner().ok("a {b: append((c: d, e: f), g)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.append((c: d, e: f), g)}\n"), "a {\ \n b: c d, e f, g;\ \n}\n" @@ -204,8 +227,8 @@ mod map { #[test] fn named() { assert_eq!( - runner() - .ok("a {b: append($list: c d, $val: e, $separator: comma)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.append($list: c d, $val: e, $separator: comma)}\n"), "a {\ \n b: c, d, e;\ \n}\n" @@ -214,7 +237,8 @@ fn named() { #[test] fn non_list() { assert_eq!( - runner().ok("a {b: append(c, d)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.append(c, d)}\n"), "a {\ \n b: c d;\ \n}\n" @@ -227,7 +251,8 @@ mod single { #[test] fn comma() { assert_eq!( - runner().ok("a {b: append((1,), 2)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.append((1,), 2)}\n"), "a {\ \n b: 1, 2;\ \n}\n" @@ -236,8 +261,9 @@ mod single { #[test] fn space() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: append(with-separator(1, space), 2)}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"core_functions/list/utils\";\ + \na {b: list.append(utils.with-separator(1, space), 2)}\n"), "a {\ \n b: 1 2;\ \n}\n" @@ -246,7 +272,8 @@ mod single { #[test] fn undecided() { assert_eq!( - runner().ok("a {b: append(1, 2)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.append(1, 2)}\n"), "a {\ \n b: 1 2;\ \n}\n" @@ -261,7 +288,7 @@ mod slash { fn default() { assert_eq!( runner().ok("@use \"sass:list\";\ - \na {b: append(list.slash(c, d), e)}\n"), + \na {b: list.append(list.slash(c, d), e)}\n"), "a {\ \n b: c / d / e;\ \n}\n" @@ -270,7 +297,8 @@ mod slash { #[test] fn overridden() { assert_eq!( - runner().ok("a {b: append(c d, e, $separator: slash)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.append(c d, e, $separator: slash)}\n"), "a {\ \n b: c / d / e;\ \n}\n" @@ -284,7 +312,8 @@ mod space { #[test] fn default() { assert_eq!( - runner().ok("a {b: append(1 2 3, 4)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.append(1 2 3, 4)}\n"), "a {\ \n b: 1 2 3 4;\ \n}\n" @@ -293,7 +322,8 @@ mod space { #[test] fn overridden() { assert_eq!( - runner().ok("a {b: append((1, 2, 3), 4, $separator: space)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.append((1, 2, 3), 4, $separator: space)}\n"), "a {\ \n b: 1 2 3 4;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/list/index.rs b/rsass/tests/spec/core_functions/list/index.rs index f637e8782..c34339019 100644 --- a/rsass/tests/spec/core_functions/list/index.rs +++ b/rsass/tests/spec/core_functions/list/index.rs @@ -12,33 +12,39 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: index(c d e)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.index(c d e)}\n" + ), "Error: Missing argument $value.\ \n ,--> input.scss\ - \n1 | a {b: index(c d e)}\ - \n | ^^^^^^^^^^^^ invocation\ + \n2 | a {b: list.index(c d e)}\ + \n | ^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function index($list, $value) {\ \n | ==================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: index(c d e, d, e)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.index(c d e, d, e)}\n" + ), "Error: Only 2 arguments allowed, but 3 were passed.\ \n ,--> input.scss\ - \n1 | a {b: index(c d e, d, e)}\ - \n | ^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: list.index(c d e, d, e)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function index($list, $value) {\ \n | ==================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -49,7 +55,8 @@ mod found { #[test] fn first() { assert_eq!( - runner().ok("a {b: index(a b c, a)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.index(a b c, a)}\n"), "a {\ \n b: 1;\ \n}\n" @@ -58,7 +65,8 @@ mod found { #[test] fn last() { assert_eq!( - runner().ok("a {b: index(a b c, c)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.index(a b c, c)}\n"), "a {\ \n b: 3;\ \n}\n" @@ -67,7 +75,8 @@ mod found { #[test] fn map() { assert_eq!( - runner().ok("a {b: index((c: d, e: f, g: h), e f)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.index((c: d, e: f, g: h), e f)}\n"), "a {\ \n b: 2;\ \n}\n" @@ -76,7 +85,8 @@ mod found { #[test] fn multiple() { assert_eq!( - runner().ok("a {b: index(a b c a b c, b)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.index(a b c a b c, b)}\n"), "a {\ \n b: 2;\ \n}\n" @@ -85,7 +95,8 @@ mod found { #[test] fn non_list() { assert_eq!( - runner().ok("a {b: index(c, c)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.index(c, c)}\n"), "a {\ \n b: 1;\ \n}\n" @@ -94,7 +105,8 @@ mod found { #[test] fn sass_equality() { assert_eq!( - runner().ok("a {b: index(1px 1in 1cm, 96px)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.index(1px 1in 1cm, 96px)}\n"), "a {\ \n b: 2;\ \n}\n" @@ -103,7 +115,8 @@ mod found { #[test] fn single() { assert_eq!( - runner().ok("a {b: index([c], c)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.index([c], c)}\n"), "a {\ \n b: 1;\ \n}\n" @@ -113,7 +126,8 @@ mod found { #[test] fn named() { assert_eq!( - runner().ok("a {b: index($list: c d e, $value: d)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.index($list: c d e, $value: d)}\n"), "a {\ \n b: 2;\ \n}\n" @@ -126,7 +140,9 @@ mod not_found { #[test] fn empty() { assert_eq!( - runner().ok("a {b: inspect(index((), c))}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(list.index((), c))}\n"), "a {\ \n b: null;\ \n}\n" @@ -139,8 +155,10 @@ mod not_found { #[test] fn empty() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: inspect(index($empty-map, e))}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\ + \na {b: meta.inspect(list.index(utils.$empty-map, e))}\n"), "a {\ \n b: null;\ \n}\n" @@ -149,7 +167,9 @@ mod not_found { #[test] fn non_empty() { assert_eq!( - runner().ok("a {b: inspect(index((c: d, e: f, g: h), e))}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(list.index((c: d, e: f, g: h), e))}\n"), "a {\ \n b: null;\ \n}\n" @@ -159,7 +179,9 @@ mod not_found { #[test] fn non_empty() { assert_eq!( - runner().ok("a {b: inspect(index(c d e, f))}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(list.index(c d e, f))}\n"), "a {\ \n b: null;\ \n}\n" @@ -168,7 +190,9 @@ mod not_found { #[test] fn non_list() { assert_eq!( - runner().ok("a {b: inspect(index(c, d))}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(list.index(c, d))}\n"), "a {\ \n b: null;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/list/is_bracketed.rs b/rsass/tests/spec/core_functions/list/is_bracketed.rs index a37d0befd..a7dced499 100644 --- a/rsass/tests/spec/core_functions/list/is_bracketed.rs +++ b/rsass/tests/spec/core_functions/list/is_bracketed.rs @@ -12,7 +12,8 @@ mod bracketed { #[test] fn empty() { assert_eq!( - runner().ok("a {b: is-bracketed([])}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.is-bracketed([])}\n"), "a {\ \n b: true;\ \n}\n" @@ -21,7 +22,8 @@ mod bracketed { #[test] fn multi() { assert_eq!( - runner().ok("a {b: is-bracketed([1, 2, 3])}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.is-bracketed([1, 2, 3])}\n"), "a {\ \n b: true;\ \n}\n" @@ -30,7 +32,8 @@ mod bracketed { #[test] fn single() { assert_eq!( - runner().ok("a {b: is-bracketed([1])}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.is-bracketed([1])}\n"), "a {\ \n b: true;\ \n}\n" @@ -44,33 +47,39 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: is-bracketed()}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.is-bracketed()}\n" + ), "Error: Missing argument $list.\ \n ,--> input.scss\ - \n1 | a {b: is-bracketed()}\ - \n | ^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: list.is-bracketed()}\ + \n | ^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function is-bracketed($list) {\ \n | =================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: is-bracketed(a b, c d)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.is-bracketed(a b, c d)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: is-bracketed(a b, c d)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: list.is-bracketed(a b, c d)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function is-bracketed($list) {\ \n | =================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -81,7 +90,8 @@ mod unbracketed { #[test] fn empty() { assert_eq!( - runner().ok("a {b: is-bracketed(())}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.is-bracketed(())}\n"), "a {\ \n b: false;\ \n}\n" @@ -90,7 +100,8 @@ mod unbracketed { #[test] fn map() { assert_eq!( - runner().ok("a {b: is-bracketed((c: d, e: f, g: h))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.is-bracketed((c: d, e: f, g: h))}\n"), "a {\ \n b: false;\ \n}\n" @@ -99,7 +110,8 @@ mod unbracketed { #[test] fn multi() { assert_eq!( - runner().ok("a {b: is-bracketed(1 2 3)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.is-bracketed(1 2 3)}\n"), "a {\ \n b: false;\ \n}\n" @@ -108,7 +120,8 @@ mod unbracketed { #[test] fn non_list() { assert_eq!( - runner().ok("a {b: is-bracketed(1)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.is-bracketed(1)}\n"), "a {\ \n b: false;\ \n}\n" @@ -117,7 +130,8 @@ mod unbracketed { #[test] fn single() { assert_eq!( - runner().ok("a {b: is-bracketed((1,))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.is-bracketed((1,))}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/list/join/empty.rs b/rsass/tests/spec/core_functions/list/join/empty.rs index 1632c89cf..869558b8f 100644 --- a/rsass/tests/spec/core_functions/list/join/empty.rs +++ b/rsass/tests/spec/core_functions/list/join/empty.rs @@ -16,11 +16,13 @@ mod both { #[test] fn first() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \n$result: join($empty-comma-list, ());\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.join(utils.$empty-comma-list, ());\ \na {\ - \n value: inspect($result);\ - \n separator: real-separator($result);\ + \n value: meta.inspect($result);\ + \n separator: utils.real-separator($result);\ \n}\n"), "a {\ \n value: ();\ @@ -31,11 +33,13 @@ mod both { #[test] fn last() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \n$result: join((), $empty-comma-list);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.join((), utils.$empty-comma-list);\ \na {\ - \n value: inspect($result);\ - \n separator: real-separator($result);\ + \n value: meta.inspect($result);\ + \n separator: utils.real-separator($result);\ \n}\n"), "a {\ \n value: ();\ @@ -51,12 +55,14 @@ mod both { #[test] fn first() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \n$empty-slash-list: join((), (), $separator: slash);\ - \n$result: join($empty-slash-list, ());\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$empty-slash-list: list.join((), (), $separator: slash);\ + \n$result: list.join($empty-slash-list, ());\ \na {\ - \n value: inspect($result);\ - \n separator: real-separator($result);\ + \n value: meta.inspect($result);\ + \n separator: utils.real-separator($result);\ \n}\n"), "a {\ \n value: ();\ @@ -67,12 +73,14 @@ mod both { #[test] fn last() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \n$empty-slash-list: join((), (), $separator: slash);\ - \n$result: join((), $empty-slash-list);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$empty-slash-list: list.join((), (), $separator: slash);\ + \n$result: list.join((), $empty-slash-list);\ \na {\ - \n value: inspect($result);\ - \n separator: real-separator($result);\ + \n value: meta.inspect($result);\ + \n separator: utils.real-separator($result);\ \n}\n"), "a {\ \n value: ();\ @@ -88,11 +96,13 @@ mod both { #[test] fn first() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \n$result: join($empty-space-list, ());\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.join(utils.$empty-space-list, ());\ \na {\ - \n value: inspect($result);\ - \n separator: real-separator($result);\ + \n value: meta.inspect($result);\ + \n separator: utils.real-separator($result);\ \n}\n"), "a {\ \n value: ();\ @@ -103,11 +113,13 @@ mod both { #[test] fn last() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \n$result: join((), $empty-space-list);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.join((), utils.$empty-space-list);\ \na {\ - \n value: inspect($result);\ - \n separator: real-separator($result);\ + \n value: meta.inspect($result);\ + \n separator: utils.real-separator($result);\ \n}\n"), "a {\ \n value: ();\ @@ -120,13 +132,15 @@ mod both { fn undecided() { assert_eq!( runner().ok( - "@import \"core_functions/list/utils\";\n\ - \n$result: join((), ());\ + "@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.join((), ());\ \na {\ - \n value: inspect($result);\n\ + \n value: meta.inspect($result);\n\ \n // `join()` should always produce a real separator, even when the inputs have\ \n // undecided separators. It should default to `space`.\ - \n separator: real-separator($result);\ + \n separator: utils.real-separator($result);\ \n}\n" ), "a {\ @@ -143,8 +157,9 @@ mod first { #[test] fn comma() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: join($empty-comma-list, 1 2 3)}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"core_functions/list/utils\";\ + \na {b: list.join(utils.$empty-comma-list, 1 2 3)}\n"), "a {\ \n b: 1, 2, 3;\ \n}\n" @@ -153,9 +168,9 @@ mod first { #[test] fn slash() { assert_eq!( - runner() - .ok("$empty-slash-list: join((), (), $separator: slash);\ - \na {b: join($empty-slash-list, 1 2 3)}\n"), + runner().ok("@use \"sass:list\";\ + \n$empty-slash-list: list.join((), (), $separator: slash);\ + \na {b: list.join($empty-slash-list, 1 2 3)}\n"), "a {\ \n b: 1 / 2 / 3;\ \n}\n" @@ -164,8 +179,9 @@ mod first { #[test] fn space() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: join($empty-space-list, (1, 2, 3))}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"core_functions/list/utils\";\ + \na {b: list.join(utils.$empty-space-list, (1, 2, 3))}\n"), "a {\ \n b: 1 2 3;\ \n}\n" @@ -178,7 +194,8 @@ mod first { #[test] fn and_comma() { assert_eq!( - runner().ok("a {b: join((), (1, 2, 3))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join((), (1, 2, 3))}\n"), "a {\ \n b: 1, 2, 3;\ \n}\n" @@ -188,7 +205,7 @@ mod first { fn and_slash() { assert_eq!( runner().ok("@use \"sass:list\";\ - \na {b: join((), list.slash(1, 2, 3))}\n"), + \na {b: list.join((), list.slash(1, 2, 3))}\n"), "a {\ \n b: 1 / 2 / 3;\ \n}\n" @@ -197,7 +214,8 @@ mod first { #[test] fn and_space() { assert_eq!( - runner().ok("a {b: join((), 1 2 3)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join((), 1 2 3)}\n"), "a {\ \n b: 1 2 3;\ \n}\n" @@ -216,8 +234,9 @@ mod map { #[test] fn comma() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: join($empty-map, (1, 2, 3))}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"core_functions/list/utils\";\ + \na {b: list.join(utils.$empty-map, (1, 2, 3))}\n"), "a {\ \n b: 1, 2, 3;\ \n}\n" @@ -227,8 +246,8 @@ mod map { fn slash() { assert_eq!( runner().ok("@use \"sass:list\";\ - \n@import \"core_functions/list/utils\";\ - \na {b: join($empty-map, list.slash(1, 2, 3))}\n"), + \n@use \"core_functions/list/utils\";\ + \na {b: list.join(utils.$empty-map, list.slash(1, 2, 3))}\n"), "a {\ \n b: 1 / 2 / 3;\ \n}\n" @@ -237,8 +256,9 @@ mod map { #[test] fn space() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: join($empty-map, 1 2 3)}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"core_functions/list/utils\";\ + \na {b: list.join(utils.$empty-map, 1 2 3)}\n"), "a {\ \n b: 1 2 3;\ \n}\n" @@ -247,11 +267,13 @@ mod map { #[test] fn undecided() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \n$result: join($empty-map, ());\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.join(utils.$empty-map, ());\ \na {\ - \n value: inspect($result);\ - \n separator: real-separator($result);\ + \n value: meta.inspect($result);\ + \n separator: utils.real-separator($result);\ \n}\n"), "a {\ \n value: ();\ @@ -267,8 +289,9 @@ mod map { #[test] fn comma() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: join((1, 2, 3), $empty-map)}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"core_functions/list/utils\";\ + \na {b: list.join((1, 2, 3), utils.$empty-map)}\n"), "a {\ \n b: 1, 2, 3;\ \n}\n" @@ -278,8 +301,8 @@ mod map { fn slash() { assert_eq!( runner().ok("@use \"sass:list\";\ - \n@import \"core_functions/list/utils\";\ - \na {b: join(list.slash(1, 2, 3), $empty-map)}\n"), + \n@use \"core_functions/list/utils\";\ + \na {b: list.join(list.slash(1, 2, 3), utils.$empty-map)}\n"), "a {\ \n b: 1 / 2 / 3;\ \n}\n" @@ -288,8 +311,9 @@ mod map { #[test] fn space() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: join(1 2 3, $empty-map)}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"core_functions/list/utils\";\ + \na {b: list.join(1 2 3, utils.$empty-map)}\n"), "a {\ \n b: 1 2 3;\ \n}\n" @@ -298,11 +322,13 @@ mod map { #[test] fn undecided() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \n$result: join($empty-map, ());\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.join(utils.$empty-map, ());\ \na {\ - \n value: inspect($result);\ - \n separator: real-separator($result);\ + \n value: meta.inspect($result);\ + \n separator: utils.real-separator($result);\ \n}\n"), "a {\ \n value: ();\ @@ -319,8 +345,9 @@ mod second { #[test] fn comma() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: join(1 2 3, $empty-comma-list)}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"core_functions/list/utils\";\ + \na {b: list.join(1 2 3, utils.$empty-comma-list)}\n"), "a {\ \n b: 1 2 3;\ \n}\n" @@ -329,9 +356,9 @@ mod second { #[test] fn slash() { assert_eq!( - runner() - .ok("$empty-slash-list: join((), (), $separator: slash);\ - \na {b: join(1 2 3, $empty-slash-list)}\n"), + runner().ok("@use \"sass:list\";\ + \n$empty-slash-list: list.join((), (), $separator: slash);\ + \na {b: list.join(1 2 3, $empty-slash-list)}\n"), "a {\ \n b: 1 2 3;\ \n}\n" @@ -340,8 +367,9 @@ mod second { #[test] fn space() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: join((1, 2, 3), $empty-space-list)}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"core_functions/list/utils\";\ + \na {b: list.join((1, 2, 3), utils.$empty-space-list)}\n"), "a {\ \n b: 1, 2, 3;\ \n}\n" @@ -354,7 +382,8 @@ mod second { #[test] fn comma() { assert_eq!( - runner().ok("a {b: join((1, 2, 3), ())}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join((1, 2, 3), ())}\n"), "a {\ \n b: 1, 2, 3;\ \n}\n" @@ -364,7 +393,7 @@ mod second { fn slash() { assert_eq!( runner().ok("@use \"sass:list\";\ - \na {b: join(list.slash(1, 2, 3), ())}\n"), + \na {b: list.join(list.slash(1, 2, 3), ())}\n"), "a {\ \n b: 1 / 2 / 3;\ \n}\n" @@ -373,7 +402,8 @@ mod second { #[test] fn space() { assert_eq!( - runner().ok("a {b: join(1 2 3, ())}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join(1 2 3, ())}\n"), "a {\ \n b: 1 2 3;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/list/join/error.rs b/rsass/tests/spec/core_functions/list/join/error.rs index 7acd957d4..2191d5b37 100644 --- a/rsass/tests/spec/core_functions/list/join/error.rs +++ b/rsass/tests/spec/core_functions/list/join/error.rs @@ -9,72 +9,76 @@ fn runner() -> crate::TestRunner { fn named() { assert_eq!( runner().err( - "a {b: join(c, d, $invalid: true)}\n" + "@use \"sass:list\";\ + \na {b: list.join(c, d, $invalid: true)}\n" ), "Error: No argument named $invalid.\ \n ,--> input.scss\ - \n1 | a {b: join(c, d, $invalid: true)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: list.join(c, d, $invalid: true)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function join($list1, $list2, $separator: auto, $bracketed: auto) {\ \n | ======================================================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn positional_and_named() { assert_eq!( runner().err( - "a {b: join(c, d, comma, true, false, $invalid: true)}\n" + "@use \"sass:list\";\ + \na {b: list.join(c, d, comma, true, false, $invalid: true)}\n" ), "Error: Only 4 positional arguments allowed, but 5 were passed.\ \n ,--> input.scss\ - \n1 | a {b: join(c, d, comma, true, false, $invalid: true)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: list.join(c, d, comma, true, false, $invalid: true)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function join($list1, $list2, $separator: auto, $bracketed: auto) {\ \n | ======================================================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_few_args() { assert_eq!( runner().err( - "a {b: join(c)}\n" + "@use \"sass:list\";\ + \na {b: list.join(c)}\n" ), "Error: Missing argument $list2.\ \n ,--> input.scss\ - \n1 | a {b: join(c)}\ - \n | ^^^^^^^ invocation\ + \n2 | a {b: list.join(c)}\ + \n | ^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function join($list1, $list2, $separator: auto, $bracketed: auto) {\ \n | ======================================================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( runner().err( - "a {b: join(c, d, comma, true, false)}\n" + "@use \"sass:list\";\ + \na {b: list.join(c, d, comma, true, false)}\n" ), "Error: Only 4 arguments allowed, but 5 were passed.\ \n ,--> input.scss\ - \n1 | a {b: join(c, d, comma, true, false)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: list.join(c, d, comma, true, false)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function join($list1, $list2, $separator: auto, $bracketed: auto) {\ \n | ======================================================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod test_type { @@ -84,13 +88,16 @@ mod test_type { #[test] fn separator() { assert_eq!( - runner().err("a {b: join(c, d, $separator: 1)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.join(c, d, $separator: 1)}\n" + ), "Error: $separator: 1 is not a string.\ \n ,\ - \n1 | a {b: join(c, d, $separator: 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: list.join(c, d, $separator: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -98,13 +105,14 @@ mod test_type { fn unknown_separator() { assert_eq!( runner().err( - "a {b: join(c, d, $separator: e)}\n" + "@use \"sass:list\";\ + \na {b: list.join(c, d, $separator: e)}\n" ), "Error: $separator: Must be \"space\", \"comma\", \"slash\", or \"auto\".\ \n ,\ - \n1 | a {b: join(c, d, $separator: e)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: list.join(c, d, $separator: e)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } diff --git a/rsass/tests/spec/core_functions/list/join/multi.rs b/rsass/tests/spec/core_functions/list/join/multi.rs index b4a21fb21..405db8ef1 100644 --- a/rsass/tests/spec/core_functions/list/join/multi.rs +++ b/rsass/tests/spec/core_functions/list/join/multi.rs @@ -12,7 +12,8 @@ mod auto { #[test] fn bracketed() { assert_eq!( - runner().ok("a {b: join(c d, e f, $bracketed: auto)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join(c d, e f, $bracketed: auto)}\n"), "a {\ \n b: c d e f;\ \n}\n" @@ -21,7 +22,8 @@ mod auto { #[test] fn separator() { assert_eq!( - runner().ok("a {b: join((c, d), e f, $separator: auto)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join((c, d), e f, $separator: auto)}\n"), "a {\ \n b: c, d, e, f;\ \n}\n" @@ -36,7 +38,8 @@ mod bracketed { fn and_separator() { assert_eq!( runner().ok( - "a {b: join(c, d, $bracketed: true, $separator: comma)}\n" + "@use \"sass:list\";\ + \na {b: list.join(c, d, $bracketed: true, $separator: comma)}\n" ), "a {\ \n b: [c, d];\ @@ -46,7 +49,8 @@ mod bracketed { #[test] fn both() { assert_eq!( - runner().ok("a {b: join([c d], [e f])}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join([c d], [e f])}\n"), "a {\ \n b: [c d e f];\ \n}\n" @@ -55,7 +59,8 @@ mod bracketed { #[test] fn test_false() { assert_eq!( - runner().ok("a {b: join([c], [d], $bracketed: false)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join([c], [d], $bracketed: false)}\n"), "a {\ \n b: c d;\ \n}\n" @@ -64,7 +69,8 @@ mod bracketed { #[test] fn falsey() { assert_eq!( - runner().ok("a {b: join([c], [d], $bracketed: null)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join([c], [d], $bracketed: null)}\n"), "a {\ \n b: c d;\ \n}\n" @@ -73,7 +79,8 @@ mod bracketed { #[test] fn first() { assert_eq!( - runner().ok("a {b: join([c d], e f)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join([c d], e f)}\n"), "a {\ \n b: [c d e f];\ \n}\n" @@ -82,7 +89,8 @@ mod bracketed { #[test] fn positional() { assert_eq!( - runner().ok("a {b: join(c, d, comma, true)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join(c, d, comma, true)}\n"), "a {\ \n b: [c, d];\ \n}\n" @@ -91,7 +99,8 @@ mod bracketed { #[test] fn second() { assert_eq!( - runner().ok("a {b: join(c d, [e f])}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join(c d, [e f])}\n"), "a {\ \n b: c d e f;\ \n}\n" @@ -100,7 +109,8 @@ mod bracketed { #[test] fn test_true() { assert_eq!( - runner().ok("a {b: join(c, d, $bracketed: true)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join(c, d, $bracketed: true)}\n"), "a {\ \n b: [c d];\ \n}\n" @@ -109,7 +119,8 @@ mod bracketed { #[test] fn truthy() { assert_eq!( - runner().ok("a {b: join(c, d, $bracketed: e)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join(c, d, $bracketed: e)}\n"), "a {\ \n b: [c d];\ \n}\n" @@ -123,7 +134,8 @@ mod comma { #[test] fn both() { assert_eq!( - runner().ok("a {b: join((c, d), (e, f))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join((c, d), (e, f))}\n"), "a {\ \n b: c, d, e, f;\ \n}\n" @@ -132,7 +144,8 @@ mod comma { #[test] fn first() { assert_eq!( - runner().ok("a {b: join((c, d), e f)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join((c, d), e f)}\n"), "a {\ \n b: c, d, e, f;\ \n}\n" @@ -141,7 +154,8 @@ mod comma { #[test] fn second() { assert_eq!( - runner().ok("a {b: join(c d, (e, f))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join(c d, (e, f))}\n"), "a {\ \n b: c d e f;\ \n}\n" @@ -154,7 +168,8 @@ mod comma { #[test] fn forces_comma() { assert_eq!( - runner().ok("a {b: join(c, d, $separator: comma)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join(c, d, $separator: comma)}\n"), "a {\ \n b: c, d;\ \n}\n" @@ -163,8 +178,8 @@ mod comma { #[test] fn forces_not_comma() { assert_eq!( - runner() - .ok("a {b: join((c, d), (e, f), $separator: space)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join((c, d), (e, f), $separator: space)}\n"), "a {\ \n b: c d e f;\ \n}\n" @@ -179,7 +194,8 @@ mod map { #[test] fn both() { assert_eq!( - runner().ok("a {b: join((c: d, e: f), (g: h, i: j))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join((c: d, e: f), (g: h, i: j))}\n"), "a {\ \n b: c d, e f, g h, i j;\ \n}\n" @@ -192,7 +208,8 @@ mod map { #[test] fn comma() { assert_eq!( - runner().ok("a {b: join((c: d, e: f), (g, h))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join((c: d, e: f), (g, h))}\n"), "a {\ \n b: c d, e f, g, h;\ \n}\n" @@ -202,7 +219,7 @@ mod map { fn slash() { assert_eq!( runner().ok("@use \"sass:list\";\ - \na {b: join((c: d, e: f), list.slash(g, h))}\n"), + \na {b: list.join((c: d, e: f), list.slash(g, h))}\n"), "a {\ \n b: c d, e f, g, h;\ \n}\n" @@ -211,7 +228,9 @@ mod map { #[test] fn space() { assert_eq!( - runner().ok("a {b: inspect(join((c: d, e: f), g h))}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(list.join((c: d, e: f), g h))}\n"), "a {\ \n b: c d, e f, g, h;\ \n}\n" @@ -225,7 +244,8 @@ mod map { #[test] fn comma() { assert_eq!( - runner().ok("a {b: join((c, d), (e: f, g: h))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join((c, d), (e: f, g: h))}\n"), "a {\ \n b: c, d, e f, g h;\ \n}\n" @@ -235,7 +255,7 @@ mod map { fn slash() { assert_eq!( runner().ok("@use \"sass:list\";\ - \na {b: join(list.slash(c, d), (e: f, g: h))}\n"), + \na {b: list.join(list.slash(c, d), (e: f, g: h))}\n"), "a {\ \n b: c / d / e f / g h;\ \n}\n" @@ -245,8 +265,10 @@ mod map { fn space() { assert_eq!( runner().ok( - "// Use inspect() to prove that the map is converted to a list of pairs.\ - \na {b: inspect(join(c d, (e: f, g: h)))}\n" + "@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n// Use inspect() to prove that the map is converted to a list of pairs.\ + \na {b: meta.inspect(list.join(c d, (e: f, g: h)))}\n" ), "a {\ \n b: c d (e f) (g h);\ @@ -259,7 +281,8 @@ mod map { fn named() { assert_eq!( runner().ok( - "a {b: join($list1: a b, $list2: c d, $separator: comma, $bracketed: true)}\n" + "@use \"sass:list\";\ + \na {b: list.join($list1: a b, $list2: c d, $separator: comma, $bracketed: true)}\n" ), "a {\ \n b: [a, b, c, d];\ @@ -274,7 +297,7 @@ mod slash { fn both() { assert_eq!( runner().ok("@use \"sass:list\";\ - \na {b: join(list.slash(c, d), list.slash(e, f))}\n"), + \na {b: list.join(list.slash(c, d), list.slash(e, f))}\n"), "a {\ \n b: c / d / e / f;\ \n}\n" @@ -284,7 +307,7 @@ mod slash { fn first() { assert_eq!( runner().ok("@use \"sass:list\";\ - \na {b: join(list.slash(c, d), e f)}\n"), + \na {b: list.join(list.slash(c, d), e f)}\n"), "a {\ \n b: c / d / e / f;\ \n}\n" @@ -294,7 +317,7 @@ mod slash { fn second() { assert_eq!( runner().ok("@use \"sass:list\";\ - \na {b: join(c d, list.slash(e, f))}\n"), + \na {b: list.join(c d, list.slash(e, f))}\n"), "a {\ \n b: c d e f;\ \n}\n" @@ -309,7 +332,7 @@ mod slash { assert_eq!( runner().ok( "@use \"sass:list\";\ - \na {b: join(list.slash(c, d), list.slash(e, f), $separator: space)}\n" + \na {b: list.join(list.slash(c, d), list.slash(e, f), $separator: space)}\n" ), "a {\ \n b: c d e f;\ @@ -319,7 +342,8 @@ mod slash { #[test] fn forces_slash() { assert_eq!( - runner().ok("a {b: join(c, d, $separator: slash)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join(c, d, $separator: slash)}\n"), "a {\ \n b: c / d;\ \n}\n" @@ -334,7 +358,8 @@ mod space { #[test] fn both() { assert_eq!( - runner().ok("a {b: join(c d, e f)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join(c d, e f)}\n"), "a {\ \n b: c d e f;\ \n}\n" @@ -347,7 +372,8 @@ mod space { #[test] fn forces_not_space() { assert_eq!( - runner().ok("a {b: join(c d, e f, $separator: comma)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join(c d, e f, $separator: comma)}\n"), "a {\ \n b: c, d, e, f;\ \n}\n" @@ -356,7 +382,8 @@ mod space { #[test] fn forces_space() { assert_eq!( - runner().ok("a {b: join(c, d, $separator: space)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join(c, d, $separator: space)}\n"), "a {\ \n b: c d;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/list/join/single.rs b/rsass/tests/spec/core_functions/list/join/single.rs index 088f82171..50a943e61 100644 --- a/rsass/tests/spec/core_functions/list/join/single.rs +++ b/rsass/tests/spec/core_functions/list/join/single.rs @@ -16,8 +16,9 @@ mod both { #[test] fn first() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: join((1,), [2])}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"core_functions/list/utils\";\ + \na {b: list.join((1,), [2])}\n"), "a {\ \n b: 1, 2;\ \n}\n" @@ -26,8 +27,9 @@ mod both { #[test] fn last() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \na {b: join([1], (2,))}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"core_functions/list/utils\";\n\ + \na {b: list.join([1], (2,))}\n"), "a {\ \n b: [1, 2];\ \n}\n" @@ -41,8 +43,8 @@ mod both { #[test] fn first() { assert_eq!( - runner() - .ok("a {b: join(join(1, (), $separator: slash), [2])}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join(list.join(1, (), $separator: slash), [2])}\n"), "a {\ \n b: 1 / 2;\ \n}\n" @@ -51,8 +53,8 @@ mod both { #[test] fn last() { assert_eq!( - runner() - .ok("a {b: join([1], join(2, (), $separator: slash))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join([1], list.join(2, (), $separator: slash))}\n"), "a {\ \n b: [1 / 2];\ \n}\n" @@ -66,8 +68,9 @@ mod both { #[test] fn first() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: join(with-separator(1, space), [2])}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"core_functions/list/utils\";\ + \na {b: list.join(utils.with-separator(1, space), [2])}\n"), "a {\ \n b: 1 2;\ \n}\n" @@ -76,8 +79,9 @@ mod both { #[test] fn last() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: join([1], with-separator(2, space))}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"core_functions/list/utils\";\ + \na {b: list.join([1], utils.with-separator(2, space))}\n"), "a {\ \n b: [1 2];\ \n}\n" @@ -87,7 +91,8 @@ mod both { #[test] fn undecided() { assert_eq!( - runner().ok("a {b: join([1], [2])}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join([1], [2])}\n"), "a {\ \n b: [1 2];\ \n}\n" @@ -101,7 +106,8 @@ mod first { #[test] fn comma() { assert_eq!( - runner().ok("a {b: join((1,), 2 3 4)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join((1,), 2 3 4)}\n"), "a {\ \n b: 1, 2, 3, 4;\ \n}\n" @@ -110,18 +116,23 @@ mod first { #[test] fn slash() { assert_eq!( - runner() - .ok("a {b: join(join(1, (), $separator: slash), 2 3 4)}\n"), - "a {\ + runner().ok( + "@use \"sass:list\";\ + \na {b: list.join(list.join(1, (), $separator: slash), 2 3 4)}\n" + ), + "a {\ \n b: 1 / 2 / 3 / 4;\ \n}\n" - ); + ); } #[test] fn space() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: join(with-separator(1, space), (2, 3, 4))}\n"), + runner().ok( + "@use \"sass:list\";\ + \n@use \"core_functions/list/utils\";\ + \na {b: list.join(utils.with-separator(1, space), (2, 3, 4))}\n" + ), "a {\ \n b: 1 2 3 4;\ \n}\n" @@ -134,7 +145,8 @@ mod first { #[test] fn and_comma() { assert_eq!( - runner().ok("a {b: join([1], (2, 3, 4))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join([1], (2, 3, 4))}\n"), "a {\ \n b: [1, 2, 3, 4];\ \n}\n" @@ -144,7 +156,7 @@ mod first { fn and_slash() { assert_eq!( runner().ok("@use \"sass:list\";\ - \na {b: join([1], list.slash(2, 3, 4))}\n"), + \na {b: list.join([1], list.slash(2, 3, 4))}\n"), "a {\ \n b: [1 / 2 / 3 / 4];\ \n}\n" @@ -153,7 +165,8 @@ mod first { #[test] fn and_space() { assert_eq!( - runner().ok("a {b: join([1], 2 3 4)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join([1], 2 3 4)}\n"), "a {\ \n b: [1 2 3 4];\ \n}\n" @@ -168,7 +181,8 @@ mod non_list { #[test] fn both() { assert_eq!( - runner().ok("a {b: join(c, d)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join(c, d)}\n"), "a {\ \n b: c d;\ \n}\n" @@ -181,7 +195,8 @@ mod non_list { #[test] fn comma() { assert_eq!( - runner().ok("a {b: join(c, (d, e))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join(c, (d, e))}\n"), "a {\ \n b: c, d, e;\ \n}\n" @@ -191,7 +206,7 @@ mod non_list { fn slash() { assert_eq!( runner().ok("@use \"sass:list\";\ - \na {b: join(c, list.slash(d, e))}\n"), + \na {b: list.join(c, list.slash(d, e))}\n"), "a {\ \n b: c / d / e;\ \n}\n" @@ -200,7 +215,9 @@ mod non_list { #[test] fn space() { assert_eq!( - runner().ok("a {b: inspect(join(c, d e))}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(list.join(c, d e))}\n"), "a {\ \n b: c d e;\ \n}\n" @@ -209,23 +226,21 @@ mod non_list { #[test] fn undecided() { assert_eq!( - runner().ok( - "@import \"core_functions/list/utils\";\n\ - \n$result: join(c, ());\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.join(c, ());\ \na {\ - \n value: inspect($result);\ - \n type: type-of($result);\n\ - \n // Note: LibSass\'s output here is strange but not strictly-speaking wrong.\ - \n // See sass/libsass#2926 for details.\ - \n separator: real-separator($result);\ - \n}\n" - ), - "a {\ + \n value: meta.inspect($result);\ + \n type: meta.type-of($result);\ + \n separator: utils.real-separator($result);\ + \n}\n"), + "a {\ \n value: c;\ \n type: list;\ \n separator: space;\ \n}\n" - ); + ); } } mod second { @@ -235,7 +250,8 @@ mod non_list { #[test] fn comma() { assert_eq!( - runner().ok("a {b: join((c, d), e)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join((c, d), e)}\n"), "a {\ \n b: c, d, e;\ \n}\n" @@ -245,7 +261,7 @@ mod non_list { fn slash() { assert_eq!( runner().ok("@use \"sass:list\";\ - \na {b: join(list.slash(c, d), e)}\n"), + \na {b: list.join(list.slash(c, d), e)}\n"), "a {\ \n b: c / d / e;\ \n}\n" @@ -254,7 +270,9 @@ mod non_list { #[test] fn space() { assert_eq!( - runner().ok("a {b: inspect(join(c d, e))}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(list.join(c d, e))}\n"), "a {\ \n b: c d e;\ \n}\n" @@ -263,23 +281,21 @@ mod non_list { #[test] fn undecided() { assert_eq!( - runner().ok( - "@import \"core_functions/list/utils\";\n\ - \n$result: join((), c);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.join((), c);\ \na {\ - \n value: inspect($result);\ - \n type: type-of($result);\n\ - \n // Note: LibSass\'s output here is strange but not strictly-speaking wrong.\ - \n // See sass/libsass#2926 for details.\ - \n separator: real-separator($result);\ - \n}\n" - ), - "a {\ + \n value: meta.inspect($result);\ + \n type: meta.type-of($result);\ + \n separator: utils.real-separator($result);\ + \n}\n"), + "a {\ \n value: c;\ \n type: list;\ \n separator: space;\ \n}\n" - ); + ); } } } @@ -290,7 +306,8 @@ mod second { #[test] fn comma() { assert_eq!( - runner().ok("a {b: join(1 2 3, (4,))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join(1 2 3, (4,))}\n"), "a {\ \n b: 1 2 3 4;\ \n}\n" @@ -299,18 +316,23 @@ mod second { #[test] fn slash() { assert_eq!( - runner() - .ok("a {b: join(1 2 3, join(4, (), $separator: slash))}\n"), - "a {\ + runner().ok( + "@use \"sass:list\";\ + \na {b: list.join(1 2 3, list.join(4, (), $separator: slash))}\n" + ), + "a {\ \n b: 1 2 3 4;\ \n}\n" - ); + ); } #[test] fn space() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: join((1, 2, 3), with-separator(4, space))}\n"), + runner().ok( + "@use \"sass:list\";\ + \n@use \"core_functions/list/utils\";\ + \na {b: list.join((1, 2, 3), utils.with-separator(4, space))}\n" + ), "a {\ \n b: 1, 2, 3, 4;\ \n}\n" @@ -323,7 +345,8 @@ mod second { #[test] fn comma() { assert_eq!( - runner().ok("a {b: join((1, 2, 3), [4])}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join((1, 2, 3), [4])}\n"), "a {\ \n b: 1, 2, 3, 4;\ \n}\n" @@ -333,7 +356,7 @@ mod second { fn slash() { assert_eq!( runner().ok("@use \"sass:list\";\ - \na {b: join(list.slash(1, 2, 3), [4])}\n"), + \na {b: list.join(list.slash(1, 2, 3), [4])}\n"), "a {\ \n b: 1 / 2 / 3 / 4;\ \n}\n" @@ -342,7 +365,8 @@ mod second { #[test] fn space() { assert_eq!( - runner().ok("a {b: join(1 2 3, [4])}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.join(1 2 3, [4])}\n"), "a {\ \n b: 1 2 3 4;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/list/length.rs b/rsass/tests/spec/core_functions/list/length.rs index 08f664bac..3cd002797 100644 --- a/rsass/tests/spec/core_functions/list/length.rs +++ b/rsass/tests/spec/core_functions/list/length.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn t0() { assert_eq!( - runner().ok("a {b: length(())}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.length(())}\n"), "a {\ \n b: 0;\ \n}\n" @@ -17,7 +18,8 @@ fn t0() { #[test] fn t1() { assert_eq!( - runner().ok("a {b: length(join((), 1))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.length(list.join((), 1))}\n"), "a {\ \n b: 1;\ \n}\n" @@ -26,7 +28,8 @@ fn t1() { #[test] fn t2() { assert_eq!( - runner().ok("a {b: length(c d)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.length(c d)}\n"), "a {\ \n b: 2;\ \n}\n" @@ -39,40 +42,47 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: length()}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.length()}\n" + ), "Error: Missing argument $list.\ \n ,--> input.scss\ - \n1 | a {b: length()}\ - \n | ^^^^^^^^ invocation\ + \n2 | a {b: list.length()}\ + \n | ^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function length($list) {\ \n | ============= declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: length(1, 2)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.length(1, 2)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: length(1, 2)}\ - \n | ^^^^^^^^^^^^ invocation\ + \n2 | a {b: list.length(1, 2)}\ + \n | ^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function length($list) {\ \n | ============= declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn many() { assert_eq!( - runner().ok("a {b: length((1, 2, 3, 4, 5))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.length((1, 2, 3, 4, 5))}\n"), "a {\ \n b: 5;\ \n}\n" @@ -85,8 +95,9 @@ mod map { #[test] fn empty() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: length($empty-map)}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"core_functions/list/utils\";\ + \na {b: list.length(utils.$empty-map)}\n"), "a {\ \n b: 0;\ \n}\n" @@ -95,7 +106,8 @@ mod map { #[test] fn non_empty() { assert_eq!( - runner().ok("a {b: length((1: 2, 3: 4))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.length((1: 2, 3: 4))}\n"), "a {\ \n b: 2;\ \n}\n" @@ -105,7 +117,8 @@ mod map { #[test] fn named() { assert_eq!( - runner().ok("a {b: length($list: 1 2 3)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.length($list: 1 2 3)}\n"), "a {\ \n b: 3;\ \n}\n" @@ -114,7 +127,8 @@ fn named() { #[test] fn non_list() { assert_eq!( - runner().ok("a {b: length(c)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.length(c)}\n"), "a {\ \n b: 1;\ \n}\n" @@ -123,8 +137,9 @@ fn non_list() { #[test] fn null_list_item() { assert_eq!( - runner().ok("// regression test for scssphp/scssphp#403\ - \na {b: length((null))}\n"), + runner().ok("@use \"sass:list\";\ + \n// regression test for scssphp/scssphp#403\ + \na {b: list.length((null))}\n"), "a {\ \n b: 1;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/list/nth.rs b/rsass/tests/spec/core_functions/list/nth.rs index df714b108..c3a197a62 100644 --- a/rsass/tests/spec/core_functions/list/nth.rs +++ b/rsass/tests/spec/core_functions/list/nth.rs @@ -12,7 +12,8 @@ mod t1 { #[test] fn of_1() { assert_eq!( - runner().ok("a {b: nth(join((), c), 1)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.nth(list.join((), c), 1)}\n"), "a {\ \n b: c;\ \n}\n" @@ -21,7 +22,8 @@ mod t1 { #[test] fn of_2() { assert_eq!( - runner().ok("a {b: nth(c d, 1)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.nth(c d, 1)}\n"), "a {\ \n b: c;\ \n}\n" @@ -35,7 +37,8 @@ mod t2 { #[test] fn of_2() { assert_eq!( - runner().ok("a {b: nth(c d, 2)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.nth(c d, 2)}\n"), "a {\ \n b: d;\ \n}\n" @@ -44,7 +47,8 @@ mod t2 { #[test] fn of_4() { assert_eq!( - runner().ok("a {b: nth(c d e f, 2)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.nth(c d e f, 2)}\n"), "a {\ \n b: d;\ \n}\n" @@ -54,7 +58,8 @@ mod t2 { #[test] fn bracketed() { assert_eq!( - runner().ok("a {b: nth([c, d], 2)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.nth([c, d], 2)}\n"), "a {\ \n b: d;\ \n}\n" @@ -71,89 +76,108 @@ mod error { #[test] fn t0() { assert_eq!( - runner().err("a {b: nth(c d, 0)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.nth(c d, 0)}\n" + ), "Error: $n: List index may not be 0.\ \n ,\ - \n1 | a {b: nth(c d, 0)}\ - \n | ^^^^^^^^^^^\ + \n2 | a {b: list.nth(c d, 0)}\ + \n | ^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_high() { assert_eq!( - runner().err("a {b: nth(c d, 3)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.nth(c d, 3)}\n" + ), "Error: $n: Invalid index 3 for a list with 2 elements.\ \n ,\ - \n1 | a {b: nth(c d, 3)}\ - \n | ^^^^^^^^^^^\ + \n2 | a {b: list.nth(c d, 3)}\ + \n | ^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_low() { assert_eq!( - runner().err("a {b: nth(c d, -3)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.nth(c d, -3)}\n" + ), "Error: $n: Invalid index -3 for a list with 2 elements.\ \n ,\ - \n1 | a {b: nth(c d, -3)}\ - \n | ^^^^^^^^^^^^\ + \n2 | a {b: list.nth(c d, -3)}\ + \n | ^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: nth(c d)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.nth(c d)}\n" + ), "Error: Missing argument $n.\ \n ,--> input.scss\ - \n1 | a {b: nth(c d)}\ - \n | ^^^^^^^^ invocation\ + \n2 | a {b: list.nth(c d)}\ + \n | ^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function nth($list, $n) {\ \n | ============== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: nth(c d, 1, 2)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.nth(c d, 1, 2)}\n" + ), "Error: Only 2 arguments allowed, but 3 were passed.\ \n ,--> input.scss\ - \n1 | a {b: nth(c d, 1, 2)}\ - \n | ^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: list.nth(c d, 1, 2)}\ + \n | ^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function nth($list, $n) {\ \n | ============== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: nth(c d, e)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.nth(c d, e)}\n" + ), "Error: $n: e is not a number.\ \n ,\ - \n1 | a {b: nth(c d, e)}\ - \n | ^^^^^^^^^^^\ + \n2 | a {b: list.nth(c d, e)}\ + \n | ^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn map() { assert_eq!( - runner().ok("a {b: nth((c: d, e: f, g: h), 2)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.nth((c: d, e: f, g: h), 2)}\n"), "a {\ \n b: e f;\ \n}\n" @@ -162,7 +186,8 @@ fn map() { #[test] fn named() { assert_eq!( - runner().ok("a {b: nth($list: c d, $n: 1)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.nth($list: c d, $n: 1)}\n"), "a {\ \n b: c;\ \n}\n" @@ -179,7 +204,8 @@ mod negative { #[test] fn of_1() { assert_eq!( - runner().ok("a {b: nth(join((), c), -1)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.nth(list.join((), c), -1)}\n"), "a {\ \n b: c;\ \n}\n" @@ -188,7 +214,8 @@ mod negative { #[test] fn of_2() { assert_eq!( - runner().ok("a {b: nth(c d, -1)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.nth(c d, -1)}\n"), "a {\ \n b: d;\ \n}\n" @@ -202,7 +229,8 @@ mod negative { #[test] fn of_2() { assert_eq!( - runner().ok("a {b: nth(c d, -2)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.nth(c d, -2)}\n"), "a {\ \n b: c;\ \n}\n" @@ -211,7 +239,8 @@ mod negative { #[test] fn of_4() { assert_eq!( - runner().ok("a {b: nth(c d e f, -2)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.nth(c d e f, -2)}\n"), "a {\ \n b: e;\ \n}\n" @@ -222,7 +251,8 @@ mod negative { #[test] fn non_list() { assert_eq!( - runner().ok("a {b: nth(c, 1)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.nth(c, 1)}\n"), "a {\ \n b: c;\ \n}\n" @@ -232,7 +262,8 @@ fn non_list() { #[ignore] // unexepected error fn units() { assert_eq!( - runner().ok("a {b: nth(c d, 1px)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.nth(c d, 1px)}\n"), "a {\ \n b: c;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/list/separator.rs b/rsass/tests/spec/core_functions/list/separator.rs index 738c86a38..f4db2d799 100644 --- a/rsass/tests/spec/core_functions/list/separator.rs +++ b/rsass/tests/spec/core_functions/list/separator.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn bracketed() { assert_eq!( - runner().ok("a {b: list-separator([c, d])}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.separator([c, d])}\n"), "a {\ \n b: comma;\ \n}\n" @@ -21,7 +22,8 @@ mod empty { #[test] fn comma() { assert_eq!( - runner().ok("a {b: list-separator(join((), (), comma))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.separator(list.join((), (), comma))}\n"), "a {\ \n b: comma;\ \n}\n" @@ -30,8 +32,9 @@ mod empty { #[test] fn map() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \na {b: list-separator($empty-map)}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"core_functions/list/utils\";\n\ + \na {b: list.separator(utils.$empty-map)}\n"), "a {\ \n b: space;\ \n}\n" @@ -40,7 +43,8 @@ mod empty { #[test] fn space() { assert_eq!( - runner().ok("a {b: list-separator(())}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.separator(())}\n"), "a {\ \n b: space;\ \n}\n" @@ -54,33 +58,39 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: list-separator()}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.separator()}\n" + ), "Error: Missing argument $list.\ \n ,--> input.scss\ - \n1 | a {b: list-separator()}\ + \n2 | a {b: list.separator()}\ \n | ^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function separator($list) {\ \n | ================ declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: list-separator(c, d)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.separator(c, d)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: list-separator(c, d)}\ + \n2 | a {b: list.separator(c, d)}\ \n | ^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function separator($list) {\ \n | ================ declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -91,7 +101,8 @@ mod multi { #[test] fn comma() { assert_eq!( - runner().ok("a {b: list-separator((1, 2, 3))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.separator((1, 2, 3))}\n"), "a {\ \n b: comma;\ \n}\n" @@ -100,7 +111,8 @@ mod multi { #[test] fn map() { assert_eq!( - runner().ok("a {b: list-separator((c: d, e: f, g: h))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.separator((c: d, e: f, g: h))}\n"), "a {\ \n b: comma;\ \n}\n" @@ -110,7 +122,7 @@ mod multi { fn slash() { assert_eq!( runner().ok("@use \'sass:list\';\ - \na {b: list-separator(list.slash(1, 2, 3))}\n"), + \na {b: list.separator(list.slash(1, 2, 3))}\n"), "a {\ \n b: slash;\ \n}\n" @@ -119,7 +131,8 @@ mod multi { #[test] fn space() { assert_eq!( - runner().ok("a {b: list-separator(1 2 3)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.separator(1 2 3)}\n"), "a {\ \n b: space;\ \n}\n" @@ -133,7 +146,8 @@ mod single { #[test] fn comma() { assert_eq!( - runner().ok("a {b: list-separator((1,))}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.separator((1,))}\n"), "a {\ \n b: comma;\ \n}\n" @@ -142,7 +156,8 @@ mod single { #[test] fn non_list() { assert_eq!( - runner().ok("a {b: list-separator(1)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.separator(1)}\n"), "a {\ \n b: space;\ \n}\n" @@ -151,9 +166,8 @@ mod single { #[test] fn slash() { assert_eq!( - runner().ok( - "a {b: list-separator(join(1, (), $separator: slash))}\n" - ), + runner().ok("@use \"sass:list\";\ + \na {b: list.separator(list.join(1, (), $separator: slash))}\n"), "a {\ \n b: slash;\ \n}\n" @@ -162,7 +176,8 @@ mod single { #[test] fn space() { assert_eq!( - runner().ok("a {b: list-separator([1])}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.separator([1])}\n"), "a {\ \n b: space;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/list/set_nth.rs b/rsass/tests/spec/core_functions/list/set_nth.rs index 26f701fac..b7523e62b 100644 --- a/rsass/tests/spec/core_functions/list/set_nth.rs +++ b/rsass/tests/spec/core_functions/list/set_nth.rs @@ -12,10 +12,12 @@ mod t1 { #[test] fn of_1() { assert_eq!( - runner().ok("$result: set-nth(join((), b), 1, c);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n$result: list.set-nth(list.join((), b), 1, c);\ \na {\ \n result: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n result: c;\ @@ -26,7 +28,8 @@ mod t1 { #[test] fn of_2() { assert_eq!( - runner().ok("a {b: set-nth(c d, 1, e)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.set-nth(c d, 1, e)}\n"), "a {\ \n b: e d;\ \n}\n" @@ -40,7 +43,8 @@ mod t2 { #[test] fn of_2() { assert_eq!( - runner().ok("a {b: set-nth(c d, 2, e)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.set-nth(c d, 2, e)}\n"), "a {\ \n b: c e;\ \n}\n" @@ -49,7 +53,8 @@ mod t2 { #[test] fn of_4() { assert_eq!( - runner().ok("a {b: set-nth(c d e f, 2, g)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.set-nth(c d e f, 2, g)}\n"), "a {\ \n b: c g e f;\ \n}\n" @@ -59,7 +64,8 @@ mod t2 { #[test] fn bracketed() { assert_eq!( - runner().ok("a {b: set-nth([c, d], 2, e)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.set-nth([c, d], 2, e)}\n"), "a {\ \n b: [c, e];\ \n}\n" @@ -76,89 +82,108 @@ mod error { #[test] fn t0() { assert_eq!( - runner().err("a {b: set-nth(c d, 0, e)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.set-nth(c d, 0, e)}\n" + ), "Error: $n: List index may not be 0.\ \n ,\ - \n1 | a {b: set-nth(c d, 0, e)}\ - \n | ^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: list.set-nth(c d, 0, e)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: set-nth(c d, 1)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.set-nth(c d, 1)}\n" + ), "Error: Missing argument $value.\ \n ,--> input.scss\ - \n1 | a {b: set-nth(c d, 1)}\ - \n | ^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: list.set-nth(c d, 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function set-nth($list, $n, $value) {\ \n | ========================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_high() { assert_eq!( - runner().err("a {b: set-nth(c d, 3, e)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.set-nth(c d, 3, e)}\n" + ), "Error: $n: Invalid index 3 for a list with 2 elements.\ \n ,\ - \n1 | a {b: set-nth(c d, 3, e)}\ - \n | ^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: list.set-nth(c d, 3, e)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_low() { assert_eq!( - runner().err("a {b: set-nth(c d, -3, e)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.set-nth(c d, -3, e)}\n" + ), "Error: $n: Invalid index -3 for a list with 2 elements.\ \n ,\ - \n1 | a {b: set-nth(c d, -3, e)}\ - \n | ^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: list.set-nth(c d, -3, e)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: set-nth(c d, 1, 2, 3)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.set-nth(c d, 1, 2, 3)}\n" + ), "Error: Only 3 arguments allowed, but 4 were passed.\ \n ,--> input.scss\ - \n1 | a {b: set-nth(c d, 1, 2, 3)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: list.set-nth(c d, 1, 2, 3)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:list\ \n1 | @function set-nth($list, $n, $value) {\ \n | ========================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn test_type() { assert_eq!( - runner().err("a {b: set-nth(c d, e, f)}\n"), + runner().err( + "@use \"sass:list\";\ + \na {b: list.set-nth(c d, e, f)}\n" + ), "Error: $n: e is not a number.\ \n ,\ - \n1 | a {b: set-nth(c d, e, f)}\ - \n | ^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: list.set-nth(c d, e, f)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn map() { assert_eq!( - runner().ok("a {b: set-nth((c: d, e: f, g: h), 2, i)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.set-nth((c: d, e: f, g: h), 2, i)}\n"), "a {\ \n b: c d, i, g h;\ \n}\n" @@ -167,7 +192,8 @@ fn map() { #[test] fn named() { assert_eq!( - runner().ok("a {b: set-nth($list: c d, $n: 1, $value: e)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.set-nth($list: c d, $n: 1, $value: e)}\n"), "a {\ \n b: e d;\ \n}\n" @@ -184,10 +210,12 @@ mod negative { #[test] fn of_1() { assert_eq!( - runner().ok("$result: set-nth(join((), b), -1, c);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n$result: list.set-nth(list.join((), b), -1, c);\ \na {\ \n result: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n result: c;\ @@ -198,7 +226,8 @@ mod negative { #[test] fn of_2() { assert_eq!( - runner().ok("a {b: set-nth(c d, -1, e)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.set-nth(c d, -1, e)}\n"), "a {\ \n b: c e;\ \n}\n" @@ -212,7 +241,8 @@ mod negative { #[test] fn of_2() { assert_eq!( - runner().ok("a {b: set-nth(c d, -2, e)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.set-nth(c d, -2, e)}\n"), "a {\ \n b: e d;\ \n}\n" @@ -221,7 +251,8 @@ mod negative { #[test] fn of_4() { assert_eq!( - runner().ok("a {b: set-nth(c d e f, -2, g)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.set-nth(c d e f, -2, g)}\n"), "a {\ \n b: c d g f;\ \n}\n" @@ -232,10 +263,12 @@ mod negative { #[test] fn non_list() { assert_eq!( - runner().ok("$result: set-nth(b, 1, c);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n$result: list.set-nth(b, 1, c);\ \na {\ \n result: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n result: c;\ @@ -247,7 +280,8 @@ fn non_list() { #[ignore] // unexepected error fn units() { assert_eq!( - runner().ok("a {b: set-nth(c d, 1px, e)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.set-nth(c d, 1px, e)}\n"), "a {\ \n b: e d;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/list/utils.rs b/rsass/tests/spec/core_functions/list/utils.rs index f915c1489..e80f4d8d2 100644 --- a/rsass/tests/spec/core_functions/list/utils.rs +++ b/rsass/tests/spec/core_functions/list/utils.rs @@ -12,8 +12,8 @@ mod empty_map { #[test] fn same_as_empty_list() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: $empty-map == ()}\n"), + runner().ok("@use \"core_functions/list/utils\";\ + \na {b: utils.$empty-map == ()}\n"), "a {\ \n b: true;\ \n}\n" @@ -31,8 +31,8 @@ mod real_separator { #[test] fn comma() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: real-separator($empty-comma-list)}\n"), + runner().ok("@use \"core_functions/list/utils\";\ + \na {b: utils.real-separator(utils.$empty-comma-list)}\n"), "a {\ \n b: comma;\ \n}\n" @@ -41,8 +41,8 @@ mod real_separator { #[test] fn space() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: real-separator($empty-space-list)}\n"), + runner().ok("@use \"core_functions/list/utils\";\ + \na {b: utils.real-separator(utils.$empty-space-list)}\n"), "a {\ \n b: space;\ \n}\n" @@ -51,8 +51,8 @@ mod real_separator { #[test] fn undecided() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: real-separator(())}\n"), + runner().ok("@use \"core_functions/list/utils\";\ + \na {b: utils.real-separator(())}\n"), "a {\ \n b: undecided;\ \n}\n" @@ -66,8 +66,8 @@ mod real_separator { #[test] fn comma() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: real-separator((1, 2))}\n"), + runner().ok("@use \"core_functions/list/utils\";\ + \na {b: utils.real-separator((1, 2))}\n"), "a {\ \n b: comma;\ \n}\n" @@ -76,8 +76,8 @@ mod real_separator { #[test] fn space() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: real-separator(1 2)}\n"), + runner().ok("@use \"core_functions/list/utils\";\ + \na {b: utils.real-separator(1 2)}\n"), "a {\ \n b: space;\ \n}\n" @@ -91,8 +91,8 @@ mod real_separator { #[test] fn comma() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: real-separator((1,))}\n"), + runner().ok("@use \"core_functions/list/utils\";\ + \na {b: utils.real-separator((1,))}\n"), "a {\ \n b: comma;\ \n}\n" @@ -101,8 +101,8 @@ mod real_separator { #[test] fn undecided() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: real-separator([1])}\n"), + runner().ok("@use \"core_functions/list/utils\";\ + \na {b: utils.real-separator([1])}\n"), "a {\ \n b: undecided;\ \n}\n" @@ -121,8 +121,8 @@ mod with_separator { #[test] fn comma() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: with-separator(1 2, comma)}\n"), + runner().ok("@use \"core_functions/list/utils\";\ + \na {b: utils.with-separator(1 2, comma)}\n"), "a {\ \n b: 1, 2;\ \n}\n" @@ -131,8 +131,8 @@ mod with_separator { #[test] fn space() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: with-separator((1, 2), space)}\n"), + runner().ok("@use \"core_functions/list/utils\";\ + \na {b: utils.with-separator((1, 2), space)}\n"), "a {\ \n b: 1 2;\ \n}\n" @@ -146,22 +146,26 @@ mod with_separator { #[test] fn comma() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: real-separator(with-separator([1], comma))}\n"), - "a {\ + runner().ok( + "@use \"core_functions/list/utils\";\ + \na {b: utils.real-separator(utils.with-separator([1], comma))}\n" + ), + "a {\ \n b: comma;\ \n}\n" - ); + ); } #[test] fn space() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\ - \na {b: real-separator(with-separator((1,), space))}\n"), - "a {\ + runner().ok( + "@use \"core_functions/list/utils\";\ + \na {b: utils.real-separator(utils.with-separator((1,), space))}\n" + ), + "a {\ \n b: space;\ \n}\n" - ); + ); } } } diff --git a/rsass/tests/spec/core_functions/list/zip.rs b/rsass/tests/spec/core_functions/list/zip.rs index 2d592a1b1..012523c6a 100644 --- a/rsass/tests/spec/core_functions/list/zip.rs +++ b/rsass/tests/spec/core_functions/list/zip.rs @@ -12,7 +12,10 @@ mod map { #[test] fn empty() { assert_eq!( - runner().ok("a {b: inspect(zip(map-remove((c: d), c)))}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(list.zip(map.remove((c: d), c)))}\n"), "a {\ \n b: ();\ \n}\n" @@ -21,7 +24,9 @@ mod map { #[test] fn non_empty() { assert_eq!( - runner().ok("a {b: inspect(zip((c: d, e: f, g: h), 1 2 3))}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(list.zip((c: d, e: f, g: h), 1 2 3))}\n"), "a {\ \n b: (c d) 1, (e f) 2, (g h) 3;\ \n}\n" @@ -31,11 +36,13 @@ mod map { #[test] fn no_lists() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \n$result: zip();\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.zip();\ \na {\ - \n value: inspect($result);\ - \n separator: real-separator($result);\ + \n value: meta.inspect($result);\ + \n separator: utils.real-separator($result);\ \n}\n"), "a {\ \n value: ();\ @@ -46,7 +53,8 @@ fn no_lists() { #[test] fn non_list() { assert_eq!( - runner().ok("a {b: zip(c, d, e)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.zip(c, d, e)}\n"), "a {\ \n b: c d e;\ \n}\n" @@ -59,14 +67,16 @@ mod one_list { #[test] fn bracketed() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \n$result: zip([1 2 3]);\ - \n$element: nth($result, 2);\n\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.zip([1 2 3]);\ + \n$element: list.nth($result, 2);\n\ \na {\ \n value: $result;\ \n element: $element {\ - \n type: type-of($element);\ - \n separator: real-separator($element);\ + \n type: meta.type-of($element);\ + \n separator: utils.real-separator($element);\ \n }\ \n}\n"), "a {\ @@ -80,14 +90,16 @@ mod one_list { #[test] fn comma() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \n$result: zip((1, 2, 3));\ - \n$element: nth($result, 2);\n\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.zip((1, 2, 3));\ + \n$element: list.nth($result, 2);\n\ \na {\ \n value: $result;\ \n element: $element {\ - \n type: type-of($element);\ - \n separator: real-separator($element);\ + \n type: meta.type-of($element);\ + \n separator: utils.real-separator($element);\ \n }\ \n}\n"), "a {\ @@ -101,11 +113,13 @@ mod one_list { #[test] fn empty() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \n$result: zip(());\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.zip(());\ \na {\ - \n value: inspect($result);\ - \n separator: real-separator($result);\ + \n value: meta.inspect($result);\ + \n separator: utils.real-separator($result);\ \n}\n"), "a {\ \n value: ();\ @@ -116,14 +130,16 @@ mod one_list { #[test] fn space() { assert_eq!( - runner().ok("@import \"core_functions/list/utils\";\n\ - \n$result: zip(1 2 3);\ - \n$element: nth($result, 2);\n\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"core_functions/list/utils\";\n\ + \n$result: list.zip(1 2 3);\ + \n$element: list.nth($result, 2);\n\ \na {\ \n value: $result;\ \n element: $element {\ - \n type: type-of($element);\ - \n separator: real-separator($element);\ + \n type: meta.type-of($element);\ + \n separator: utils.real-separator($element);\ \n }\ \n}\n"), "a {\ @@ -138,7 +154,8 @@ mod one_list { #[test] fn three_lists() { assert_eq!( - runner().ok("a {b: zip(1 2 3, c d e, red green blue)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.zip(1 2 3, c d e, red green blue)}\n"), "a {\ \n b: 1 c red, 2 d green, 3 e blue;\ \n}\n" @@ -151,7 +168,9 @@ mod two_lists { #[test] fn first_empty() { assert_eq!( - runner().ok("a {b: inspect(zip((), 1 2 3))}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(list.zip((), 1 2 3))}\n"), "a {\ \n b: ();\ \n}\n" @@ -160,7 +179,8 @@ mod two_lists { #[test] fn first_longer() { assert_eq!( - runner().ok("a {b: zip(1 2 3 4, c d)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.zip(1 2 3 4, c d)}\n"), "a {\ \n b: 1 c, 2 d;\ \n}\n" @@ -169,7 +189,8 @@ mod two_lists { #[test] fn same_length() { assert_eq!( - runner().ok("a {b: zip(1 2 3, c d e)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.zip(1 2 3, c d e)}\n"), "a {\ \n b: 1 c, 2 d, 3 e;\ \n}\n" @@ -178,7 +199,9 @@ mod two_lists { #[test] fn second_empty() { assert_eq!( - runner().ok("a {b: inspect(zip(1 2 3, ()))}\n"), + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(list.zip(1 2 3, ()))}\n"), "a {\ \n b: ();\ \n}\n" @@ -187,7 +210,8 @@ mod two_lists { #[test] fn second_longer() { assert_eq!( - runner().ok("a {b: zip(1 2, c d e f)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.zip(1 2, c d e f)}\n"), "a {\ \n b: 1 c, 2 d;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/map/deep_merge.rs b/rsass/tests/spec/core_functions/map/deep_merge.rs index 484c011d3..f0f242ff2 100644 --- a/rsass/tests/spec/core_functions/map/deep_merge.rs +++ b/rsass/tests/spec/core_functions/map/deep_merge.rs @@ -13,8 +13,9 @@ mod deep { fn different_keys() { assert_eq!( runner().ok( - "@use \'sass:map\';\ - \na {b: inspect(map.deep-merge((c: (d: e, f: g)), (c: (1: 2, 3: 4))))}\n" + "@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-merge((c: (d: e, f: g)), (c: (1: 2, 3: 4))))}\n" ), "a {\ \n b: (c: (d: e, f: g, 1: 2, 3: 4));\ @@ -28,8 +29,9 @@ mod deep { #[test] fn first() { assert_eq!( - runner().ok("@use \'sass:map\';\ - \na {b: inspect(map.deep-merge((c: ()), (c: (d: e))))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-merge((c: ()), (c: (d: e))))}\n"), "a {\ \n b: (c: (d: e));\ \n}\n" @@ -38,8 +40,9 @@ mod deep { #[test] fn second() { assert_eq!( - runner().ok("@use \'sass:map\';\ - \na {b: inspect(map.deep-merge((c: (d: e)), (c: ())))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-merge((c: (d: e)), (c: ())))}\n"), "a {\ \n b: (c: (d: e));\ \n}\n" @@ -50,8 +53,9 @@ mod deep { fn multiple_layers() { assert_eq!( runner().ok( - "@use \'sass:map\';\ - \na {b: inspect(map.deep-merge((c: (d: (e: (f: g)))), (c: (d: (e: (1: 2))))))}\n" + "@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-merge((c: (d: (e: (f: g)))), (c: (d: (e: (1: 2))))))}\n" ), "a {\ \n b: (c: (d: (e: (f: g, 1: 2))));\ @@ -62,8 +66,9 @@ mod deep { fn overlapping_keys() { assert_eq!( runner().ok( - "@use \'sass:map\';\ - \na {b: inspect(map.deep-merge((c: (d: e, f: g, h: i)), (c: (j: 1, f: 2, k: 3))))}\n" + "@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-merge((c: (d: e, f: g, h: i)), (c: (j: 1, f: 2, k: 3))))}\n" ), "a {\ \n b: (c: (d: e, f: 2, h: i, j: 1, k: 3));\ @@ -74,8 +79,9 @@ mod deep { fn same_keys() { assert_eq!( runner().ok( - "@use \'sass:map\';\ - \na {b: inspect(map.deep-merge((c: (d: e, f: g)), (c: (d: 1, f: 2))))}\n" + "@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-merge((c: (d: e, f: g)), (c: (d: 1, f: 2))))}\n" ), "a {\ \n b: (c: (d: 1, f: 2));\ @@ -165,8 +171,9 @@ mod error { fn named() { assert_eq!( runner().ok( - "@use \'sass:map\';\ - \na {b: inspect(map.deep-merge($map1: (c: d), $map2: (1: 2)))}\n" + "@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-merge($map1: (c: d), $map2: (1: 2)))}\n" ), "a {\ \n b: (c: d, 1: 2);\ @@ -180,12 +187,15 @@ mod shallow { #[test] fn different_keys() { assert_eq!( - runner().ok("@use \'sass:map\';\ - \na {b: inspect(map.deep-merge((c: d, e: f), (1: 2, 3: 4)))}\n"), - "a {\ + runner().ok( + "@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-merge((c: d, e: f), (1: 2, 3: 4)))}\n" + ), + "a {\ \n b: (c: d, e: f, 1: 2, 3: 4);\ \n}\n" - ); + ); } mod empty { #[allow(unused)] @@ -194,8 +204,9 @@ mod shallow { #[test] fn both() { assert_eq!( - runner().ok("@use \'sass:map\';\ - \na {b: inspect(map.deep-merge((), ()))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-merge((), ()))}\n"), "a {\ \n b: ();\ \n}\n" @@ -204,8 +215,9 @@ mod shallow { #[test] fn first() { assert_eq!( - runner().ok("@use \'sass:map\';\ - \na {b: inspect(map.deep-merge((), (c: d, e: f)))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-merge((), (c: d, e: f)))}\n"), "a {\ \n b: (c: d, e: f);\ \n}\n" @@ -214,8 +226,9 @@ mod shallow { #[test] fn second() { assert_eq!( - runner().ok("@use \'sass:map\';\ - \na {b: inspect(map.deep-merge((c: d, e: f), ()))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-merge((c: d, e: f), ()))}\n"), "a {\ \n b: (c: d, e: f);\ \n}\n" @@ -226,8 +239,9 @@ mod shallow { fn overlapping_keys() { assert_eq!( runner().ok( - "@use \'sass:map\';\ - \na {b: inspect(map.deep-merge((c: d, e: f, g: h), (i: 1, e: 2, j: 3)))}\n" + "@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-merge((c: d, e: f, g: h), (i: 1, e: 2, j: 3)))}\n" ), "a {\ \n b: (c: d, e: 2, g: h, i: 1, j: 3);\ @@ -237,11 +251,14 @@ mod shallow { #[test] fn same_keys() { assert_eq!( - runner().ok("@use \'sass:map\';\ - \na {b: inspect(map.deep-merge((c: d, e: f), (c: 1, e: 2)))}\n"), - "a {\ + runner().ok( + "@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-merge((c: d, e: f), (c: 1, e: 2)))}\n" + ), + "a {\ \n b: (c: 1, e: 2);\ \n}\n" - ); + ); } } diff --git a/rsass/tests/spec/core_functions/map/deep_remove.rs b/rsass/tests/spec/core_functions/map/deep_remove.rs index c0b9a826f..90f26e91b 100644 --- a/rsass/tests/spec/core_functions/map/deep_remove.rs +++ b/rsass/tests/spec/core_functions/map/deep_remove.rs @@ -56,8 +56,9 @@ mod found { fn first() { assert_eq!( runner().ok( - "@use \'sass:map\';\ - \na {b: inspect(map.deep-remove((c: (d: e, f: g, h: i)), c, d))}\n" + "@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-remove((c: (d: e, f: g, h: i)), c, d))}\n" ), "a {\ \n b: (c: (f: g, h: i));\ @@ -68,8 +69,9 @@ mod found { fn last() { assert_eq!( runner().ok( - "@use \'sass:map\';\ - \na {b: inspect(map.deep-remove((c: (d: e, f: g, h: i)), c, h))}\n" + "@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-remove((c: (d: e, f: g, h: i)), c, h))}\n" ), "a {\ \n b: (c: (d: e, f: g));\ @@ -80,8 +82,9 @@ mod found { fn middle() { assert_eq!( runner().ok( - "@use \'sass:map\';\ - \na {b: inspect(map.deep-remove((c: (d: e, f: g, h: i)), c, f))}\n" + "@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-remove((c: (d: e, f: g, h: i)), c, f))}\n" ), "a {\ \n b: (c: (d: e, h: i));\ @@ -91,8 +94,9 @@ mod found { #[test] fn single() { assert_eq!( - runner().ok("@use \'sass:map\';\ - \na {b: inspect(map.deep-remove((c: (d: e)), c, d))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-remove((c: (d: e)), c, d))}\n"), "a {\ \n b: (c: ());\ \n}\n" @@ -102,8 +106,9 @@ mod found { #[test] fn top_level() { assert_eq!( - runner().ok("@use \'sass:map\';\ - \na {b: inspect(map.deep-remove((c: d), c))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-remove((c: d), c))}\n"), "a {\ \n b: ();\ \n}\n" @@ -117,8 +122,9 @@ mod not_found { #[test] fn empty() { assert_eq!( - runner().ok("@use \'sass:map\';\ - \na {b: inspect(map.deep-remove((), 1))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-remove((), 1))}\n"), "a {\ \n b: ();\ \n}\n" @@ -127,20 +133,22 @@ mod not_found { #[test] fn extra_keys() { assert_eq!( - runner().ok( - "@use \'sass:map\';\ - \na {b: inspect(map.deep-remove((c: (d: e)), c, d, e, f, g))}\n" - ), - "a {\ + runner().ok( + "@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-remove((c: (d: e)), c, d, e, f, g))}\n" + ), + "a {\ \n b: (c: (d: e));\ \n}\n" - ); + ); } #[test] fn nested() { assert_eq!( - runner().ok("@use \'sass:map\';\ - \na {b: inspect(map.deep-remove((c: (d: e)), c, e))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-remove((c: (d: e)), c, e))}\n"), "a {\ \n b: (c: (d: e));\ \n}\n" @@ -149,8 +157,9 @@ mod not_found { #[test] fn not_a_map() { assert_eq!( - runner().ok("@use \'sass:map\';\ - \na {b: inspect(map.deep-remove((c: (d: e)), c, d, e))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-remove((c: (d: e)), c, d, e))}\n"), "a {\ \n b: (c: (d: e));\ \n}\n" @@ -159,8 +168,9 @@ mod not_found { #[test] fn top_level() { assert_eq!( - runner().ok("@use \'sass:map\';\ - \na {b: inspect(map.deep-remove((c: d), d))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \'sass:map\';\ + \na {b: meta.inspect(map.deep-remove((c: d), d))}\n"), "a {\ \n b: (c: d);\ \n}\n" diff --git a/rsass/tests/spec/core_functions/map/get.rs b/rsass/tests/spec/core_functions/map/get.rs index 9d6011115..0124aa660 100644 --- a/rsass/tests/spec/core_functions/map/get.rs +++ b/rsass/tests/spec/core_functions/map/get.rs @@ -12,17 +12,20 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: map-get(1)}\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.get(1)}\n" + ), "Error: Missing argument $key.\ \n ,--> input.scss\ - \n1 | a {b: map-get(1)}\ + \n2 | a {b: map.get(1)}\ \n | ^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:map\ \n1 | @function get($map, $key, $keys...) {\ \n | ========================= declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod test_type { @@ -32,16 +35,34 @@ mod error { #[test] fn map() { assert_eq!( - runner().err("a {b: map-get(1, 2)}\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.get(1, 2)}\n" + ), "Error: $map: 1 is not a map.\ \n ,\ - \n1 | a {b: map-get(1, 2)}\ + \n2 | a {b: map.get(1, 2)}\ \n | ^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } + #[test] + fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:map\";\ + \na {b: map.map-get((c: d), c)}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: map.map-get((c: d), c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } } mod found { #[allow(unused)] @@ -50,7 +71,8 @@ mod found { #[test] fn first() { assert_eq!( - runner().ok("a {b: map-get((1: 2, 3: 4, 5: 6), 1)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.get((1: 2, 3: 4, 5: 6), 1)}\n"), "a {\ \n b: 2;\ \n}\n" @@ -59,7 +81,8 @@ mod found { #[test] fn last() { assert_eq!( - runner().ok("a {b: map-get((1: 2, 3: 4, 5: 6), 5)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.get((1: 2, 3: 4, 5: 6), 5)}\n"), "a {\ \n b: 6;\ \n}\n" @@ -68,7 +91,8 @@ mod found { #[test] fn middle() { assert_eq!( - runner().ok("a {b: map-get((1: 2, 3: 4, 5: 6), 3)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.get((1: 2, 3: 4, 5: 6), 3)}\n"), "a {\ \n b: 4;\ \n}\n" @@ -77,7 +101,8 @@ mod found { #[test] fn single() { assert_eq!( - runner().ok("a {b: map-get((c: d), c)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.get((c: d), c)}\n"), "a {\ \n b: d;\ \n}\n" @@ -87,7 +112,8 @@ mod found { #[test] fn named() { assert_eq!( - runner().ok("a {b: map-get($map: (c: d), $key: c)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.get($map: (c: d), $key: c)}\n"), "a {\ \n b: d;\ \n}\n" @@ -104,7 +130,8 @@ mod nested { #[test] fn full_path() { assert_eq!( - runner().ok("a {b: map-get((c: (d: (e: f))), c, d, e)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.get((c: (d: (e: f))), c, d, e)}\n"), "a {\ \n b: f;\ \n}\n" @@ -113,8 +140,9 @@ mod nested { #[test] fn partial_path() { assert_eq!( - runner() - .ok("a {b: inspect(map-get((c: (d: (e: f))), c, d))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.get((c: (d: (e: f))), c, d))}\n"), "a {\ \n b: (e: f);\ \n}\n" @@ -128,9 +156,9 @@ mod nested { #[test] fn deep() { assert_eq!( - runner().ok( - "a {b: inspect(map-get((c: (d: (e: f))), c, d, g))}\n" - ), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.get((c: (d: (e: f))), c, d, g))}\n"), "a {\ \n b: null;\ \n}\n" @@ -139,9 +167,9 @@ mod nested { #[test] fn too_many_keys() { assert_eq!( - runner().ok( - "a {b: inspect(map-get((c: (d: (e: f))), c, d, e, f))}\n" - ), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.get((c: (d: (e: f))), c, d, e, f))}\n"), "a {\ \n b: null;\ \n}\n" @@ -150,7 +178,9 @@ mod nested { #[test] fn top_level() { assert_eq!( - runner().ok("a {b: inspect(map-get((c: (d: (e: f))), d))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.get((c: (d: (e: f))), d))}\n"), "a {\ \n b: null;\ \n}\n" @@ -165,7 +195,9 @@ mod not_found { #[test] fn dash_sensitive() { assert_eq!( - runner().ok("a {b: inspect(map-get((c-d: e), c_d))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.get((c-d: e), c_d))}\n"), "a {\ \n b: null;\ \n}\n" @@ -174,7 +206,9 @@ mod not_found { #[test] fn empty() { assert_eq!( - runner().ok("a {b: inspect(map-get((), 1))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.get((), 1))}\n"), "a {\ \n b: null;\ \n}\n" @@ -183,7 +217,9 @@ mod not_found { #[test] fn non_empty() { assert_eq!( - runner().ok("a {b: inspect(map-get((c: d), d))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.get((c: d), d))}\n"), "a {\ \n b: null;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/map/has_key.rs b/rsass/tests/spec/core_functions/map/has_key.rs index aad9f0107..9425a4ebc 100644 --- a/rsass/tests/spec/core_functions/map/has_key.rs +++ b/rsass/tests/spec/core_functions/map/has_key.rs @@ -12,17 +12,20 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: map-has-key(1)}\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.has-key(1)}\n" + ), "Error: Missing argument $key.\ \n ,--> input.scss\ - \n1 | a {b: map-has-key(1)}\ + \n2 | a {b: map.has-key(1)}\ \n | ^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:map\ \n1 | @function has-key($map, $key, $keys...) {\ \n | ============================= declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod test_type { @@ -32,16 +35,34 @@ mod error { #[test] fn map() { assert_eq!( - runner().err("a {b: map-has-key(1, 2)}\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.has-key(1, 2)}\n" + ), "Error: $map: 1 is not a map.\ \n ,\ - \n1 | a {b: map-has-key(1, 2)}\ + \n2 | a {b: map.has-key(1, 2)}\ \n | ^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } + #[test] + fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:map\";\ + \na {b: map.map-has-key((c: d), c)}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: map.map-has-key((c: d), c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } } mod found { #[allow(unused)] @@ -50,7 +71,8 @@ mod found { #[test] fn first() { assert_eq!( - runner().ok("a {b: map-has-key((1: 2, 3: 4, 5: 6), 1)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.has-key((1: 2, 3: 4, 5: 6), 1)}\n"), "a {\ \n b: true;\ \n}\n" @@ -59,7 +81,8 @@ mod found { #[test] fn last() { assert_eq!( - runner().ok("a {b: map-has-key((1: 2, 3: 4, 5: 6), 5)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.has-key((1: 2, 3: 4, 5: 6), 5)}\n"), "a {\ \n b: true;\ \n}\n" @@ -68,7 +91,8 @@ mod found { #[test] fn middle() { assert_eq!( - runner().ok("a {b: map-has-key((1: 2, 3: 4, 5: 6), 3)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.has-key((1: 2, 3: 4, 5: 6), 3)}\n"), "a {\ \n b: true;\ \n}\n" @@ -77,7 +101,8 @@ mod found { #[test] fn single() { assert_eq!( - runner().ok("a {b: map-has-key((c: d), c)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.has-key((c: d), c)}\n"), "a {\ \n b: true;\ \n}\n" @@ -87,7 +112,8 @@ mod found { #[test] fn named() { assert_eq!( - runner().ok("a {b: map-has-key($map: (c: d), $key: c)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.has-key($map: (c: d), $key: c)}\n"), "a {\ \n b: true;\ \n}\n" @@ -104,8 +130,8 @@ mod nested { #[test] fn full_path() { assert_eq!( - runner() - .ok("a {b: map-has-key((c: (d: (e: f))), c, d, e)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.has-key((c: (d: (e: f))), c, d, e)}\n"), "a {\ \n b: true;\ \n}\n" @@ -114,7 +140,8 @@ mod nested { #[test] fn partial_path() { assert_eq!( - runner().ok("a {b: map-has-key((c: (d: (e: f))), c, d)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.has-key((c: (d: (e: f))), c, d)}\n"), "a {\ \n b: true;\ \n}\n" @@ -128,8 +155,8 @@ mod nested { #[test] fn deep() { assert_eq!( - runner() - .ok("a {b: map-has-key((c: (d: (e: f))), c, d, g)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.has-key((c: (d: (e: f))), c, d, g)}\n"), "a {\ \n b: false;\ \n}\n" @@ -138,8 +165,8 @@ mod nested { #[test] fn too_many_keys() { assert_eq!( - runner() - .ok("a {b: map-has-key((c: (d: (e: f))), c, d, e, f)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.has-key((c: (d: (e: f))), c, d, e, f)}\n"), "a {\ \n b: false;\ \n}\n" @@ -148,7 +175,8 @@ mod nested { #[test] fn top_level() { assert_eq!( - runner().ok("a {b: map-has-key((c: (d: (e: f))), d)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.has-key((c: (d: (e: f))), d)}\n"), "a {\ \n b: false;\ \n}\n" @@ -163,7 +191,8 @@ mod not_found { #[test] fn empty() { assert_eq!( - runner().ok("a {b: map-has-key((), 1)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.has-key((), 1)}\n"), "a {\ \n b: false;\ \n}\n" @@ -172,7 +201,8 @@ mod not_found { #[test] fn non_empty() { assert_eq!( - runner().ok("a {b: map-has-key((c: d), d)}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.has-key((c: d), d)}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/map/keys.rs b/rsass/tests/spec/core_functions/map/keys.rs index b678c7b40..36be700ce 100644 --- a/rsass/tests/spec/core_functions/map/keys.rs +++ b/rsass/tests/spec/core_functions/map/keys.rs @@ -8,10 +8,13 @@ fn runner() -> crate::TestRunner { #[test] fn empty() { assert_eq!( - runner().ok("$result: map-keys(());\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \n$result: map.keys(());\ \na {\ - \n value: inspect($result);\ - \n separator: list-separator($result);\ + \n value: meta.inspect($result);\ + \n separator: list.separator($result);\ \n}\n"), "a {\ \n value: ();\ @@ -26,52 +29,77 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: map-keys()}\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.keys()}\n" + ), "Error: Missing argument $map.\ \n ,--> input.scss\ - \n1 | a {b: map-keys()}\ + \n2 | a {b: map.keys()}\ \n | ^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:map\ \n1 | @function keys($map) {\ \n | ========== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: map-keys((c: d), (e: f))}\n\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.keys((c: d), (e: f))}\n\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: map-keys((c: d), (e: f))}\ + \n2 | a {b: map.keys((c: d), (e: f))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:map\ \n1 | @function keys($map) {\ \n | ========== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: map-keys(1)}\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.keys(1)}\n" + ), "Error: $map: 1 is not a map.\ \n ,\ - \n1 | a {b: map-keys(1)}\ + \n2 | a {b: map.keys(1)}\ \n | ^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:map\";\ + \na {b: map.map-keys((c: d))}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: map.map-keys((c: d))}\ + \n | ^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", ); } } #[test] fn multiple() { assert_eq!( - runner().ok("a {b: map-keys((c: d, e: f, g: h))}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.keys((c: d, e: f, g: h))}\n"), "a {\ \n b: c, e, g;\ \n}\n" @@ -80,7 +108,8 @@ fn multiple() { #[test] fn named() { assert_eq!( - runner().ok("a {b: map-keys($map: (1: 2, 3: 4))}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.keys($map: (1: 2, 3: 4))}\n"), "a {\ \n b: 1, 3;\ \n}\n" @@ -89,11 +118,14 @@ fn named() { #[test] fn single() { assert_eq!( - runner().ok("$result: map-keys((1: 2));\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \n$result: map.keys((1: 2));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ - \n separator: list-separator($result);\ + \n type: meta.type-of($result);\ + \n separator: list.separator($result);\ \n}\n"), "a {\ \n value: 1;\ diff --git a/rsass/tests/spec/core_functions/map/merge.rs b/rsass/tests/spec/core_functions/map/merge.rs index 8bae1c540..0efeb3165 100644 --- a/rsass/tests/spec/core_functions/map/merge.rs +++ b/rsass/tests/spec/core_functions/map/merge.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn different_keys() { assert_eq!( - runner() - .ok("a {b: inspect(map-merge((c: d, e: f), (1: 2, 3: 4)))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.merge((c: d, e: f), (1: 2, 3: 4)))}\n"), "a {\ \n b: (c: d, e: f, 1: 2, 3: 4);\ \n}\n" @@ -22,7 +23,9 @@ mod empty { #[test] fn both() { assert_eq!( - runner().ok("a {b: inspect(map-merge((), ()))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.merge((), ()))}\n"), "a {\ \n b: ();\ \n}\n" @@ -31,7 +34,9 @@ mod empty { #[test] fn first() { assert_eq!( - runner().ok("a {b: inspect(map-merge((), (c: d, e: f)))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.merge((), (c: d, e: f)))}\n"), "a {\ \n b: (c: d, e: f);\ \n}\n" @@ -40,7 +45,9 @@ mod empty { #[test] fn second() { assert_eq!( - runner().ok("a {b: inspect(map-merge((c: d, e: f), ()))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.merge((c: d, e: f), ()))}\n"), "a {\ \n b: (c: d, e: f);\ \n}\n" @@ -54,13 +61,16 @@ mod error { #[test] fn one_arg() { assert_eq!( - runner().err("a {b: map-merge((c: d))}\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.merge((c: d))}\n" + ), "Error: Expected $args to contain a key.\ \n ,\ - \n1 | a {b: map-merge((c: d))}\ + \n2 | a {b: map.merge((c: d))}\ \n | ^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod test_type { @@ -70,25 +80,31 @@ mod error { #[test] fn map1() { assert_eq!( - runner().err("a {b: map-merge(1, (c: d))}\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.merge(1, (c: d))}\n" + ), "Error: $map1: 1 is not a map.\ \n ,\ - \n1 | a {b: map-merge(1, (c: d))}\ + \n2 | a {b: map.merge(1, (c: d))}\ \n | ^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn map2() { assert_eq!( - runner().err("a {b: map-merge((c: d), 1)}\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.merge((c: d), 1)}\n" + ), "Error: $map2: 1 is not a map.\ \n ,\ - \n1 | a {b: map-merge((c: d), 1)}\ + \n2 | a {b: map.merge((c: d), 1)}\ \n | ^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod nested { @@ -98,51 +114,78 @@ mod error { #[test] fn map1() { assert_eq!( - runner().err("a {b: map-merge(1, c, (d: e))}\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.merge(1, c, (d: e))}\n" + ), "Error: $map1: 1 is not a map.\ \n ,\ - \n1 | a {b: map-merge(1, c, (d: e))}\ + \n2 | a {b: map.merge(1, c, (d: e))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn map2() { assert_eq!( - runner().err("a {b: map-merge((c: d), e, 1)}\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.merge((c: d), e, 1)}\n" + ), "Error: $map2: 1 is not a map.\ \n ,\ - \n1 | a {b: map-merge((c: d), e, 1)}\ + \n2 | a {b: map.merge((c: d), e, 1)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } } #[test] + fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:map\";\ + \na {b: map.map-merge((c: d), (1: 2))}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: map.map-merge((c: d), (1: 2))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } + #[test] fn zero_args() { assert_eq!( - runner().err("a {b: map-merge()}\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.merge()}\n" + ), "Error: Missing argument $map1.\ \n ,--> input.scss\ - \n1 | a {b: map-merge()}\ + \n2 | a {b: map.merge()}\ \n | ^^^^^^^^^^^ invocation\ \n \'\ \n ,\ \n1 | @function merge($map1, $args...) {\ \n | ====================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn named() { assert_eq!( - runner() - .ok("a {b: inspect(map-merge($map1: (c: d), $map2: (1: 2)))}\n"), + runner().ok( + "@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.merge($map1: (c: d), $map2: (1: 2)))}\n" + ), "a {\ \n b: (c: d, 1: 2);\ \n}\n" @@ -156,7 +199,9 @@ mod nested { fn different_keys() { assert_eq!( runner().ok( - "a {b: inspect(map-merge((c: (d: e, f: g)), c, (1: 2, 3: 4)))}\n" + "@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.merge((c: (d: e, f: g)), c, (1: 2, 3: 4)))}\n" ), "a {\ \n b: (c: (d: e, f: g, 1: 2, 3: 4));\ @@ -170,7 +215,9 @@ mod nested { #[test] fn both() { assert_eq!( - runner().ok("a {b: inspect(map-merge((c: ()), c, ()))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.merge((c: ()), c, ()))}\n"), "a {\ \n b: (c: ());\ \n}\n" @@ -179,9 +226,9 @@ mod nested { #[test] fn first() { assert_eq!( - runner().ok( - "a {b: inspect(map-merge((c: ()), c, (d: e, f: g)))}\n" - ), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.merge((c: ()), c, (d: e, f: g)))}\n"), "a {\ \n b: (c: (d: e, f: g));\ \n}\n" @@ -190,9 +237,9 @@ mod nested { #[test] fn second() { assert_eq!( - runner().ok( - "a {b: inspect(map-merge((c: (d: e, f: g)), c, ()))}\n" - ), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.merge((c: (d: e, f: g)), c, ()))}\n"), "a {\ \n b: (c: (d: e, f: g));\ \n}\n" @@ -202,7 +249,9 @@ mod nested { #[test] fn intermediate_value_is_not_a_map() { assert_eq!( - runner().ok("a {b: inspect(map-merge((c: 1), c, d, (e: f)))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.merge((c: 1), c, d, (e: f)))}\n"), "a {\ \n b: (c: (d: (e: f)));\ \n}\n" @@ -211,7 +260,9 @@ mod nested { #[test] fn leaf_value_is_not_a_map() { assert_eq!( - runner().ok("a {b: inspect(map-merge((c: 1), c, (d: e)))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.merge((c: 1), c, (d: e)))}\n"), "a {\ \n b: (c: (d: e));\ \n}\n" @@ -221,7 +272,9 @@ mod nested { fn multiple_keys() { assert_eq!( runner().ok( - "a {b: inspect(map-merge((c: (d: (e: (f: (g: h))))), c, d, e, f, (g: 1)))}\n" + "@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.merge((c: (d: (e: (f: (g: h))))), c, d, e, f, (g: 1)))}\n" ), "a {\ \n b: (c: (d: (e: (f: (g: 1)))));\ @@ -232,7 +285,9 @@ mod nested { fn overlapping_keys() { assert_eq!( runner().ok( - "a {b: inspect(map-merge((c: (d: e, f: g, h: i)), c, (j: 1, f: 2, k: 3)))}\n" + "@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.merge((c: (d: e, f: g, h: i)), c, (j: 1, f: 2, k: 3)))}\n" ), "a {\ \n b: (c: (d: e, f: 2, h: i, j: 1, k: 3));\ @@ -243,7 +298,9 @@ mod nested { fn same_keys() { assert_eq!( runner().ok( - "a {b: inspect(map-merge((c: (d: e, f: g)), c, (d: 1, f: 2)))}\n" + "@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.merge((c: (d: e, f: g)), c, (d: 1, f: 2)))}\n" ), "a {\ \n b: (c: (d: 1, f: 2));\ @@ -255,7 +312,9 @@ mod nested { fn overlapping_keys() { assert_eq!( runner().ok( - "a {b: inspect(map-merge((c: d, e: f, g: h), (i: 1, e: 2, j: 3)))}\n" + "@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.merge((c: d, e: f, g: h), (i: 1, e: 2, j: 3)))}\n" ), "a {\ \n b: (c: d, e: 2, g: h, i: 1, j: 3);\ @@ -265,8 +324,9 @@ fn overlapping_keys() { #[test] fn same_keys() { assert_eq!( - runner() - .ok("a {b: inspect(map-merge((c: d, e: f), (c: 1, e: 2)))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.merge((c: d, e: f), (c: 1, e: 2)))}\n"), "a {\ \n b: (c: 1, e: 2);\ \n}\n" diff --git a/rsass/tests/spec/core_functions/map/remove.rs b/rsass/tests/spec/core_functions/map/remove.rs index 02868be7f..f87d6eb46 100644 --- a/rsass/tests/spec/core_functions/map/remove.rs +++ b/rsass/tests/spec/core_functions/map/remove.rs @@ -12,30 +12,36 @@ mod error { #[test] fn positional_and_named() { assert_eq!( - runner().err("a {b: map-remove((c: d, e: f), c, $key: e)}\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.remove((c: d, e: f), c, $key: e)}\n" + ), "Error: Argument $key was passed both by position and by name.\ \n ,\ - \n1 | a {b: map-remove((c: d, e: f), c, $key: e)}\ + \n2 | a {b: map.remove((c: d, e: f), c, $key: e)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] #[ignore] // wrong error fn too_few_args() { assert_eq!( - runner().err("a {b: map-remove()}\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.remove()}\n" + ), "Error: Missing argument $map.\ \n ,--> input.scss\ - \n1 | a {b: map-remove()}\ + \n2 | a {b: map.remove()}\ \n | ^^^^^^^^^^^^ invocation\ \n \'\ \n ,\ \n1 | @function remove($map) {\ \n | ============ declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod test_type { @@ -45,16 +51,34 @@ mod error { #[test] fn map() { assert_eq!( - runner().err("a {b: map-remove(1)}\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.remove(1)}\n" + ), "Error: $map: 1 is not a map.\ \n ,\ - \n1 | a {b: map-remove(1)}\ + \n2 | a {b: map.remove(1)}\ \n | ^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } + #[test] + fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:map\";\ + \na {b: map.map-remove((c: d), c)}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: map.map-remove((c: d), c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } } mod found { #[allow(unused)] @@ -63,8 +87,9 @@ mod found { #[test] fn first() { assert_eq!( - runner() - .ok("a {b: inspect(map-remove((1: 2, 3: 4, 5: 6), 1))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.remove((1: 2, 3: 4, 5: 6), 1))}\n"), "a {\ \n b: (3: 4, 5: 6);\ \n}\n" @@ -73,8 +98,9 @@ mod found { #[test] fn last() { assert_eq!( - runner() - .ok("a {b: inspect(map-remove((1: 2, 3: 4, 5: 6), 5))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.remove((1: 2, 3: 4, 5: 6), 5))}\n"), "a {\ \n b: (1: 2, 3: 4);\ \n}\n" @@ -83,8 +109,9 @@ mod found { #[test] fn middle() { assert_eq!( - runner() - .ok("a {b: inspect(map-remove((1: 2, 3: 4, 5: 6), 3))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.remove((1: 2, 3: 4, 5: 6), 3))}\n"), "a {\ \n b: (1: 2, 5: 6);\ \n}\n" @@ -98,7 +125,9 @@ mod found { fn all() { assert_eq!( runner().ok( - "a {b: inspect(map-remove((1: 2, 3: 4, 5: 6, 7: 8, 9: 10), 1, 5, 9))}\n" + "@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.remove((1: 2, 3: 4, 5: 6, 7: 8, 9: 10), 1, 5, 9))}\n" ), "a {\ \n b: (3: 4, 7: 8);\ @@ -109,7 +138,9 @@ mod found { fn some() { assert_eq!( runner().ok( - "a {b: inspect(map-remove((1: 2, 3: 4, 5: 6, 7: 8), 1, 5, 9))}\n" + "@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.remove((1: 2, 3: 4, 5: 6, 7: 8), 1, 5, 9))}\n" ), "a {\ \n b: (3: 4, 7: 8);\ @@ -120,7 +151,9 @@ mod found { #[test] fn single() { assert_eq!( - runner().ok("a {b: inspect(map-remove((c: d), c))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.remove((c: d), c))}\n"), "a {\ \n b: ();\ \n}\n" @@ -130,7 +163,9 @@ mod found { #[test] fn named() { assert_eq!( - runner().ok("a {b: inspect(map-remove($map: (c: d), $key: c))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.remove($map: (c: d), $key: c))}\n"), "a {\ \n b: ();\ \n}\n" @@ -143,7 +178,9 @@ mod not_found { #[test] fn empty() { assert_eq!( - runner().ok("a {b: inspect(map-remove((), 1))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.remove((), 1))}\n"), "a {\ \n b: ();\ \n}\n" @@ -152,7 +189,9 @@ mod not_found { #[test] fn multiple() { assert_eq!( - runner().ok("a {b: inspect(map-remove((c: d), e, f, g))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.remove((c: d), e, f, g))}\n"), "a {\ \n b: (c: d);\ \n}\n" @@ -161,7 +200,9 @@ mod not_found { #[test] fn no_keys() { assert_eq!( - runner().ok("a {b: inspect(map-remove((c: d)))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.remove((c: d)))}\n"), "a {\ \n b: (c: d);\ \n}\n" @@ -170,7 +211,9 @@ mod not_found { #[test] fn non_empty() { assert_eq!( - runner().ok("a {b: inspect(map-remove((c: d), d))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.inspect(map.remove((c: d), d))}\n"), "a {\ \n b: (c: d);\ \n}\n" diff --git a/rsass/tests/spec/core_functions/map/set.rs b/rsass/tests/spec/core_functions/map/set.rs index 9be6e2ba3..8ef83b986 100644 --- a/rsass/tests/spec/core_functions/map/set.rs +++ b/rsass/tests/spec/core_functions/map/set.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn empty() { assert_eq!( - runner().ok("@use \"sass:map\";\ - \na {b: inspect(map.set((), c, d))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:map\";\ + \na {b: meta.inspect(map.set((), c, d))}\n"), "a {\ \n b: (c: d);\ \n}\n" @@ -87,8 +88,11 @@ mod error { #[test] fn named() { assert_eq!( - runner().ok("@use \"sass:map\";\ - \na {b: inspect(map.set($map: (c: d), $key: c, $value: e))}\n"), + runner().ok( + "@use \"sass:meta\";\ + \n@use \"sass:map\";\ + \na {b: meta.inspect(map.set($map: (c: d), $key: c, $value: e))}\n" + ), "a {\ \n b: (c: e);\ \n}\n" @@ -101,8 +105,9 @@ mod nested { #[test] fn empty() { assert_eq!( - runner().ok("@use \"sass:map\";\ - \na {b: inspect(map.set((c: ()), c, d, e, f))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:map\";\ + \na {b: meta.inspect(map.set((c: ()), c, d, e, f))}\n"), "a {\ \n b: (c: (d: (e: f)));\ \n}\n" @@ -112,8 +117,9 @@ mod nested { fn long() { assert_eq!( runner().ok( - "@use \"sass:map\";\ - \na {b: inspect(map.set((c: (d: (e: (f: (g: h))))), c, d, e, f, g, i))}\n" + "@use \"sass:meta\";\ + \n@use \"sass:map\";\ + \na {b: meta.inspect(map.set((c: (d: (e: (f: (g: h))))), c, d, e, f, g, i))}\n" ), "a {\ \n b: (c: (d: (e: (f: (g: i)))));\ @@ -123,8 +129,9 @@ mod nested { #[test] fn new_key() { assert_eq!( - runner().ok("@use \"sass:map\";\ - \na {b: inspect(map.set((c: (d: e)), c, f, g))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:map\";\ + \na {b: meta.inspect(map.set((c: (d: e)), c, f, g))}\n"), "a {\ \n b: (c: (d: e, f: g));\ \n}\n" @@ -133,8 +140,9 @@ mod nested { #[test] fn update_existing_key() { assert_eq!( - runner().ok("@use \"sass:map\";\ - \na {b: inspect(map.set((c: (d: e)), c, d, f))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:map\";\ + \na {b: meta.inspect(map.set((c: (d: e)), c, d, f))}\n"), "a {\ \n b: (c: (d: f));\ \n}\n" @@ -143,8 +151,9 @@ mod nested { #[test] fn value_is_not_a_map() { assert_eq!( - runner().ok("@use \"sass:map\";\ - \na {b: inspect(map.set((c: 1), c, d, f))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:map\";\ + \na {b: meta.inspect(map.set((c: 1), c, d, f))}\n"), "a {\ \n b: (c: (d: f));\ \n}\n" @@ -154,8 +163,9 @@ mod nested { #[test] fn new_key() { assert_eq!( - runner().ok("@use \"sass:map\";\ - \na {b: inspect(map.set((c: d), e, f))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:map\";\ + \na {b: meta.inspect(map.set((c: d), e, f))}\n"), "a {\ \n b: (c: d, e: f);\ \n}\n" @@ -164,8 +174,9 @@ fn new_key() { #[test] fn update_existing_key() { assert_eq!( - runner().ok("@use \"sass:map\";\ - \na {b: inspect(map.set((c: d), c, e))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:map\";\ + \na {b: meta.inspect(map.set((c: d), c, e))}\n"), "a {\ \n b: (c: e);\ \n}\n" diff --git a/rsass/tests/spec/core_functions/map/values.rs b/rsass/tests/spec/core_functions/map/values.rs index 5d4bdbeb6..99731e9f5 100644 --- a/rsass/tests/spec/core_functions/map/values.rs +++ b/rsass/tests/spec/core_functions/map/values.rs @@ -8,10 +8,13 @@ fn runner() -> crate::TestRunner { #[test] fn empty() { assert_eq!( - runner().ok("$result: map-values(());\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \n$result: map.values(());\ \na {\ - \n value: inspect($result);\ - \n separator: list-separator($result);\ + \n value: meta.inspect($result);\ + \n separator: list.separator($result);\ \n}\n"), "a {\ \n value: ();\ @@ -26,52 +29,77 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: map-values()}\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.values()}\n" + ), "Error: Missing argument $map.\ \n ,--> input.scss\ - \n1 | a {b: map-values()}\ + \n2 | a {b: map.values()}\ \n | ^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:map\ \n1 | @function values($map) {\ \n | ============ declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: map-values((c: d), (e: f))}\n\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.values((c: d), (e: f))}\n\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: map-values((c: d), (e: f))}\ + \n2 | a {b: map.values((c: d), (e: f))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:map\ \n1 | @function values($map) {\ \n | ============ declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: map-values(1)}\n"), + runner().err( + "@use \"sass:map\";\ + \na {b: map.values(1)}\n" + ), "Error: $map: 1 is not a map.\ \n ,\ - \n1 | a {b: map-values(1)}\ + \n2 | a {b: map.values(1)}\ \n | ^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:map\";\ + \na {b: map.map-values((c: d))}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: map.map-values((c: d))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", ); } } #[test] fn multiple() { assert_eq!( - runner().ok("a {b: map-values((c: d, e: f, g: h))}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.values((c: d, e: f, g: h))}\n"), "a {\ \n b: d, f, h;\ \n}\n" @@ -80,7 +108,8 @@ fn multiple() { #[test] fn named() { assert_eq!( - runner().ok("a {b: map-values($map: (1: 2, 3: 4))}\n"), + runner().ok("@use \"sass:map\";\ + \na {b: map.values($map: (1: 2, 3: 4))}\n"), "a {\ \n b: 2, 4;\ \n}\n" @@ -89,11 +118,14 @@ fn named() { #[test] fn single() { assert_eq!( - runner().ok("$result: map-values((1: 2));\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \n$result: map.values((1: 2));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ - \n separator: list-separator($result);\ + \n type: meta.type-of($result);\ + \n separator: list.separator($result);\ \n}\n"), "a {\ \n value: 2;\ diff --git a/rsass/tests/spec/core_functions/math/ceil.rs b/rsass/tests/spec/core_functions/math/ceil.rs index 24cc804c0..7edbb4ddd 100644 --- a/rsass/tests/spec/core_functions/math/ceil.rs +++ b/rsass/tests/spec/core_functions/math/ceil.rs @@ -12,52 +12,62 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: ceil()}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.ceil()}\n" + ), "Error: Missing argument $number.\ \n ,--> input.scss\ - \n1 | a {b: ceil()}\ - \n | ^^^^^^ invocation\ + \n2 | a {b: math.ceil()}\ + \n | ^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:math\ \n1 | @function ceil($number) {\ \n | ============= declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: ceil(1, 2)}\n\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.ceil(1, 2)}\n\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: ceil(1, 2)}\ - \n | ^^^^^^^^^^ invocation\ + \n2 | a {b: math.ceil(1, 2)}\ + \n | ^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:math\ \n1 | @function ceil($number) {\ \n | ============= declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: ceil(c)}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.ceil(c)}\n" + ), "Error: $number: c is not a number.\ \n ,\ - \n1 | a {b: ceil(c)}\ - \n | ^^^^^^^\ + \n2 | a {b: math.ceil(c)}\ + \n | ^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn high() { assert_eq!( - runner().ok("a {b: ceil(2.9)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.ceil(2.9)}\n"), "a {\ \n b: 3;\ \n}\n" @@ -66,7 +76,8 @@ fn high() { #[test] fn integer() { assert_eq!( - runner().ok("a {b: ceil(1)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.ceil(1)}\n"), "a {\ \n b: 1;\ \n}\n" @@ -75,7 +86,8 @@ fn integer() { #[test] fn low() { assert_eq!( - runner().ok("a {b: ceil(6.000000000000001)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.ceil(6.000000000000001)}\n"), "a {\ \n b: 7;\ \n}\n" @@ -84,7 +96,8 @@ fn low() { #[test] fn named() { assert_eq!( - runner().ok("a {b: ceil($number: 1.6)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.ceil($number: 1.6)}\n"), "a {\ \n b: 2;\ \n}\n" @@ -93,7 +106,8 @@ fn named() { #[test] fn negative() { assert_eq!( - runner().ok("a {b: ceil(-7.6)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.ceil(-7.6)}\n"), "a {\ \n b: -7;\ \n}\n" @@ -102,7 +116,8 @@ fn negative() { #[test] fn preserves_units() { assert_eq!( - runner().ok("a {b: ceil(7px / 4em) * 1em}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.ceil(7px / 4em) * 1em}\n"), "a {\ \n b: 2px;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/math/comparable.rs b/rsass/tests/spec/core_functions/math/comparable.rs index e9cbf82ef..7a1508030 100644 --- a/rsass/tests/spec/core_functions/math/comparable.rs +++ b/rsass/tests/spec/core_functions/math/comparable.rs @@ -12,33 +12,39 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: comparable(1)}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.compatible(1)}\n" + ), "Error: Missing argument $number2.\ \n ,--> input.scss\ - \n1 | a {b: comparable(1)}\ - \n | ^^^^^^^^^^^^^ invocation\ + \n2 | a {b: math.compatible(1)}\ + \n | ^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:math\ \n1 | @function compatible($number1, $number2) {\ \n | ============================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: comparable(1, 2, 3)}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.compatible(1, 2, 3)}\n" + ), "Error: Only 2 arguments allowed, but 3 were passed.\ \n ,--> input.scss\ - \n1 | a {b: comparable(1, 2, 3)}\ - \n | ^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: math.compatible(1, 2, 3)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:math\ \n1 | @function compatible($number1, $number2) {\ \n | ============================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod test_type { @@ -48,33 +54,55 @@ mod error { #[test] fn arg_1() { assert_eq!( - runner().err("a {b: comparable(c, 1)}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.compatible(c, 1)}\n" + ), "Error: $number1: c is not a number.\ \n ,\ - \n1 | a {b: comparable(c, 1)}\ - \n | ^^^^^^^^^^^^^^^^\ + \n2 | a {b: math.compatible(c, 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn arg_2() { assert_eq!( - runner().err("a {b: comparable(1, c)}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.compatible(1, c)}\n" + ), "Error: $number2: c is not a number.\ \n ,\ - \n1 | a {b: comparable(1, c)}\ - \n | ^^^^^^^^^^^^^^^^\ + \n2 | a {b: math.compatible(1, c)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } + #[test] + fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:math\";\ + \na {b: math.comparable(1px, 1in)}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: math.comparable(1px, 1in)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } } #[test] fn named() { assert_eq!( - runner().ok("a {b: comparable($number1: 1, $number2: 2)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.compatible($number1: 1, $number2: 2)}\n"), "a {\ \n b: true;\ \n}\n" @@ -87,7 +115,8 @@ mod unit { #[test] fn to_compatible() { assert_eq!( - runner().ok("a {b: comparable(1px, 2in)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.compatible(1px, 2in)}\n"), "a {\ \n b: true;\ \n}\n" @@ -96,7 +125,8 @@ mod unit { #[test] fn to_different() { assert_eq!( - runner().ok("a {b: comparable(1px, 2em)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.compatible(1px, 2em)}\n"), "a {\ \n b: false;\ \n}\n" @@ -105,7 +135,8 @@ mod unit { #[test] fn to_inverse() { assert_eq!( - runner().ok("a {b: comparable(1px, 1/1px)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.compatible(1px, 1/1px)}\n"), "a {\ \n b: false;\ \n}\n" @@ -114,7 +145,8 @@ mod unit { #[test] fn to_same() { assert_eq!( - runner().ok("a {b: comparable(1px, 2px)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.compatible(1px, 2px)}\n"), "a {\ \n b: true;\ \n}\n" @@ -128,7 +160,8 @@ mod unitless { #[test] fn to_unit() { assert_eq!( - runner().ok("a {b: comparable(1, 2px)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.compatible(1, 2px)}\n"), "a {\ \n b: true;\ \n}\n" @@ -137,7 +170,8 @@ mod unitless { #[test] fn to_unitless() { assert_eq!( - runner().ok("a {b: comparable(1, 2)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.compatible(1, 2)}\n"), "a {\ \n b: true;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/math/div.rs b/rsass/tests/spec/core_functions/math/div.rs index d7b386743..a5fd61cd5 100644 --- a/rsass/tests/spec/core_functions/math/div.rs +++ b/rsass/tests/spec/core_functions/math/div.rs @@ -55,11 +55,12 @@ mod non_numeric { #[test] fn denominator() { assert_eq!( - runner().ok("@use \"sass:math\";\ + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:math\";\ \na {\ \n $result: math.div(6, b);\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: 6/b;\ @@ -70,11 +71,12 @@ mod non_numeric { #[test] fn numerator() { assert_eq!( - runner().ok("@use \"sass:math\";\ + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:math\";\ \na {\ \n $result: math.div(b, 3);\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: b/3;\ diff --git a/rsass/tests/spec/core_functions/math/floor.rs b/rsass/tests/spec/core_functions/math/floor.rs index 5f63ed739..5fc7efaf9 100644 --- a/rsass/tests/spec/core_functions/math/floor.rs +++ b/rsass/tests/spec/core_functions/math/floor.rs @@ -12,52 +12,62 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: floor()}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.floor()}\n" + ), "Error: Missing argument $number.\ \n ,--> input.scss\ - \n1 | a {b: floor()}\ - \n | ^^^^^^^ invocation\ + \n2 | a {b: math.floor()}\ + \n | ^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:math\ \n1 | @function floor($number) {\ \n | ============== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: floor(1, 2)}\n\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.floor(1, 2)}\n\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: floor(1, 2)}\ - \n | ^^^^^^^^^^^ invocation\ + \n2 | a {b: math.floor(1, 2)}\ + \n | ^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:math\ \n1 | @function floor($number) {\ \n | ============== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: floor(c)}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.floor(c)}\n" + ), "Error: $number: c is not a number.\ \n ,\ - \n1 | a {b: floor(c)}\ - \n | ^^^^^^^^\ + \n2 | a {b: math.floor(c)}\ + \n | ^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn high() { assert_eq!( - runner().ok("a {b: floor(2.999999999999999)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.floor(2.999999999999999)}\n"), "a {\ \n b: 2;\ \n}\n" @@ -66,7 +76,8 @@ fn high() { #[test] fn integer() { assert_eq!( - runner().ok("a {b: floor(1)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.floor(1)}\n"), "a {\ \n b: 1;\ \n}\n" @@ -75,7 +86,8 @@ fn integer() { #[test] fn low() { assert_eq!( - runner().ok("a {b: floor(6.1)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.floor(6.1)}\n"), "a {\ \n b: 6;\ \n}\n" @@ -84,7 +96,8 @@ fn low() { #[test] fn named() { assert_eq!( - runner().ok("a {b: floor($number: 1.6)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.floor($number: 1.6)}\n"), "a {\ \n b: 1;\ \n}\n" @@ -93,7 +106,8 @@ fn named() { #[test] fn negative() { assert_eq!( - runner().ok("a {b: floor(-7.2)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.floor(-7.2)}\n"), "a {\ \n b: -8;\ \n}\n" @@ -102,7 +116,8 @@ fn negative() { #[test] fn preserves_units() { assert_eq!( - runner().ok("a {b: floor(7px / 4em) * 1em}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.floor(7px / 4em) * 1em}\n"), "a {\ \n b: 1px;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/math/percentage.rs b/rsass/tests/spec/core_functions/math/percentage.rs index 730f2597e..08ceb2a98 100644 --- a/rsass/tests/spec/core_functions/math/percentage.rs +++ b/rsass/tests/spec/core_functions/math/percentage.rs @@ -12,64 +12,77 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: percentage()}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.percentage()}\n" + ), "Error: Missing argument $number.\ \n ,--> input.scss\ - \n1 | a {b: percentage()}\ - \n | ^^^^^^^^^^^^ invocation\ + \n2 | a {b: math.percentage()}\ + \n | ^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:math\ \n1 | @function percentage($number) {\ \n | =================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: percentage(1, 2)}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.percentage(1, 2)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: percentage(1, 2)}\ - \n | ^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: math.percentage(1, 2)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:math\ \n1 | @function percentage($number) {\ \n | =================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: percentage(c)}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.percentage(c)}\n" + ), "Error: $number: c is not a number.\ \n ,\ - \n1 | a {b: percentage(c)}\ - \n | ^^^^^^^^^^^^^\ + \n2 | a {b: math.percentage(c)}\ + \n | ^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn unit() { assert_eq!( - runner().err("a {b: percentage(1%)}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.percentage(1%)}\n" + ), "Error: $number: Expected 1% to have no units.\ \n ,\ - \n1 | a {b: percentage(1%)}\ - \n | ^^^^^^^^^^^^^^\ + \n2 | a {b: math.percentage(1%)}\ + \n | ^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn integer() { assert_eq!( - runner().ok("a {b: percentage(42)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.percentage(42)}\n"), "a {\ \n b: 4200%;\ \n}\n" @@ -78,7 +91,8 @@ fn integer() { #[test] fn large() { assert_eq!( - runner().ok("a {b: percentage(123.456)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.percentage(123.456)}\n"), "a {\ \n b: 12345.6%;\ \n}\n" @@ -87,7 +101,8 @@ fn large() { #[test] fn named() { assert_eq!( - runner().ok("a {b: percentage($number: 1)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.percentage($number: 1)}\n"), "a {\ \n b: 100%;\ \n}\n" @@ -96,7 +111,8 @@ fn named() { #[test] fn negative() { assert_eq!( - runner().ok("a {b: percentage(-0.4)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.percentage(-0.4)}\n"), "a {\ \n b: -40%;\ \n}\n" @@ -105,7 +121,8 @@ fn negative() { #[test] fn small() { assert_eq!( - runner().ok("a {b: percentage(0.246)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.percentage(0.246)}\n"), "a {\ \n b: 24.6%;\ \n}\n" @@ -114,7 +131,8 @@ fn small() { #[test] fn zero() { assert_eq!( - runner().ok("a {b: percentage(0)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.percentage(0)}\n"), "a {\ \n b: 0%;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/math/random.rs b/rsass/tests/spec/core_functions/math/random.rs index 1e03fd85e..142fea432 100644 --- a/rsass/tests/spec/core_functions/math/random.rs +++ b/rsass/tests/spec/core_functions/math/random.rs @@ -4,7 +4,7 @@ fn runner() -> crate::TestRunner { super::runner() .with_cwd("random") - .mock_file("_util.scss", "// Calls `random()` one thousand times, and throws an error if `$check` returns\n// `false` for any of the values.\n@mixin check-values($arg, $check) {\n @for $i from 1 through 1000 {\n $value: random($arg);\n @if not call($check, $value) {\n @error \"#{$value} did not match expectation\";\n }\n }\n}\n") + .mock_file("_util.scss", "@use \"sass:math\";\n@use \"sass:meta\";\n\n// Calls `random()` one thousand times, and throws an error if `$check` returns\n// `false` for any of the values.\n@mixin check-values($arg, $check) {\n @for $i from 1 through 1000 {\n $value: math.random($arg);\n @if not meta.call($check, $value) {\n @error \"#{$value} did not match expectation\";\n }\n }\n}\n") } mod error { @@ -17,52 +17,64 @@ mod error { fn decimal() { let runner = runner().with_cwd("decimal"); assert_eq!( - runner.err("a {b: random(1.5)}\n"), + runner.err( + "@use \"sass:math\";\ + \na {b: math.random(1.5)}\n" + ), "Error: $limit: 1.5 is not an int.\ \n ,\ - \n1 | a {b: random(1.5)}\ - \n | ^^^^^^^^^^^\ + \n2 | a {b: math.random(1.5)}\ + \n | ^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn negative() { let runner = runner().with_cwd("negative"); assert_eq!( - runner.err("a {b: random(-1)}\n"), + runner.err( + "@use \"sass:math\";\ + \na {b: math.random(-1)}\n" + ), "Error: $limit: Must be greater than 0, was -1.\ \n ,\ - \n1 | a {b: random(-1)}\ - \n | ^^^^^^^^^^\ + \n2 | a {b: math.random(-1)}\ + \n | ^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { let runner = runner().with_cwd("type"); assert_eq!( - runner.err("a {b: random(c)}\n"), + runner.err( + "@use \"sass:math\";\ + \na {b: math.random(c)}\n" + ), "Error: $limit: c is not a number.\ \n ,\ - \n1 | a {b: random(c)}\ - \n | ^^^^^^^^^\ + \n2 | a {b: math.random(c)}\ + \n | ^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn zero() { let runner = runner().with_cwd("zero"); assert_eq!( - runner.err("a {b: random(0)}\n"), + runner.err( + "@use \"sass:math\";\ + \na {b: math.random(0)}\n" + ), "Error: $limit: Must be greater than 0, was 0.\ \n ,\ - \n1 | a {b: random(0)}\ - \n | ^^^^^^^^^\ + \n2 | a {b: math.random(0)}\ + \n | ^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -70,7 +82,8 @@ mod error { fn ignores_units() { let runner = runner().with_cwd("ignores_units"); assert_eq!( - runner.ok("a {b: random(1px)}\n"), + runner.ok("@use \"sass:math\";\ + \na {b: math.random(1px)}\n"), "a {\ \n b: 1;\ \n}\n" @@ -80,7 +93,8 @@ fn ignores_units() { fn named() { let runner = runner().with_cwd("named"); assert_eq!( - runner.ok("$value: random($limit: 10);\ + runner.ok("@use \"sass:math\";\ + \n$value: math.random($limit: 10);\ \na {b: $value > 0 and $value <= 10}\n"), "a {\ \n b: true;\ @@ -91,7 +105,8 @@ fn named() { fn no_arg() { let runner = runner().with_cwd("no_arg"); assert_eq!( - runner.ok("$value: random();\ + runner.ok("@use \"sass:math\";\ + \n$value: math.random();\ \na {b: $value >= 0 and $value < 1}\n"), "a {\ \n b: true;\ @@ -102,9 +117,12 @@ fn no_arg() { fn null() { let runner = runner().with_cwd("null"); assert_eq!( - runner.ok("@import \"../util\";\ + runner.ok( + "@use \"sass:meta\";\ + \n@use \"../util\";\ \n@function check($value) {@return $value >= 0 and $value < 1}\ - \n@include check-values(null, get-function(check));\n"), + \n@include util.check-values(null, meta.get-function(check));\n" + ), "" ); } @@ -112,9 +130,10 @@ fn null() { fn one() { let runner = runner().with_cwd("one"); assert_eq!( - runner.ok("@import \"../util\";\ + runner.ok("@use \"sass:meta\";\ + \n@use \"../util\";\ \n@function check($value) {@return $value == 1}\ - \n@include check-values(1, get-function(check));\n"), + \n@include util.check-values(1, meta.get-function(check));\n"), "" ); } @@ -123,9 +142,11 @@ fn one_hundred() { let runner = runner().with_cwd("one_hundred"); assert_eq!( runner.ok( - "@import \"../util\";\ - \n@function check($value) {@return $value == round($value) and $value > 0 and $value <= 100}\ - \n@include check-values(100, get-function(check));\n" + "@use \"sass:math\";\ + \n@use \"sass:meta\";\ + \n@use \"../util\";\ + \n@function check($value) {@return $value == math.round($value) and $value > 0 and $value <= 100}\ + \n@include util.check-values(100, meta.get-function(check));\n" ), "" ); @@ -134,9 +155,10 @@ fn one_hundred() { fn two() { let runner = runner().with_cwd("two"); assert_eq!( - runner.ok("@import \"../util\";\ + runner.ok("@use \"sass:meta\";\ + \n@use \"../util\";\ \n@function check($value) {@return $value == 1 or $value == 2}\ - \n@include check-values(2, get-function(check));\n"), + \n@include util.check-values(2, meta.get-function(check));\n"), "" ); } @@ -145,8 +167,9 @@ fn within_precision() { let runner = runner().with_cwd("within_precision"); assert_eq!( runner.ok( - "// This is within the precision limit to be considered identical to 1.\ - \na {b: random(1.0000000000001)}\n" + "@use \"sass:math\";\ + \n// This is within the precision limit to be considered identical to 1.\ + \na {b: math.random(1.0000000000001)}\n" ), "a {\ \n b: 1;\ diff --git a/rsass/tests/spec/core_functions/math/unit.rs b/rsass/tests/spec/core_functions/math/unit.rs index 622705aee..c1af190a7 100644 --- a/rsass/tests/spec/core_functions/math/unit.rs +++ b/rsass/tests/spec/core_functions/math/unit.rs @@ -12,52 +12,62 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: unit()}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.unit()}\n" + ), "Error: Missing argument $number.\ \n ,--> input.scss\ - \n1 | a {b: unit()}\ - \n | ^^^^^^ invocation\ + \n2 | a {b: math.unit()}\ + \n | ^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:math\ \n1 | @function unit($number) {\ \n | ============= declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: unit(1, 2)}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.unit(1, 2)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: unit(1, 2)}\ - \n | ^^^^^^^^^^ invocation\ + \n2 | a {b: math.unit(1, 2)}\ + \n | ^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:math\ \n1 | @function unit($number) {\ \n | ============= declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: unit(c)}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.unit(c)}\n" + ), "Error: $number: c is not a number.\ \n ,\ - \n1 | a {b: unit(c)}\ - \n | ^^^^^^^\ + \n2 | a {b: math.unit(c)}\ + \n | ^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn multiple_denominators() { assert_eq!( - runner().ok("a {b: unit(1 / 1px / 3em / 4rad)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.unit(1 / 1px / 3em / 4rad)}\n"), "a {\ \n b: \"(px*em*rad)^-1\";\ \n}\n" @@ -66,7 +76,8 @@ fn multiple_denominators() { #[test] fn multiple_numerators() { assert_eq!( - runner().ok("a {b: unit(1px * 1em * 1rad)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.unit(1px * 1em * 1rad)}\n"), "a {\ \n b: \"px*em*rad\";\ \n}\n" @@ -75,7 +86,8 @@ fn multiple_numerators() { #[test] fn named() { assert_eq!( - runner().ok("a {b: unit($number: 1)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.unit($number: 1)}\n"), "a {\ \n b: \"\";\ \n}\n" @@ -84,7 +96,8 @@ fn named() { #[test] fn none() { assert_eq!( - runner().ok("a {b: unit(1)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.unit(1)}\n"), "a {\ \n b: \"\";\ \n}\n" @@ -97,7 +110,8 @@ mod numerator_and_denominator { #[test] fn multiple() { assert_eq!( - runner().ok("a {b: unit(1px * 1em / 1rad / 1s)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.unit(1px * 1em / 1rad / 1s)}\n"), "a {\ \n b: \"px*em/rad*s\";\ \n}\n" @@ -106,7 +120,8 @@ mod numerator_and_denominator { #[test] fn single() { assert_eq!( - runner().ok("a {b: unit(1px / 1em)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.unit(1px / 1em)}\n"), "a {\ \n b: \"px/em\";\ \n}\n" @@ -116,7 +131,8 @@ mod numerator_and_denominator { #[test] fn one_denominator() { assert_eq!( - runner().ok("a {b: unit(1/1px)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.unit(1/1px)}\n"), "a {\ \n b: \"px^-1\";\ \n}\n" @@ -125,7 +141,8 @@ fn one_denominator() { #[test] fn one_numerator() { assert_eq!( - runner().ok("a {b: unit(1px)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.unit(1px)}\n"), "a {\ \n b: \"px\";\ \n}\n" diff --git a/rsass/tests/spec/core_functions/math/unitless.rs b/rsass/tests/spec/core_functions/math/unitless.rs index c995d67fd..71bf5f879 100644 --- a/rsass/tests/spec/core_functions/math/unitless.rs +++ b/rsass/tests/spec/core_functions/math/unitless.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn denominator() { assert_eq!( - runner().ok("a {b: unitless(1/1px)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.is-unitless(1/1px)}\n"), "a {\ \n b: false;\ \n}\n" @@ -21,52 +22,77 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: unitless()}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.is-unitless()}\n" + ), "Error: Missing argument $number.\ \n ,--> input.scss\ - \n1 | a {b: unitless()}\ - \n | ^^^^^^^^^^ invocation\ + \n2 | a {b: math.is-unitless()}\ + \n | ^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:math\ \n1 | @function is-unitless($number) {\ \n | ==================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: unitless(1, 2)}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.is-unitless(1, 2)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: unitless(1, 2)}\ - \n | ^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: math.is-unitless(1, 2)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:math\ \n1 | @function is-unitless($number) {\ \n | ==================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: unitless(c)}\n"), + runner().err( + "@use \"sass:math\";\ + \na {b: math.is-unitless(c)}\n" + ), "Error: $number: c is not a number.\ \n ,\ - \n1 | a {b: unitless(c)}\ - \n | ^^^^^^^^^^^\ + \n2 | a {b: math.is-unitless(c)}\ + \n | ^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:math\";\ + \na {b: math.unitless(1)}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: math.unitless(1)}\ + \n | ^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", ); } } #[test] fn named() { assert_eq!( - runner().ok("a {b: unitless($number: 100)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.is-unitless($number: 100)}\n"), "a {\ \n b: true;\ \n}\n" @@ -75,7 +101,8 @@ fn named() { #[test] fn numerator() { assert_eq!( - runner().ok("a {b: unitless(1px)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.is-unitless(1px)}\n"), "a {\ \n b: false;\ \n}\n" @@ -84,7 +111,8 @@ fn numerator() { #[test] fn numerator_and_denominator() { assert_eq!( - runner().ok("a {b: unitless(1px/1em)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.is-unitless(1px/1em)}\n"), "a {\ \n b: false;\ \n}\n" @@ -93,7 +121,8 @@ fn numerator_and_denominator() { #[test] fn unitless() { assert_eq!( - runner().ok("a {b: unitless(1)}\n"), + runner().ok("@use \"sass:math\";\ + \na {b: math.is-unitless(1)}\n"), "a {\ \n b: true;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/math/variables.rs b/rsass/tests/spec/core_functions/math/variables.rs index 06f90e0fc..3f8944f33 100644 --- a/rsass/tests/spec/core_functions/math/variables.rs +++ b/rsass/tests/spec/core_functions/math/variables.rs @@ -169,7 +169,6 @@ fn max_safe_integer() { ); } #[test] -#[ignore = "Requires too much precision, last digit may or may not be right."] fn min_number() { assert_eq!( runner().ok( diff --git a/rsass/tests/spec/core_functions/meta/call.rs b/rsass/tests/spec/core_functions/meta/call.rs index 7085e8b91..85636ceeb 100644 --- a/rsass/tests/spec/core_functions/meta/call.rs +++ b/rsass/tests/spec/core_functions/meta/call.rs @@ -13,7 +13,8 @@ mod args { fn named() { assert_eq!( runner().ok( - "a {b: call(get-function(\"rgb\"), $blue: 1, $green: 2, $red: 3)}\n" + "@use \"sass:meta\";\ + \na {b: meta.call(meta.get-function(\"rgb\"), $blue: 1, $green: 2, $red: 3)}\n" ), "a {\ \n b: rgb(3, 2, 1);\ @@ -23,8 +24,9 @@ mod args { #[test] fn none() { assert_eq!( - runner().ok("@function a() {@return b}\ - \nc {d: call(get-function(\"a\"))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@function a() {@return b}\ + \nc {d: meta.call(meta.get-function(\"a\"))}\n"), "c {\ \n d: b;\ \n}\n" @@ -33,7 +35,8 @@ mod args { #[test] fn positional() { assert_eq!( - runner().ok("a {b: call(get-function(\"rgb\"), 1, 2, 3)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.call(meta.get-function(\"rgb\"), 1, 2, 3)}\n"), "a {\ \n b: rgb(1, 2, 3);\ \n}\n" @@ -47,9 +50,10 @@ mod args { fn combined() { assert_eq!( runner().ok( - "$positional: 1 2;\ + "@use \"sass:meta\";\ + \n$positional: 1 2;\ \n$named: (\"blue\": 3);\ - \na {b: call(get-function(\"rgb\"), $positional..., $named...)}\n" + \na {b: meta.call(meta.get-function(\"rgb\"), $positional..., $named...)}\n" ), "a {\ \n b: rgb(1, 2, 3);\ @@ -59,9 +63,9 @@ mod args { #[test] fn named() { assert_eq!( - runner() - .ok("$args: (\"green\": 1, \"blue\": 2, \"red\": 3);\ - \na {b: call(get-function(\"rgb\"), $args...)}\n"), + runner().ok("@use \"sass:meta\";\ + \n$args: (\"green\": 1, \"blue\": 2, \"red\": 3);\ + \na {b: meta.call(meta.get-function(\"rgb\"), $args...)}\n"), "a {\ \n b: rgb(3, 1, 2);\ \n}\n" @@ -70,8 +74,9 @@ mod args { #[test] fn positional() { assert_eq!( - runner().ok("$args: 1, 2, 3;\ - \na {b: call(get-function(\"rgb\"), $args...)}\n"), + runner().ok("@use \"sass:meta\";\ + \n$args: 1, 2, 3;\ + \na {b: meta.call(meta.get-function(\"rgb\"), $args...)}\n"), "a {\ \n b: rgb(1, 2, 3);\ \n}\n" @@ -87,57 +92,68 @@ mod error { fn if_args() { assert_eq!( runner().err( - "// The if() function has a special behavior to avoid evaluating the\ + "@use \"sass:meta\";\ + \n// The if() function has a special behavior to avoid evaluating the\ \n// non-returned argument but that behavior does not propagate to call()\ \n// itself when using call() to call if().\ - \na {b: call(get-function(\"if\"), true, \"\", $undefined)}\n" + \na {b: meta.call(meta.get-function(\"if\"), true, \"\", $undefined)}\n" ), "Error: Undefined variable.\ \n ,\ - \n4 | a {b: call(get-function(\"if\"), true, \"\", $undefined)}\ - \n | ^^^^^^^^^^\ + \n5 | a {b: meta.call(meta.get-function(\"if\"), true, \"\", $undefined)}\ + \n | ^^^^^^^^^^\ \n \'\ - \n input.scss 4:42 root stylesheet", + \n input.scss 5:52 root stylesheet", ); } #[test] + #[ignore] // wrong error fn invalid_args() { assert_eq!( - runner().err("a {b: call(get-function(\"rgb\"), 1)}\n"), - "Error: Missing element $green.\ + runner().err( + "@use \"sass:meta\";\ + \na {b: meta.call(meta.get-function(\"rgb\"), 1)}\n" + ), + "Error: $channels: The rgb color space has 3 channels but 1 has 1.\ \n ,\ - \n1 | a {b: call(get-function(\"rgb\"), 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.call(meta.get-function(\"rgb\"), 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", - ); + \n input.scss 2:7 root stylesheet", + ); } #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: call()}\n"), + runner().err( + "@use \"sass:meta\";\ + \na {b: meta.call()}\n" + ), "Error: Missing argument $function.\ \n ,--> input.scss\ - \n1 | a {b: call()}\ - \n | ^^^^^^ invocation\ + \n2 | a {b: meta.call()}\ + \n | ^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function call($function, $args...) {\ \n | ========================= declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: call(1)}\n"), + runner().err( + "@use \"sass:meta\";\ + \na {b: meta.call(1)}\n" + ), "Error: $function: 1 is not a function reference.\ \n ,\ - \n1 | a {b: call(1)}\ - \n | ^^^^^^^\ + \n2 | a {b: meta.call(1)}\ + \n | ^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -145,7 +161,8 @@ mod error { fn named() { assert_eq!( runner().ok( - "a {b: call($function: get-function(\"rgb\"), $red: 1, $green: 2, $blue: 3)}\n" + "@use \"sass:meta\";\ + \na {b: meta.call($function: meta.get-function(\"rgb\"), $red: 1, $green: 2, $blue: 3)}\n" ), "a {\ \n b: rgb(1, 2, 3);\ @@ -159,7 +176,8 @@ mod string { #[test] fn built_in() { assert_eq!( - runner().ok("a {b: call(\"rgb\", 1, 2, 3)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.call(\"rgb\", 1, 2, 3)}\n"), "a {\ \n b: rgb(1, 2, 3);\ \n}\n" @@ -168,8 +186,9 @@ mod string { #[test] fn local() { assert_eq!( - runner().ok("@function a($arg) {@return $arg + 1}\ - \na {b: call(\"a\", 1)}\n"), + runner().ok("@use \"sass:meta\";\ + \n@function a($arg) {@return $arg + 1}\ + \na {b: meta.call(\"a\", 1)}\n"), "a {\ \n b: 2;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/meta/content_exists.rs b/rsass/tests/spec/core_functions/meta/content_exists.rs index be0c084a1..99e4bab2b 100644 --- a/rsass/tests/spec/core_functions/meta/content_exists.rs +++ b/rsass/tests/spec/core_functions/meta/content_exists.rs @@ -12,9 +12,10 @@ mod controls { #[test] fn test_false() { assert_eq!( - runner().ok("// Regression test for sass/libsass#2842\ + runner().ok("@use \"sass:meta\";\ + \n// Regression test for sass/libsass#2842\ \n@mixin test-content-exists() {\ - \n @if content-exists() {\ + \n @if meta.content-exists() {\ \n @content;\ \n }\ \n @else {\ @@ -32,9 +33,10 @@ mod controls { #[test] fn test_true() { assert_eq!( - runner().ok("// Regression test for sass/libsass#2842\ + runner().ok("@use \"sass:meta\";\ + \n// Regression test for sass/libsass#2842\ \n@mixin test-content-exists() {\ - \n @if content-exists() {\ + \n @if meta.content-exists() {\ \n @content;\ \n }\ \n @else {\ @@ -61,21 +63,22 @@ mod error { fn in_content() { assert_eq!( runner().err( - "@mixin call-content {\ + "@use \"sass:meta\";\ + \n@mixin call-content {\ \n @content;\ \n}\n\ \n@include call-content {\ - \n a {b: content-exists()}\ + \n a {b: meta.content-exists()}\ \n}\n" ), "Error: content-exists() may only be called within a mixin.\ \n ,\ - \n6 | a {b: content-exists()}\ - \n | ^^^^^^^^^^^^^^^^\ + \n7 | a {b: meta.content-exists()}\ + \n | ^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 6:9 @content\ - \n input.scss 2:3 call-content()\ - \n input.scss 5:1 root stylesheet", + \n input.scss 7:9 @content\ + \n input.scss 3:3 call-content()\ + \n input.scss 6:1 root stylesheet", ); } #[test] @@ -83,8 +86,9 @@ mod error { fn in_function_called_by_mixin() { assert_eq!( runner().err( - "@function call-content-exists() {\ - \n @return content-exists();\ + "@use \"sass:meta\";\ + \n@function call-content-exists() {\ + \n @return meta.content-exists();\ \n}\n\ \n@mixin call-function {\ \n a {b: call-content-exists()};\ @@ -93,24 +97,27 @@ mod error { ), "Error: content-exists() may only be called within a mixin.\ \n ,\ - \n2 | @return content-exists();\ - \n | ^^^^^^^^^^^^^^^^\ + \n3 | @return meta.content-exists();\ + \n | ^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 2:11 call-content-exists()\ - \n input.scss 6:9 call-function()\ - \n input.scss 9:1 root stylesheet", + \n input.scss 3:11 call-content-exists()\ + \n input.scss 7:9 call-function()\ + \n input.scss 10:1 root stylesheet", ); } #[test] fn outside_mixin() { assert_eq!( - runner().err("a {b: content-exists()}\n"), + runner().err( + "@use \"sass:meta\";\ + \na {b: meta.content-exists()}\n" + ), "Error: content-exists() may only be called within a mixin.\ \n ,\ - \n1 | a {b: content-exists()}\ - \n | ^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.content-exists()}\ + \n | ^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] @@ -118,22 +125,23 @@ mod error { fn too_many_args() { assert_eq!( runner().err( - "@mixin a {\ - \n b {c: content-exists(1)}\ + "@use \"sass:meta\";\ + \n@mixin a {\ + \n b {c: meta.content-exists(1)}\ \n}\ \n@include a;\n" ), "Error: Only 0 arguments allowed, but 1 was passed.\ \n ,--> input.scss\ - \n2 | b {c: content-exists(1)}\ - \n | ^^^^^^^^^^^^^^^^^ invocation\ + \n3 | b {c: meta.content-exists(1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function content-exists() {\ \n | ================ declaration\ \n \'\ - \n input.scss 2:9 a()\ - \n input.scss 4:1 root stylesheet", + \n input.scss 3:9 a()\ + \n input.scss 5:1 root stylesheet", ); } } @@ -144,11 +152,12 @@ mod test_false { #[test] fn through_content() { assert_eq!( - runner().ok("@mixin call-content {\ + runner().ok("@use \"sass:meta\";\ + \n@mixin call-content {\ \n @content;\ \n}\n\ \n@mixin print-content-exists {\ - \n a {b: content-exists()}\ + \n a {b: meta.content-exists()}\ \n}\n\ \n@include call-content {\ \n @include print-content-exists;\ @@ -161,8 +170,9 @@ mod test_false { #[test] fn top_level() { assert_eq!( - runner().ok("@mixin a {\ - \n b {c: content-exists()}\ + runner().ok("@use \"sass:meta\";\ + \n@mixin a {\ + \n b {c: meta.content-exists()}\ \n}\ \n@include a;\n"), "b {\ @@ -178,8 +188,9 @@ mod test_true { #[test] fn empty() { assert_eq!( - runner().ok("@mixin a {\ - \n b {c: content-exists()}\ + runner().ok("@use \"sass:meta\";\ + \n@mixin a {\ + \n b {c: meta.content-exists()}\ \n @content;\ \n}\ \n@include a {}\n"), @@ -191,8 +202,9 @@ mod test_true { #[test] fn non_empty() { assert_eq!( - runner().ok("@mixin a {\ - \n b {c: content-exists()}\ + runner().ok("@use \"sass:meta\";\ + \n@mixin a {\ + \n b {c: meta.content-exists()}\ \n @content;\ \n}\ \n@include a {\ diff --git a/rsass/tests/spec/core_functions/meta/feature_exists.rs b/rsass/tests/spec/core_functions/meta/feature_exists.rs index 3188edfec..79f0e75e2 100644 --- a/rsass/tests/spec/core_functions/meta/feature_exists.rs +++ b/rsass/tests/spec/core_functions/meta/feature_exists.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn at_error() { assert_eq!( - runner().ok("a {b: feature-exists(at-error)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.feature-exists(at-error)}\n"), "a {\ \n b: true;\ \n}\n" @@ -17,7 +18,8 @@ fn at_error() { #[test] fn custom_property() { assert_eq!( - runner().ok("a {b: feature-exists(custom-property)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.feature-exists(custom-property)}\n"), "a {\ \n b: true;\ \n}\n" @@ -26,7 +28,8 @@ fn custom_property() { #[test] fn dash_sensitive() { assert_eq!( - runner().ok("a {b: feature-exists(at_error)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.feature-exists(at_error)}\n"), "a {\ \n b: false;\ \n}\n" @@ -39,54 +42,71 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: feature-exists()}\n"), + runner().err( + "@use \"sass:meta\";\ + \na {b: meta.feature-exists()}\n" + ), "Error: Missing argument $feature.\ \n ,--> input.scss\ - \n1 | a {b: feature-exists()}\ - \n | ^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: meta.feature-exists()}\ + \n | ^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function feature-exists($feature) {\ \n | ======================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner() - .err("a {b: feature-exists(at-error, custom-property)}\n"), - "Error: Only 1 argument allowed, but 2 were passed.\ + runner().err( + "@use \"sass:meta\";\ + \na {b: meta.feature-exists(at-error, custom-property)}\n" + ), + "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: feature-exists(at-error, custom-property)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: meta.feature-exists(at-error, custom-property)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function feature-exists($feature) {\ \n | ======================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", - ); + \n input.scss 2:7 root stylesheet", + ); } #[test] + #[ignore] // wrong error fn test_type() { assert_eq!( - runner().err("a {b: feature-exists(1)}\n"), - "Error: $feature: 1 is not a string.\ + runner().err( + "@use \"sass:meta\";\ + \na {b: meta.feature-exists(1)}\n" + ), + "DEPRECATION WARNING: The feature-exists() function is deprecated.\n\ + \nMore info: https://sass-lang.com/d/feature-exists\n\ \n ,\ - \n1 | a {b: feature-exists(1)}\ - \n | ^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.feature-exists(1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", - ); + \n input.scss 2:7 root stylesheet\n\ + \nError: $feature: 1 is not a string.\ + \n ,\ + \n2 | a {b: meta.feature-exists(1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); } } #[test] #[ignore] // wrong result fn extend_selector_pseudoclass() { assert_eq!( - runner().ok("a {b: feature-exists(extend-selector-pseudoclass)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.feature-exists(extend-selector-pseudoclass)}\n"), "a {\ \n b: true;\ \n}\n" @@ -95,7 +115,8 @@ fn extend_selector_pseudoclass() { #[test] fn global_variable_shadowing() { assert_eq!( - runner().ok("a {b: feature-exists(global-variable-shadowing)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.feature-exists(global-variable-shadowing)}\n"), "a {\ \n b: true;\ \n}\n" @@ -104,7 +125,8 @@ fn global_variable_shadowing() { #[test] fn named() { assert_eq!( - runner().ok("a {b: feature-exists($feature: at-error)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.feature-exists($feature: at-error)}\n"), "a {\ \n b: true;\ \n}\n" @@ -113,7 +135,8 @@ fn named() { #[test] fn quote_insensitive() { assert_eq!( - runner().ok("a {b: feature-exists(\"at-error\")}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.feature-exists(\"at-error\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -122,7 +145,8 @@ fn quote_insensitive() { #[test] fn units_level_3() { assert_eq!( - runner().ok("a {b: feature-exists(units-level-3)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.feature-exists(units-level-3)}\n"), "a {\ \n b: true;\ \n}\n" @@ -131,7 +155,8 @@ fn units_level_3() { #[test] fn unknown() { assert_eq!( - runner().ok("a {b: feature-exists(unknown)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.feature-exists(unknown)}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/meta/function_exists.rs b/rsass/tests/spec/core_functions/meta/function_exists.rs index cc9a035d7..7d59851ba 100644 --- a/rsass/tests/spec/core_functions/meta/function_exists.rs +++ b/rsass/tests/spec/core_functions/meta/function_exists.rs @@ -64,8 +64,9 @@ mod different_module { fn chosen_prefix() { let runner = runner().with_cwd("chosen_prefix"); assert_eq!( - runner.ok("@use \"sass:color\" as a;\ - \nb {c: function-exists(\"red\", \"a\")}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"sass:color\" as a;\ + \nb {c: meta.function-exists(\"red\", \"a\")}\n"), "b {\ \n c: true;\ \n}\n" @@ -75,8 +76,9 @@ mod different_module { fn defined() { let runner = runner().with_cwd("defined"); assert_eq!( - runner.ok("@use \"sass:color\";\ - \na {b: function-exists(\"red\", \"color\")}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"sass:color\";\ + \na {b: meta.function-exists(\"red\", \"color\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -92,10 +94,11 @@ mod different_module { fn test_as() { let runner = runner().with_cwd("as"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ \na {\ - \n with-prefix: function-exists(b-c);\ - \n without-prefix: function-exists(c);\ + \n with-prefix: meta.function-exists(b-c);\ + \n without-prefix: meta.function-exists(c);\ \n}\n"), "a {\ \n with-prefix: true;\ @@ -107,8 +110,9 @@ mod different_module { fn bare() { let runner = runner().with_cwd("bare"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ - \na {b: function-exists(c)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ + \na {b: meta.function-exists(c)}\n"), "a {\ \n b: true;\ \n}\n" @@ -118,10 +122,11 @@ mod different_module { fn hide() { let runner = runner().with_cwd("hide"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ \na {\ - \n hidden: function-exists(b);\ - \n not-hidden: function-exists(c);\ + \n hidden: meta.function-exists(b);\ + \n not-hidden: meta.function-exists(c);\ \n}\n"), "a {\ \n hidden: false;\ @@ -133,10 +138,11 @@ mod different_module { fn show() { let runner = runner().with_cwd("show"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ \na {\ - \n shown: function-exists(b);\ - \n not-shown: function-exists(c);\ + \n shown: meta.function-exists(b);\ + \n not-shown: meta.function-exists(c);\ \n}\n"), "a {\ \n shown: true;\ @@ -149,8 +155,9 @@ mod different_module { fn through_use() { let runner = runner().with_cwd("through_use"); assert_eq!( - runner.ok("@use \"other\" as *;\ - \na {b: function-exists(global-function)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"other\" as *;\ + \na {b: meta.function-exists(global-function)}\n"), "a {\ \n b: true;\ \n}\n" @@ -160,8 +167,9 @@ mod different_module { fn undefined() { let runner = runner().with_cwd("undefined"); assert_eq!( - runner.ok("@use \"sass:color\";\ - \na {b: function-exists(\"c\", \"color\")}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"sass:color\";\ + \na {b: meta.function-exists(\"c\", \"color\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -184,34 +192,40 @@ mod error { fn too_few() { let runner = runner().with_cwd("too_few"); assert_eq!( - runner.err("a {b: function-exists()}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.function-exists()}\n" + ), "Error: Missing argument $name.\ \n ,--> input.scss\ - \n1 | a {b: function-exists()}\ - \n | ^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: meta.function-exists()}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function function-exists($name, $module: null) {\ \n | ===================================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many() { let runner = runner().with_cwd("too_many"); assert_eq!( - runner.err("a {b: function-exists(c, d, e)}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.function-exists(c, d, e)}\n" + ), "Error: Only 2 arguments allowed, but 3 were passed.\ \n ,--> input.scss\ - \n1 | a {b: function-exists(c, d, e)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: meta.function-exists(c, d, e)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function function-exists($name, $module: null) {\ \n | ===================================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod test_type { @@ -224,26 +238,32 @@ mod error { fn module() { let runner = runner().with_cwd("module"); assert_eq!( - runner.err("a {b: function-exists(\"red\", 1)}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.function-exists(\"red\", 1)}\n" + ), "Error: $module: 1 is not a string.\ \n ,\ - \n1 | a {b: function-exists(\"red\", 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.function-exists(\"red\", 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn name() { let runner = runner().with_cwd("name"); assert_eq!( - runner.err("a {b: function-exists(12px)}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.function-exists(12px)}\n" + ), "Error: $name: 12px is not a string.\ \n ,\ - \n1 | a {b: function-exists(12px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.function-exists(12px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -254,21 +274,22 @@ mod error { let runner = runner().with_cwd("conflict"); assert_eq!( runner.err( - "@use \"other1\" as *;\ + "@use \"sass:meta\";\ + \n@use \"other1\" as *;\ \n@use \"other2\" as *;\n\ - \na {b: function-exists(member)}\n" + \na {b: meta.function-exists(member)}\n" ), "Error: This function is available from multiple global modules.\ \n ,\ - \n1 | @use \"other1\" as *;\ + \n2 | @use \"other1\" as *;\ \n | ================== includes function\ - \n2 | @use \"other2\" as *;\ + \n3 | @use \"other2\" as *;\ \n | ================== includes function\ \n... |\ - \n4 | a {b: function-exists(member)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^ function use\ + \n5 | a {b: meta.function-exists(member)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function use\ \n \'\ - \n input.scss 4:7 root stylesheet", + \n input.scss 5:7 root stylesheet", ); } mod module { @@ -281,13 +302,16 @@ mod error { fn built_in_but_not_loaded() { let runner = runner().with_cwd("built_in_but_not_loaded"); assert_eq!( - runner.err("a {b: function-exists(\"red\", \"color\")}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.function-exists(\"red\", \"color\")}\n" + ), "Error: There is no module with the namespace \"color\".\ \n ,\ - \n1 | a {b: function-exists(\"red\", \"color\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.function-exists(\"red\", \"color\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] @@ -295,28 +319,32 @@ mod error { let runner = runner().with_cwd("dash_sensitive"); assert_eq!( runner.err( - "@use \"sass:color\" as a-b;\ - \nc {d: function-exists(\"c\", $module: \"a_b\")}\n" + "@use \"sass:meta\";\ + \n@use \"sass:color\" as a-b;\ + \nc {d: meta.function-exists(\"c\", $module: \"a_b\")}\n" ), "Error: There is no module with the namespace \"a_b\".\ \n ,\ - \n2 | c {d: function-exists(\"c\", $module: \"a_b\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n3 | c {d: meta.function-exists(\"c\", $module: \"a_b\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 2:7 root stylesheet", + \n input.scss 3:7 root stylesheet", ); } #[test] fn non_existent() { let runner = runner().with_cwd("non_existent"); assert_eq!( - runner.err("a {b: function-exists(\"c\", \"d\")}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.function-exists(\"c\", \"d\")}\n" + ), "Error: There is no module with the namespace \"d\".\ \n ,\ - \n1 | a {b: function-exists(\"c\", \"d\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.function-exists(\"c\", \"d\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -325,8 +353,11 @@ mod error { fn named() { let runner = runner().with_cwd("named"); assert_eq!( - runner.ok("@use \"sass:color\";\n\ - \na {b: function-exists($name: \"red\", $module: \"color\")}\n"), + runner.ok( + "@use \"sass:meta\";\ + \n@use \"sass:color\";\n\ + \na {b: meta.function-exists($name: \"red\", $module: \"color\")}\n" + ), "a {\ \n b: true;\ \n}\n" @@ -348,8 +379,9 @@ mod same_module { fn dash_to_underscore() { let runner = runner().with_cwd("dash_to_underscore"); assert_eq!( - runner.ok("@function a_b() {@return null}\n\ - \nc {d: function-exists(a-b)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@function a_b() {@return null}\n\ + \nc {d: meta.function-exists(a-b)}\n"), "c {\ \n d: true;\ \n}\n" @@ -359,8 +391,9 @@ mod same_module { fn underscore_to_dash() { let runner = runner().with_cwd("underscore_to_dash"); assert_eq!( - runner.ok("@function a-b() {@return null}\n\ - \nc {d: function-exists(a_b)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@function a-b() {@return null}\n\ + \nc {d: meta.function-exists(a_b)}\n"), "c {\ \n d: true;\ \n}\n" @@ -371,8 +404,9 @@ mod same_module { fn global() { let runner = runner().with_cwd("global"); assert_eq!( - runner.ok("@function global-function() {@return null}\n\ - \na {b: function-exists(global-function)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@function global-function() {@return null}\n\ + \na {b: meta.function-exists(global-function)}\n"), "a {\ \n b: true;\ \n}\n" @@ -382,9 +416,10 @@ mod same_module { fn local() { let runner = runner().with_cwd("local"); assert_eq!( - runner.ok("a {\ + runner.ok("@use \"sass:meta\";\ + \na {\ \n @function local-function() {@return null}\ - \n b: function-exists(local-function);\ + \n b: meta.function-exists(local-function);\ \n}\n"), "a {\ \n b: true;\ @@ -395,8 +430,9 @@ mod same_module { fn non_existent() { let runner = runner().with_cwd("non_existent"); assert_eq!( - runner.ok("a {\ - \n b: function-exists(non-existent);\ + runner.ok("@use \"sass:meta\";\ + \na {\ + \n b: meta.function-exists(non-existent);\ \n}\n"), "a {\ \n b: false;\ @@ -407,8 +443,9 @@ mod same_module { fn through_import() { let runner = runner().with_cwd("through_import"); assert_eq!( - runner.ok("@import \"other\";\ - \na {b: function-exists(global-function)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@import \"other\";\ + \na {b: meta.function-exists(global-function)}\n"), "a {\ \n b: true;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/meta/get_function/different_module.rs b/rsass/tests/spec/core_functions/meta/get_function/different_module.rs index 071a907fd..560337685 100644 --- a/rsass/tests/spec/core_functions/meta/get_function/different_module.rs +++ b/rsass/tests/spec/core_functions/meta/get_function/different_module.rs @@ -47,11 +47,12 @@ fn chosen_prefix() { let runner = runner().with_cwd("chosen_prefix"); assert_eq!( runner.ok( - "@use \"sass:color\" as a;\ - \nb {c: call(get-function(\"red\", $module: \"a\"), #abcdef)}\n" + "@use \"sass:meta\";\ + \n@use \"sass:math\" as a;\ + \nb {c: meta.call(meta.get-function(\"round\", $module: \"a\"), 0.6)}\n" ), "b {\ - \n c: 171;\ + \n c: 1;\ \n}\n" ); } @@ -60,11 +61,12 @@ fn defined() { let runner = runner().with_cwd("defined"); assert_eq!( runner.ok( - "@use \"sass:color\";\ - \na {b: call(get-function(\"red\", $module: \"color\"), #abcdef)}\n" + "@use \"sass:math\";\ + \n@use \"sass:meta\";\ + \na {b: meta.call(meta.get-function(\"round\", $module: \"math\"), 0.6)}\n" ), "a {\ - \n b: 171;\ + \n b: 1;\ \n}\n" ); } @@ -73,11 +75,12 @@ fn named() { let runner = runner().with_cwd("named"); assert_eq!( runner.ok( - "@use \"sass:color\";\ - \na {b: call(get-function($name: \"red\", $module: \"color\"), #abcdef)}\n" + "@use \"sass:meta\";\ + \n@use \"sass:math\";\ + \na {b: meta.call(meta.get-function($name: \"round\", $module: \"math\"), 0.6)}\n" ), "a {\ - \n b: 171;\ + \n b: 1;\ \n}\n" ); } @@ -91,9 +94,10 @@ mod through_forward { fn test_as() { let runner = runner().with_cwd("as"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ \na {\ - \n b: call(get-function(c-d));\ + \n b: meta.call(meta.get-function(c-d));\ \n}\n"), "a {\ \n b: d;\ @@ -104,8 +108,9 @@ mod through_forward { fn bare() { let runner = runner().with_cwd("bare"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ - \na {b: call(get-function(c))}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ + \na {b: meta.call(meta.get-function(c))}\n"), "a {\ \n b: c;\ \n}\n" @@ -115,9 +120,10 @@ mod through_forward { fn hide() { let runner = runner().with_cwd("hide"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ \na {\ - \n b: call(get-function(d));\ + \n b: meta.call(meta.get-function(d));\ \n}\n"), "a {\ \n b: d;\ @@ -128,9 +134,10 @@ mod through_forward { fn show() { let runner = runner().with_cwd("show"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ \na {\ - \n b: call(get-function(c));\ + \n b: meta.call(meta.get-function(c));\ \n}\n"), "a {\ \n b: c;\ @@ -142,8 +149,9 @@ mod through_forward { fn through_use() { let runner = runner().with_cwd("through_use"); assert_eq!( - runner.ok("@use \"other\" as *;\ - \na {b: call(get-function(add-two), 10)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"other\" as *;\ + \na {b: meta.call(meta.get-function(add-two), 10)}\n"), "a {\ \n b: 12;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/meta/get_function/equality.rs b/rsass/tests/spec/core_functions/meta/get_function/equality.rs index 27b2c63e8..95ad69be9 100644 --- a/rsass/tests/spec/core_functions/meta/get_function/equality.rs +++ b/rsass/tests/spec/core_functions/meta/get_function/equality.rs @@ -12,29 +12,33 @@ mod built_in { #[test] fn different() { assert_eq!( - runner() - .ok("a {b: get-function(lighten) == get-function(darken)}\n"), - "a {\ + runner().ok( + "@use \"sass:meta\";\ + \na {b: meta.get-function(lighten) == meta.get-function(darken)}\n" + ), + "a {\ \n b: false;\ \n}\n" - ); + ); } #[test] fn same() { assert_eq!( - runner().ok( - "a {b: get-function(lighten) == get-function(lighten)}\n" - ), - "a {\ + runner().ok( + "@use \"sass:meta\";\ + \na {b: meta.get-function(lighten) == meta.get-function(lighten)}\n" + ), + "a {\ \n b: true;\ \n}\n" - ); + ); } } #[test] fn same_value() { assert_eq!( - runner().ok("$lighten-fn: get-function(lighten);\ + runner().ok("@use \"sass:meta\";\ + \n$lighten-fn: meta.get-function(lighten);\ \na {b: $lighten-fn == $lighten-fn}\n"), "a {\ \n b: true;\ @@ -49,9 +53,10 @@ mod user_defined { fn different() { assert_eq!( runner().ok( - "@function user-defined-1() {@return null}\ + "@use \"sass:meta\";\ + \n@function user-defined-1() {@return null}\ \n@function user-defined-2() {@return null}\ - \na {b: get-function(user-defined-1) == get-function(user-defined-2)}\n" + \na {b: meta.get-function(user-defined-1) == meta.get-function(user-defined-2)}\n" ), "a {\ \n b: false;\ @@ -61,10 +66,11 @@ mod user_defined { #[test] fn redefined() { assert_eq!( - runner().ok("@function user-defined() {@return null}\ - \n$first-reference: get-function(user-defined);\n\ + runner().ok("@use \"sass:meta\";\ + \n@function user-defined() {@return null}\ + \n$first-reference: meta.get-function(user-defined);\n\ \n@function user-defined() {@return null}\ - \n$second-reference: get-function(user-defined);\ + \n$second-reference: meta.get-function(user-defined);\ \na {b: $first-reference == $second-reference}\n"), "a {\ \n b: false;\ @@ -75,8 +81,9 @@ mod user_defined { fn same() { assert_eq!( runner().ok( - "@function user-defined() {@return null}\ - \na {b: get-function(user-defined) == get-function(user-defined)}\n" + "@use \"sass:meta\";\ + \n@function user-defined() {@return null}\ + \na {b: meta.get-function(user-defined) == meta.get-function(user-defined)}\n" ), "a {\ \n b: true;\ diff --git a/rsass/tests/spec/core_functions/meta/get_function/error.rs b/rsass/tests/spec/core_functions/meta/get_function/error.rs index 7a005d0f1..56f86bb9c 100644 --- a/rsass/tests/spec/core_functions/meta/get_function/error.rs +++ b/rsass/tests/spec/core_functions/meta/get_function/error.rs @@ -41,18 +41,19 @@ mod argument { let runner = runner().with_cwd("function_ref"); assert_eq!( runner.err( - "@function foo() {\ + "@use \"sass:meta\";\ + \n@function foo() {\ \n @return null;\ \n}\n\ - \n$foo-ref: get-function(foo);\ - \na {b: get-function($foo-ref)}\n" + \n$foo-ref: meta.get-function(foo);\ + \na {b: meta.get-function($foo-ref)}\n" ), "Error: $name: get-function(\"foo\") is not a string.\ \n ,\ - \n6 | a {b: get-function($foo-ref)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^\ + \n7 | a {b: meta.get-function($foo-ref)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 6:7 root stylesheet", + \n input.scss 7:7 root stylesheet", ); } #[test] @@ -103,26 +104,32 @@ mod argument { fn module() { let runner = runner().with_cwd("module"); assert_eq!( - runner.err("a {b: get-function(c, $module: 1)}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.get-function(c, $module: 1)}\n" + ), "Error: $module: 1 is not a string.\ \n ,\ - \n1 | a {b: get-function(c, $module: 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.get-function(c, $module: 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn name() { let runner = runner().with_cwd("name"); assert_eq!( - runner.err("a {b: get-function(2px)}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.get-function(2px)}\n" + ), "Error: $name: 2px is not a string.\ \n ,\ - \n1 | a {b: get-function(2px)}\ - \n | ^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.get-function(2px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -133,55 +140,61 @@ fn conflict() { let runner = runner().with_cwd("conflict"); assert_eq!( runner.err( - "@use \"other1\" as *;\ + "@use \"sass:meta\";\ + \n@use \"other1\" as *;\ \n@use \"other2\" as *;\n\ - \na {b: get-function(member)}\n" + \na {b: meta.get-function(member)}\n" ), "Error: This function is available from multiple global modules.\ \n ,\ - \n1 | @use \"other1\" as *;\ + \n2 | @use \"other1\" as *;\ \n | ================== includes function\ - \n2 | @use \"other2\" as *;\ + \n3 | @use \"other2\" as *;\ \n | ================== includes function\ \n... |\ - \n4 | a {b: get-function(member)}\ - \n | ^^^^^^^^^^^^^^^^^^^^ function use\ + \n5 | a {b: meta.get-function(member)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^ function use\ \n \'\ - \n input.scss 4:7 root stylesheet", + \n input.scss 5:7 root stylesheet", ); } #[test] fn division() { let runner = runner().with_cwd("division"); assert_eq!( - runner.err("a {b: get-function(rgb) / get-function(lighten)}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.get-function(rgb) / meta.get-function(lighten)}\n" + ), "Error: get-function(\"rgb\") isn\'t a valid CSS value.\ \n ,\ - \n1 | a {b: get-function(rgb) / get-function(lighten)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.get-function(rgb) / meta.get-function(lighten)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] +#[ignore] // wrong error fn function_exists() { let runner = runner().with_cwd("function_exists"); assert_eq!( runner.err( - "@function add-two($v) {\ + "@use \"sass:meta\";\n\ + \n@function add-two($v) {\ \n @return $v + 2;\ \n}\n\ - \n$add-two-fn: get-function(add-two);\n\ + \n$add-two-fn: meta.get-function(add-two);\n\ \n.error {\ - \n error: get-function($add-two-fn);\ + \n error: meta.get-function($add-two-fn);\ \n}\n" ), "Error: $name: get-function(\"add-two\") is not a string.\ - \n ,\ - \n8 | error: get-function($add-two-fn);\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 8:10 root stylesheet", + \n ,\ + \n10 | error: meta.get-function($add-two-fn);\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 10:10 root stylesheet", ); } mod module { @@ -196,27 +209,31 @@ mod module { assert_eq!( runner.err( "@use \"sass:color\";\ - \na {b: get-function(\"red\", $css: true, $module: \"color\")}\n" + \n@use \"sass:meta\";\ + \na {b: meta.get-function(\"red\", $css: true, $module: \"color\")}\n" ), "Error: $css and $module may not both be passed at once.\ \n ,\ - \n2 | a {b: get-function(\"red\", $css: true, $module: \"color\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n3 | a {b: meta.get-function(\"red\", $css: true, $module: \"color\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 2:7 root stylesheet", + \n input.scss 3:7 root stylesheet", ); } #[test] fn built_in_but_not_loaded() { let runner = runner().with_cwd("built_in_but_not_loaded"); assert_eq!( - runner.err("a {b: get-function(\"red\", $module: \"color\")}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.get-function(\"red\", $module: \"color\")}\n" + ), "Error: There is no module with the namespace \"color\".\ \n ,\ - \n1 | a {b: get-function(\"red\", $module: \"color\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.get-function(\"red\", $module: \"color\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] @@ -225,27 +242,31 @@ mod module { assert_eq!( runner.err( "@use \"sass:color\" as a-b;\ - \nc {d: get-function(\"c\", $module: \"a_b\")}\n" + \n@use \"sass:meta\";\ + \nc {d: meta.get-function(\"c\", $module: \"a_b\")}\n" ), "Error: There is no module with the namespace \"a_b\".\ \n ,\ - \n2 | c {d: get-function(\"c\", $module: \"a_b\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n3 | c {d: meta.get-function(\"c\", $module: \"a_b\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 2:7 root stylesheet", + \n input.scss 3:7 root stylesheet", ); } #[test] fn non_existent() { let runner = runner().with_cwd("non_existent"); assert_eq!( - runner.err("a {b: get-function(\"c\", $module: \"d\")}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.get-function(\"c\", $module: \"d\")}\n" + ), "Error: There is no module with the namespace \"d\".\ \n ,\ - \n1 | a {b: get-function(\"c\", $module: \"d\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.get-function(\"c\", $module: \"d\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] @@ -254,14 +275,15 @@ mod module { assert_eq!( runner.err( "@use \"sass:color\";\ - \na {b: get-function(\"c\", $module: \"color\")}\n" + \n@use \"sass:meta\";\ + \na {b: meta.get-function(\"c\", $module: \"color\")}\n" ), "Error: Function not found: \"c\"\ \n ,\ - \n2 | a {b: get-function(\"c\", $module: \"color\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n3 | a {b: meta.get-function(\"c\", $module: \"color\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 2:7 root stylesheet", + \n input.scss 3:7 root stylesheet", ); } } @@ -269,13 +291,16 @@ mod module { fn non_existent() { let runner = runner().with_cwd("non_existent"); assert_eq!( - runner.err("a {b: get-function(does-not-exist)}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.get-function(does-not-exist)}\n" + ), "Error: Function not found: does-not-exist\ \n ,\ - \n1 | a {b: get-function(does-not-exist)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.get-function(does-not-exist)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod through_forward { @@ -289,17 +314,18 @@ mod through_forward { let runner = runner().with_cwd("hide"); assert_eq!( runner.err( - "@use \"midstream\" as *;\ + "@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ \na {\ - \n b: call(get-function(c));\ + \n b: meta.call(meta.get-function(c));\ \n}\n" ), "Error: Function not found: c\ \n ,\ - \n3 | b: call(get-function(c));\ - \n | ^^^^^^^^^^^^^^^\ + \n4 | b: meta.call(meta.get-function(c));\ + \n | ^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 3:11 root stylesheet", + \n input.scss 4:16 root stylesheet", ); } #[test] @@ -307,17 +333,18 @@ mod through_forward { let runner = runner().with_cwd("show"); assert_eq!( runner.err( - "@use \"midstream\" as *;\ + "@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ \na {\ - \n b: call(get-function(d));\ + \n b: meta.call(meta.get-function(d));\ \n}\n" ), "Error: Function not found: d\ \n ,\ - \n3 | b: call(get-function(d));\ - \n | ^^^^^^^^^^^^^^^\ + \n4 | b: meta.call(meta.get-function(d));\ + \n | ^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 3:11 root stylesheet", + \n input.scss 4:16 root stylesheet", ); } } diff --git a/rsass/tests/spec/core_functions/meta/get_function/meta.rs b/rsass/tests/spec/core_functions/meta/get_function/meta.rs index 695d54917..3e9b3a3a6 100644 --- a/rsass/tests/spec/core_functions/meta/get_function/meta.rs +++ b/rsass/tests/spec/core_functions/meta/get_function/meta.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn inspect() { assert_eq!( - runner().ok("a {b: inspect(get-function(lighten))};\n"), + runner().ok("@use \"sass:meta\";\n\ + \na {b: meta.inspect(meta.get-function(lighten))};\n"), "a {\ \n b: get-function(\"lighten\");\ \n}\n" @@ -17,7 +18,8 @@ fn inspect() { #[test] fn type_of() { assert_eq!( - runner().ok("a {b: type-of(get-function(lighten))};\n"), + runner().ok("@use \"sass:meta\";\n\ + \na {b: meta.type-of(meta.get-function(lighten))};\n"), "a {\ \n b: function;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/meta/get_function/same_module.rs b/rsass/tests/spec/core_functions/meta/get_function/same_module.rs index 8bff1a0bb..e55c64e5d 100644 --- a/rsass/tests/spec/core_functions/meta/get_function/same_module.rs +++ b/rsass/tests/spec/core_functions/meta/get_function/same_module.rs @@ -12,10 +12,11 @@ fn runner() -> crate::TestRunner { fn built_in() { let runner = runner().with_cwd("built_in"); assert_eq!( - runner.ok("$lighten-fn: get-function(lighten);\n\ - \na {b: call($lighten-fn, red, 30%)}\n"), + runner.ok("@use \"sass:meta\";\ + \n$round-fn: meta.get-function(round);\n\ + \na {b: meta.call($round-fn, 0.6)}\n"), "a {\ - \n b: #ff9999;\ + \n b: 1;\ \n}\n" ); } @@ -29,8 +30,9 @@ mod dash_insensitive { fn dash_to_underscore() { let runner = runner().with_cwd("dash_to_underscore"); assert_eq!( - runner.ok("@function add_two($v) {@return $v + 2}\n\ - \na {b: call(get-function(add-two), 10)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@function add_two($v) {@return $v + 2}\n\ + \na {b: meta.call(meta.get-function(add-two), 10)}\n"), "a {\ \n b: 12;\ \n}\n" @@ -40,8 +42,9 @@ mod dash_insensitive { fn underscore_to_dash() { let runner = runner().with_cwd("underscore_to_dash"); assert_eq!( - runner.ok("@function add-two($v) {@return $v + 2}\n\ - \na {b: call(get-function(add_two), 10)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@function add-two($v) {@return $v + 2}\n\ + \na {b: meta.call(meta.get-function(add_two), 10)}\n"), "a {\ \n b: 12;\ \n}\n" @@ -52,15 +55,16 @@ mod dash_insensitive { fn plain_css() { let runner = runner().with_cwd("plain_css"); assert_eq!( - runner.ok("$sass-fn: get-function(lighten);\ - \n$css-fn: get-function(lighten, $css: true);\n\ + runner.ok("@use \"sass:meta\";\ + \n$sass-fn: meta.get-function(round);\ + \n$css-fn: meta.get-function(round, $css: true);\n\ \na {\ - \n sass-fn: call($sass-fn, red, 30%);\ - \n css-fn: call($css-fn, red, 30%);\ + \n sass-fn: meta.call($sass-fn, 0.6);\ + \n css-fn: meta.call($css-fn, 0.6);\ \n}\n"), "a {\ - \n sass-fn: #ff9999;\ - \n css-fn: lighten(red, 30%);\ + \n sass-fn: 1;\ + \n css-fn: round(0.6);\ \n}\n" ); } @@ -69,13 +73,14 @@ fn redefined() { let runner = runner().with_cwd("redefined"); assert_eq!( runner.ok( - "@function add-two($v) {@return $v + 2}\ - \n$add-two-fn: get-function(add-two);\n\ + "@use \"sass:meta\";\ + \n@function add-two($v) {@return $v + 2}\ + \n$add-two-fn: meta.get-function(add-two);\n\ \n// The function returned by `get-function()` is locked in place when it\'s\ \n// called. Redefining the function after the fact shouldn\'t affect the stored\ \n// value.\ \n@function add-two($v) {@error \"Should not be called\"}\n\ - \na {b: call($add-two-fn, 10)}\n" + \na {b: meta.call($add-two-fn, 10)}\n" ), "a {\ \n b: 12;\ @@ -86,8 +91,9 @@ fn redefined() { fn through_import() { let runner = runner().with_cwd("through_import"); assert_eq!( - runner.ok("@import \"other\";\ - \na {b: call(get-function(add-two), 10)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@import \"other\";\ + \na {b: meta.call(meta.get-function(add-two), 10)}\n"), "a {\ \n b: 12;\ \n}\n" @@ -97,9 +103,10 @@ fn through_import() { fn user_defined() { let runner = runner().with_cwd("user_defined"); assert_eq!( - runner.ok("@function add-two($v) {@return $v + 2}\ - \n$add-two-fn: get-function(add-two);\n\ - \na {b: call($add-two-fn, 10)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@function add-two($v) {@return $v + 2}\ + \n$add-two-fn: meta.get-function(add-two);\n\ + \na {b: meta.call($add-two-fn, 10)}\n"), "a {\ \n b: 12;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/meta/get_function/scope.rs b/rsass/tests/spec/core_functions/meta/get_function/scope.rs index 01e86bd7d..a0a62d48f 100644 --- a/rsass/tests/spec/core_functions/meta/get_function/scope.rs +++ b/rsass/tests/spec/core_functions/meta/get_function/scope.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn captures_inner_scope() { assert_eq!( runner().ok( - "@function add-two($v) {@error \"Should not be called\"}\ + "@use \"sass:meta\";\ + \n@function add-two($v) {@error \"Should not be called\"}\ \n.scope1 {\ \n @function add-two($v) {@error \"Should not be called\"}\ \n .scope2 {\ @@ -18,7 +19,7 @@ fn captures_inner_scope() { \n @function add-two($v) {@return $v + 2}\n\ \n // Like a normal function call, get-function() will always use the\ \n // innermost definition of a function.\ - \n a: call(get-function(add-two), 10);\ + \n a: meta.call(meta.get-function(add-two), 10);\ \n }\ \n }\ \n}\n" @@ -32,14 +33,15 @@ fn captures_inner_scope() { fn stores_local_scope() { assert_eq!( runner().ok( - "$add-two-fn: null;\n\ + "@use \"sass:meta\";\ + \n$add-two-fn: null;\n\ \n.scope {\ \n @function add-two($v) {@return $v + 2}\n\ \n // This function reference will still refer to this nested `add-two` function\ \n // even when it goes out of scope.\ - \n $add-two-fn: get-function(add-two) !global;\ + \n $add-two-fn: meta.get-function(add-two) !global;\ \n}\n\ - \na {b: call($add-two-fn, 10)}\n" + \na {b: meta.call($add-two-fn, 10)}\n" ), "a {\ \n b: 12;\ diff --git a/rsass/tests/spec/core_functions/meta/get_mixin/different_module.rs b/rsass/tests/spec/core_functions/meta/get_mixin/different_module.rs index 4e664a2a5..49976b1ee 100644 --- a/rsass/tests/spec/core_functions/meta/get_mixin/different_module.rs +++ b/rsass/tests/spec/core_functions/meta/get_mixin/different_module.rs @@ -4,48 +4,18 @@ fn runner() -> crate::TestRunner { super::runner() .with_cwd("different_module") - .mock_file( - "chosen_prefix/_other.scss", - "@mixin a($color) {c: red($color)}\n", - ) - .mock_file( - "defined/_other.scss", - "@mixin a($color) {b: red($color)}\n", - ) - .mock_file("named/_other.scss", "@mixin a($color) {b: red($color)}\n") - .mock_file( - "through_forward/as/_midstream.scss", - "@forward \"upstream\" as c-*;\n", - ) + .mock_file("chosen_prefix/_other.scss", "@use \"sass:color\";\n@mixin a($color) {c: color.channel($color, 'red')}\n") + .mock_file("defined/_other.scss", "@use \"sass:color\";\n@mixin a($color) {b: color.channel($color, 'red')}\n") + .mock_file("named/_other.scss", "@use \"sass:color\";\n@mixin a($color) {b: color.channel($color, 'red')}\n") + .mock_file("through_forward/as/_midstream.scss", "@forward \"upstream\" as c-*;\n") .mock_file("through_forward/as/_upstream.scss", "@mixin d() {b: d}\n") - .mock_file( - "through_forward/bare/_midstream.scss", - "@forward \"upstream\";\n", - ) - .mock_file( - "through_forward/bare/_upstream.scss", - "@mixin c() {b: c}\n", - ) - .mock_file( - "through_forward/hide/_midstream.scss", - "@forward \"upstream\" hide c;\n", - ) - .mock_file( - "through_forward/hide/_upstream.scss", - "@mixin d() {b: d}\n", - ) - .mock_file( - "through_forward/show/_midstream.scss", - "@forward \"upstream\" show c;\n", - ) - .mock_file( - "through_forward/show/_upstream.scss", - "@mixin c() {b: c}\n", - ) - .mock_file( - "through_use/other.scss", - "@mixin add-two($v) {b: $v + 2}\n", - ) + .mock_file("through_forward/bare/_midstream.scss", "@forward \"upstream\";\n") + .mock_file("through_forward/bare/_upstream.scss", "@mixin c() {b: c}\n") + .mock_file("through_forward/hide/_midstream.scss", "@forward \"upstream\" hide c;\n") + .mock_file("through_forward/hide/_upstream.scss", "@mixin d() {b: d}\n") + .mock_file("through_forward/show/_midstream.scss", "@forward \"upstream\" show c;\n") + .mock_file("through_forward/show/_upstream.scss", "@mixin c() {b: c}\n") + .mock_file("through_use/other.scss", "@mixin add-two($v) {b: $v + 2}\n") } #[test] diff --git a/rsass/tests/spec/core_functions/meta/get_mixin/scope.rs b/rsass/tests/spec/core_functions/meta/get_mixin/scope.rs index 7fc799273..13348e4f2 100644 --- a/rsass/tests/spec/core_functions/meta/get_mixin/scope.rs +++ b/rsass/tests/spec/core_functions/meta/get_mixin/scope.rs @@ -20,7 +20,7 @@ fn captures_inner_scope() { \n @mixin add-two($v) {a: $v + 2}\n\ \n // Like a normal mixin call, get-mixin() will always use the\ \n // innermost definition of a mixin.\ - \n @include meta.apply(get-mixin(add-two), 10);\ + \n @include meta.apply(meta.get-mixin(add-two), 10);\ \n }\ \n }\ \n}\n" @@ -80,7 +80,7 @@ fn stores_local_scope() { \n @mixin add-two($v) {b: $v + 2}\n\ \n // This mixin reference will still refer to this nested `add-two` mixin\ \n // even when it goes out of scope.\ - \n $add-two-mixin: get-mixin(add-two) !global;\ + \n $add-two-mixin: meta.get-mixin(add-two) !global;\ \n}\n\ \na {@include meta.apply($add-two-mixin, 10)}\n" ), diff --git a/rsass/tests/spec/core_functions/meta/global_variable_exists.rs b/rsass/tests/spec/core_functions/meta/global_variable_exists.rs index 14fcd1c40..ed1174535 100644 --- a/rsass/tests/spec/core_functions/meta/global_variable_exists.rs +++ b/rsass/tests/spec/core_functions/meta/global_variable_exists.rs @@ -64,8 +64,9 @@ mod dash_insensitive { fn dash_to_underscore() { let runner = runner().with_cwd("dash_to_underscore"); assert_eq!( - runner.ok("$a_b: null;\n\ - \nc {d: global-variable-exists(a-b)}\n"), + runner.ok("@use \"sass:meta\";\ + \n$a_b: null;\n\ + \nc {d: meta.global-variable-exists(a-b)}\n"), "c {\ \n d: true;\ \n}\n" @@ -75,8 +76,9 @@ mod dash_insensitive { fn underscore_to_dash() { let runner = runner().with_cwd("underscore_to_dash"); assert_eq!( - runner.ok("$a-b: null;\n\ - \nc {d: global-variable-exists(a_b)}\n"), + runner.ok("@use \"sass:meta\";\ + \n$a-b: null;\n\ + \nc {d: meta.global-variable-exists(a_b)}\n"), "c {\ \n d: true;\ \n}\n" @@ -93,8 +95,9 @@ mod different_module { fn chosen_prefix() { let runner = runner().with_cwd("chosen_prefix"); assert_eq!( - runner.ok("@use \"other\" as a;\ - \nb {c: global-variable-exists(\"d\", \"a\")}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"other\" as a;\ + \nb {c: meta.global-variable-exists(\"d\", \"a\")}\n"), "b {\ \n c: true;\ \n}\n" @@ -104,8 +107,9 @@ mod different_module { fn defined() { let runner = runner().with_cwd("defined"); assert_eq!( - runner.ok("@use \"other\";\ - \na {b: global-variable-exists(\"c\", \"other\")}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"other\";\ + \na {b: meta.global-variable-exists(\"c\", \"other\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -121,10 +125,11 @@ mod different_module { fn test_as() { let runner = runner().with_cwd("as"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ \na {\ - \n with-prefix: global-variable-exists(b-c);\ - \n without-prefix: global-variable-exists(c);\ + \n with-prefix: meta.global-variable-exists(b-c);\ + \n without-prefix: meta.global-variable-exists(c);\ \n}\n"), "a {\ \n with-prefix: true;\ @@ -136,8 +141,9 @@ mod different_module { fn bare() { let runner = runner().with_cwd("bare"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ - \na {b: variable-exists(c)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ + \na {b: meta.variable-exists(c)}\n"), "a {\ \n b: true;\ \n}\n" @@ -147,10 +153,11 @@ mod different_module { fn hide() { let runner = runner().with_cwd("hide"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ \na {\ - \n hidden: global-variable-exists(b);\ - \n not-hidden: global-variable-exists(c);\ + \n hidden: meta.global-variable-exists(b);\ + \n not-hidden: meta.global-variable-exists(c);\ \n}\n"), "a {\ \n hidden: false;\ @@ -162,10 +169,11 @@ mod different_module { fn show() { let runner = runner().with_cwd("show"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ \na {\ - \n shown: global-variable-exists(b);\ - \n not-shown: global-variable-exists(c);\ + \n shown: meta.global-variable-exists(b);\ + \n not-shown: meta.global-variable-exists(c);\ \n}\n"), "a {\ \n shown: true;\ @@ -178,8 +186,9 @@ mod different_module { fn through_use() { let runner = runner().with_cwd("through_use"); assert_eq!( - runner.ok("@use \"other\" as *;\ - \na {b: global-variable-exists(global-variable)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"other\" as *;\ + \na {b: meta.global-variable-exists(global-variable)}\n"), "a {\ \n b: true;\ \n}\n" @@ -189,8 +198,9 @@ mod different_module { fn undefined() { let runner = runner().with_cwd("undefined"); assert_eq!( - runner.ok("@use \"sass:color\";\ - \na {b: global-variable-exists(\"c\", \"color\")}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"sass:color\";\ + \na {b: meta.global-variable-exists(\"c\", \"color\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -214,18 +224,19 @@ mod error { let runner = runner().with_cwd("too_few"); assert_eq!( runner.err( - "a {b: global-variable-exists()}\n" + "@use \"sass:meta\";\ + \na {b: meta.global-variable-exists()}\n" ), "Error: Missing argument $name.\ \n ,--> input.scss\ - \n1 | a {b: global-variable-exists()}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: meta.global-variable-exists()}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function global-variable-exists($name, $module: null) {\ \n | ============================================ declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] @@ -233,18 +244,19 @@ mod error { let runner = runner().with_cwd("too_many"); assert_eq!( runner.err( - "a {b: global-variable-exists(c, d, e)}\n" + "@use \"sass:meta\";\ + \na {b: meta.global-variable-exists(c, d, e)}\n" ), "Error: Only 2 arguments allowed, but 3 were passed.\ \n ,--> input.scss\ - \n1 | a {b: global-variable-exists(c, d, e)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: meta.global-variable-exists(c, d, e)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function global-variable-exists($name, $module: null) {\ \n | ============================================ declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod test_type { @@ -257,26 +269,32 @@ mod error { fn module() { let runner = runner().with_cwd("module"); assert_eq!( - runner.err("a {b: global-variable-exists(\"c\", 1)}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.global-variable-exists(\"c\", 1)}\n" + ), "Error: $module: 1 is not a string.\ \n ,\ - \n1 | a {b: global-variable-exists(\"c\", 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.global-variable-exists(\"c\", 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn name() { let runner = runner().with_cwd("name"); assert_eq!( - runner.err("a {b: global-variable-exists(12px)}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.global-variable-exists(12px)}\n" + ), "Error: $name: 12px is not a string.\ \n ,\ - \n1 | a {b: global-variable-exists(12px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.global-variable-exists(12px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -287,21 +305,22 @@ mod error { let runner = runner().with_cwd("conflict"); assert_eq!( runner.err( - "@use \"other1\" as *;\ + "@use \"sass:meta\";\ + \n@use \"other1\" as *;\ \n@use \"other2\" as *;\n\ - \na {b: global-variable-exists(member)}\n" + \na {b: meta.global-variable-exists(member)}\n" ), "Error: This variable is available from multiple global modules.\ \n ,\ - \n1 | @use \"other1\" as *;\ + \n2 | @use \"other1\" as *;\ \n | ================== includes variable\ - \n2 | @use \"other2\" as *;\ + \n3 | @use \"other2\" as *;\ \n | ================== includes variable\ \n... |\ - \n4 | a {b: global-variable-exists(member)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable use\ + \n5 | a {b: meta.global-variable-exists(member)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable use\ \n \'\ - \n input.scss 4:7 root stylesheet", + \n input.scss 5:7 root stylesheet", ); } mod module { @@ -314,14 +333,16 @@ mod error { fn built_in_but_not_loaded() { let runner = runner().with_cwd("built_in_but_not_loaded"); assert_eq!( - runner - .err("a {b: global-variable-exists(\"c\", \"color\")}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.global-variable-exists(\"c\", \"color\")}\n" + ), "Error: There is no module with the namespace \"color\".\ \n ,\ - \n1 | a {b: global-variable-exists(\"c\", \"color\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.global-variable-exists(\"c\", \"color\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] @@ -329,28 +350,32 @@ mod error { let runner = runner().with_cwd("dash_sensitive"); assert_eq!( runner.err( - "@use \"sass:color\" as a-b;\ - \nc {d: global-variable-exists(\"c\", $module: \"a_b\")}\n" + "@use \"sass:meta\";\ + \n@use \"sass:color\" as a-b;\ + \nc {d: meta.global-variable-exists(\"c\", $module: \"a_b\")}\n" ), "Error: There is no module with the namespace \"a_b\".\ \n ,\ - \n2 | c {d: global-variable-exists(\"c\", $module: \"a_b\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n3 | c {d: meta.global-variable-exists(\"c\", $module: \"a_b\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 2:7 root stylesheet", + \n input.scss 3:7 root stylesheet", ); } #[test] fn non_existent() { let runner = runner().with_cwd("non_existent"); assert_eq!( - runner.err("a {b: global-variable-exists(\"c\", \"d\")}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.global-variable-exists(\"c\", \"d\")}\n" + ), "Error: There is no module with the namespace \"d\".\ \n ,\ - \n1 | a {b: global-variable-exists(\"c\", \"d\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.global-variable-exists(\"c\", \"d\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -360,8 +385,9 @@ fn named() { let runner = runner().with_cwd("named"); assert_eq!( runner.ok( - "@use \"other\";\ - \na {b: global-variable-exists($name: \"c\", $module: \"other\")}\n" + "@use \"sass:meta\";\ + \n@use \"other\";\ + \na {b: meta.global-variable-exists($name: \"c\", $module: \"other\")}\n" ), "a {\ \n b: true;\ @@ -378,8 +404,9 @@ mod same_module { fn global() { let runner = runner().with_cwd("global"); assert_eq!( - runner.ok("$global-variable: null;\n\ - \na {b: global-variable-exists(global-variable)}\n"), + runner.ok("@use \"sass:meta\";\ + \n$global-variable: null;\n\ + \na {b: meta.global-variable-exists(global-variable)}\n"), "a {\ \n b: true;\ \n}\n" @@ -389,9 +416,10 @@ mod same_module { fn local() { let runner = runner().with_cwd("local"); assert_eq!( - runner.ok("a {\ + runner.ok("@use \"sass:meta\";\ + \na {\ \n $local-variable: null;\ - \n b: global-variable-exists(local-variable);\ + \n b: meta.global-variable-exists(local-variable);\ \n}\n"), "a {\ \n b: false;\ @@ -402,8 +430,9 @@ mod same_module { fn non_existent() { let runner = runner().with_cwd("non_existent"); assert_eq!( - runner.ok("a {\ - \n b: global-variable-exists(non-existent);\ + runner.ok("@use \"sass:meta\";\ + \na {\ + \n b: meta.global-variable-exists(non-existent);\ \n}\n"), "a {\ \n b: false;\ @@ -414,8 +443,9 @@ mod same_module { fn through_import() { let runner = runner().with_cwd("through_import"); assert_eq!( - runner.ok("@import \"other\";\ - \na {b: global-variable-exists(global-variable)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@import \"other\";\ + \na {b: meta.global-variable-exists(global-variable)}\n"), "a {\ \n b: true;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/meta/inspect/boolean.rs b/rsass/tests/spec/core_functions/meta/inspect/boolean.rs index 484c2b9a8..34e9e7665 100644 --- a/rsass/tests/spec/core_functions/meta/inspect/boolean.rs +++ b/rsass/tests/spec/core_functions/meta/inspect/boolean.rs @@ -8,10 +8,11 @@ fn runner() -> crate::TestRunner { #[test] fn test_false() { assert_eq!( - runner().ok("$result: inspect(false);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect(false);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: false;\ @@ -22,10 +23,11 @@ fn test_false() { #[test] fn test_true() { assert_eq!( - runner().ok("$result: inspect(true);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect(true);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: true;\ diff --git a/rsass/tests/spec/core_functions/meta/inspect/color.rs b/rsass/tests/spec/core_functions/meta/inspect/color.rs index 21e5c46a4..31a2e84f2 100644 --- a/rsass/tests/spec/core_functions/meta/inspect/color.rs +++ b/rsass/tests/spec/core_functions/meta/inspect/color.rs @@ -4,7 +4,7 @@ fn runner() -> crate::TestRunner { super::runner() .with_cwd("color") - .mock_file("generated/_utils.scss", "/// Returns a copy of `$color` that doesn't have color-literal metadata\n/// associated with it.\n@function generated-color($color) {\n // This doesn't change the value of `$color` at all, but it does construct a\n // new object.\n @return scale-color($color, $blue: 0%);\n}\n") + .mock_file("generated/_utils.scss", "@use \"sass:color\";\n/// Returns a copy of `$color` that doesn't have color-literal metadata\n/// associated with it.\n@function generated-color($color) {\n // This doesn't change the value of `$color` at all, but it does construct a\n // new object.\n @return color.scale($color, $blue: 0%);\n}\n") } mod generated { @@ -17,10 +17,11 @@ mod generated { fn alpha() { let runner = runner().with_cwd("alpha"); assert_eq!( - runner.ok("$result: inspect(rgba(1, 2, 3, 0.4));\ + runner.ok("@use \"sass:meta\";\ + \n$result: meta.inspect(rgba(1, 2, 3, 0.4));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: rgba(1, 2, 3, 0.4);\ @@ -32,11 +33,12 @@ mod generated { fn long_hex() { let runner = runner().with_cwd("long_hex"); assert_eq!( - runner.ok("@import \"../utils\";\ - \n$result: inspect(generated-color(#abcdef));\ + runner.ok("@use \"sass:meta\";\ + \n@use \"../utils\";\ + \n$result: meta.inspect(utils.generated-color(#abcdef));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: #abcdef;\ @@ -48,11 +50,12 @@ mod generated { fn named() { let runner = runner().with_cwd("named"); assert_eq!( - runner.ok("@import \"../utils\";\ - \n$result: inspect(generated-color(#00f));\ + runner.ok("@use \"sass:meta\";\ + \n@use \"../utils\";\ + \n$result: meta.inspect(utils.generated-color(#00f));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: blue;\ @@ -64,11 +67,12 @@ mod generated { fn short_hex() { let runner = runner().with_cwd("short_hex"); assert_eq!( - runner.ok("@import \"../utils\";\ - \n$result: inspect(generated-color(#abc));\ + runner.ok("@use \"sass:meta\";\ + \n@use \"../utils\";\ + \n$result: meta.inspect(utils.generated-color(#abc));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: #aabbcc;\ @@ -80,11 +84,12 @@ mod generated { fn transparent() { let runner = runner().with_cwd("transparent"); assert_eq!( - runner.ok("@import \"../utils\";\ - \n$result: inspect(generated-color(transparent));\ + runner.ok("@use \"sass:meta\";\ + \n@use \"../utils\";\ + \n$result: meta.inspect(utils.generated-color(transparent));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: rgba(0, 0, 0, 0);\ @@ -103,10 +108,11 @@ mod literal { fn long_hex() { let runner = runner().with_cwd("long_hex"); assert_eq!( - runner.ok("$result: inspect(#0000ff);\ + runner.ok("@use \"sass:meta\";\ + \n$result: meta.inspect(#0000ff);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: #0000ff;\ @@ -118,10 +124,11 @@ mod literal { fn named() { let runner = runner().with_cwd("named"); assert_eq!( - runner.ok("$result: inspect(blue);\ + runner.ok("@use \"sass:meta\";\ + \n$result: meta.inspect(blue);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: blue;\ @@ -133,10 +140,11 @@ mod literal { fn short_hex() { let runner = runner().with_cwd("short_hex"); assert_eq!( - runner.ok("$result: inspect(#00f);\ + runner.ok("@use \"sass:meta\";\ + \n$result: meta.inspect(#00f);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: #00f;\ @@ -148,10 +156,11 @@ mod literal { fn transparent() { let runner = runner().with_cwd("transparent"); assert_eq!( - runner.ok("$result: inspect(transparent);\ + runner.ok("@use \"sass:meta\";\ + \n$result: meta.inspect(transparent);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: transparent;\ diff --git a/rsass/tests/spec/core_functions/meta/inspect/error.rs b/rsass/tests/spec/core_functions/meta/inspect/error.rs index 77b1cb7d7..5d00fc6a7 100644 --- a/rsass/tests/spec/core_functions/meta/inspect/error.rs +++ b/rsass/tests/spec/core_functions/meta/inspect/error.rs @@ -8,32 +8,38 @@ fn runner() -> crate::TestRunner { #[test] fn too_few_args() { assert_eq!( - runner().err("a {a: inspect()}\n"), + runner().err( + "@use \"sass:meta\";\ + \na {a: meta.inspect()}\n" + ), "Error: Missing argument $value.\ \n ,--> input.scss\ - \n1 | a {a: inspect()}\ - \n | ^^^^^^^^^ invocation\ + \n2 | a {a: meta.inspect()}\ + \n | ^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function inspect($value) {\ \n | =============== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {a: inspect(1, 2)}\n"), + runner().err( + "@use \"sass:meta\";\ + \na {a: meta.inspect(1, 2)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {a: inspect(1, 2)}\ - \n | ^^^^^^^^^^^^^ invocation\ + \n2 | a {a: meta.inspect(1, 2)}\ + \n | ^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function inspect($value) {\ \n | =============== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } diff --git a/rsass/tests/spec/core_functions/meta/inspect/function.rs b/rsass/tests/spec/core_functions/meta/inspect/function.rs index d8606df6f..138cbe42b 100644 --- a/rsass/tests/spec/core_functions/meta/inspect/function.rs +++ b/rsass/tests/spec/core_functions/meta/inspect/function.rs @@ -8,11 +8,14 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$result: inspect(get-function(\"get-function\"));\ + runner().ok( + "@use \"sass:meta\";\ + \n$result: meta.inspect(meta.get-function(\"get-function\", $module: \"meta\"));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ - \n}\n"), + \n type: meta.type-of($result);\ + \n}\n" + ), "a {\ \n value: get-function(\"get-function\");\ \n type: string;\ diff --git a/rsass/tests/spec/core_functions/meta/inspect/inspect.rs b/rsass/tests/spec/core_functions/meta/inspect/inspect.rs index 8c503c688..ce7aed88d 100644 --- a/rsass/tests/spec/core_functions/meta/inspect/inspect.rs +++ b/rsass/tests/spec/core_functions/meta/inspect/inspect.rs @@ -12,7 +12,8 @@ mod empty { #[test] fn bracketed() { assert_eq!( - runner().ok("a {b: inspect([])}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.inspect([])}\n"), "a {\ \n b: [];\ \n}\n" diff --git a/rsass/tests/spec/core_functions/meta/inspect/list/bracketed.rs b/rsass/tests/spec/core_functions/meta/inspect/list/bracketed.rs index 9dfca6987..9e7291b4d 100644 --- a/rsass/tests/spec/core_functions/meta/inspect/list/bracketed.rs +++ b/rsass/tests/spec/core_functions/meta/inspect/list/bracketed.rs @@ -8,10 +8,11 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$result: inspect([1, 2, 3]);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect([1, 2, 3]);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: [1, 2, 3];\ diff --git a/rsass/tests/spec/core_functions/meta/inspect/list/comma.rs b/rsass/tests/spec/core_functions/meta/inspect/list/comma.rs index 750d9838d..2addbbeff 100644 --- a/rsass/tests/spec/core_functions/meta/inspect/list/comma.rs +++ b/rsass/tests/spec/core_functions/meta/inspect/list/comma.rs @@ -8,10 +8,11 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$result: inspect((1, 2, 3));\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect((1, 2, 3));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: 1, 2, 3;\ diff --git a/rsass/tests/spec/core_functions/meta/inspect/list/empty.rs b/rsass/tests/spec/core_functions/meta/inspect/list/empty.rs index a7576258b..0f27a60ab 100644 --- a/rsass/tests/spec/core_functions/meta/inspect/list/empty.rs +++ b/rsass/tests/spec/core_functions/meta/inspect/list/empty.rs @@ -8,10 +8,11 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$result: inspect(());\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect(());\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: ();\ diff --git a/rsass/tests/spec/core_functions/meta/inspect/list/nested.rs b/rsass/tests/spec/core_functions/meta/inspect/list/nested.rs index 335c5646d..19f6fed76 100644 --- a/rsass/tests/spec/core_functions/meta/inspect/list/nested.rs +++ b/rsass/tests/spec/core_functions/meta/inspect/list/nested.rs @@ -16,10 +16,11 @@ mod bracketed { #[test] fn bracketed() { assert_eq!( - runner().ok("$result: inspect([[1, 2], [3, 4]]);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect([[1, 2], [3, 4]]);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: [[1, 2], [3, 4]];\ @@ -30,10 +31,11 @@ mod bracketed { #[test] fn unbracketed() { assert_eq!( - runner().ok("$result: inspect(((1, 2), (3, 4)));\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect(((1, 2), (3, 4)));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: (1, 2), (3, 4);\ @@ -50,10 +52,12 @@ mod bracketed { fn bracketed() { assert_eq!( runner().ok( - "$result: inspect(join([[1, 2], [3, 4]], (), $separator: slash));\ + "@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n$result: meta.inspect(list.join([[1, 2], [3, 4]], (), $separator: slash));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n" ), "a {\ @@ -65,11 +69,12 @@ mod bracketed { #[test] fn unbracketed() { assert_eq!( - runner().ok("@use \"sass:list\";\ - \n$result: inspect(list.slash([1, 2], [3, 4]));\ + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:list\";\ + \n$result: meta.inspect(list.slash([1, 2], [3, 4]));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: [1, 2] / [3, 4];\ @@ -85,10 +90,11 @@ mod bracketed { #[test] fn bracketed() { assert_eq!( - runner().ok("$result: inspect([[1, 2] [3, 4]]);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect([[1, 2] [3, 4]]);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: [[1, 2] [3, 4]];\ @@ -99,10 +105,11 @@ mod bracketed { #[test] fn unbracketed() { assert_eq!( - runner().ok("$result: inspect([1, 2] [3, 4]);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect([1, 2] [3, 4]);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: [1, 2] [3, 4];\ @@ -123,10 +130,11 @@ mod comma { #[test] fn bracketed() { assert_eq!( - runner().ok("$result: inspect([(1, 2), (3, 4)]);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect([(1, 2), (3, 4)]);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: [(1, 2), (3, 4)];\ @@ -137,10 +145,11 @@ mod comma { #[test] fn unbracketed() { assert_eq!( - runner().ok("$result: inspect(((1, 2), (3, 4)));\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect(((1, 2), (3, 4)));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: (1, 2), (3, 4);\ @@ -157,10 +166,12 @@ mod comma { fn bracketed() { assert_eq!( runner().ok( - "$result: inspect(join([(1, 2), (3, 4)], (), $separator: slash));\ + "@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n$result: meta.inspect(list.join([(1, 2), (3, 4)], (), $separator: slash));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n" ), "a {\ @@ -172,11 +183,12 @@ mod comma { #[test] fn unbracketed() { assert_eq!( - runner().ok("@use \"sass:list\";\ - \n$result: inspect(list.slash((1, 2), (3, 4)));\ + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:list\";\ + \n$result: meta.inspect(list.slash((1, 2), (3, 4)));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: (1, 2) / (3, 4);\ @@ -192,10 +204,11 @@ mod comma { #[test] fn bracketed() { assert_eq!( - runner().ok("$result: inspect([(1, 2) (3, 4)]);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect([(1, 2) (3, 4)]);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: [(1, 2) (3, 4)];\ @@ -206,10 +219,11 @@ mod comma { #[test] fn unbracketed() { assert_eq!( - runner().ok("$result: inspect((1, 2) (3, 4));\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect((1, 2) (3, 4));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: (1, 2) (3, 4);\ @@ -230,10 +244,11 @@ mod empty { #[test] fn bracketed() { assert_eq!( - runner().ok("$result: inspect([(), ()]);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect([(), ()]);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: [(), ()];\ @@ -244,10 +259,11 @@ mod empty { #[test] fn unbracketed() { assert_eq!( - runner().ok("$result: inspect(((), ()));\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect(((), ()));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: (), ();\ @@ -264,10 +280,12 @@ mod empty { fn bracketed() { assert_eq!( runner().ok( - "$result: inspect(join([(), ()], (), $separator: slash));\ + "@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n$result: meta.inspect(list.join([(), ()], (), $separator: slash));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n" ), "a {\ @@ -279,11 +297,12 @@ mod empty { #[test] fn unbracketed() { assert_eq!( - runner().ok("@use \"sass:list\";\ - \n$result: inspect(list.slash((), ()));\ + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:list\";\ + \n$result: meta.inspect(list.slash((), ()));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: () / ();\ @@ -299,10 +318,11 @@ mod empty { #[test] fn bracketed() { assert_eq!( - runner().ok("$result: inspect([() ()]);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect([() ()]);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: [() ()];\ @@ -313,10 +333,11 @@ mod empty { #[test] fn unbracketed() { assert_eq!( - runner().ok("$result: inspect(() ());\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect(() ());\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: () ();\ @@ -333,7 +354,8 @@ mod empty_bracketed { #[test] fn bracketed() { assert_eq!( - runner().ok("a {b: inspect([[] []])}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.inspect([[] []])}\n"), "a {\ \n b: [[] []];\ \n}\n" @@ -342,7 +364,8 @@ mod empty_bracketed { #[test] fn unbracketed() { assert_eq!( - runner().ok("a {b: inspect(([] []))}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.inspect(([] []))}\n"), "a {\ \n b: [] [];\ \n}\n" @@ -360,10 +383,11 @@ mod space { #[test] fn bracketed() { assert_eq!( - runner().ok("$result: inspect([1 2, 3 4]);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect([1 2, 3 4]);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: [1 2, 3 4];\ @@ -374,10 +398,11 @@ mod space { #[test] fn unbracketed() { assert_eq!( - runner().ok("$result: inspect((1 2, 3 4));\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect((1 2, 3 4));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: 1 2, 3 4;\ @@ -394,10 +419,12 @@ mod space { fn bracketed() { assert_eq!( runner().ok( - "$result: inspect(join([1 2, 3 4], (), $separator: slash));\ + "@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n$result: meta.inspect(list.join([1 2, 3 4], (), $separator: slash));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n" ), "a {\ @@ -409,11 +436,12 @@ mod space { #[test] fn unbracketed() { assert_eq!( - runner().ok("@use \"sass:list\";\ - \n$result: inspect(list.slash(1 2, 3 4));\ + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:list\";\ + \n$result: meta.inspect(list.slash(1 2, 3 4));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: 1 2 / 3 4;\ @@ -429,10 +457,11 @@ mod space { #[test] fn bracketed() { assert_eq!( - runner().ok("$result: inspect([(1 2) (3 4)]);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect([(1 2) (3 4)]);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: [(1 2) (3 4)];\ @@ -443,10 +472,11 @@ mod space { #[test] fn unbracketed() { assert_eq!( - runner().ok("$result: inspect((1 2) (3 4));\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect((1 2) (3 4));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: (1 2) (3 4);\ diff --git a/rsass/tests/spec/core_functions/meta/inspect/list/single.rs b/rsass/tests/spec/core_functions/meta/inspect/list/single.rs index 36691dd36..d8dcbee2a 100644 --- a/rsass/tests/spec/core_functions/meta/inspect/list/single.rs +++ b/rsass/tests/spec/core_functions/meta/inspect/list/single.rs @@ -12,10 +12,11 @@ mod bracketed { #[test] fn comma() { assert_eq!( - runner().ok("$result: inspect([1,]);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect([1,]);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: [1,];\ @@ -26,10 +27,11 @@ mod bracketed { #[test] fn undecided() { assert_eq!( - runner().ok("$result: inspect([1]);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect([1]);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: [1];\ @@ -41,10 +43,11 @@ mod bracketed { #[test] fn comma() { assert_eq!( - runner().ok("$result: inspect((1,));\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect((1,));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: (1,);\ @@ -55,10 +58,12 @@ fn comma() { #[test] fn slash() { assert_eq!( - runner().ok("$result: inspect(append((), 1, slash));\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n$result: meta.inspect(list.append((), 1, slash));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: (1/);\ @@ -69,10 +74,12 @@ fn slash() { #[test] fn space() { assert_eq!( - runner().ok("$result: inspect(append((), 1, space));\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n$result: meta.inspect(list.append((), 1, space));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: 1;\ diff --git a/rsass/tests/spec/core_functions/meta/inspect/list/space.rs b/rsass/tests/spec/core_functions/meta/inspect/list/space.rs index 89d70d23a..9364d5bf9 100644 --- a/rsass/tests/spec/core_functions/meta/inspect/list/space.rs +++ b/rsass/tests/spec/core_functions/meta/inspect/list/space.rs @@ -8,10 +8,11 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$result: inspect(1 2 3);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect(1 2 3);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: 1 2 3;\ diff --git a/rsass/tests/spec/core_functions/meta/inspect/map.rs b/rsass/tests/spec/core_functions/meta/inspect/map.rs index 92f9a40c2..ba10f9183 100644 --- a/rsass/tests/spec/core_functions/meta/inspect/map.rs +++ b/rsass/tests/spec/core_functions/meta/inspect/map.rs @@ -16,10 +16,11 @@ mod list { #[test] fn comma() { assert_eq!( - runner().ok("$result: inspect(((1, 2): 3, (4, 5): 6));\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect(((1, 2): 3, (4, 5): 6));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: ((1, 2): 3, (4, 5): 6);\ @@ -30,10 +31,11 @@ mod list { #[test] fn space() { assert_eq!( - runner().ok("$result: inspect((1 2: 3, 4 5: 6));\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect((1 2: 3, 4 5: 6));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: (1 2: 3, 4 5: 6);\ @@ -49,10 +51,11 @@ mod list { #[test] fn comma() { assert_eq!( - runner().ok("$result: inspect((1: (2, 3), 4: (5, 6)));\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect((1: (2, 3), 4: (5, 6)));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: (1: (2, 3), 4: (5, 6));\ @@ -63,10 +66,11 @@ mod list { #[test] fn space() { assert_eq!( - runner().ok("$result: inspect((1: 2 3, 4: 5 6));\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect((1: 2 3, 4: 5 6));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: (1: 2 3, 4: 5 6);\ @@ -79,10 +83,11 @@ mod list { #[test] fn number() { assert_eq!( - runner().ok("$result: inspect((1: 2, 3: 4));\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect((1: 2, 3: 4));\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: (1: 2, 3: 4);\ diff --git a/rsass/tests/spec/core_functions/meta/inspect/mixin.rs b/rsass/tests/spec/core_functions/meta/inspect/mixin.rs index a5b92181b..05217c0f1 100644 --- a/rsass/tests/spec/core_functions/meta/inspect/mixin.rs +++ b/rsass/tests/spec/core_functions/meta/inspect/mixin.rs @@ -10,7 +10,7 @@ fn runner() -> crate::TestRunner { fn builtin() { assert_eq!( runner().ok("@use \"sass:meta\";\ - \na {b: inspect(meta.get-mixin(load-css, meta))};\n"), + \na {b: meta.inspect(meta.get-mixin(load-css, meta))};\n"), "a {\ \n b: get-mixin(\"load-css\");\ \n}\n" @@ -22,7 +22,7 @@ fn user_defined() { assert_eq!( runner().ok("@use \"sass:meta\";\ \n@mixin a() {}\ - \na {b: inspect(meta.get-mixin(a))};\n"), + \na {b: meta.inspect(meta.get-mixin(a))};\n"), "a {\ \n b: get-mixin(\"a\");\ \n}\n" diff --git a/rsass/tests/spec/core_functions/meta/inspect/null.rs b/rsass/tests/spec/core_functions/meta/inspect/null.rs index a57fc7e24..382b56de6 100644 --- a/rsass/tests/spec/core_functions/meta/inspect/null.rs +++ b/rsass/tests/spec/core_functions/meta/inspect/null.rs @@ -8,10 +8,11 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$result: inspect(null);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect(null);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: null;\ diff --git a/rsass/tests/spec/core_functions/meta/inspect/number.rs b/rsass/tests/spec/core_functions/meta/inspect/number.rs index 9444ad5e6..5566143b5 100644 --- a/rsass/tests/spec/core_functions/meta/inspect/number.rs +++ b/rsass/tests/spec/core_functions/meta/inspect/number.rs @@ -9,12 +9,13 @@ fn runner() -> crate::TestRunner { fn unit() { assert_eq!( runner().ok( - "// We explicitly don\'t test the inspect format for complex units. Their format\ + "@use \"sass:meta\";\ + \n// We explicitly don\'t test the inspect format for complex units. Their format\ \n// isn\'t guaranteed by the spec, since they can\'t be written literally in Sass.\ - \n$result: inspect(50px);\ + \n$result: meta.inspect(50px);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n" ), "a {\ @@ -26,10 +27,11 @@ fn unit() { #[test] fn unitless() { assert_eq!( - runner().ok("$result: inspect(123.456);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect(123.456);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: 123.456;\ diff --git a/rsass/tests/spec/core_functions/meta/inspect/string.rs b/rsass/tests/spec/core_functions/meta/inspect/string.rs index 692a5c051..0d8271f4b 100644 --- a/rsass/tests/spec/core_functions/meta/inspect/string.rs +++ b/rsass/tests/spec/core_functions/meta/inspect/string.rs @@ -9,15 +9,17 @@ fn runner() -> crate::TestRunner { fn quoted() { assert_eq!( runner().ok( - "$result: inspect(\"foo\");\ + "@use \"sass:meta\";\ + \n@use \"sass:string\";\ + \n$result: meta.inspect(\"foo\");\ \na {\ \n value: $result;\ - \n type: type-of($result);\n\ + \n type: meta.type-of($result);\n\ \n // inspect() should always return an unquoted string, so when it\'s passed a\ \n // quoted string its return value should contain quote characters. We check\ \n // the length to verify that the quotes are included, since there\'s no\ \n // built-in way to check whether a string is quoted.\ - \n length: str-length($result);\ + \n length: string.length($result);\ \n}\n" ), "a {\ @@ -30,10 +32,11 @@ fn quoted() { #[test] fn unquoted() { assert_eq!( - runner().ok("$result: inspect(foo);\ + runner().ok("@use \"sass:meta\";\ + \n$result: meta.inspect(foo);\ \na {\ \n value: $result;\ - \n type: type-of($result);\ + \n type: meta.type-of($result);\ \n}\n"), "a {\ \n value: foo;\ diff --git a/rsass/tests/spec/core_functions/meta/keywords.rs b/rsass/tests/spec/core_functions/meta/keywords.rs index 1cdd7e7aa..60ce0fff0 100644 --- a/rsass/tests/spec/core_functions/meta/keywords.rs +++ b/rsass/tests/spec/core_functions/meta/keywords.rs @@ -4,15 +4,18 @@ fn runner() -> crate::TestRunner { super::runner() .with_cwd("keywords") - .mock_file("_utils.scss", "/// Returns the keyword arguments passed to this function as a map.\n@function args-to-keywords($args...) {\n @return keywords($args);\n}\n") + .mock_file("_utils.scss", "@use \"sass:meta\";\n/// Returns the keyword arguments passed to this function as a map.\n@function args-to-keywords($args...) {\n @return meta.keywords($args);\n}\n") } #[test] fn dash_insensitive() { let runner = runner().with_cwd("dash_insensitive"); assert_eq!( - runner.ok("@import \"../utils\";\ - \na {b: inspect(args-to-keywords($c-d: e, $f_g: h))}\n"), + runner.ok( + "@use \"sass:meta\";\ + \n@use \"../utils\";\ + \na {b: meta.inspect(utils.args-to-keywords($c-d: e, $f_g: h))}\n" + ), "a {\ \n b: (c-d: e, f-g: h);\ \n}\n" @@ -28,8 +31,9 @@ mod empty { fn no_args() { let runner = runner().with_cwd("no_args"); assert_eq!( - runner.ok("@import \"../../utils\";\ - \na {b: inspect(args-to-keywords())}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"../../utils\";\ + \na {b: meta.inspect(utils.args-to-keywords())}\n"), "a {\ \n b: ();\ \n}\n" @@ -39,8 +43,9 @@ mod empty { fn positional() { let runner = runner().with_cwd("positional"); assert_eq!( - runner.ok("@import \"../../utils\";\ - \na {b: inspect(args-to-keywords(1, 2, 3))}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"../../utils\";\ + \na {b: meta.inspect(utils.args-to-keywords(1, 2, 3))}\n"), "a {\ \n b: ();\ \n}\n" @@ -57,34 +62,40 @@ mod error { fn too_few_args() { let runner = runner().with_cwd("too_few_args"); assert_eq!( - runner.err("a {b: keywords()}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.keywords()}\n" + ), "Error: Missing argument $args.\ \n ,--> input.scss\ - \n1 | a {b: keywords()}\ - \n | ^^^^^^^^^^ invocation\ + \n2 | a {b: meta.keywords()}\ + \n | ^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function keywords($args) {\ \n | =============== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { let runner = runner().with_cwd("too_many_args"); assert_eq!( - runner.err("a {b: keywords(1, 2)}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.keywords(1, 2)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: keywords(1, 2)}\ - \n | ^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: meta.keywords(1, 2)}\ + \n | ^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function keywords($args) {\ \n | =============== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod test_type { @@ -94,29 +105,36 @@ mod error { } #[test] + #[ignore] // wrong error fn non_arg_list() { let runner = runner().with_cwd("non_arg_list"); assert_eq!( - runner.err("a {b: keywords(1 2 3)}\n"), - "Error: $args: 1 2 3 is not an argument list.\ + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.keywords(1 2 3)}\n" + ), + "Error: $args: (1 2 3) is not an argument list.\ \n ,\ - \n1 | a {b: keywords(1 2 3)}\ - \n | ^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.keywords(1 2 3)}\ + \n | ^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn non_list() { let runner = runner().with_cwd("non_list"); assert_eq!( - runner.err("a {b: keywords(1)}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.keywords(1)}\n" + ), "Error: $args: 1 is not an argument list.\ \n ,\ - \n1 | a {b: keywords(1)}\ - \n | ^^^^^^^^^^^\ + \n2 | a {b: meta.keywords(1)}\ + \n | ^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -131,26 +149,30 @@ mod forwarded { fn call() { let runner = runner().with_cwd("call"); assert_eq!( - runner.ok("@import \"../../utils\";\n\ + runner.ok( + "@use \"sass:meta\";\ + \n@use \"../../utils\";\n\ \n@function args-to-keywords-forward($args...) {\ - \n @return call(get-function(\"args-to-keywords\"), $args...);\ + \n @return meta.call(meta.get-function(\"args-to-keywords\", $module: \"utils\"), $args...);\ \n}\n\ - \na {b: inspect(args-to-keywords-forward($c: d))}\n"), - "a {\ + \na {b: meta.inspect(args-to-keywords-forward($c: d))}\n" + ), + "a {\ \n b: (c: d);\ \n}\n" - ); + ); } #[test] fn content() { let runner = runner().with_cwd("content"); assert_eq!( - runner.ok("@import \"../../utils\";\n\ + runner.ok("@use \"sass:meta\";\ + \n@use \"../../utils\";\n\ \n@mixin args-to-keywords-forward($args...) {\ \n @content($args...);\ \n}\n\ \n@include args-to-keywords-forward($c: d) using ($args...) {\ - \n a {b: inspect(args-to-keywords($args...))}\ + \n a {b: meta.inspect(utils.args-to-keywords($args...))}\ \n}\n"), "a {\ \n b: (c: d);\ @@ -161,11 +183,12 @@ mod forwarded { fn function() { let runner = runner().with_cwd("function"); assert_eq!( - runner.ok("@import \"../../utils\";\n\ + runner.ok("@use \"sass:meta\";\ + \n@use \"../../utils\";\n\ \n@function args-to-keywords-forward($args...) {\ - \n @return args-to-keywords($args...);\ + \n @return utils.args-to-keywords($args...);\ \n}\n\ - \na {b: inspect(args-to-keywords-forward($c: d))}\n"), + \na {b: meta.inspect(args-to-keywords-forward($c: d))}\n"), "a {\ \n b: (c: d);\ \n}\n" @@ -175,9 +198,10 @@ mod forwarded { fn mixin() { let runner = runner().with_cwd("mixin"); assert_eq!( - runner.ok("@import \"../../utils\";\n\ + runner.ok("@use \"sass:meta\";\ + \n@use \"../../utils\";\n\ \n@mixin args-to-keywords-forward($args...) {\ - \n a {b: inspect(args-to-keywords($args...))}\ + \n a {b: meta.inspect(utils.args-to-keywords($args...))}\ \n}\n\ \n@include args-to-keywords-forward($c: d);\n"), "a {\ @@ -190,8 +214,11 @@ mod forwarded { fn multi_arg() { let runner = runner().with_cwd("multi_arg"); assert_eq!( - runner.ok("@import \"../utils\";\ - \na {b: inspect(args-to-keywords($c: d, $e: f, $g: h))}\n"), + runner.ok( + "@use \"sass:meta\";\ + \n@use \"../utils\";\ + \na {b: meta.inspect(utils.args-to-keywords($c: d, $e: f, $g: h))}\n" + ), "a {\ \n b: (c: d, e: f, g: h);\ \n}\n" @@ -201,10 +228,11 @@ fn multi_arg() { fn named() { let runner = runner().with_cwd("named"); assert_eq!( - runner.ok("@function args-to-keywords($args...) {\ - \n @return keywords($args: $args);\ + runner.ok("@use \"sass:meta\";\ + \n@function args-to-keywords($args...) {\ + \n @return meta.keywords($args: $args);\ \n}\n\ - \na {b: inspect(args-to-keywords($c: d))}\n"), + \na {b: meta.inspect(args-to-keywords($c: d))}\n"), "a {\ \n b: (c: d);\ \n}\n" @@ -214,8 +242,9 @@ fn named() { fn one_arg() { let runner = runner().with_cwd("one_arg"); assert_eq!( - runner.ok("@import \"../utils\";\ - \na {b: inspect(args-to-keywords($c: d))}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"../utils\";\ + \na {b: meta.inspect(utils.args-to-keywords($c: d))}\n"), "a {\ \n b: (c: d);\ \n}\n" diff --git a/rsass/tests/spec/core_functions/meta/load_css/with.rs b/rsass/tests/spec/core_functions/meta/load_css/with.rs index bc484ad14..d78ecff09 100644 --- a/rsass/tests/spec/core_functions/meta/load_css/with.rs +++ b/rsass/tests/spec/core_functions/meta/load_css/with.rs @@ -41,7 +41,7 @@ fn runner() -> crate::TestRunner { .mock_file("through_import/transitive/_loaded.scss", "@import \"midstream\";\n") .mock_file("through_import/transitive/_midstream.scss", "@import \"upstream\";\n") .mock_file("through_import/transitive/_upstream.scss", "$a: original !default;\nb {c: $a}\n") - .mock_file("variable_exists/_other.scss", "$before-declaration: variable-exists(a);\n$a: original !default;\nb {\n before-declaration: $before-declaration;\n after-declaration: variable-exists(a);\n}\n") + .mock_file("variable_exists/_other.scss", "@use \"sass:meta\";\n$before-declaration: meta.variable-exists(a);\n$a: original !default;\nb {\n before-declaration: $before-declaration;\n after-declaration: meta.variable-exists(a);\n}\n") } mod core_module { diff --git a/rsass/tests/spec/core_functions/meta/mixin_exists.rs b/rsass/tests/spec/core_functions/meta/mixin_exists.rs index 76aeb1882..c7bab53ba 100644 --- a/rsass/tests/spec/core_functions/meta/mixin_exists.rs +++ b/rsass/tests/spec/core_functions/meta/mixin_exists.rs @@ -64,8 +64,9 @@ mod different_module { fn chosen_prefix() { let runner = runner().with_cwd("chosen_prefix"); assert_eq!( - runner.ok("@use \"other\" as a;\ - \nb {c: mixin-exists(\"d\", \"a\")}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"other\" as a;\ + \nb {c: meta.mixin-exists(\"d\", \"a\")}\n"), "b {\ \n c: true;\ \n}\n" @@ -75,8 +76,9 @@ mod different_module { fn defined() { let runner = runner().with_cwd("defined"); assert_eq!( - runner.ok("@use \"other\";\ - \na {b: mixin-exists(\"c\", \"other\")}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"other\";\ + \na {b: meta.mixin-exists(\"c\", \"other\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -92,10 +94,11 @@ mod different_module { fn test_as() { let runner = runner().with_cwd("as"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ \na {\ - \n with-prefix: mixin-exists(b-c);\ - \n without-prefix: mixin-exists(c);\ + \n with-prefix: meta.mixin-exists(b-c);\ + \n without-prefix: meta.mixin-exists(c);\ \n}\n"), "a {\ \n with-prefix: true;\ @@ -107,8 +110,9 @@ mod different_module { fn bare() { let runner = runner().with_cwd("bare"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ - \na {b: mixin-exists(c)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ + \na {b: meta.mixin-exists(c)}\n"), "a {\ \n b: true;\ \n}\n" @@ -118,10 +122,11 @@ mod different_module { fn hide() { let runner = runner().with_cwd("hide"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ \na {\ - \n hidden: mixin-exists(b);\ - \n not-hidden: mixin-exists(c);\ + \n hidden: meta.mixin-exists(b);\ + \n not-hidden: meta.mixin-exists(c);\ \n}\n"), "a {\ \n hidden: false;\ @@ -133,10 +138,11 @@ mod different_module { fn show() { let runner = runner().with_cwd("show"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ \na {\ - \n shown: mixin-exists(b);\ - \n not-shown: mixin-exists(c);\ + \n shown: meta.mixin-exists(b);\ + \n not-shown: meta.mixin-exists(c);\ \n}\n"), "a {\ \n shown: true;\ @@ -149,8 +155,9 @@ mod different_module { fn through_use() { let runner = runner().with_cwd("through_use"); assert_eq!( - runner.ok("@use \"other\" as *;\ - \na {b: mixin-exists(global-mixin)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"other\" as *;\ + \na {b: meta.mixin-exists(global-mixin)}\n"), "a {\ \n b: true;\ \n}\n" @@ -160,8 +167,9 @@ mod different_module { fn undefined() { let runner = runner().with_cwd("undefined"); assert_eq!( - runner.ok("@use \"sass:color\";\ - \na {b: mixin-exists(\"c\", \"color\")}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"sass:color\";\ + \na {b: meta.mixin-exists(\"c\", \"color\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -184,34 +192,40 @@ mod error { fn too_few() { let runner = runner().with_cwd("too_few"); assert_eq!( - runner.err("a {b: mixin-exists()}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.mixin-exists()}\n" + ), "Error: Missing argument $name.\ \n ,--> input.scss\ - \n1 | a {b: mixin-exists()}\ - \n | ^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: meta.mixin-exists()}\ + \n | ^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function mixin-exists($name, $module: null) {\ \n | ================================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many() { let runner = runner().with_cwd("too_many"); assert_eq!( - runner.err("a {b: mixin-exists(c, d, e)}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.mixin-exists(c, d, e)}\n" + ), "Error: Only 2 arguments allowed, but 3 were passed.\ \n ,--> input.scss\ - \n1 | a {b: mixin-exists(c, d, e)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: meta.mixin-exists(c, d, e)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function mixin-exists($name, $module: null) {\ \n | ================================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod test_type { @@ -224,26 +238,32 @@ mod error { fn module() { let runner = runner().with_cwd("module"); assert_eq!( - runner.err("a {b: mixin-exists(c, 1)}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.mixin-exists(c, 1)}\n" + ), "Error: $module: 1 is not a string.\ \n ,\ - \n1 | a {b: mixin-exists(c, 1)}\ - \n | ^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.mixin-exists(c, 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn name() { let runner = runner().with_cwd("name"); assert_eq!( - runner.err("a {b: mixin-exists(12px)}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.mixin-exists(12px)}\n" + ), "Error: $name: 12px is not a string.\ \n ,\ - \n1 | a {b: mixin-exists(12px)}\ - \n | ^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.mixin-exists(12px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -254,21 +274,22 @@ mod error { let runner = runner().with_cwd("conflict"); assert_eq!( runner.err( - "@use \"other1\" as *;\ + "@use \"sass:meta\";\ + \n@use \"other1\" as *;\ \n@use \"other2\" as *;\n\ - \na {b: mixin-exists(member)}\n" + \na {b: meta.mixin-exists(member)}\n" ), "Error: This mixin is available from multiple global modules.\ \n ,\ - \n1 | @use \"other1\" as *;\ + \n2 | @use \"other1\" as *;\ \n | ================== includes mixin\ - \n2 | @use \"other2\" as *;\ + \n3 | @use \"other2\" as *;\ \n | ================== includes mixin\ \n... |\ - \n4 | a {b: mixin-exists(member)}\ - \n | ^^^^^^^^^^^^^^^^^^^^ mixin use\ + \n5 | a {b: meta.mixin-exists(member)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^ mixin use\ \n \'\ - \n input.scss 4:7 root stylesheet", + \n input.scss 5:7 root stylesheet", ); } mod module { @@ -281,13 +302,16 @@ mod error { fn built_in_but_not_loaded() { let runner = runner().with_cwd("built_in_but_not_loaded"); assert_eq!( - runner.err("a {b: mixin-exists(\"c\", \"color\")}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.mixin-exists(\"c\", \"color\")}\n" + ), "Error: There is no module with the namespace \"color\".\ \n ,\ - \n1 | a {b: mixin-exists(\"c\", \"color\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.mixin-exists(\"c\", \"color\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] @@ -295,28 +319,32 @@ mod error { let runner = runner().with_cwd("dash_sensitive"); assert_eq!( runner.err( - "@use \"sass:color\" as a-b;\ - \nc {d: mixin-exists(\"c\", $module: \"a_b\")}\n" + "@use \"sass:meta\";\ + \n@use \"sass:color\" as a-b;\ + \nc {d: meta.mixin-exists(\"c\", $module: \"a_b\")}\n" ), "Error: There is no module with the namespace \"a_b\".\ \n ,\ - \n2 | c {d: mixin-exists(\"c\", $module: \"a_b\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n3 | c {d: meta.mixin-exists(\"c\", $module: \"a_b\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 2:7 root stylesheet", + \n input.scss 3:7 root stylesheet", ); } #[test] fn non_existent() { let runner = runner().with_cwd("non_existent"); assert_eq!( - runner.err("a {b: mixin-exists(\"c\", \"d\")}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.mixin-exists(\"c\", \"d\")}\n" + ), "Error: There is no module with the namespace \"d\".\ \n ,\ - \n1 | a {b: mixin-exists(\"c\", \"d\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.mixin-exists(\"c\", \"d\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -325,8 +353,9 @@ mod error { fn named() { let runner = runner().with_cwd("named"); assert_eq!( - runner.ok("@use \"other\";\ - \na {b: mixin-exists($name: \"c\", $module: \"other\")}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"other\";\ + \na {b: meta.mixin-exists($name: \"c\", $module: \"other\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -342,8 +371,9 @@ mod same_module { fn global() { let runner = runner().with_cwd("global"); assert_eq!( - runner.ok("@mixin global-mixin() {}\n\ - \na {b: mixin-exists(global-mixin)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@mixin global-mixin() {}\n\ + \na {b: meta.mixin-exists(global-mixin)}\n"), "a {\ \n b: true;\ \n}\n" @@ -353,9 +383,10 @@ mod same_module { fn local() { let runner = runner().with_cwd("local"); assert_eq!( - runner.ok("a {\ + runner.ok("@use \"sass:meta\";\ + \na {\ \n @mixin local-mixin() {}\ - \n b: mixin-exists(local-mixin);\ + \n b: meta.mixin-exists(local-mixin);\ \n}\n"), "a {\ \n b: true;\ @@ -366,8 +397,9 @@ mod same_module { fn non_existent() { let runner = runner().with_cwd("non_existent"); assert_eq!( - runner.ok("a {\ - \n b: mixin-exists(non-existent);\ + runner.ok("@use \"sass:meta\";\ + \na {\ + \n b: meta.mixin-exists(non-existent);\ \n}\n"), "a {\ \n b: false;\ @@ -378,8 +410,9 @@ mod same_module { fn through_import() { let runner = runner().with_cwd("through_import"); assert_eq!( - runner.ok("@import \"other\";\ - \na {b: mixin-exists(global-mixin)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@import \"other\";\ + \na {b: meta.mixin-exists(global-mixin)}\n"), "a {\ \n b: true;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/meta/type_of.rs b/rsass/tests/spec/core_functions/meta/type_of.rs index 42eecaef9..3b706cd04 100644 --- a/rsass/tests/spec/core_functions/meta/type_of.rs +++ b/rsass/tests/spec/core_functions/meta/type_of.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn arglist() { assert_eq!( - runner().ok("@function type-of-arglist($args...) {\ - \n @return type-of($args);\ + runner().ok("@use \"sass:meta\";\ + \n@function type-of-arglist($args...) {\ + \n @return meta.type-of($args);\ \n}\n\ \na {b: type-of-arglist()}\n"), "a {\ @@ -24,7 +25,8 @@ mod boolean { #[test] fn test_false() { assert_eq!( - runner().ok("a {b: type-of(false)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.type-of(false)}\n"), "a {\ \n b: bool;\ \n}\n" @@ -33,7 +35,8 @@ mod boolean { #[test] fn test_true() { assert_eq!( - runner().ok("a {b: type-of(true)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.type-of(true)}\n"), "a {\ \n b: bool;\ \n}\n" @@ -51,7 +54,8 @@ mod calculation { #[test] fn calc() { assert_eq!( - runner().ok("a {b: type-of(calc(var(--c)))}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.type-of(calc(var(--c)))}\n"), "a {\ \n b: calculation;\ \n}\n" @@ -60,7 +64,8 @@ mod calculation { #[test] fn clamp() { assert_eq!( - runner().ok("a {b: type-of(clamp(1%, 1px, 2px))}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.type-of(clamp(1%, 1px, 2px))}\n"), "a {\ \n b: calculation;\ \n}\n" @@ -70,7 +75,8 @@ mod calculation { #[test] fn simplified() { assert_eq!( - runner().ok("a {b: type-of(calc(1px))}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.type-of(calc(1px))}\n"), "a {\ \n b: number;\ \n}\n" @@ -80,7 +86,8 @@ mod calculation { #[test] fn color() { assert_eq!( - runner().ok("a {b: type-of(red)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.type-of(red)}\n"), "a {\ \n b: color;\ \n}\n" @@ -93,40 +100,49 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: type-of()}\n"), + runner().err( + "@use \"sass:meta\";\ + \na {b: meta.type-of()}\n" + ), "Error: Missing argument $value.\ \n ,--> input.scss\ - \n1 | a {b: type-of()}\ - \n | ^^^^^^^^^ invocation\ + \n2 | a {b: meta.type-of()}\ + \n | ^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function type-of($value) {\ \n | =============== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: type-of(1, 2)}\n"), + runner().err( + "@use \"sass:meta\";\ + \na {b: meta.type-of(1, 2)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: type-of(1, 2)}\ - \n | ^^^^^^^^^^^^^ invocation\ + \n2 | a {b: meta.type-of(1, 2)}\ + \n | ^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function type-of($value) {\ \n | =============== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn function() { assert_eq!( - runner().ok("a {b: type-of(get-function(\"type-of\"))}\n"), + runner().ok( + "@use \"sass:meta\";\ + \na {b: meta.type-of(meta.get-function(\"type-of\", $module: \"meta\"))}\n" + ), "a {\ \n b: function;\ \n}\n" @@ -139,7 +155,8 @@ mod list { #[test] fn empty() { assert_eq!( - runner().ok("a {b: type-of(())}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.type-of(())}\n"), "a {\ \n b: list;\ \n}\n" @@ -148,7 +165,8 @@ mod list { #[test] fn non_empty() { assert_eq!( - runner().ok("a {b: type-of(1 2 3)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.type-of(1 2 3)}\n"), "a {\ \n b: list;\ \n}\n" @@ -162,7 +180,9 @@ mod map { #[test] fn empty() { assert_eq!( - runner().ok("a {b: type-of(map-remove((c: d), c))}\n"), + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \na {b: meta.type-of(map.remove((c: d), c))}\n"), "a {\ \n b: map;\ \n}\n" @@ -171,7 +191,8 @@ mod map { #[test] fn non_empty() { assert_eq!( - runner().ok("a {b: type-of((c: d))}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.type-of((c: d))}\n"), "a {\ \n b: map;\ \n}\n" @@ -187,7 +208,7 @@ mod mixin { fn builtin() { assert_eq!( runner().ok("@use \"sass:meta\";\ - \na {b: type-of(meta.get-mixin(load-css, meta))}\n"), + \na {b: meta.type-of(meta.get-mixin(load-css, meta))}\n"), "a {\ \n b: mixin;\ \n}\n" @@ -199,7 +220,7 @@ mod mixin { assert_eq!( runner().ok("@use \"sass:meta\";\ \n@mixin a() {}\ - \na {b: type-of(meta.get-mixin(a))}\n"), + \na {b: meta.type-of(meta.get-mixin(a))}\n"), "a {\ \n b: mixin;\ \n}\n" @@ -209,7 +230,8 @@ mod mixin { #[test] fn named() { assert_eq!( - runner().ok("a {b: type-of($value: c)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.type-of($value: c)}\n"), "a {\ \n b: string;\ \n}\n" @@ -218,7 +240,8 @@ fn named() { #[test] fn null() { assert_eq!( - runner().ok("a {b: type-of(null)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.type-of(null)}\n"), "a {\ \n b: null;\ \n}\n" @@ -231,7 +254,8 @@ mod number { #[test] fn unit() { assert_eq!( - runner().ok("a {b: type-of(1.5px * 3.4em)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.type-of(1.5px * 3.4em)}\n"), "a {\ \n b: number;\ \n}\n" @@ -240,7 +264,8 @@ mod number { #[test] fn unitless() { assert_eq!( - runner().ok("a {b: type-of(1)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.type-of(1)}\n"), "a {\ \n b: number;\ \n}\n" @@ -254,7 +279,8 @@ mod string { #[test] fn quoted() { assert_eq!( - runner().ok("a {b: type-of(\"c\")}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.type-of(\"c\")}\n"), "a {\ \n b: string;\ \n}\n" @@ -263,7 +289,8 @@ mod string { #[test] fn unquoted() { assert_eq!( - runner().ok("a {b: type-of(c)}\n"), + runner().ok("@use \"sass:meta\";\ + \na {b: meta.type-of(c)}\n"), "a {\ \n b: string;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/meta/variable_exists.rs b/rsass/tests/spec/core_functions/meta/variable_exists.rs index 6fe32963d..59625256a 100644 --- a/rsass/tests/spec/core_functions/meta/variable_exists.rs +++ b/rsass/tests/spec/core_functions/meta/variable_exists.rs @@ -37,21 +37,22 @@ fn conflict() { let runner = runner().with_cwd("conflict"); assert_eq!( runner.err( - "@use \"other1\" as *;\ + "@use \"sass:meta\";\ + \n@use \"other1\" as *;\ \n@use \"other2\" as *;\n\ - \na {b: variable-exists(member)}\n" + \na {b: meta.variable-exists(member)}\n" ), "Error: This variable is available from multiple global modules.\ \n ,\ - \n1 | @use \"other1\" as *;\ + \n2 | @use \"other1\" as *;\ \n | ================== includes variable\ - \n2 | @use \"other2\" as *;\ + \n3 | @use \"other2\" as *;\ \n | ================== includes variable\ \n... |\ - \n4 | a {b: variable-exists(member)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^ variable use\ + \n5 | a {b: meta.variable-exists(member)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable use\ \n \'\ - \n input.scss 4:7 root stylesheet", + \n input.scss 5:7 root stylesheet", ); } mod dash_insensitive { @@ -64,8 +65,9 @@ mod dash_insensitive { fn dash_to_underscore() { let runner = runner().with_cwd("dash_to_underscore"); assert_eq!( - runner.ok("$a_b: null;\n\ - \nc {d: variable-exists(a-b)}\n"), + runner.ok("@use \"sass:meta\";\ + \n$a_b: null;\n\ + \nc {d: meta.variable-exists(a-b)}\n"), "c {\ \n d: true;\ \n}\n" @@ -75,8 +77,9 @@ mod dash_insensitive { fn underscore_to_dash() { let runner = runner().with_cwd("underscore_to_dash"); assert_eq!( - runner.ok("$a-b: null;\n\ - \nc {d: variable-exists(a_b)}\n"), + runner.ok("@use \"sass:meta\";\ + \n$a-b: null;\n\ + \nc {d: meta.variable-exists(a_b)}\n"), "c {\ \n d: true;\ \n}\n" @@ -99,47 +102,56 @@ mod error { fn too_few() { let runner = runner().with_cwd("too_few"); assert_eq!( - runner.err("a {b: variable-exists()}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.variable-exists()}\n" + ), "Error: Missing argument $name.\ \n ,--> input.scss\ - \n1 | a {b: variable-exists()}\ - \n | ^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: meta.variable-exists()}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function variable-exists($name) {\ \n | ====================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many() { let runner = runner().with_cwd("too_many"); assert_eq!( - runner.err("a {b: variable-exists(foo, bar)}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.variable-exists(foo, bar)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: variable-exists(foo, bar)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: meta.variable-exists(foo, bar)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:meta\ \n1 | @function variable-exists($name) {\ \n | ====================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { let runner = runner().with_cwd("type"); assert_eq!( - runner.err("a {b: variable-exists(12px)}\n"), + runner.err( + "@use \"sass:meta\";\ + \na {b: meta.variable-exists(12px)}\n" + ), "Error: $name: 12px is not a string.\ \n ,\ - \n1 | a {b: variable-exists(12px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: meta.variable-exists(12px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -148,8 +160,9 @@ mod error { fn global() { let runner = runner().with_cwd("global"); assert_eq!( - runner.ok("$global-variable: null;\n\ - \na {b: variable-exists(global-variable)}\n"), + runner.ok("@use \"sass:meta\";\ + \n$global-variable: null;\n\ + \na {b: meta.variable-exists(global-variable)}\n"), "a {\ \n b: true;\ \n}\n" @@ -159,7 +172,8 @@ fn global() { fn keyword() { let runner = runner().with_cwd("keyword"); assert_eq!( - runner.ok("a {b: variable-exists($name: foo)}\n"), + runner.ok("@use \"sass:meta\";\ + \na {b: meta.variable-exists($name: foo)}\n"), "a {\ \n b: false;\ \n}\n" @@ -169,9 +183,10 @@ fn keyword() { fn local() { let runner = runner().with_cwd("local"); assert_eq!( - runner.ok("a {\ + runner.ok("@use \"sass:meta\";\ + \na {\ \n $local-variable: null;\ - \n b: variable-exists(local-variable);\ + \n b: meta.variable-exists(local-variable);\ \n}\n"), "a {\ \n b: true;\ @@ -182,8 +197,9 @@ fn local() { fn non_existent() { let runner = runner().with_cwd("non_existent"); assert_eq!( - runner.ok("a {\ - \n b: variable-exists(non-existent);\ + runner.ok("@use \"sass:meta\";\ + \na {\ + \n b: meta.variable-exists(non-existent);\ \n}\n"), "a {\ \n b: false;\ @@ -200,10 +216,11 @@ mod through_forward { fn test_as() { let runner = runner().with_cwd("as"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ \na {\ - \n with-prefix: variable-exists(b-c);\ - \n without-prefix: variable-exists(c);\ + \n with-prefix: meta.variable-exists(b-c);\ + \n without-prefix: meta.variable-exists(c);\ \n}\n"), "a {\ \n with-prefix: true;\ @@ -215,10 +232,11 @@ mod through_forward { fn hide() { let runner = runner().with_cwd("hide"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ \na {\ - \n hidden: variable-exists(b);\ - \n not-hidden: variable-exists(c);\ + \n hidden: meta.variable-exists(b);\ + \n not-hidden: meta.variable-exists(c);\ \n}\n"), "a {\ \n hidden: false;\ @@ -230,10 +248,11 @@ mod through_forward { fn show() { let runner = runner().with_cwd("show"); assert_eq!( - runner.ok("@use \"midstream\" as *;\ + runner.ok("@use \"sass:meta\";\ + \n@use \"midstream\" as *;\ \na {\ - \n shown: variable-exists(b);\ - \n not-shown: variable-exists(c);\ + \n shown: meta.variable-exists(b);\ + \n not-shown: meta.variable-exists(c);\ \n}\n"), "a {\ \n shown: true;\ @@ -246,8 +265,9 @@ mod through_forward { fn through_import() { let runner = runner().with_cwd("through_import"); assert_eq!( - runner.ok("@import \"other\";\ - \na {b: variable-exists(global-variable)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@import \"other\";\ + \na {b: meta.variable-exists(global-variable)}\n"), "a {\ \n b: true;\ \n}\n" @@ -257,8 +277,9 @@ fn through_import() { fn through_use() { let runner = runner().with_cwd("through_use"); assert_eq!( - runner.ok("@use \"other\" as *;\ - \na {b: variable-exists(global-variable)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"other\" as *;\ + \na {b: meta.variable-exists(global-variable)}\n"), "a {\ \n b: true;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/mod.rs b/rsass/tests/spec/core_functions/mod.rs index f448e37d9..7e11aef8c 100644 --- a/rsass/tests/spec/core_functions/mod.rs +++ b/rsass/tests/spec/core_functions/mod.rs @@ -7,6 +7,10 @@ fn runner() -> crate::TestRunner { mod color; +mod general; + +mod global; + mod list; mod map; diff --git a/rsass/tests/spec/core_functions/modules/color/adjust.rs b/rsass/tests/spec/core_functions/modules/color/adjust.rs new file mode 100644 index 000000000..b0930b6f5 --- /dev/null +++ b/rsass/tests/spec/core_functions/modules/color/adjust.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color/adjust.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("adjust") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.adjust(#abcdef, $red: 10)}\n"), + "a {\ + \n b: #b5cdef;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/modules/color/alpha.rs b/rsass/tests/spec/core_functions/modules/color/alpha.rs new file mode 100644 index 000000000..d49a65f2e --- /dev/null +++ b/rsass/tests/spec/core_functions/modules/color/alpha.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color/alpha.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("alpha") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.alpha(#abcdef)}\n"), + "a {\ + \n b: 1;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/modules/color/blue.rs b/rsass/tests/spec/core_functions/modules/color/blue.rs new file mode 100644 index 000000000..020569946 --- /dev/null +++ b/rsass/tests/spec/core_functions/modules/color/blue.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color/blue.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("blue") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.blue(#abcdef)}\n"), + "a {\ + \n b: 239;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/modules/color/change.rs b/rsass/tests/spec/core_functions/modules/color/change.rs new file mode 100644 index 000000000..3bd3655a8 --- /dev/null +++ b/rsass/tests/spec/core_functions/modules/color/change.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color/change.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("change") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.change(#abcdef, $red: 10)}\n"), + "a {\ + \n b: #0acdef;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/modules/color/complement.rs b/rsass/tests/spec/core_functions/modules/color/complement.rs new file mode 100644 index 000000000..da4890b1e --- /dev/null +++ b/rsass/tests/spec/core_functions/modules/color/complement.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color/complement.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("complement") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.complement(#abcdef)}\n"), + "a {\ + \n b: #efcdab;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/modules/color/css_overloads.rs b/rsass/tests/spec/core_functions/modules/color/css_overloads.rs new file mode 100644 index 000000000..c45940b03 --- /dev/null +++ b/rsass/tests/spec/core_functions/modules/color/css_overloads.rs @@ -0,0 +1,62 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color/css_overloads.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("css_overloads") +} + +mod alpha { + #[allow(unused)] + use super::runner; + + #[test] + fn multi_arg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.alpha(c=d, e=f, g=h)}\n"), + "a {\ + \n b: alpha(c=d, e=f, g=h);\ + \n}\n" + ); + } + #[test] + fn one_arg() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.alpha(c=d)}\n"), + "a {\ + \n b: alpha(c=d);\ + \n}\n" + ); + } +} +#[test] +fn grayscale() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.grayscale(1)}\n"), + "a {\ + \n b: grayscale(1);\ + \n}\n" + ); +} +#[test] +fn invert() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(1)}\n"), + "a {\ + \n b: invert(1);\ + \n}\n" + ); +} +#[test] +fn opacity() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.opacity(1)}\n"), + "a {\ + \n b: opacity(1);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/modules/color.rs b/rsass/tests/spec/core_functions/modules/color/error.rs similarity index 55% rename from rsass/tests/spec/core_functions/modules/color.rs rename to rsass/tests/spec/core_functions/modules/color/error.rs index b781d9dcb..67c192aa7 100644 --- a/rsass/tests/spec/core_functions/modules/color.rs +++ b/rsass/tests/spec/core_functions/modules/color/error.rs @@ -1,142 +1,28 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color.hrx" +//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color/error.hrx" #[allow(unused)] fn runner() -> crate::TestRunner { - super::runner().with_cwd("color") + super::runner().with_cwd("error") } #[test] -fn adjust() { +fn adjust_color() { assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.adjust(#abcdef, $red: 10)}\n"), - "a {\ - \n b: #b5cdef;\ - \n}\n" - ); -} -#[test] -fn alpha() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.alpha(#abcdef)}\n"), - "a {\ - \n b: 1;\ - \n}\n" - ); -} -#[test] -fn blue() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.blue(#abcdef)}\n"), - "a {\ - \n b: 239;\ - \n}\n" - ); -} -#[test] -fn change() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.change(#abcdef, $red: 10)}\n"), - "a {\ - \n b: #0acdef;\ - \n}\n" - ); -} -#[test] -fn complement() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.complement(#abcdef)}\n"), - "a {\ - \n b: #efcdab;\ - \n}\n" - ); -} -mod css_overloads { - #[allow(unused)] - use super::runner; - - mod alpha { - #[allow(unused)] - use super::runner; - - #[test] - fn multi_arg() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.alpha(c=d, e=f, g=h)}\n"), - "a {\ - \n b: alpha(c=d, e=f, g=h);\ - \n}\n" - ); - } - #[test] - fn one_arg() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.alpha(c=d)}\n"), - "a {\ - \n b: alpha(c=d);\ - \n}\n" - ); - } - } - #[test] - fn grayscale() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.grayscale(1)}\n"), - "a {\ - \n b: grayscale(1);\ - \n}\n" - ); - } - #[test] - fn invert() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.invert(1)}\n"), - "a {\ - \n b: invert(1);\ - \n}\n" - ); - } - #[test] - fn opacity() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.opacity(1)}\n"), - "a {\ - \n b: opacity(1);\ - \n}\n" - ); - } -} -mod error { - #[allow(unused)] - use super::runner; - - #[test] - fn adjust_color() { - assert_eq!( - runner().err( - "@use \"sass:color\";\ + runner().err( + "@use \"sass:color\";\ \na {b: color.adjust-color(#abcdef, $red: 10)}\n" - ), - "Error: Undefined function.\ + ), + "Error: Undefined function.\ \n ,\ \n2 | a {b: color.adjust-color(#abcdef, $red: 10)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn adjust_hue() { - assert_eq!( + ); +} +#[test] +fn adjust_hue() { + assert_eq!( runner().err( "@use \"sass:color\";\ \na {b: color.adjust-hue(#abcdef, 10)}\n" @@ -150,25 +36,25 @@ mod error { \n \'\ \n input.scss 2:7 root stylesheet", ); - } - #[test] - fn change_color() { - assert_eq!( - runner().err( - "@use \"sass:color\";\ +} +#[test] +fn change_color() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ \na {b: color.change-color(#abcdef, $red: 10)}\n" - ), - "Error: Undefined function.\ + ), + "Error: Undefined function.\ \n ,\ \n2 | a {b: color.change-color(#abcdef, $red: 10)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn darken() { - assert_eq!( + ); +} +#[test] +fn darken() { + assert_eq!( runner().err( "@use \"sass:color\";\ \na {b: color.darken(#abcdef, 10%)}\n" @@ -182,10 +68,10 @@ mod error { \n \'\ \n input.scss 2:7 root stylesheet", ); - } - #[test] - fn desaturate() { - assert_eq!( +} +#[test] +fn desaturate() { + assert_eq!( runner().err( "@use \"sass:color\";\ \na {b: color.desaturate(#abcdef, 10%)}\n" @@ -199,10 +85,10 @@ mod error { \n \'\ \n input.scss 2:7 root stylesheet", ); - } - #[test] - fn fade_in() { - assert_eq!( +} +#[test] +fn fade_in() { + assert_eq!( runner().err( "@use \"sass:color\";\ \na {b: color.fade-in(#abcdef, 0.5)}\n" @@ -216,10 +102,10 @@ mod error { \n \'\ \n input.scss 2:7 root stylesheet", ); - } - #[test] - fn fade_out() { - assert_eq!( +} +#[test] +fn fade_out() { + assert_eq!( runner().err( "@use \"sass:color\";\ \na {b: color.fade-out(#abcdef, 0.5)}\n" @@ -233,10 +119,10 @@ mod error { \n \'\ \n input.scss 2:7 root stylesheet", ); - } - #[test] - fn lighten() { - assert_eq!( +} +#[test] +fn lighten() { + assert_eq!( runner().err( "@use \"sass:color\";\ \na {b: color.lighten(#abcdef, 10%)}\n" @@ -250,10 +136,10 @@ mod error { \n \'\ \n input.scss 2:7 root stylesheet", ); - } - #[test] - fn opacify() { - assert_eq!( +} +#[test] +fn opacify() { + assert_eq!( runner().err( "@use \"sass:color\";\ \na {b: color.opacify(#abcdef, 0.5)}\n" @@ -267,10 +153,10 @@ mod error { \n \'\ \n input.scss 2:7 root stylesheet", ); - } - #[test] - fn saturate() { - assert_eq!( +} +#[test] +fn saturate() { + assert_eq!( runner().err( "@use \"sass:color\";\ \na {b: color.saturate(#abcdef, 10%)}\n" @@ -284,25 +170,25 @@ mod error { \n \'\ \n input.scss 2:7 root stylesheet", ); - } - #[test] - fn scale_color() { - assert_eq!( - runner().err( - "@use \"sass:color\";\ +} +#[test] +fn scale_color() { + assert_eq!( + runner().err( + "@use \"sass:color\";\ \na {b: color.scale-color(#abcdef, $red: 10%)}\n" - ), - "Error: Undefined function.\ + ), + "Error: Undefined function.\ \n ,\ \n2 | a {b: color.scale-color(#abcdef, $red: 10%)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn transparentize() { - assert_eq!( + ); +} +#[test] +fn transparentize() { + assert_eq!( runner().err( "@use \"sass:color\";\ \na {b: color.transparentize(#abcdef, 0.5)}\n" @@ -316,95 +202,4 @@ mod error { \n \'\ \n input.scss 2:7 root stylesheet", ); - } -} -#[test] -fn green() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.green(#abcdef)}\n"), - "a {\ - \n b: 205;\ - \n}\n" - ); -} -#[test] -fn hue() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.hue(#abcdef)}\n"), - "a {\ - \n b: 210deg;\ - \n}\n" - ); -} -#[test] -fn ie_hex_str() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.ie-hex-str(#abcdef)}\n"), - "a {\ - \n b: #FFABCDEF;\ - \n}\n" - ); -} -#[test] -fn invert() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.invert(#abcdef)}\n"), - "a {\ - \n b: #543210;\ - \n}\n" - ); -} -#[test] -fn lightness() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.lightness(#abcdef)}\n"), - "a {\ - \n b: 80.3921568627%;\ - \n}\n" - ); -} -#[test] -fn mix() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.mix(#abcdef, #daddee)}\n"), - "a {\ - \n b: #c3d5ef;\ - \n}\n" - ); -} -#[test] -fn red() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.red(#abcdef)}\n"), - "a {\ - \n b: 171;\ - \n}\n" - ); -} -#[test] -fn saturation() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.saturation(#abcdef)}\n"), - "a {\ - \n b: 68%;\ - \n}\n" - ); -} -#[test] -fn scale() { - assert_eq!( - runner().ok("@use \"sass:color\";\ - \na {b: color.scale(#abcdef, $red: 10%)}\n"), - "a {\ - \n b: #b3cdef;\ - \n}\n" - ); } diff --git a/rsass/tests/spec/core_functions/modules/color/green.rs b/rsass/tests/spec/core_functions/modules/color/green.rs new file mode 100644 index 000000000..cb839625c --- /dev/null +++ b/rsass/tests/spec/core_functions/modules/color/green.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color/green.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("green") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.green(#abcdef)}\n"), + "a {\ + \n b: 205;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/modules/color/hue.rs b/rsass/tests/spec/core_functions/modules/color/hue.rs new file mode 100644 index 000000000..e5e3806dd --- /dev/null +++ b/rsass/tests/spec/core_functions/modules/color/hue.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color/hue.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("hue") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.hue(#abcdef)}\n"), + "a {\ + \n b: 210deg;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/modules/color/ie_hex_str.rs b/rsass/tests/spec/core_functions/modules/color/ie_hex_str.rs new file mode 100644 index 000000000..29e935c66 --- /dev/null +++ b/rsass/tests/spec/core_functions/modules/color/ie_hex_str.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color/ie_hex_str.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("ie_hex_str") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.ie-hex-str(#abcdef)}\n"), + "a {\ + \n b: #FFABCDEF;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/modules/color/invert.rs b/rsass/tests/spec/core_functions/modules/color/invert.rs new file mode 100644 index 000000000..d7b4cb3bb --- /dev/null +++ b/rsass/tests/spec/core_functions/modules/color/invert.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color/invert.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("invert") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.invert(#abcdef)}\n"), + "a {\ + \n b: #543210;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/modules/color/lightness.rs b/rsass/tests/spec/core_functions/modules/color/lightness.rs new file mode 100644 index 000000000..bda3361ee --- /dev/null +++ b/rsass/tests/spec/core_functions/modules/color/lightness.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color/lightness.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("lightness") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.lightness(#abcdef)}\n"), + "a {\ + \n b: 80.3921568627%;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/modules/color/mix.rs b/rsass/tests/spec/core_functions/modules/color/mix.rs new file mode 100644 index 000000000..b177eb40f --- /dev/null +++ b/rsass/tests/spec/core_functions/modules/color/mix.rs @@ -0,0 +1,18 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color/mix.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("mix") +} + +#[test] +#[ignore] // wrong result +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.mix(#abcdef, #daddee)}\n"), + "a {\ + \n b: rgb(194.5, 213, 238.5);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/modules/color/mod.rs b/rsass/tests/spec/core_functions/modules/color/mod.rs new file mode 100644 index 000000000..c567357a6 --- /dev/null +++ b/rsass/tests/spec/core_functions/modules/color/mod.rs @@ -0,0 +1,38 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("color") +} + +mod adjust; + +mod alpha; + +mod blue; + +mod change; + +mod complement; + +mod css_overloads; + +mod error; + +mod green; + +mod hue; + +mod ie_hex_str; + +mod invert; + +mod lightness; + +mod mix; + +mod red; + +mod saturation; + +mod scale; diff --git a/rsass/tests/spec/core_functions/modules/color/red.rs b/rsass/tests/spec/core_functions/modules/color/red.rs new file mode 100644 index 000000000..7527e6bb6 --- /dev/null +++ b/rsass/tests/spec/core_functions/modules/color/red.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color/red.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("red") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.red(#abcdef)}\n"), + "a {\ + \n b: 171;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/modules/color/saturation.rs b/rsass/tests/spec/core_functions/modules/color/saturation.rs new file mode 100644 index 000000000..79e6f4719 --- /dev/null +++ b/rsass/tests/spec/core_functions/modules/color/saturation.rs @@ -0,0 +1,17 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color/saturation.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("saturation") +} + +#[test] +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.saturation(#abcdef)}\n"), + "a {\ + \n b: 68%;\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/modules/color/scale.rs b/rsass/tests/spec/core_functions/modules/color/scale.rs new file mode 100644 index 000000000..2798df331 --- /dev/null +++ b/rsass/tests/spec/core_functions/modules/color/scale.rs @@ -0,0 +1,18 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/modules/color/scale.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("scale") +} + +#[test] +#[ignore] // wrong result +fn test() { + assert_eq!( + runner().ok("@use \"sass:color\";\ + \na {b: color.scale(#abcdef, $red: 10%)}\n"), + "a {\ + \n b: rgb(179.4, 205, 239);\ + \n}\n" + ); +} diff --git a/rsass/tests/spec/core_functions/modules/map.rs b/rsass/tests/spec/core_functions/modules/map.rs deleted file mode 100644 index b6bd9357f..000000000 --- a/rsass/tests/spec/core_functions/modules/map.rs +++ /dev/null @@ -1,166 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/modules/map.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("map") -} - -mod error { - #[allow(unused)] - use super::runner; - - #[test] - fn map_get() { - assert_eq!( - runner().err( - "@use \"sass:map\";\ - \na {b: map.map-get((c: d), c)}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n2 | a {b: map.map-get((c: d), c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn map_has_key() { - assert_eq!( - runner().err( - "@use \"sass:map\";\ - \na {b: map.map-has-key((c: d), c)}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n2 | a {b: map.map-has-key((c: d), c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn map_keys() { - assert_eq!( - runner().err( - "@use \"sass:map\";\ - \na {b: map.map-keys((c: d))}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n2 | a {b: map.map-keys((c: d))}\ - \n | ^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn map_merge() { - assert_eq!( - runner().err( - "@use \"sass:map\";\ - \n@use \"sass:meta\";\ - \na {b: meta.map-inspect(map.merge((c: d), (e: f)))}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n3 | a {b: meta.map-inspect(map.merge((c: d), (e: f)))}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet", - ); - } - #[test] - fn map_remove() { - assert_eq!( - runner().err( - "@use \"sass:map\";\ - \n@use \"sass:meta\";\ - \na {b: meta.map-inspect(map.remove((c: d), c))}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n3 | a {b: meta.map-inspect(map.remove((c: d), c))}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 3:7 root stylesheet", - ); - } - #[test] - fn map_values() { - assert_eq!( - runner().err( - "@use \"sass:map\";\ - \na {b: map.map-values((c: d), c)}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n2 | a {b: map.map-values((c: d), c)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } -} -#[test] -fn get() { - assert_eq!( - runner().ok("@use \"sass:map\";\ - \na {b: map.get((c: d), c)}\n"), - "a {\ - \n b: d;\ - \n}\n" - ); -} -#[test] -fn has_key() { - assert_eq!( - runner().ok("@use \"sass:map\";\ - \na {b: map.has-key((c: d), c)}\n"), - "a {\ - \n b: true;\ - \n}\n" - ); -} -#[test] -fn keys() { - assert_eq!( - runner().ok("@use \"sass:map\";\ - \na {b: map.keys((c: d))}\n"), - "a {\ - \n b: c;\ - \n}\n" - ); -} -#[test] -fn merge() { - assert_eq!( - runner().ok("@use \"sass:map\";\ - \n@use \"sass:meta\";\ - \na {b: meta.inspect(map.merge((c: d), (e: f)))}\n"), - "a {\ - \n b: (c: d, e: f);\ - \n}\n" - ); -} -#[test] -fn remove() { - assert_eq!( - runner().ok("@use \"sass:map\";\ - \n@use \"sass:meta\";\ - \na {b: meta.inspect(map.remove((c: d), c))}\n"), - "a {\ - \n b: ();\ - \n}\n" - ); -} -#[test] -fn values() { - assert_eq!( - runner().ok("@use \"sass:map\";\ - \na {b: map.values((c: d))}\n"), - "a {\ - \n b: d;\ - \n}\n" - ); -} diff --git a/rsass/tests/spec/core_functions/modules/math.rs b/rsass/tests/spec/core_functions/modules/math.rs deleted file mode 100644 index 595c42ea1..000000000 --- a/rsass/tests/spec/core_functions/modules/math.rs +++ /dev/null @@ -1,152 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/modules/math.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("math") -} - -#[test] -fn abs() { - assert_eq!( - runner().ok("@use \"sass:math\";\ - \na {b: math.abs(-1)}\n"), - "a {\ - \n b: 1;\ - \n}\n" - ); -} -#[test] -fn ceil() { - assert_eq!( - runner().ok("@use \"sass:math\";\ - \na {b: math.ceil(0.5)}\n"), - "a {\ - \n b: 1;\ - \n}\n" - ); -} -#[test] -fn compatible() { - assert_eq!( - runner().ok("@use \"sass:math\";\ - \na {b: math.compatible(1px, 1in)}\n"), - "a {\ - \n b: true;\ - \n}\n" - ); -} -mod error { - #[allow(unused)] - use super::runner; - - #[test] - fn comparable() { - assert_eq!( - runner().err( - "@use \"sass:math\";\ - \na {b: math.comparable(1px, 1in)}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n2 | a {b: math.comparable(1px, 1in)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn unitless() { - assert_eq!( - runner().err( - "@use \"sass:math\";\ - \na {b: math.unitless(1)}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n2 | a {b: math.unitless(1)}\ - \n | ^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } -} -#[test] -fn floor() { - assert_eq!( - runner().ok("@use \"sass:math\";\ - \na {b: math.floor(0.5)}\n"), - "a {\ - \n b: 0;\ - \n}\n" - ); -} -#[test] -fn is_unitless() { - assert_eq!( - runner().ok("@use \"sass:math\";\ - \na {b: math.is-unitless(1)}\n"), - "a {\ - \n b: true;\ - \n}\n" - ); -} -#[test] -fn max() { - assert_eq!( - runner().ok("@use \"sass:math\";\ - \na {b: math.max(1, 2, 3)}\n"), - "a {\ - \n b: 3;\ - \n}\n" - ); -} -#[test] -fn min() { - assert_eq!( - runner().ok("@use \"sass:math\";\ - \na {b: math.min(1, 2, 3)}\n"), - "a {\ - \n b: 1;\ - \n}\n" - ); -} -#[test] -fn percentage() { - assert_eq!( - runner().ok("@use \"sass:math\";\ - \na {b: math.percentage(0.5)}\n"), - "a {\ - \n b: 50%;\ - \n}\n" - ); -} -#[test] -fn random() { - assert_eq!( - runner().ok("@use \"sass:math\";\ - \na {b: math.random(5) <= 5}\n"), - "a {\ - \n b: true;\ - \n}\n" - ); -} -#[test] -fn round() { - assert_eq!( - runner().ok("@use \"sass:math\";\ - \na {b: math.round(0.5)}\n"), - "a {\ - \n b: 1;\ - \n}\n" - ); -} -#[test] -fn unit() { - assert_eq!( - runner().ok("@use \"sass:math\";\ - \na {b: math.unit(5px)}\n"), - "a {\ - \n b: \"px\";\ - \n}\n" - ); -} diff --git a/rsass/tests/spec/core_functions/modules/mod.rs b/rsass/tests/spec/core_functions/modules/mod.rs index 47dbf9fe8..a66229fd1 100644 --- a/rsass/tests/spec/core_functions/modules/mod.rs +++ b/rsass/tests/spec/core_functions/modules/mod.rs @@ -6,15 +6,3 @@ fn runner() -> crate::TestRunner { } mod color; - -mod general; - -mod map; - -mod math; - -mod meta; - -mod selector; - -mod string; diff --git a/rsass/tests/spec/core_functions/modules/selector.rs b/rsass/tests/spec/core_functions/modules/selector.rs deleted file mode 100644 index 07d842557..000000000 --- a/rsass/tests/spec/core_functions/modules/selector.rs +++ /dev/null @@ -1,182 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/modules/selector.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("selector") -} - -#[test] -fn append() { - assert_eq!( - runner().ok("@use \"sass:selector\";\ - \na {b: selector.append(c, d)}\n"), - "a {\ - \n b: cd;\ - \n}\n" - ); -} -mod error { - #[allow(unused)] - use super::runner; - - #[test] - fn selector_append() { - assert_eq!( - runner().err( - "@use \"sass:selector\";\ - \na {b: selector.selector-append(c, d)}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n2 | a {b: selector.selector-append(c, d)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn selector_extend() { - assert_eq!( - runner().err( - "@use \"sass:selector\";\ - \na {b: selector.selector-extend(c, c, d)}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n2 | a {b: selector.selector-extend(c, c, d)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn selector_nest() { - assert_eq!( - runner().err( - "@use \"sass:selector\";\ - \na {b: selector.selector-nest(c, d)}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n2 | a {b: selector.selector-nest(c, d)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn selector_parse() { - assert_eq!( - runner().err( - "@use \"sass:selector\";\ - \na {b: selector.selector-parse(\".c.d\")}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n2 | a {b: selector.selector-parse(\".c.d\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn selector_replace() { - assert_eq!( - runner().err( - "@use \"sass:selector\";\ - \na {b: selector.selector-replace(c, c, d)}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n2 | a {b: selector.selector-replace(c, c, d)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn selector_unify() { - assert_eq!( - runner().err( - "@use \"sass:selector\";\ - \na {b: selector.selector-unify(\".c\", \".d\")}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n2 | a {b: selector.selector-unify(\".c\", \".d\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } -} -#[test] -fn extend() { - assert_eq!( - runner().ok("@use \"sass:selector\";\ - \na {b: selector.extend(c, c, d)}\n"), - "a {\ - \n b: c, d;\ - \n}\n" - ); -} -#[test] -fn is_superselector() { - assert_eq!( - runner().ok("@use \"sass:selector\";\ - \na {b: selector.is-superselector(c, d)}\n"), - "a {\ - \n b: false;\ - \n}\n" - ); -} -#[test] -fn nest() { - assert_eq!( - runner().ok("@use \"sass:selector\";\ - \na {b: selector.nest(c, d)}\n"), - "a {\ - \n b: c d;\ - \n}\n" - ); -} -#[test] -fn parse() { - assert_eq!( - runner().ok("@use \"sass:selector\";\ - \na {b: selector.parse(\".c, .d\")}\n"), - "a {\ - \n b: .c, .d;\ - \n}\n" - ); -} -#[test] -fn replace() { - assert_eq!( - runner().ok("@use \"sass:selector\";\ - \na {b: selector.replace(c, c, d)}\n"), - "a {\ - \n b: d;\ - \n}\n" - ); -} -#[test] -fn simple_selectors() { - assert_eq!( - runner().ok("@use \"sass:selector\";\ - \na {b: selector.simple-selectors(\".c.d\")}\n"), - "a {\ - \n b: .c, .d;\ - \n}\n" - ); -} -#[test] -fn unify() { - assert_eq!( - runner().ok("@use \"sass:selector\";\ - \na {b: selector.unify(\".c\", \".d\")}\n"), - "a {\ - \n b: .c.d;\ - \n}\n" - ); -} diff --git a/rsass/tests/spec/core_functions/modules/string.rs b/rsass/tests/spec/core_functions/modules/string.rs deleted file mode 100644 index d51e304cb..000000000 --- a/rsass/tests/spec/core_functions/modules/string.rs +++ /dev/null @@ -1,153 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/modules/string.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("string") -} - -mod error { - #[allow(unused)] - use super::runner; - - #[test] - fn str_index() { - assert_eq!( - runner().err( - "@use \"sass:string\";\ - \na {b: string.str-index(\"c\", \"c\")}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n2 | a {b: string.str-index(\"c\", \"c\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn str_insert() { - assert_eq!( - runner().err( - "@use \"sass:string\";\ - \na {b: string.str-insert(\"c\", 1, \"d\")}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n2 | a {b: string.str-insert(\"c\", 1, \"d\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn str_length() { - assert_eq!( - runner().err( - "@use \"sass:string\";\ - \na {b: string.str-length(\"c\")}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n2 | a {b: string.str-length(\"c\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } - #[test] - fn str_slice() { - assert_eq!( - runner().err( - "@use \"sass:string\";\ - \na {b: string.str-slice(\"c\", 1, 1)}\n" - ), - "Error: Undefined function.\ - \n ,\ - \n2 | a {b: string.str-slice(\"c\", 1, 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ - \n \'\ - \n input.scss 2:7 root stylesheet", - ); - } -} -#[test] -fn index() { - assert_eq!( - runner().ok("@use \"sass:string\";\ - \na {b: string.index(\"c\", \"c\")}\n"), - "a {\ - \n b: 1;\ - \n}\n" - ); -} -#[test] -fn insert() { - assert_eq!( - runner().ok("@use \"sass:string\";\ - \na {b: string.insert(\"c\", \"d\", 1)}\n"), - "a {\ - \n b: \"dc\";\ - \n}\n" - ); -} -#[test] -fn length() { - assert_eq!( - runner().ok("@use \"sass:string\";\ - \na {b: string.length(\"c\")}\n"), - "a {\ - \n b: 1;\ - \n}\n" - ); -} -#[test] -fn quote() { - assert_eq!( - runner().ok("@use \"sass:string\";\ - \na {b: string.quote(c)}\n"), - "a {\ - \n b: \"c\";\ - \n}\n" - ); -} -#[test] -fn slice() { - assert_eq!( - runner().ok("@use \"sass:string\";\ - \na {b: string.slice(\"c\", 1, 1)}\n"), - "a {\ - \n b: \"c\";\ - \n}\n" - ); -} -#[test] -fn to_upper_case() { - assert_eq!( - runner().ok("@use \"sass:string\";\ - \na {b: string.to-upper-case(\"c\")}\n"), - "a {\ - \n b: \"C\";\ - \n}\n" - ); -} -#[test] -fn unique_id() { - assert_eq!( - runner().ok("@use \"sass:meta\";\ - \n@use \"sass:string\";\ - \na {b: meta.type-of(string.unique-id())}\n"), - "a {\ - \n b: string;\ - \n}\n" - ); -} -#[test] -fn unquote() { - assert_eq!( - runner().ok("@use \"sass:string\";\ - \na {b: string.unquote(\"c\")}\n"), - "a {\ - \n b: c;\ - \n}\n" - ); -} diff --git a/rsass/tests/spec/core_functions/selector/append.rs b/rsass/tests/spec/core_functions/selector/append.rs index c63f2040c..27a869f4e 100644 --- a/rsass/tests/spec/core_functions/selector/append.rs +++ b/rsass/tests/spec/core_functions/selector/append.rs @@ -12,7 +12,8 @@ mod classes { #[test] fn double() { assert_eq!( - runner().ok("a {b: selector-append(\".c, .d\", \".e, .f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.append(\".c, .d\", \".e, .f\")}\n"), "a {\ \n b: .c.e, .c.f, .d.e, .d.f;\ \n}\n" @@ -21,7 +22,8 @@ mod classes { #[test] fn single() { assert_eq!( - runner().ok("a {b: selector-append(\".c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.append(\".c\", \".d\")}\n"), "a {\ \n b: .c.d;\ \n}\n" @@ -35,7 +37,8 @@ mod combinator { #[test] fn final_trailing() { assert_eq!( - runner().ok("a {b: selector-append(\"c\", \"d ~\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.append(\"c\", \"d ~\")}\n"), "a {\ \n b: cd ~;\ \n}\n" @@ -44,7 +47,8 @@ mod combinator { #[test] fn initial_leading() { assert_eq!( - runner().ok("a {b: selector-append(\"> c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.append(\"> c\", \"d\")}\n"), "a {\ \n b: > cd;\ \n}\n" @@ -57,7 +61,8 @@ mod combinator { #[test] fn final_trailing() { assert_eq!( - runner().ok("a {b: selector-append(\"c\", \"d + >\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.append(\"c\", \"d + >\")}\n"), "a {\ \n b: cd + >;\ \n}\n" @@ -66,7 +71,8 @@ mod combinator { #[test] fn initial_leading() { assert_eq!( - runner().ok("a {b: selector-append(\"~ ~ c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.append(\"~ ~ c\", \"d\")}\n"), "a {\ \n b: ~ ~ cd;\ \n}\n" @@ -75,7 +81,8 @@ mod combinator { #[test] fn middle() { assert_eq!( - runner().ok("a {b: selector-append(\"c > > d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.append(\"c > > d\", \"e\")}\n"), "a {\ \n b: c > > de;\ \n}\n" @@ -94,26 +101,31 @@ mod error { #[test] fn leading() { assert_eq!( - runner().err("a {b: selector-append(\".c\", \"> .d\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.append(\".c\", \"> .d\")}\n" + ), "Error: Can\'t append > .d to .c.\ \n ,\ - \n1 | a {b: selector-append(\".c\", \"> .d\")}\ + \n2 | a {b: selector.append(\".c\", \"> .d\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn only() { assert_eq!( - runner() - .err("a {b: selector-append(\".c\", \">\", \".d\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.append(\".c\", \">\", \".d\")}\n" + ), "Error: Can\'t append > to .c.\ \n ,\ - \n1 | a {b: selector-append(\".c\", \">\", \".d\")}\ + \n2 | a {b: selector.append(\".c\", \">\", \".d\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] @@ -121,7 +133,8 @@ mod error { fn trailing() { assert_eq!( runner().err( - "a {b: selector-append(\".c ~\", \".d\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.append(\".c ~\", \".d\")}\n" ), "Error: Selector \".c ~\" can\'t be used as a parent in a compound selector.\ \n ,\ @@ -129,7 +142,7 @@ mod error { \n | ^^^^ outer selector\ \n \'\ \n ,--> input.scss\ - \n1 | a {b: selector-append(\".c ~\", \".d\")}\ + \n2 | a {b: selector.append(\".c ~\", \".d\")}\ \n | ============================= parent selector\ \n \'\ \n - 1:1 root stylesheet", @@ -139,7 +152,10 @@ mod error { #[test] fn invalid() { assert_eq!( - runner().err("a {b: selector-append(\"[c\", \"d\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.append(\"[c\", \"d\")}\n" + ), "Error: expected more input.\ \n ,\ \n1 | [c\ @@ -147,28 +163,34 @@ mod error { \n \'\ \n - 1:3 root stylesheet\ \n ,\ - \n1 | a {b: selector-append(\"[c\", \"d\")}\ + \n2 | a {b: selector.append(\"[c\", \"d\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn namespace() { assert_eq!( - runner().err("a {b: selector-append(\"c\", \"|d\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.append(\"c\", \"|d\")}\n" + ), "Error: Can\'t append |d to c.\ \n ,\ - \n1 | a {b: selector-append(\"c\", \"|d\")}\ + \n2 | a {b: selector.append(\"c\", \"|d\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn parent() { assert_eq!( - runner().err("a {b: selector-append(\".c\", \"&\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.append(\".c\", \"&\")}\n" + ), "Error: Parent selectors aren\'t allowed here.\ \n ,\ \n1 | &\ @@ -176,47 +198,71 @@ mod error { \n \'\ \n - 1:1 root stylesheet\ \n ,\ - \n1 | a {b: selector-append(\".c\", \"&\")}\ + \n2 | a {b: selector.append(\".c\", \"&\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: selector-append()}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.append()}\n" + ), "Error: $selectors: At least one selector must be passed.\ \n ,\ - \n1 | a {b: selector-append()}\ + \n2 | a {b: selector.append()}\ \n | ^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: selector-append(\"c\", 1)}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.append(\"c\", 1)}\n" + ), "Error: 1 is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | a {b: selector-append(\"c\", 1)}\ + \n2 | a {b: selector.append(\"c\", 1)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn universal() { assert_eq!( - runner().err("a {b: selector-append(\".c\", \"*\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.append(\".c\", \"*\")}\n" + ), "Error: Can\'t append * to .c.\ \n ,\ - \n1 | a {b: selector-append(\".c\", \"*\")}\ + \n2 | a {b: selector.append(\".c\", \"*\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.selector-append(c, d)}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: selector.selector-append(c, d)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", ); } } @@ -231,7 +277,8 @@ mod format { #[test] fn initial() { assert_eq!( - runner().ok("a {b: selector-append((c, d e), f)}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.append((c, d e), f)}\n"), "a {\ \n b: cf, d ef;\ \n}\n" @@ -240,7 +287,8 @@ mod format { #[test] fn later() { assert_eq!( - runner().ok("a {b: selector-append(c, (d, e f))}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.append(c, (d, e f))}\n"), "a {\ \n b: cd, ce f;\ \n}\n" @@ -250,7 +298,8 @@ mod format { #[test] fn output() { assert_eq!( - runner().ok("$result: selector-append(\"c d, e f\", \"g\");\ + runner().ok("@use \"sass:selector\";\ + \n$result: selector.append(\"c d, e f\", \"g\");\ \na {\ \n result: $result;\ \n structure: $result == (\"c\" \"dg\", \"e\" \"fg\");\ @@ -265,7 +314,8 @@ mod format { #[test] fn many_args() { assert_eq!( - runner().ok("a {b: selector-append(\".c\", \".d\", \".e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.append(\".c\", \".d\", \".e\")}\n"), "a {\ \n b: .c.d.e;\ \n}\n" @@ -274,7 +324,8 @@ fn many_args() { #[test] fn one_arg() { assert_eq!( - runner().ok("a {b: selector-append(\".c.d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.append(\".c.d\")}\n"), "a {\ \n b: .c.d;\ \n}\n" @@ -287,7 +338,8 @@ mod suffix { #[test] fn descendant() { assert_eq!( - runner().ok("a {b: selector-append(\"c d\", \"e f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.append(\"c d\", \"e f\")}\n"), "a {\ \n b: c de f;\ \n}\n" @@ -296,7 +348,8 @@ mod suffix { #[test] fn multiple() { assert_eq!( - runner().ok("a {b: selector-append(\".c, .d\", \"e, f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.append(\".c, .d\", \"e, f\")}\n"), "a {\ \n b: .ce, .cf, .de, .df;\ \n}\n" @@ -305,7 +358,8 @@ mod suffix { #[test] fn single() { assert_eq!( - runner().ok("a {b: selector-append(\".c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.append(\".c\", \"d\")}\n"), "a {\ \n b: .cd;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/extend/complex/combinator_only.rs b/rsass/tests/spec/core_functions/selector/extend/complex/combinator_only.rs index 56dd86bd1..5fee59ed9 100644 --- a/rsass/tests/spec/core_functions/selector/extend/complex/combinator_only.rs +++ b/rsass/tests/spec/core_functions/selector/extend/complex/combinator_only.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn extender() { assert_eq!( - runner().ok("a {b: selector-extend(\".c\", \".c\", \">\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c\", \".c\", \">\")}\n"), "a {\ \n b: .c, >;\ \n}\n" @@ -18,7 +19,8 @@ fn extender() { #[test] fn selector() { assert_eq!( - runner().ok("a {b: selector-extend(\"+\", \".c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"+\", \".c\", \".d\")}\n"), "a {\ \n b: +;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/extend/complex/with_unification.rs b/rsass/tests/spec/core_functions/selector/extend/complex/with_unification.rs index 90a408805..5e448545d 100644 --- a/rsass/tests/spec/core_functions/selector/extend/complex/with_unification.rs +++ b/rsass/tests/spec/core_functions/selector/extend/complex/with_unification.rs @@ -13,8 +13,8 @@ mod leading_combinator { #[ignore] // wrong result fn both() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"~ .c.x\", \".c\", \"+ .d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"~ .c.x\", \".c\", \"+ .d\")}\n"), "a {\ \n b: ~ .c.x;\ \n}\n" @@ -23,8 +23,8 @@ mod leading_combinator { #[test] fn extender() { assert_eq!( - runner() - .ok("a {b: selector-extend(\".c.x\", \".c\", \"+ .d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c.x\", \".c\", \"+ .d\")}\n"), "a {\ \n b: .c.x, + .x.d;\ \n}\n" @@ -33,8 +33,8 @@ mod leading_combinator { #[test] fn selector() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"> .c.x\", \".c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"> .c.x\", \".c\", \".d\")}\n"), "a {\ \n b: > .c.x, > .x.d;\ \n}\n" @@ -53,9 +53,8 @@ mod multiple_combinators { #[ignore] // wrong result fn extender() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c.x\", \".c\", \"+ ~ .d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c.x\", \".c\", \"+ ~ .d\")}\n"), "a {\ \n b: .c.x;\ \n}\n" @@ -65,9 +64,8 @@ mod multiple_combinators { #[ignore] // wrong result fn selector() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"> + .c.x\", \".c\", \".d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"> + .c.x\", \".c\", \".d\")}\n"), "a {\ \n b: > + .c.x;\ \n}\n" @@ -82,24 +80,22 @@ mod multiple_combinators { #[ignore] // wrong result fn extender() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c.x\", \".c\", \".d ~ + .e\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c.x\", \".c\", \".d ~ + .e\")}\n"), + "a {\ \n b: .c.x;\ \n}\n" - ); + ); } #[test] fn selector() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c.x ~ ~ .d\", \".c\", \".e\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c.x ~ ~ .d\", \".c\", \".e\")}\n"), + "a {\ \n b: .c.x ~ ~ .d;\ \n}\n" - ); + ); } } mod trailing { @@ -110,9 +106,8 @@ mod multiple_combinators { #[ignore] // wrong result fn extender() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c.x\", \".c\", \".d + +\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c.x\", \".c\", \".d + +\")}\n"), "a {\ \n b: .c.x;\ \n}\n" @@ -121,9 +116,8 @@ mod multiple_combinators { #[test] fn selector() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c.x > ~\", \".c\", \".d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c.x > ~\", \".c\", \".d\")}\n"), "a {\ \n b: .c.x > ~;\ \n}\n" @@ -143,37 +137,34 @@ mod parent { #[ignore] // wrong result fn complex() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c .d.x .e\", \".d\", \".f .g\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c .d.x .e\", \".d\", \".f .g\")}\n"), + "a {\ \n b: .c .d.x .e, .c .f .x.g .e, .f .c .x.g .e;\ \n}\n" - ); + ); } #[test] #[ignore] // wrong result fn list() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c .d.x .e\", \".d\", \".f, .g\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c .d.x .e\", \".d\", \".f, .g\")}\n"), + "a {\ \n b: .c .d.x .e, .c .x.f .e, .c .x.g .e;\ \n}\n" - ); + ); } #[test] #[ignore] // wrong result fn simple() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c .d.x .e\", \".d\", \".f\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c .d.x .e\", \".d\", \".f\")}\n"), + "a {\ \n b: .c .d.x .e, .c .x.f .e;\ \n}\n" - ); + ); } } mod without_grandparent { @@ -184,33 +175,30 @@ mod parent { #[ignore] // wrong result fn complex() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c.x .d\", \".c\", \".e .f\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c.x .d\", \".c\", \".e .f\")}\n"), + "a {\ \n b: .c.x .d, .e .x.f .d;\ \n}\n" - ); + ); } #[test] #[ignore] // wrong result fn list() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c.x .d\", \".c\", \".e, .f\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c.x .d\", \".c\", \".e, .f\")}\n"), + "a {\ \n b: .c.x .d, .x.e .d, .x.f .d;\ \n}\n" - ); + ); } #[test] #[ignore] // wrong result fn simple() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c.x .d\", \".c\", \".e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c.x .d\", \".c\", \".e\")}\n"), "a {\ \n b: .c.x .d, .x.e .d;\ \n}\n" @@ -225,8 +213,8 @@ mod trailing_combinator { #[test] fn both() { assert_eq!( - runner() - .ok("a {b: selector-extend(\".c.x ~\", \".c\", \".d >\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c.x ~\", \".c\", \".d >\")}\n"), "a {\ \n b: .c.x ~;\ \n}\n" @@ -240,9 +228,8 @@ mod trailing_combinator { #[ignore] // wrong result fn child() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c.x .d\", \".c\", \".e >\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c.x .d\", \".c\", \".e >\")}\n"), "a {\ \n b: .c.x .d, .x.e > .d;\ \n}\n" @@ -252,9 +239,8 @@ mod trailing_combinator { #[ignore] // wrong result fn next_sibling() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c.x .d\", \".c\", \".e +\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c.x .d\", \".c\", \".e +\")}\n"), "a {\ \n b: .c.x .d, .x.e + .d;\ \n}\n" @@ -264,9 +250,8 @@ mod trailing_combinator { #[ignore] // wrong result fn sibling() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c.x .d\", \".c\", \".e ~\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c.x .d\", \".c\", \".e ~\")}\n"), "a {\ \n b: .c.x .d, .x.e ~ .d;\ \n}\n" @@ -277,8 +262,8 @@ mod trailing_combinator { #[ignore] // wrong result fn selector() { assert_eq!( - runner() - .ok("a {b: selector-extend(\".c.x +\", \".c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c.x +\", \".c\", \".d\")}\n"), "a {\ \n b: .c.x +, .x.d +;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/extend/complex/without_unification.rs b/rsass/tests/spec/core_functions/selector/extend/complex/without_unification.rs index 0b779a23a..f0425d127 100644 --- a/rsass/tests/spec/core_functions/selector/extend/complex/without_unification.rs +++ b/rsass/tests/spec/core_functions/selector/extend/complex/without_unification.rs @@ -13,8 +13,8 @@ mod leading_combinator { #[ignore] // wrong result fn both() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"~ .c\", \".c\", \"+ .d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"~ .c\", \".c\", \"+ .d\")}\n"), "a {\ \n b: ~ .c;\ \n}\n" @@ -23,7 +23,8 @@ mod leading_combinator { #[test] fn extender() { assert_eq!( - runner().ok("a {b: selector-extend(\".c\", \".c\", \"+ .d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c\", \".c\", \"+ .d\")}\n"), "a {\ \n b: .c, + .d;\ \n}\n" @@ -32,7 +33,8 @@ mod leading_combinator { #[test] fn selector() { assert_eq!( - runner().ok("a {b: selector-extend(\"> .c\", \".c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"> .c\", \".c\", \".d\")}\n"), "a {\ \n b: > .c, > .d;\ \n}\n" @@ -51,9 +53,8 @@ mod multiple_combinators { #[ignore] // wrong result fn extender() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c\", \".c\", \"+ ~ .d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c\", \".c\", \"+ ~ .d\")}\n"), "a {\ \n b: .c;\ \n}\n" @@ -63,9 +64,8 @@ mod multiple_combinators { #[ignore] // wrong result fn selector() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"> + .c\", \".c\", \".d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"> + .c\", \".c\", \".d\")}\n"), "a {\ \n b: > + .c;\ \n}\n" @@ -80,9 +80,8 @@ mod multiple_combinators { #[ignore] // wrong result fn extender() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c\", \".c\", \".d ~ + .e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c\", \".c\", \".d ~ + .e\")}\n"), "a {\ \n b: .c;\ \n}\n" @@ -91,9 +90,8 @@ mod multiple_combinators { #[test] fn selector() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c ~ ~ .d\", \".c\", \".e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c ~ ~ .d\", \".c\", \".e\")}\n"), "a {\ \n b: .c ~ ~ .d;\ \n}\n" @@ -107,9 +105,8 @@ mod multiple_combinators { #[test] fn extender() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c\", \".c\", \".d + +\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c\", \".c\", \".d + +\")}\n"), "a {\ \n b: .c;\ \n}\n" @@ -118,9 +115,8 @@ mod multiple_combinators { #[test] fn selector() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c > ~\", \".c\", \".d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c > ~\", \".c\", \".d\")}\n"), "a {\ \n b: .c > ~;\ \n}\n" @@ -140,33 +136,30 @@ mod parent { #[ignore] // wrong result fn complex() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c .d .e\", \".d\", \".f .g\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c .d .e\", \".d\", \".f .g\")}\n"), + "a {\ \n b: .c .d .e, .c .f .g .e, .f .c .g .e;\ \n}\n" - ); + ); } #[test] #[ignore] // wrong result fn list() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c .d .e\", \".d\", \".f, .g\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c .d .e\", \".d\", \".f, .g\")}\n"), + "a {\ \n b: .c .d .e, .c .f .e, .c .g .e;\ \n}\n" - ); + ); } #[test] #[ignore] // wrong result fn simple() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c .d .e\", \".d\", \".f\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c .d .e\", \".d\", \".f\")}\n"), "a {\ \n b: .c .d .e, .c .f .e;\ \n}\n" @@ -181,9 +174,8 @@ mod parent { #[ignore] // wrong result fn complex() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c .d\", \".c\", \".e .f\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c .d\", \".c\", \".e .f\")}\n"), "a {\ \n b: .c .d, .e .f .d;\ \n}\n" @@ -193,9 +185,8 @@ mod parent { #[ignore] // wrong result fn list() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c .d\", \".c\", \".e, .f\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c .d\", \".c\", \".e, .f\")}\n"), "a {\ \n b: .c .d, .e .d, .f .d;\ \n}\n" @@ -205,9 +196,8 @@ mod parent { #[ignore] // wrong result fn simple() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c .d\", \".c\", \".e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c .d\", \".c\", \".e\")}\n"), "a {\ \n b: .c .d, .e .d;\ \n}\n" @@ -222,8 +212,8 @@ mod trailing_combinator { #[test] fn both() { assert_eq!( - runner() - .ok("a {b: selector-extend(\".c ~\", \".c\", \".d >\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c ~\", \".c\", \".d >\")}\n"), "a {\ \n b: .c ~;\ \n}\n" @@ -237,9 +227,8 @@ mod trailing_combinator { #[ignore] // wrong result fn child() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c .d\", \".c\", \".e >\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c .d\", \".c\", \".e >\")}\n"), "a {\ \n b: .c .d, .e > .d;\ \n}\n" @@ -249,9 +238,8 @@ mod trailing_combinator { #[ignore] // wrong result fn next_sibling() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c .d\", \".c\", \".e +\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c .d\", \".c\", \".e +\")}\n"), "a {\ \n b: .c .d, .e + .d;\ \n}\n" @@ -261,9 +249,8 @@ mod trailing_combinator { #[ignore] // wrong result fn sibling() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c .d\", \".c\", \".e ~\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c .d\", \".c\", \".e ~\")}\n"), "a {\ \n b: .c .d, .e ~ .d;\ \n}\n" @@ -274,7 +261,8 @@ mod trailing_combinator { #[ignore] // wrong result fn selector() { assert_eq!( - runner().ok("a {b: selector-extend(\".c +\", \".c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c +\", \".c\", \".d\")}\n"), "a {\ \n b: .c +, .d +;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/extend/error.rs b/rsass/tests/spec/core_functions/selector/extend/error.rs index 15c15e50b..ae29cb5af 100644 --- a/rsass/tests/spec/core_functions/selector/extend/error.rs +++ b/rsass/tests/spec/core_functions/selector/extend/error.rs @@ -16,33 +16,41 @@ mod extendee { #[test] fn list() { assert_eq!( - runner().err("a {b: selector-extend(\"c\", d e, \"f\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", d e, \"f\")}\n" + ), "Error: Can\'t extend complex selector d e.\ \n ,\ - \n1 | a {b: selector-extend(\"c\", d e, \"f\")}\ + \n2 | a {b: selector.extend(\"c\", d e, \"f\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn string() { assert_eq!( - runner() - .err("a {b: selector-extend(\"c\", \"d e\", \"f\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"d e\", \"f\")}\n" + ), "Error: Can\'t extend complex selector d e.\ \n ,\ - \n1 | a {b: selector-extend(\"c\", \"d e\", \"f\")}\ + \n2 | a {b: selector.extend(\"c\", \"d e\", \"f\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn invalid() { assert_eq!( - runner().err("a {b: selector-extend(\"c\", \"[d\", \"e\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"[d\", \"e\")}\n" + ), "Error: $extendee: expected more input.\ \n ,\ \n1 | [d\ @@ -50,16 +58,19 @@ mod extendee { \n \'\ \n - 1:3 root stylesheet\ \n ,\ - \n1 | a {b: selector-extend(\"c\", \"[d\", \"e\")}\ + \n2 | a {b: selector.extend(\"c\", \"[d\", \"e\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn parent() { assert_eq!( - runner().err("a {b: selector-extend(\"c\", \"&\", \"d\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"&\", \"d\")}\n" + ), "Error: $extendee: Parent selectors aren\'t allowed here.\ \n ,\ \n1 | &\ @@ -67,25 +78,26 @@ mod extendee { \n \'\ \n - 1:1 root stylesheet\ \n ,\ - \n1 | a {b: selector-extend(\"c\", \"&\", \"d\")}\ + \n2 | a {b: selector.extend(\"c\", \"&\", \"d\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( runner().err( - "a {b: selector-extend(\"c\", 1, \"d\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", 1, \"d\")}\n" ), "Error: $extendee: 1 is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | a {b: selector-extend(\"c\", 1, \"d\")}\ + \n2 | a {b: selector.extend(\"c\", 1, \"d\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -96,7 +108,10 @@ mod extender { #[test] fn invalid() { assert_eq!( - runner().err("a {b: selector-extend(\"c\", \"d\", \"[e\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"d\", \"[e\")}\n" + ), "Error: $extender: expected more input.\ \n ,\ \n1 | [e\ @@ -104,16 +119,19 @@ mod extender { \n \'\ \n - 1:3 root stylesheet\ \n ,\ - \n1 | a {b: selector-extend(\"c\", \"d\", \"[e\")}\ + \n2 | a {b: selector.extend(\"c\", \"d\", \"[e\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn parent() { assert_eq!( - runner().err("a {b: selector-extend(\"c\", \"d\", \"&\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"d\", \"&\")}\n" + ), "Error: $extender: Parent selectors aren\'t allowed here.\ \n ,\ \n1 | &\ @@ -121,25 +139,26 @@ mod extender { \n \'\ \n - 1:1 root stylesheet\ \n ,\ - \n1 | a {b: selector-extend(\"c\", \"d\", \"&\")}\ + \n2 | a {b: selector.extend(\"c\", \"d\", \"&\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( runner().err( - "a {b: selector-extend(\"c\", \"d\", 1)}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"d\", 1)}\n" ), "Error: $extender: 1 is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | a {b: selector-extend(\"c\", \"d\", 1)}\ + \n2 | a {b: selector.extend(\"c\", \"d\", 1)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -150,7 +169,10 @@ mod selector { #[test] fn invalid() { assert_eq!( - runner().err("a {b: selector-extend(\"[c\", \"d\", \"e\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.extend(\"[c\", \"d\", \"e\")}\n" + ), "Error: $selector: expected more input.\ \n ,\ \n1 | [c\ @@ -158,16 +180,19 @@ mod selector { \n \'\ \n - 1:3 root stylesheet\ \n ,\ - \n1 | a {b: selector-extend(\"[c\", \"d\", \"e\")}\ + \n2 | a {b: selector.extend(\"[c\", \"d\", \"e\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn parent() { assert_eq!( - runner().err("a {b: selector-extend(\"&\", \"c\", \"d\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.extend(\"&\", \"c\", \"d\")}\n" + ), "Error: $selector: Parent selectors aren\'t allowed here.\ \n ,\ \n1 | &\ @@ -175,57 +200,79 @@ mod selector { \n \'\ \n - 1:1 root stylesheet\ \n ,\ - \n1 | a {b: selector-extend(\"&\", \"c\", \"d\")}\ + \n2 | a {b: selector.extend(\"&\", \"c\", \"d\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( runner().err( - "a {b: selector-extend(1, \"c\", \"d\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(1, \"c\", \"d\")}\n" ), "Error: $selector: 1 is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | a {b: selector-extend(1, \"c\", \"d\")}\ + \n2 | a {b: selector.extend(1, \"c\", \"d\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: selector-extend(\"c\", \"d\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"d\")}\n" + ), "Error: Missing argument $extender.\ \n ,--> input.scss\ - \n1 | a {b: selector-extend(\"c\", \"d\")}\ + \n2 | a {b: selector.extend(\"c\", \"d\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:selector\ \n1 | @function extend($selector, $extendee, $extender) {\ \n | ======================================= declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: selector-extend(\"c\", \"d\", \"e\", \"f\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"d\", \"e\", \"f\")}\n" + ), "Error: Only 3 arguments allowed, but 4 were passed.\ \n ,--> input.scss\ - \n1 | a {b: selector-extend(\"c\", \"d\", \"e\", \"f\")}\ + \n2 | a {b: selector.extend(\"c\", \"d\", \"e\", \"f\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:selector\ \n1 | @function extend($selector, $extendee, $extender) {\ \n | ======================================= declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.selector-extend(c, c, d)}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: selector.selector-extend(c, c, d)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", ); } diff --git a/rsass/tests/spec/core_functions/selector/extend/format.rs b/rsass/tests/spec/core_functions/selector/extend/format.rs index 6e9f4a4ee..2f0cd32a3 100644 --- a/rsass/tests/spec/core_functions/selector/extend/format.rs +++ b/rsass/tests/spec/core_functions/selector/extend/format.rs @@ -16,8 +16,8 @@ mod input { #[test] fn compound() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"c.d\", \"c.d\", \".e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c.d\", \"c.d\", \".e\")}\n"), "a {\ \n b: c.d, .e;\ \n}\n" @@ -27,9 +27,8 @@ mod input { #[ignore] // wrong result fn list() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c.d\", \"c, .d\", \".e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c.d\", \"c, .d\", \".e\")}\n"), "a {\ \n b: c.d, .e;\ \n}\n" @@ -39,13 +38,12 @@ mod input { #[ignore] // wrong result fn list_of_compound() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c.d.e.f\", \"c.d, .e.f\", \".g\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c.d.e.f\", \"c.d, .e.f\", \".g\")}\n"), + "a {\ \n b: c.d.e.f, .g;\ \n}\n" - ); + ); } } mod non_string { @@ -56,9 +54,8 @@ mod input { #[ignore] // wrong result fn extendee() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c.d\", (c, \".d\"), \".e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c.d\", (c, \".d\"), \".e\")}\n"), "a {\ \n b: c.d, .e;\ \n}\n" @@ -67,8 +64,8 @@ mod input { #[test] fn extender() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"c\", \"c\", (d, e f))}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"c\", (d, e f))}\n"), "a {\ \n b: c, d, e f;\ \n}\n" @@ -78,8 +75,8 @@ mod input { #[ignore] // wrong result fn selector() { assert_eq!( - runner() - .ok("a {b: selector-extend((c, d c), \"c\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend((c, d c), \"c\", \"e\")}\n"), "a {\ \n b: c, e, d c;\ \n}\n" @@ -90,7 +87,8 @@ mod input { #[test] fn output() { assert_eq!( - runner().ok("$result: selector-extend(\"c d, e f\", \"g\", \"g\");\ + runner().ok("@use \"sass:selector\";\ + \n$result: selector.extend(\"c d, e f\", \"g\", \"g\");\ \na {\ \n result: $result;\ \n structure: $result == (\"c\" \"d\", \"e\" \"f\");\ diff --git a/rsass/tests/spec/core_functions/selector/extend/list.rs b/rsass/tests/spec/core_functions/selector/extend/list.rs index a0bf20326..c1c41c2d7 100644 --- a/rsass/tests/spec/core_functions/selector/extend/list.rs +++ b/rsass/tests/spec/core_functions/selector/extend/list.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn all_match() { assert_eq!( - runner().ok("a {b: selector-extend(\".c.d\", \".c, .d\", \".e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c.d\", \".c, .d\", \".e\")}\n"), "a {\ \n b: .c.d, .e;\ \n}\n" @@ -20,7 +21,8 @@ fn all_match() { fn different_matches() { assert_eq!( runner().ok( - "a {b: selector-extend(\".c.d, .c .e, .d .f\", \".c, .d\", \".g\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\".c.d, .c .e, .d .f\", \".c, .d\", \".g\")}\n" ), "a {\ \n b: .c.d, .g, .c .e, .g .e, .d .f, .g .f;\ @@ -30,7 +32,8 @@ fn different_matches() { #[test] fn one_matches() { assert_eq!( - runner().ok("a {b: selector-extend(\".c\", \".c, .d\", \".e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c\", \".c, .d\", \".e\")}\n"), "a {\ \n b: .c, .e;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/extend/named.rs b/rsass/tests/spec/core_functions/selector/extend/named.rs index ca72ece92..4c3da0abb 100644 --- a/rsass/tests/spec/core_functions/selector/extend/named.rs +++ b/rsass/tests/spec/core_functions/selector/extend/named.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "a {b: selector-extend($selector: \"c.d\", $extendee: \"c\", $extender: \"e\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend($selector: \"c.d\", $extendee: \"c\", $extender: \"e\")}\n" ), "a {\ \n b: c.d, e.d;\ diff --git a/rsass/tests/spec/core_functions/selector/extend/no_op.rs b/rsass/tests/spec/core_functions/selector/extend/no_op.rs index a68d9e1ce..e82a1d392 100644 --- a/rsass/tests/spec/core_functions/selector/extend/no_op.rs +++ b/rsass/tests/spec/core_functions/selector/extend/no_op.rs @@ -16,8 +16,8 @@ mod conflict { #[test] fn alone() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"c.d\", \".d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c.d\", \".d\", \"e\")}\n"), "a {\ \n b: c.d;\ \n}\n" @@ -26,8 +26,8 @@ mod conflict { #[test] fn with_class() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"c.d\", \".d\", \"e.f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c.d\", \".d\", \"e.f\")}\n"), "a {\ \n b: c.d;\ \n}\n" @@ -37,7 +37,8 @@ mod conflict { #[test] fn id() { assert_eq!( - runner().ok("a {b: selector-extend(\"#c.d\", \".d\", \"#e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"#c.d\", \".d\", \"#e\")}\n"), "a {\ \n b: #c.d;\ \n}\n" @@ -46,9 +47,8 @@ mod conflict { #[test] fn next_sibling() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c + .d\", \".d\", \"e + .f\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c + .d\", \".d\", \"e + .f\")}\n"), "a {\ \n b: c + .d;\ \n}\n" @@ -57,9 +57,8 @@ mod conflict { #[test] fn parent() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c > .d\", \".d\", \"e > .f\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c > .d\", \".d\", \"e > .f\")}\n"), "a {\ \n b: c > .d;\ \n}\n" @@ -73,21 +72,19 @@ mod conflict { #[ignore] // wrong result fn class_syntax() { assert_eq!( - runner().ok( - "a {b: selector-extend(\":before.c\", \".c\", \":after\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":before.c\", \".c\", \":after\")}\n"), + "a {\ \n b: :before.c;\ \n}\n" - ); + ); } #[test] #[ignore] // wrong result fn unknown() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"::c.d\", \".d\", \"::e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"::c.d\", \".d\", \"::e\")}\n"), "a {\ \n b: ::c.d;\ \n}\n" @@ -102,8 +99,8 @@ mod conflict { #[ignore] // wrong result fn default_and_empty() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"*.c\", \".c\", \"|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"*.c\", \".c\", \"|*\")}\n"), "a {\ \n b: *.c;\ \n}\n" @@ -113,8 +110,8 @@ mod conflict { #[ignore] // wrong result fn default_and_namespace() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"*.c\", \".c\", \"d|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"*.c\", \".c\", \"d|*\")}\n"), "a {\ \n b: *.c;\ \n}\n" @@ -123,8 +120,8 @@ mod conflict { #[test] fn empty_and_default() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"|*.c\", \".c\", \"*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"|*.c\", \".c\", \"*\")}\n"), "a {\ \n b: |*.c;\ \n}\n" @@ -133,9 +130,8 @@ mod conflict { #[test] fn empty_and_namespace() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"|*.c\", \".c\", \"d|*\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"|*.c\", \".c\", \"d|*\")}\n"), "a {\ \n b: |*.c;\ \n}\n" @@ -144,8 +140,8 @@ mod conflict { #[test] fn namespace_and_default() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"c|*.d\", \".d\", \"*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|*.d\", \".d\", \"*\")}\n"), "a {\ \n b: c|*.d;\ \n}\n" @@ -154,9 +150,8 @@ mod conflict { #[test] fn namespace_and_empty() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c|*.d\", \".d\", \"|*\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|*.d\", \".d\", \"|*\")}\n"), "a {\ \n b: c|*.d;\ \n}\n" @@ -165,9 +160,8 @@ mod conflict { #[test] fn namespace_and_namespace() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c|*.d\", \".d\", \"e|*\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|*.d\", \".d\", \"e|*\")}\n"), "a {\ \n b: c|*.d;\ \n}\n" @@ -178,7 +172,8 @@ mod conflict { #[test] fn missing() { assert_eq!( - runner().ok("a {b: selector-extend(\"c\", \"d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"d\", \"e\")}\n"), "a {\ \n b: c;\ \n}\n" @@ -195,8 +190,8 @@ mod unification { #[test] fn ancestor() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"c\", \"c\", \"d c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"c\", \"d c\")}\n"), "a {\ \n b: c;\ \n}\n" @@ -205,8 +200,8 @@ mod unification { #[test] fn next_sibling() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"c\", \"c\", \"d + c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"c\", \"d + c\")}\n"), "a {\ \n b: c;\ \n}\n" @@ -215,8 +210,8 @@ mod unification { #[test] fn parent() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"c\", \"c\", \"d > c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"c\", \"d > c\")}\n"), "a {\ \n b: c;\ \n}\n" @@ -225,8 +220,8 @@ mod unification { #[test] fn sibling() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"c\", \"c\", \"d ~ c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"c\", \"d ~ c\")}\n"), "a {\ \n b: c;\ \n}\n" @@ -235,8 +230,8 @@ mod unification { #[test] fn simple() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"c\", \"c\", \"c.d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"c\", \"c.d\")}\n"), "a {\ \n b: c;\ \n}\n" @@ -246,7 +241,8 @@ mod unification { #[test] fn identical_to_extendee() { assert_eq!( - runner().ok("a {b: selector-extend(\"c.d\", \".d\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c.d\", \".d\", \".d\")}\n"), "a {\ \n b: c.d;\ \n}\n" @@ -255,7 +251,8 @@ mod unification { #[test] fn identical_to_selector() { assert_eq!( - runner().ok("a {b: selector-extend(\"c.d\", \".d\", \"c.d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c.d\", \".d\", \"c.d\")}\n"), "a {\ \n b: c.d;\ \n}\n" @@ -269,8 +266,9 @@ mod unification { #[ignore] // wrong result fn test_where() { assert_eq!( - runner().ok("a {\ - \n b: selector-extend(\":where(.x)\", \".x\", \".x .y\");\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.extend(\":where(.x)\", \".x\", \".x .y\");\ \n}\n"), "a {\ \n b: :where(.x, .x .y);\ @@ -286,20 +284,20 @@ mod unification { #[ignore] // wrong result fn is() { assert_eq!( - runner().ok( - "a {b: selector-extend(\".c:is(d)\", \":is(d)\", \"d.e\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c:is(d)\", \":is(d)\", \"d.e\")}\n"), + "a {\ \n b: .c:is(d);\ \n}\n" - ); + ); } #[test] #[ignore] // wrong result fn matches() { assert_eq!( runner().ok( - "a {b: selector-extend(\".c:matches(d)\", \":matches(d)\", \"d.e\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\".c:matches(d)\", \":matches(d)\", \"d.e\")}\n" ), "a {\ \n b: .c:matches(d);\ @@ -311,7 +309,8 @@ mod unification { fn test_where() { assert_eq!( runner().ok( - "a {b: selector-extend(\".c:where(d)\", \":where(d)\", \"d.e\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\".c:where(d)\", \":where(d)\", \"d.e\")}\n" ), "a {\ \n b: .c:where(d);\ diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/attribute.rs b/rsass/tests/spec/core_functions/selector/extend/simple/attribute.rs index 70d358bf2..af0a1a9a7 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/attribute.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/attribute.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn equal() { assert_eq!( - runner().ok("a {b: selector-extend(\"[c=d]\", \"[c=d]\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"[c=d]\", \"[c=d]\", \"e\")}\n"), "a {\ \n b: [c=d], e;\ \n}\n" @@ -21,8 +22,8 @@ mod unequal { #[test] fn name() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"[c=d]\", \"[e=d]\", \"f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"[c=d]\", \"[e=d]\", \"f\")}\n"), "a {\ \n b: [c=d];\ \n}\n" @@ -31,8 +32,8 @@ mod unequal { #[test] fn operator() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"[c=d]\", \"[c^=d]\", \"f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"[c=d]\", \"[c^=d]\", \"f\")}\n"), "a {\ \n b: [c=d];\ \n}\n" @@ -41,8 +42,8 @@ mod unequal { #[test] fn value() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"[c=d]\", \"[c=e]\", \"f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"[c=d]\", \"[c=e]\", \"f\")}\n"), "a {\ \n b: [c=d];\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/class.rs b/rsass/tests/spec/core_functions/selector/extend/simple/class.rs index 42f814958..093880dbc 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/class.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/class.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn equal() { assert_eq!( - runner().ok("a {b: selector-extend(\".c\", \".c\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c\", \".c\", \"e\")}\n"), "a {\ \n b: .c, e;\ \n}\n" @@ -17,7 +18,8 @@ fn equal() { #[test] fn unequal() { assert_eq!( - runner().ok("a {b: selector-extend(\".c\", \".d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\".c\", \".d\", \"e\")}\n"), "a {\ \n b: .c;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/id.rs b/rsass/tests/spec/core_functions/selector/extend/simple/id.rs index 66fa67881..39ddd228b 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/id.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/id.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn equal() { assert_eq!( - runner().ok("a {b: selector-extend(\"#c\", \"#c\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"#c\", \"#c\", \"e\")}\n"), "a {\ \n b: #c, e;\ \n}\n" @@ -17,7 +18,8 @@ fn equal() { #[test] fn unequal() { assert_eq!( - runner().ok("a {b: selector-extend(\"#c\", \"#d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"#c\", \"#d\", \"e\")}\n"), "a {\ \n b: #c;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/placeholder.rs b/rsass/tests/spec/core_functions/selector/extend/simple/placeholder.rs index 7bf9adcf8..c645e930e 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/placeholder.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/placeholder.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn equal() { assert_eq!( - runner().ok("a {b: selector-extend(\"%c\", \"%c\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"%c\", \"%c\", \"e\")}\n"), "a {\ \n b: %c, e;\ \n}\n" @@ -17,7 +18,8 @@ fn equal() { #[test] fn unequal() { assert_eq!( - runner().ok("a {b: selector-extend(\"%c\", \"%d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"%c\", \"%d\", \"e\")}\n"), "a {\ \n b: %c;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/arg.rs b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/arg.rs index 4db304a52..b0b7e49bb 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/arg.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/arg.rs @@ -12,9 +12,8 @@ mod class { #[test] fn equal() { assert_eq!( - runner().ok( - "a {b: selector-extend(\":c(@#$)\", \":c(@#$)\", \"e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":c(@#$)\", \":c(@#$)\", \"e\")}\n"), "a {\ \n b: :c(@#$), e;\ \n}\n" @@ -27,20 +26,18 @@ mod class { #[test] fn argument() { assert_eq!( - runner().ok( - "a {b: selector-extend(\":c(@#$)\", \":c(*&^)\", \"e\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":c(@#$)\", \":c(*&^)\", \"e\")}\n"), + "a {\ \n b: :c(@#$);\ \n}\n" - ); + ); } #[test] fn has_argument() { assert_eq!( - runner().ok( - "a {b: selector-extend(\":c(@#$)\", \":c\", \"e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":c(@#$)\", \":c\", \"e\")}\n"), "a {\ \n b: :c(@#$);\ \n}\n" @@ -49,13 +46,12 @@ mod class { #[test] fn name() { assert_eq!( - runner().ok( - "a {b: selector-extend(\":c(@#$)\", \":d(@#$)\", \"e\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":c(@#$)\", \":d(@#$)\", \"e\")}\n"), + "a {\ \n b: :c(@#$);\ \n}\n" - ); + ); } } } @@ -66,9 +62,8 @@ mod element { #[test] fn equal() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"::c(@#$)\", \"::c(@#$)\", \"e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"::c(@#$)\", \"::c(@#$)\", \"e\")}\n"), "a {\ \n b: ::c(@#$), e;\ \n}\n" @@ -81,20 +76,18 @@ mod element { #[test] fn argument() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"::c(@#$)\", \"::c(*&^)\", \"e\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"::c(@#$)\", \"::c(*&^)\", \"e\")}\n"), + "a {\ \n b: ::c(@#$);\ \n}\n" - ); + ); } #[test] fn has_argument() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"::c(@#$)\", \"::c\", \"e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"::c(@#$)\", \"::c\", \"e\")}\n"), "a {\ \n b: ::c(@#$);\ \n}\n" @@ -103,13 +96,12 @@ mod element { #[test] fn name() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"::c(@#$)\", \":d(@#$)\", \"e\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"::c(@#$)\", \":d(@#$)\", \"e\")}\n"), + "a {\ \n b: ::c(@#$);\ \n}\n" - ); + ); } } } diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/no_arg.rs b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/no_arg.rs index d5b1c9719..a155ec752 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/no_arg.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/no_arg.rs @@ -12,7 +12,8 @@ mod class { #[test] fn and_element() { assert_eq!( - runner().ok("a {b: selector-extend(\":c\", \"::c\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":c\", \"::c\", \"e\")}\n"), "a {\ \n b: :c;\ \n}\n" @@ -21,7 +22,8 @@ mod class { #[test] fn equal() { assert_eq!( - runner().ok("a {b: selector-extend(\":c\", \":c\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":c\", \":c\", \"e\")}\n"), "a {\ \n b: :c, e;\ \n}\n" @@ -30,7 +32,8 @@ mod class { #[test] fn unequal() { assert_eq!( - runner().ok("a {b: selector-extend(\":c\", \":d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":c\", \":d\", \"e\")}\n"), "a {\ \n b: :c;\ \n}\n" @@ -44,7 +47,8 @@ mod element { #[test] fn and_class() { assert_eq!( - runner().ok("a {b: selector-extend(\"::c\", \":c\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"::c\", \":c\", \"e\")}\n"), "a {\ \n b: ::c;\ \n}\n" @@ -53,7 +57,8 @@ mod element { #[test] fn equal() { assert_eq!( - runner().ok("a {b: selector-extend(\"::c\", \"::c\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"::c\", \"::c\", \"e\")}\n"), "a {\ \n b: ::c, e;\ \n}\n" @@ -62,7 +67,8 @@ mod element { #[test] fn unequal() { assert_eq!( - runner().ok("a {b: selector-extend(\"::c\", \"::d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"::c\", \"::d\", \"e\")}\n"), "a {\ \n b: ::c;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/any.rs b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/any.rs index e923006c8..0d47509d6 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/any.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/any.rs @@ -10,7 +10,8 @@ fn runner() -> crate::TestRunner { fn any_in_extender() { assert_eq!( runner().ok( - "a {b: selector-extend(\":any(.c)\", \".c\", \":any(.d, .e)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":any(.c)\", \".c\", \":any(.d, .e)\")}\n" ), "a {\ \n b: :any(.c, .d, .e);\ @@ -21,8 +22,8 @@ fn any_in_extender() { #[ignore] // wrong result fn list() { assert_eq!( - runner() - .ok("a {b: selector-extend(\":any(.c)\", \".c\", \".d, .e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":any(.c)\", \".c\", \".d, .e\")}\n"), "a {\ \n b: :any(.c, .d, .e);\ \n}\n" @@ -32,7 +33,8 @@ fn list() { #[ignore] // wrong result fn simple() { assert_eq!( - runner().ok("a {b: selector-extend(\":any(.c)\", \".c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":any(.c)\", \".c\", \".d\")}\n"), "a {\ \n b: :any(.c, .d);\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/current.rs b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/current.rs index 5d4f1ab11..9cfa87905 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/current.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/current.rs @@ -10,7 +10,8 @@ fn runner() -> crate::TestRunner { fn current_in_extender() { assert_eq!( runner().ok( - "a {b: selector-extend(\":current(.c)\", \".c\", \":current(.d, .e)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":current(.c)\", \".c\", \":current(.d, .e)\")}\n" ), "a {\ \n b: :current(.c, .d, .e);\ @@ -22,7 +23,8 @@ fn current_in_extender() { fn list() { assert_eq!( runner().ok( - "a {b: selector-extend(\":current(.c)\", \".c\", \".d, .e\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":current(.c)\", \".c\", \".d, .e\")}\n" ), "a {\ \n b: :current(.c, .d, .e);\ @@ -33,8 +35,8 @@ fn list() { #[ignore] // wrong result fn simple() { assert_eq!( - runner() - .ok("a {b: selector-extend(\":current(.c)\", \".c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":current(.c)\", \".c\", \".d\")}\n"), "a {\ \n b: :current(.c, .d);\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/is.rs b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/is.rs index 3cdb6975e..74e51a7c6 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/is.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/is.rs @@ -10,7 +10,8 @@ fn runner() -> crate::TestRunner { fn is_in_extender() { assert_eq!( runner().ok( - "a {b: selector-extend(\":is(.c)\", \".c\", \":is(.d, .e)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":is(.c)\", \".c\", \":is(.d, .e)\")}\n" ), "a {\ \n b: :is(.c, .d, .e);\ @@ -21,8 +22,8 @@ fn is_in_extender() { #[ignore] // wrong result fn list() { assert_eq!( - runner() - .ok("a {b: selector-extend(\":is(.c)\", \".c\", \".d, .e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":is(.c)\", \".c\", \".d, .e\")}\n"), "a {\ \n b: :is(.c, .d, .e);\ \n}\n" @@ -32,7 +33,8 @@ fn list() { #[ignore] // wrong result fn simple() { assert_eq!( - runner().ok("a {b: selector-extend(\":is(.c)\", \".c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":is(.c)\", \".c\", \".d\")}\n"), "a {\ \n b: :is(.c, .d);\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/matches.rs b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/matches.rs index 543e04fad..1c4f1a495 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/matches.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/matches.rs @@ -10,7 +10,8 @@ fn runner() -> crate::TestRunner { fn list() { assert_eq!( runner().ok( - "a {b: selector-extend(\":matches(.c)\", \".c\", \".d, .e\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":matches(.c)\", \".c\", \".d, .e\")}\n" ), "a {\ \n b: :matches(.c, .d, .e);\ @@ -22,7 +23,8 @@ fn list() { fn matches_in_extender() { assert_eq!( runner().ok( - "a {b: selector-extend(\":matches(.c)\", \".c\", \":matches(.d, .e)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":matches(.c)\", \".c\", \":matches(.d, .e)\")}\n" ), "a {\ \n b: :matches(.c, .d, .e);\ @@ -33,8 +35,8 @@ fn matches_in_extender() { #[ignore] // wrong result fn simple() { assert_eq!( - runner() - .ok("a {b: selector-extend(\":matches(.c)\", \".c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":matches(.c)\", \".c\", \".d\")}\n"), "a {\ \n b: :matches(.c, .d);\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/not.rs b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/not.rs index 47b3e218c..83ee924e1 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/not.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/not.rs @@ -9,9 +9,8 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn complex() { assert_eq!( - runner().ok( - "a {b: selector-extend(\":not(.c .d)\", \".d\", \".e .f\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":not(.c .d)\", \".d\", \".e .f\")}\n"), "a {\ \n b: :not(.c .d):not(.c .e .f):not(.e .c .f);\ \n}\n" @@ -21,8 +20,8 @@ fn complex() { #[ignore] // wrong result fn component() { assert_eq!( - runner() - .ok("a {b: selector-extend(\":not(.c.d)\", \".c\", \".e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":not(.c.d)\", \".c\", \".e\")}\n"), "a {\ \n b: :not(.c.d):not(.d.e);\ \n}\n" @@ -37,7 +36,8 @@ mod is { fn in_compound() { assert_eq!( runner().ok( - "a {b: selector-extend(\":not(.c)\", \".c\", \".d:is(.e, .f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":not(.c)\", \".c\", \".d:is(.e, .f)\")}\n" ), "a {\ \n b: :not(.c):not(.d:is(.e, .f));\ @@ -49,7 +49,8 @@ mod is { fn list() { assert_eq!( runner().ok( - "a {b: selector-extend(\":not(.c)\", \".c\", \":is(.d, .e)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":not(.c)\", \".c\", \":is(.d, .e)\")}\n" ), "a {\ \n b: :not(.c):not(.d):not(.e);\ @@ -61,7 +62,8 @@ mod is { fn list_of_complex() { assert_eq!( runner().ok( - "a {b: selector-extend(\":not(.c)\", \".c\", \":is(.d .e, .f .g)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":not(.c)\", \".c\", \":is(.d .e, .f .g)\")}\n" ), "a {\ \n b: :not(.c):not(.d .e):not(.f .g);\ @@ -73,8 +75,8 @@ mod is { #[ignore] // wrong result fn list() { assert_eq!( - runner() - .ok("a {b: selector-extend(\":not(.c)\", \".c\", \".d, .e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":not(.c)\", \".c\", \".d, .e\")}\n"), "a {\ \n b: :not(.c):not(.d):not(.e);\ \n}\n" @@ -85,9 +87,10 @@ fn list() { fn list_in_not() { assert_eq!( runner().ok( - "// If the original :not() already contains a selector list, we add new selectors\ + "@use \"sass:selector\";\ + \n// If the original :not() already contains a selector list, we add new selectors\ \n// to that list because there\'s no risk of breaking additional browsers.\ - \na {b: selector-extend(\":not(.c, .d)\", \".c\", \".e\")}\n" + \na {b: selector.extend(\":not(.c, .d)\", \".c\", \".e\")}\n" ), "a {\ \n b: :not(.c, .e, .d);\ @@ -103,7 +106,8 @@ mod matches { fn in_compound() { assert_eq!( runner().ok( - "a {b: selector-extend(\":not(.c)\", \".c\", \".d:matches(.e, .f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":not(.c)\", \".c\", \".d:matches(.e, .f)\")}\n" ), "a {\ \n b: :not(.c):not(.d:matches(.e, .f));\ @@ -115,7 +119,8 @@ mod matches { fn list() { assert_eq!( runner().ok( - "a {b: selector-extend(\":not(.c)\", \".c\", \":matches(.d, .e)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":not(.c)\", \".c\", \":matches(.d, .e)\")}\n" ), "a {\ \n b: :not(.c):not(.d):not(.e);\ @@ -127,7 +132,8 @@ mod matches { fn list_of_complex() { assert_eq!( runner().ok( - "a {b: selector-extend(\":not(.c)\", \".c\", \":matches(.d .e, .f .g)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":not(.c)\", \".c\", \":matches(.d .e, .f .g)\")}\n" ), "a {\ \n b: :not(.c):not(.d .e):not(.f .g);\ @@ -139,11 +145,12 @@ mod matches { fn not_in_extender() { assert_eq!( runner().ok( - "// Ideally, this should emit `.d, :not(.c)`, but that would be the only\ + "@use \"sass:selector\";\ + \n// Ideally, this should emit `.d, :not(.c)`, but that would be the only\ \n// situation where extending a pseudo selector could produce a full-on selector\ \n// list. For the sake of simplicity of the `@extend` algorithm, we just ignore\ \n// nested `:not()`s instead.\ - \na {b: selector-extend(\":not(.c)\", \".c\", \":not(.d)\")}\n" + \na {b: selector.extend(\":not(.c)\", \".c\", \":not(.d)\")}\n" ), "a {\ \n b: :not(.c);\ @@ -154,7 +161,8 @@ fn not_in_extender() { #[ignore] // wrong result fn simple() { assert_eq!( - runner().ok("a {b: selector-extend(\":not(.c)\", \".c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":not(.c)\", \".c\", \".d\")}\n"), "a {\ \n b: :not(.c):not(.d);\ \n}\n" @@ -169,7 +177,8 @@ mod test_where { fn in_compound() { assert_eq!( runner().ok( - "a {b: selector-extend(\":not(.c)\", \".c\", \".d:where(.e, .f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":not(.c)\", \".c\", \".d:where(.e, .f)\")}\n" ), "a {\ \n b: :not(.c):not(.d:where(.e, .f));\ @@ -181,7 +190,8 @@ mod test_where { fn list() { assert_eq!( runner().ok( - "a {b: selector-extend(\":not(.c)\", \".c\", \":where(.d, .e)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":not(.c)\", \".c\", \":where(.d, .e)\")}\n" ), "a {\ \n b: :not(.c):not(.d):not(.e);\ @@ -193,7 +203,8 @@ mod test_where { fn list_of_complex() { assert_eq!( runner().ok( - "a {b: selector-extend(\":not(.c)\", \".c\", \":where(.d .e, .f .g)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":not(.c)\", \".c\", \":where(.d .e, .f .g)\")}\n" ), "a {\ \n b: :not(.c):not(.d .e):not(.f .g);\ diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/nth_child.rs b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/nth_child.rs index f18faa909..c8e6f2353 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/nth_child.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/nth_child.rs @@ -9,10 +9,11 @@ fn runner() -> crate::TestRunner { fn different_arg_in_extender() { assert_eq!( runner().ok( - "// This should produce `:nth-child(2n + 1 of .c, :nth-child(2n + 1 of .d, .e))`.\ + "@use \"sass:selector\";\ + \n// This should produce `:nth-child(2n + 1 of .c, :nth-child(2n + 1 of .d, .e))`.\ \n// See sass/sass#2828.\ \na {\ - \n b: selector-extend(\ + \n b: selector.extend(\ \n \":nth-child(2n + 1 of .c)\",\ \n \".c\",\ \n \":nth-child(2n + 2 of .d, .e)\");\ @@ -28,7 +29,8 @@ fn different_arg_in_extender() { fn list() { assert_eq!( runner().ok( - "a {b: selector-extend(\":nth-child(2n + 1 of .c)\", \".c\", \".d, .e\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":nth-child(2n + 1 of .c)\", \".c\", \".d, .e\")}\n" ), "a {\ \n b: :nth-child(2n+1 of .c, .d, .e);\ @@ -39,8 +41,9 @@ fn list() { #[ignore] // wrong result fn same_arg_in_extender() { assert_eq!( - runner().ok("a {\ - \n b: selector-extend(\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.extend(\ \n \":nth-child(2n + 1 of .c)\",\ \n \".c\",\ \n \":nth-child(2n + 1 of .d, .e)\");\ @@ -55,7 +58,8 @@ fn same_arg_in_extender() { fn simple() { assert_eq!( runner().ok( - "a {b: selector-extend(\":nth-child(2n + 1 of .c)\", \".c\", \".d\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":nth-child(2n + 1 of .c)\", \".c\", \".d\")}\n" ), "a {\ \n b: :nth-child(2n+1 of .c, .d);\ diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/nth_last_child.rs b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/nth_last_child.rs index 1944dc513..457dbf582 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/nth_last_child.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/nth_last_child.rs @@ -9,11 +9,12 @@ fn runner() -> crate::TestRunner { fn different_arg_in_extender() { assert_eq!( runner().ok( - "// This should produce\ + "@use \"sass:selector\";\ + \n// This should produce\ \n// `:nth-last-child(2n + 1 of .c, :nth-last-child(2n + 1 of .d, .e))`.\ \n// See sass/sass#2828.\ \na {\ - \n b: selector-extend(\ + \n b: selector.extend(\ \n \":nth-last-child(2n + 1 of .c)\",\ \n \".c\",\ \n \":nth-last-child(2n + 2 of .d, .e)\");\ @@ -29,7 +30,8 @@ fn different_arg_in_extender() { fn list() { assert_eq!( runner().ok( - "a {b: selector-extend(\":nth-last-child(2n + 1 of .c)\", \".c\", \".d, .e\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":nth-last-child(2n + 1 of .c)\", \".c\", \".d, .e\")}\n" ), "a {\ \n b: :nth-last-child(2n+1 of .c, .d, .e);\ @@ -40,8 +42,9 @@ fn list() { #[ignore] // wrong result fn same_arg_in_extender() { assert_eq!( - runner().ok("a {\ - \n b: selector-extend(\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.extend(\ \n \":nth-last-child(2n + 1 of .c)\",\ \n \".c\",\ \n \":nth-last-child(2n + 1 of .d, .e)\");\ @@ -56,7 +59,8 @@ fn same_arg_in_extender() { fn simple() { assert_eq!( runner().ok( - "a {b: selector-extend(\":nth-last-child(2n + 1 of .c)\", \".c\", \".d\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":nth-last-child(2n + 1 of .c)\", \".c\", \".d\")}\n" ), "a {\ \n b: :nth-last-child(2n+1 of .c, .d);\ diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/prefixed.rs b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/prefixed.rs index f2d66d186..63939a827 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/prefixed.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/prefixed.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn different_prefix_in_extender() { assert_eq!( runner().ok( - "a {b: selector-extend(\":-ms-matches(.c)\", \".c\", \":-moz-matches(.d, .e)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":-ms-matches(.c)\", \".c\", \":-moz-matches(.d, .e)\")}\n" ), "a {\ \n b: :-ms-matches(.c);\ @@ -21,7 +22,8 @@ fn different_prefix_in_extender() { fn list() { assert_eq!( runner().ok( - "a {b: selector-extend(\":-ms-matches(.c)\", \".c\", \".d, .e\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":-ms-matches(.c)\", \".c\", \".d, .e\")}\n" ), "a {\ \n b: :-ms-matches(.c, .d, .e);\ @@ -33,7 +35,8 @@ fn list() { fn same_prefix_in_extender() { assert_eq!( runner().ok( - "a {b: selector-extend(\":-ms-matches(.c)\", \".c\", \":-ms-matches(.d, .e)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":-ms-matches(.c)\", \".c\", \":-ms-matches(.d, .e)\")}\n" ), "a {\ \n b: :-ms-matches(.c, .d, .e);\ @@ -45,7 +48,8 @@ fn same_prefix_in_extender() { fn simple() { assert_eq!( runner().ok( - "a {b: selector-extend(\":-ms-matches(.c)\", \".c\", \".d\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":-ms-matches(.c)\", \".c\", \".d\")}\n" ), "a {\ \n b: :-ms-matches(.c, .d);\ diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/test_where.rs b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/test_where.rs index c5e315fe4..bd8ae8ea4 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/test_where.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/idempotent/test_where.rs @@ -10,7 +10,8 @@ fn runner() -> crate::TestRunner { fn is_in_extender() { assert_eq!( runner().ok( - "a {b: selector-extend(\":where(.c)\", \".c\", \":where(.d, .e)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":where(.c)\", \".c\", \":where(.d, .e)\")}\n" ), "a {\ \n b: :where(.c, .d, .e);\ @@ -21,9 +22,8 @@ fn is_in_extender() { #[ignore] // wrong result fn list() { assert_eq!( - runner().ok( - "a {b: selector-extend(\":where(.c)\", \".c\", \".d, .e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":where(.c)\", \".c\", \".d, .e\")}\n"), "a {\ \n b: :where(.c, .d, .e);\ \n}\n" @@ -33,8 +33,8 @@ fn list() { #[ignore] // wrong result fn simple() { assert_eq!( - runner() - .ok("a {b: selector-extend(\":where(.c)\", \".c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":where(.c)\", \".c\", \".d\")}\n"), "a {\ \n b: :where(.c, .d);\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/non_idempotent.rs b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/non_idempotent.rs index 67a83db9e..b2f1aad6f 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/non_idempotent.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/non_idempotent.rs @@ -13,21 +13,19 @@ mod has { #[ignore] // wrong result fn has_in_extender() { assert_eq!( - runner().ok( - "a {b: selector-extend(\":has(.c)\", \".c\", \":has(.d)\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":has(.c)\", \".c\", \":has(.d)\")}\n"), + "a {\ \n b: :has(.c, :has(.d));\ \n}\n" - ); + ); } #[test] #[ignore] // wrong result fn list() { assert_eq!( - runner().ok( - "a {b: selector-extend(\":has(.c)\", \".c\", \".d, .e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":has(.c)\", \".c\", \".d, .e\")}\n"), "a {\ \n b: :has(.c, .d, .e);\ \n}\n" @@ -37,8 +35,8 @@ mod has { #[ignore] // wrong result fn simple() { assert_eq!( - runner() - .ok("a {b: selector-extend(\":has(.c)\", \".c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":has(.c)\", \".c\", \".d\")}\n"), "a {\ \n b: :has(.c, .d);\ \n}\n" @@ -54,7 +52,8 @@ mod host { fn host_in_extender() { assert_eq!( runner().ok( - "a {b: selector-extend(\":host(.c)\", \".c\", \":host(.d)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":host(.c)\", \".c\", \":host(.d)\")}\n" ), "a {\ \n b: :host(.c, :host(.d));\ @@ -65,9 +64,8 @@ mod host { #[ignore] // wrong result fn list() { assert_eq!( - runner().ok( - "a {b: selector-extend(\":host(.c)\", \".c\", \".d, .e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":host(.c)\", \".c\", \".d, .e\")}\n"), "a {\ \n b: :host(.c, .d, .e);\ \n}\n" @@ -77,9 +75,8 @@ mod host { #[ignore] // wrong result fn simple() { assert_eq!( - runner().ok( - "a {b: selector-extend(\":host(.c)\", \".c\", \".d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\":host(.c)\", \".c\", \".d\")}\n"), "a {\ \n b: :host(.c, .d);\ \n}\n" @@ -95,7 +92,8 @@ mod host_context { fn host_context_in_extender() { assert_eq!( runner().ok( - "a {b: selector-extend(\":host-context(.c)\", \".c\", \":host-context(.d)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":host-context(.c)\", \".c\", \":host-context(.d)\")}\n" ), "a {\ \n b: :host-context(.c, :host-context(.d));\ @@ -107,7 +105,8 @@ mod host_context { fn list() { assert_eq!( runner().ok( - "a {b: selector-extend(\":host-context(.c)\", \".c\", \".d, .e\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":host-context(.c)\", \".c\", \".d, .e\")}\n" ), "a {\ \n b: :host-context(.c, .d, .e);\ @@ -119,7 +118,8 @@ mod host_context { fn simple() { assert_eq!( runner().ok( - "a {b: selector-extend(\":host-context(.c)\", \".c\", \".d\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":host-context(.c)\", \".c\", \".d\")}\n" ), "a {\ \n b: :host-context(.c, .d);\ @@ -136,7 +136,8 @@ mod slotted { fn list() { assert_eq!( runner().ok( - "a {b: selector-extend(\"::slotted(.c)\", \".c\", \".d, .e\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\"::slotted(.c)\", \".c\", \".d, .e\")}\n" ), "a {\ \n b: ::slotted(.c, .d, .e);\ @@ -147,9 +148,8 @@ mod slotted { #[ignore] // wrong result fn simple() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"::slotted(.c)\", \".c\", \".d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"::slotted(.c)\", \".c\", \".d\")}\n"), "a {\ \n b: ::slotted(.c, .d);\ \n}\n" @@ -160,7 +160,8 @@ mod slotted { fn slotted_in_extender() { assert_eq!( runner().ok( - "a {b: selector-extend(\"::slotted(.c)\", \".c\", \"::slotted(.d)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\"::slotted(.c)\", \".c\", \"::slotted(.d)\")}\n" ), "a {\ \n b: ::slotted(.c, ::slotted(.d));\ diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/test_match.rs b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/test_match.rs index a34e94888..da048afae 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/test_match.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/pseudo/selector/test_match.rs @@ -12,8 +12,9 @@ mod prefixed { #[test] fn equal() { assert_eq!( - runner().ok("a {\ - \n b: selector-extend(\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.extend(\ \n \":nth-child(2n + 1 of c d.e, f g)\",\ \n \":nth-child(2n + 1 of c d.e, f g)\",\ \n \"h\");\ @@ -30,8 +31,9 @@ mod prefixed { #[test] fn argument() { assert_eq!( - runner().ok("a {\ - \n b: selector-extend(\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.extend(\ \n \":nth-child(2n + 1 of c d.e, f g)\",\ \n \":nth-child(2n + 1 of d, g)\",\ \n \"h\");\ @@ -45,7 +47,8 @@ mod prefixed { fn has_argument() { assert_eq!( runner().ok( - "a {b: selector-extend(\":nth-child(2n + 1 of c d.e, f g)\", \":nth-child\", \"h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":nth-child(2n + 1 of c d.e, f g)\", \":nth-child\", \"h\")}\n" ), "a {\ \n b: :nth-child(2n+1 of c d.e, f g);\ @@ -55,8 +58,9 @@ mod prefixed { #[test] fn name() { assert_eq!( - runner().ok("a {\ - \n b: selector-extend(\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.extend(\ \n \":nth-child(2n + 1 of c d.e, f g)\",\ \n \":nth-last-child(2n + 1 of c d.e, f g)\",\ \n \"h\");\ @@ -69,8 +73,9 @@ mod prefixed { #[test] fn prefix() { assert_eq!( - runner().ok("a {\ - \n b: selector-extend(\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.extend(\ \n \":nth-child(2n + 1 of c d.e, f g)\",\ \n \":nth-child(2n of c d.e, f g)\",\ \n \"h\");\ @@ -94,7 +99,8 @@ mod unprefixed { fn equal() { assert_eq!( runner().ok( - "a {b: selector-extend(\"::slotted(c.d, e.f)\", \"::slotted(c.d, e.f)\", \"g\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\"::slotted(c.d, e.f)\", \"::slotted(c.d, e.f)\", \"g\")}\n" ), "a {\ \n b: ::slotted(c.d, e.f), g;\ @@ -109,7 +115,8 @@ mod unprefixed { fn argument() { assert_eq!( runner().ok( - "a {b: selector-extend(\"::slotted(c.d, e.f)\", \"::slotted(d, g)\", \"g\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\"::slotted(c.d, e.f)\", \"::slotted(d, g)\", \"g\")}\n" ), "a {\ \n b: ::slotted(c.d, e.f);\ @@ -120,7 +127,8 @@ mod unprefixed { fn has_argument() { assert_eq!( runner().ok( - "a {b: selector-extend(\"::slotted(c.d, e.f)\", \"::slotted\", \"g\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\"::slotted(c.d, e.f)\", \"::slotted\", \"g\")}\n" ), "a {\ \n b: ::slotted(c.d, e.f);\ @@ -131,7 +139,8 @@ mod unprefixed { fn name() { assert_eq!( runner().ok( - "a {b: selector-extend(\"::slotted(c.d, e.f)\", \"::-pfx-slotted(c.d, e.f)\", \"g\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\"::slotted(c.d, e.f)\", \"::-pfx-slotted(c.d, e.f)\", \"g\")}\n" ), "a {\ \n b: ::slotted(c.d, e.f);\ @@ -152,7 +161,8 @@ mod unprefixed { fn equal() { assert_eq!( runner().ok( - "a {b: selector-extend(\":is(c d.e, f g)\", \":is(c d.e, f g)\", \"h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":is(c d.e, f g)\", \":is(c d.e, f g)\", \"h\")}\n" ), "a {\ \n b: :is(c d.e, f g), h;\ @@ -167,7 +177,8 @@ mod unprefixed { fn argument() { assert_eq!( runner().ok( - "a {b: selector-extend(\":is(c d.e, f g)\", \":is(d, g)\", \"h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":is(c d.e, f g)\", \":is(d, g)\", \"h\")}\n" ), "a {\ \n b: :is(c d.e, f g);\ @@ -177,19 +188,21 @@ mod unprefixed { #[test] fn has_argument() { assert_eq!( - runner().ok( - "a {b: selector-extend(\":is(c d.e, f g)\", \":is\", \"h\")}\n" - ), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.extend(\":is(c d.e, f g)\", \":is\", \"h\")}\n" + ), + "a {\ \n b: :is(c d.e, f g);\ \n}\n" - ); + ); } #[test] fn name() { assert_eq!( runner().ok( - "a {b: selector-extend(\":is(c d.e, f g)\", \":-pfx-is(c d.e, f g)\", \"h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":is(c d.e, f g)\", \":-pfx-is(c d.e, f g)\", \"h\")}\n" ), "a {\ \n b: :is(c d.e, f g);\ @@ -211,7 +224,8 @@ mod unprefixed { fn equal() { assert_eq!( runner().ok( - "a {b: selector-extend(\":matches(c d.e, f g)\", \":matches(c d.e, f g)\", \"h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":matches(c d.e, f g)\", \":matches(c d.e, f g)\", \"h\")}\n" ), "a {\ \n b: :matches(c d.e, f g), h;\ @@ -226,7 +240,8 @@ mod unprefixed { fn argument() { assert_eq!( runner().ok( - "a {b: selector-extend(\":matches(c d.e, f g)\", \":matches(d, g)\", \"h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":matches(c d.e, f g)\", \":matches(d, g)\", \"h\")}\n" ), "a {\ \n b: :matches(c d.e, f g);\ @@ -237,7 +252,8 @@ mod unprefixed { fn has_argument() { assert_eq!( runner().ok( - "a {b: selector-extend(\":matches(c d.e, f g)\", \":matches\", \"h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":matches(c d.e, f g)\", \":matches\", \"h\")}\n" ), "a {\ \n b: :matches(c d.e, f g);\ @@ -248,7 +264,8 @@ mod unprefixed { fn name() { assert_eq!( runner().ok( - "a {b: selector-extend(\":matches(c d.e, f g)\", \":-pfx-matches(c d.e, f g)\", \"h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":matches(c d.e, f g)\", \":-pfx-matches(c d.e, f g)\", \"h\")}\n" ), "a {\ \n b: :matches(c d.e, f g);\ @@ -270,7 +287,8 @@ mod unprefixed { fn equal() { assert_eq!( runner().ok( - "a {b: selector-extend(\":where(c d.e, f g)\", \":where(c d.e, f g)\", \"h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":where(c d.e, f g)\", \":where(c d.e, f g)\", \"h\")}\n" ), "a {\ \n b: :where(c d.e, f g), h;\ @@ -285,7 +303,8 @@ mod unprefixed { fn argument() { assert_eq!( runner().ok( - "a {b: selector-extend(\":where(c d.e, f g)\", \":where(d, g)\", \"h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":where(c d.e, f g)\", \":where(d, g)\", \"h\")}\n" ), "a {\ \n b: :where(c d.e, f g);\ @@ -296,7 +315,8 @@ mod unprefixed { fn has_argument() { assert_eq!( runner().ok( - "a {b: selector-extend(\":where(c d.e, f g)\", \":where\", \"h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":where(c d.e, f g)\", \":where\", \"h\")}\n" ), "a {\ \n b: :where(c d.e, f g);\ @@ -307,7 +327,8 @@ mod unprefixed { fn name() { assert_eq!( runner().ok( - "a {b: selector-extend(\":where(c d.e, f g)\", \":-pfx-where(c d.e, f g)\", \"h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.extend(\":where(c d.e, f g)\", \":-pfx-where(c d.e, f g)\", \"h\")}\n" ), "a {\ \n b: :where(c d.e, f g);\ diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/test_type.rs b/rsass/tests/spec/core_functions/selector/extend/simple/test_type.rs index 8e78655a9..6bbec6b24 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/test_type.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/test_type.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn and_universal() { assert_eq!( - runner().ok("a {b: selector-extend(\"c\", \"*\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"*\", \"d\")}\n"), "a {\ \n b: c;\ \n}\n" @@ -17,7 +18,8 @@ fn and_universal() { #[test] fn equal() { assert_eq!( - runner().ok("a {b: selector-extend(\"c\", \"c\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"c\", \"e\")}\n"), "a {\ \n b: c, e;\ \n}\n" @@ -34,8 +36,8 @@ mod namespace { #[test] fn and_empty() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"|c\", \"|c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"|c\", \"|c\", \"d\")}\n"), "a {\ \n b: |c, d;\ \n}\n" @@ -44,8 +46,8 @@ mod namespace { #[test] fn and_explicit() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"|c\", \"d|c\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"|c\", \"d|c\", \"e\")}\n"), "a {\ \n b: |c;\ \n}\n" @@ -54,7 +56,8 @@ mod namespace { #[test] fn and_implicit() { assert_eq!( - runner().ok("a {b: selector-extend(\"|c\", \"c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"|c\", \"c\", \"d\")}\n"), "a {\ \n b: |c;\ \n}\n" @@ -63,8 +66,8 @@ mod namespace { #[test] fn and_universal() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"|c\", \"*|c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"|c\", \"*|c\", \"d\")}\n"), "a {\ \n b: |c;\ \n}\n" @@ -78,8 +81,8 @@ mod namespace { #[test] fn and_empty() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"c|d\", \"|d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|d\", \"|d\", \"e\")}\n"), "a {\ \n b: c|d;\ \n}\n" @@ -92,9 +95,8 @@ mod namespace { #[test] fn equal() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c|d\", \"c|d\", \"e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|d\", \"c|d\", \"e\")}\n"), "a {\ \n b: c|d, e;\ \n}\n" @@ -103,9 +105,8 @@ mod namespace { #[test] fn unequal() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c|d\", \"e|d\", \"e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|d\", \"e|d\", \"e\")}\n"), "a {\ \n b: c|d;\ \n}\n" @@ -115,8 +116,8 @@ mod namespace { #[test] fn and_implicit() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"c|d\", \"d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|d\", \"d\", \"e\")}\n"), "a {\ \n b: c|d;\ \n}\n" @@ -125,8 +126,8 @@ mod namespace { #[test] fn and_universal() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"c|d\", \"*|d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|d\", \"*|d\", \"e\")}\n"), "a {\ \n b: c|d;\ \n}\n" @@ -140,8 +141,8 @@ mod namespace { #[test] fn and_empty() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"*|c\", \"|c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"*|c\", \"|c\", \"d\")}\n"), "a {\ \n b: *|c;\ \n}\n" @@ -150,8 +151,8 @@ mod namespace { #[test] fn and_explicit() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"*|c\", \"d|c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"*|c\", \"d|c\", \"d\")}\n"), "a {\ \n b: *|c;\ \n}\n" @@ -160,8 +161,8 @@ mod namespace { #[test] fn and_implicit() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"*|c\", \"c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"*|c\", \"c\", \"d\")}\n"), "a {\ \n b: *|c;\ \n}\n" @@ -170,8 +171,8 @@ mod namespace { #[test] fn and_universal() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"*|c\", \"*|c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"*|c\", \"*|c\", \"d\")}\n"), "a {\ \n b: *|c, d;\ \n}\n" @@ -182,7 +183,8 @@ mod namespace { #[test] fn unequal() { assert_eq!( - runner().ok("a {b: selector-extend(\"c\", \"d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c\", \"d\", \"e\")}\n"), "a {\ \n b: c;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/extend/simple/universal.rs b/rsass/tests/spec/core_functions/selector/extend/simple/universal.rs index 7d97bec9d..5977f8d8b 100644 --- a/rsass/tests/spec/core_functions/selector/extend/simple/universal.rs +++ b/rsass/tests/spec/core_functions/selector/extend/simple/universal.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn and_class() { assert_eq!( - runner().ok("a {b: selector-extend(\"*\", \".c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"*\", \".c\", \"d\")}\n"), "a {\ \n b: *;\ \n}\n" @@ -17,7 +18,8 @@ fn and_class() { #[test] fn and_type() { assert_eq!( - runner().ok("a {b: selector-extend(\"*\", \"c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"*\", \"c\", \"d\")}\n"), "a {\ \n b: *;\ \n}\n" @@ -26,7 +28,8 @@ fn and_type() { #[test] fn equal() { assert_eq!( - runner().ok("a {b: selector-extend(\"*\", \"*\", \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"*\", \"*\", \"c\")}\n"), "a {\ \n b: *;\ \n}\n" @@ -43,8 +46,8 @@ mod namespace { #[test] fn and_class() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"|*\", \".c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"|*\", \".c\", \"d\")}\n"), "a {\ \n b: |*;\ \n}\n" @@ -57,9 +60,8 @@ mod namespace { #[test] fn empty() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"|*\", \"|d\", \"e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"|*\", \"|d\", \"e\")}\n"), "a {\ \n b: |*;\ \n}\n" @@ -68,9 +70,8 @@ mod namespace { #[test] fn explicit() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"|*\", \"c|d\", \"e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"|*\", \"c|d\", \"e\")}\n"), "a {\ \n b: |*;\ \n}\n" @@ -79,8 +80,8 @@ mod namespace { #[test] fn implicit() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"|*\", \"d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"|*\", \"d\", \"e\")}\n"), "a {\ \n b: |*;\ \n}\n" @@ -94,9 +95,8 @@ mod namespace { #[test] fn empty() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"|*\", \"|*\", \"c\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"|*\", \"|*\", \"c\")}\n"), "a {\ \n b: |*, c;\ \n}\n" @@ -105,9 +105,8 @@ mod namespace { #[test] fn explicit() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"|*\", \"c|*\", \"d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"|*\", \"c|*\", \"d\")}\n"), "a {\ \n b: |*;\ \n}\n" @@ -116,8 +115,8 @@ mod namespace { #[test] fn implicit() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"|*\", \"*\", \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"|*\", \"*\", \"c\")}\n"), "a {\ \n b: |*;\ \n}\n" @@ -126,9 +125,8 @@ mod namespace { #[test] fn universal() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"|*\", \"*|*\", \"c\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"|*\", \"*|*\", \"c\")}\n"), "a {\ \n b: |*;\ \n}\n" @@ -143,8 +141,8 @@ mod namespace { #[test] fn and_class() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"c|*\", \".d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|*\", \".d\", \"e\")}\n"), "a {\ \n b: c|*;\ \n}\n" @@ -157,9 +155,8 @@ mod namespace { #[test] fn empty() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c|*\", \"|d\", \"e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|*\", \"|d\", \"e\")}\n"), "a {\ \n b: c|*;\ \n}\n" @@ -172,32 +169,29 @@ mod namespace { #[test] fn equal() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c|*\", \"c|d\", \"e\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|*\", \"c|d\", \"e\")}\n"), + "a {\ \n b: c|*;\ \n}\n" - ); + ); } #[test] fn unequal() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c|*\", \"e|d\", \"e\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|*\", \"e|d\", \"e\")}\n"), + "a {\ \n b: c|*;\ \n}\n" - ); + ); } } #[test] fn implicit() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c|*\", \"d\", \"e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|*\", \"d\", \"e\")}\n"), "a {\ \n b: c|*;\ \n}\n" @@ -211,9 +205,8 @@ mod namespace { #[test] fn empty() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c|*\", \"|*\", \"e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|*\", \"|*\", \"e\")}\n"), "a {\ \n b: c|*;\ \n}\n" @@ -226,32 +219,29 @@ mod namespace { #[test] fn equal() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c|*\", \"c|*\", \"e\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|*\", \"c|*\", \"e\")}\n"), + "a {\ \n b: c|*, e;\ \n}\n" - ); + ); } #[test] fn unequal() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c|*\", \"d|*\", \"e\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|*\", \"d|*\", \"e\")}\n"), + "a {\ \n b: c|*;\ \n}\n" - ); + ); } } #[test] fn implicit() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c|*\", \"*\", \"e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|*\", \"*\", \"e\")}\n"), "a {\ \n b: c|*;\ \n}\n" @@ -260,9 +250,8 @@ mod namespace { #[test] fn universal() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"c|*\", \"*|*\", \"e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"c|*\", \"*|*\", \"e\")}\n"), "a {\ \n b: c|*;\ \n}\n" @@ -277,8 +266,8 @@ mod namespace { #[test] fn and_class() { assert_eq!( - runner() - .ok("a {b: selector-extend(\"*|*\", \".c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"*|*\", \".c\", \"d\")}\n"), "a {\ \n b: *|*;\ \n}\n" @@ -291,9 +280,8 @@ mod namespace { #[test] fn empty() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"*|*\", \"|c\", \"d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"*|*\", \"|c\", \"d\")}\n"), "a {\ \n b: *|*;\ \n}\n" @@ -302,9 +290,8 @@ mod namespace { #[test] fn explicit() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"*|*\", \"c|d\", \"e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"*|*\", \"c|d\", \"e\")}\n"), "a {\ \n b: *|*;\ \n}\n" @@ -313,9 +300,8 @@ mod namespace { #[test] fn implicit() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"*|*\", \"c\", \"d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"*|*\", \"c\", \"d\")}\n"), "a {\ \n b: *|*;\ \n}\n" @@ -329,9 +315,8 @@ mod namespace { #[test] fn empty() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"*|*\", \"|*\", \"c\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"*|*\", \"|*\", \"c\")}\n"), "a {\ \n b: *|*;\ \n}\n" @@ -340,9 +325,8 @@ mod namespace { #[test] fn explicit() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"*|*\", \"c|*\", \"d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"*|*\", \"c|*\", \"d\")}\n"), "a {\ \n b: *|*;\ \n}\n" @@ -351,9 +335,8 @@ mod namespace { #[test] fn implicit() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"*|*\", \"*\", \"c\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"*|*\", \"*\", \"c\")}\n"), "a {\ \n b: *|*;\ \n}\n" @@ -362,9 +345,8 @@ mod namespace { #[test] fn universal() { assert_eq!( - runner().ok( - "a {b: selector-extend(\"*|*\", \"*|*\", \"c\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.extend(\"*|*\", \"*|*\", \"c\")}\n"), "a {\ \n b: *|*;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/complex/adjacent_sibling.rs b/rsass/tests/spec/core_functions/selector/is_superselector/complex/adjacent_sibling.rs index cd1208392..bdde7b749 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/complex/adjacent_sibling.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/complex/adjacent_sibling.rs @@ -17,7 +17,8 @@ mod multiple { fn child() { assert_eq!( runner().ok( - "a {b: is-superselector(\"a + b + c\", \"a + x > b + c\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"a + b + c\", \"a + x > b + c\")}\n" ), "a {\ \n b: false;\ @@ -28,7 +29,8 @@ mod multiple { fn descendant() { assert_eq!( runner().ok( - "a {b: is-superselector(\"a + b + c\", \"a + x b + c\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"a + b + c\", \"a + x b + c\")}\n" ), "a {\ \n b: false;\ @@ -39,7 +41,8 @@ mod multiple { fn following_sibling() { assert_eq!( runner().ok( - "a {b: is-superselector(\"a + b + c\", \"a + x ~ b + c\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"a + b + c\", \"a + x ~ b + c\")}\n" ), "a {\ \n b: false;\ @@ -50,7 +53,8 @@ mod multiple { fn next_sibling() { assert_eq!( runner().ok( - "a {b: is-superselector(\"a + b + c\", \"a + x + b + c\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"a + b + c\", \"a + x + b + c\")}\n" ), "a {\ \n b: false;\ @@ -61,8 +65,8 @@ mod multiple { #[test] fn first() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"d + c\", \"d + e + c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"d + c\", \"d + e + c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -71,7 +75,8 @@ mod multiple { #[test] fn in_sub() { assert_eq!( - runner().ok("a {b: is-superselector(\"c\", \"d + e + c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"d + e + c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -80,8 +85,8 @@ mod multiple { #[test] fn neither() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"f + c\", \"d + e + c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"f + c\", \"d + e + c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -90,8 +95,8 @@ mod multiple { #[test] fn second() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"e + c\", \"d + e + c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"e + c\", \"d + e + c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -109,8 +114,8 @@ mod single { #[test] fn equal() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"c + d\", \"c + d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c + d\", \"c + d\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -119,9 +124,8 @@ mod single { #[test] fn subset() { assert_eq!( - runner().ok( - "a {b: is-superselector(\"c + d\", \"c.e + d.f\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c + d\", \"c.e + d.f\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -130,9 +134,8 @@ mod single { #[test] fn superset() { assert_eq!( - runner().ok( - "a {b: is-superselector(\"c.e + d.f\", \"c + d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c.e + d.f\", \"c + d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -142,7 +145,8 @@ mod single { #[test] fn in_sub() { assert_eq!( - runner().ok("a {b: is-superselector(\"c\", \"d + c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"d + c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -151,7 +155,8 @@ mod single { #[test] fn in_super() { assert_eq!( - runner().ok("a {b: is-superselector(\"c + d\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c + d\", \"d\")}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/complex/bogus.rs b/rsass/tests/spec/core_functions/selector/is_superselector/complex/bogus.rs index 8cacdaad5..99591d091 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/complex/bogus.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/complex/bogus.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn sub() { assert_eq!( - runner().ok("a {b: is-superselector(\"c\", \"d + ~ c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"d + ~ c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -18,7 +19,8 @@ fn sub() { #[test] fn test_super() { assert_eq!( - runner().ok("a {b: is-superselector(\"> c\", \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"> c\", \"c\")}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/complex/child.rs b/rsass/tests/spec/core_functions/selector/is_superselector/complex/child.rs index 59089f450..fb41a2cef 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/complex/child.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/complex/child.rs @@ -17,7 +17,8 @@ mod multiple { fn child() { assert_eq!( runner().ok( - "a {b: is-superselector(\"a > b > c\", \"a > x > b > c\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"a > b > c\", \"a > x > b > c\")}\n" ), "a {\ \n b: false;\ @@ -28,7 +29,8 @@ mod multiple { fn descendant() { assert_eq!( runner().ok( - "a {b: is-superselector(\"a > b > c\", \"a > x b > c\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"a > b > c\", \"a > x b > c\")}\n" ), "a {\ \n b: false;\ @@ -39,7 +41,8 @@ mod multiple { fn following_sibling() { assert_eq!( runner().ok( - "a {b: is-superselector(\"a > b > c\", \"a > x ~ b > c\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"a > b > c\", \"a > x ~ b > c\")}\n" ), "a {\ \n b: false;\ @@ -50,7 +53,8 @@ mod multiple { fn next_sibling() { assert_eq!( runner().ok( - "a {b: is-superselector(\"a > b > c\", \"a > x + b > c\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"a > b > c\", \"a > x + b > c\")}\n" ), "a {\ \n b: false;\ @@ -61,8 +65,8 @@ mod multiple { #[test] fn first() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"d > c\", \"d > e > c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"d > c\", \"d > e > c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -71,7 +75,8 @@ mod multiple { #[test] fn in_sub() { assert_eq!( - runner().ok("a {b: is-superselector(\"c\", \"d > e > c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"d > e > c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -80,8 +85,8 @@ mod multiple { #[test] fn neither() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"f > c\", \"d > e > c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"f > c\", \"d > e > c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -90,8 +95,8 @@ mod multiple { #[test] fn second() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"e > c\", \"d > e > c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"e > c\", \"d > e > c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -109,8 +114,8 @@ mod single { #[test] fn equal() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"c > d\", \"c > d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c > d\", \"c > d\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -119,9 +124,8 @@ mod single { #[test] fn subset() { assert_eq!( - runner().ok( - "a {b: is-superselector(\"c > d\", \"c.e > d.f\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c > d\", \"c.e > d.f\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -130,9 +134,8 @@ mod single { #[test] fn superset() { assert_eq!( - runner().ok( - "a {b: is-superselector(\"c.e > d.f\", \"c > d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c.e > d.f\", \"c > d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -142,7 +145,8 @@ mod single { #[test] fn in_sub() { assert_eq!( - runner().ok("a {b: is-superselector(\"c\", \"d > c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"d > c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -151,7 +155,8 @@ mod single { #[test] fn in_super() { assert_eq!( - runner().ok("a {b: is-superselector(\"c > d\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c > d\", \"d\")}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/complex/descendant.rs b/rsass/tests/spec/core_functions/selector/is_superselector/complex/descendant.rs index c1536683e..4f5e2c3e5 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/complex/descendant.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/complex/descendant.rs @@ -16,8 +16,8 @@ mod and_child { #[test] fn first() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"d c\", \"d > e > c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"d c\", \"d > e > c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -26,8 +26,8 @@ mod and_child { #[test] fn neither() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"f c\", \"d > e > c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"f c\", \"d > e > c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -36,8 +36,8 @@ mod and_child { #[test] fn second() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"e c\", \"d > e > c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"e c\", \"d > e > c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -47,7 +47,8 @@ mod and_child { #[test] fn sub() { assert_eq!( - runner().ok("a {b: is-superselector(\"d > c\", \"d c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"d > c\", \"d c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -56,7 +57,8 @@ mod and_child { #[test] fn test_super() { assert_eq!( - runner().ok("a {b: is-superselector(\"d c\", \"d > c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"d c\", \"d > c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -74,9 +76,8 @@ mod multiple { #[test] fn child() { assert_eq!( - runner().ok( - "a {b: is-superselector(\"a b c\", \"a x > b c\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"a b c\", \"a x > b c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -85,8 +86,8 @@ mod multiple { #[test] fn descendant() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"a b c\", \"a x b c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"a b c\", \"a x b c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -95,9 +96,8 @@ mod multiple { #[test] fn following_sibling() { assert_eq!( - runner().ok( - "a {b: is-superselector(\"a b c\", \"a x ~ b c\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"a b c\", \"a x ~ b c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -106,9 +106,8 @@ mod multiple { #[test] fn next_sibling() { assert_eq!( - runner().ok( - "a {b: is-superselector(\"a b c\", \"a x + b c\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"a b c\", \"a x + b c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -118,7 +117,8 @@ mod multiple { #[test] fn in_sub() { assert_eq!( - runner().ok("a {b: is-superselector(\"c\", \"d e c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"d e c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -127,7 +127,8 @@ mod multiple { #[test] fn match_first() { assert_eq!( - runner().ok("a {b: is-superselector(\"d c\", \"d e c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"d c\", \"d e c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -136,7 +137,8 @@ mod multiple { #[test] fn match_neither() { assert_eq!( - runner().ok("a {b: is-superselector(\"f c\", \"d e c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"f c\", \"d e c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -145,7 +147,8 @@ mod multiple { #[test] fn match_second() { assert_eq!( - runner().ok("a {b: is-superselector(\"e c\", \"d e c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"e c\", \"d e c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -163,7 +166,8 @@ mod single { #[test] fn equal() { assert_eq!( - runner().ok("a {b: is-superselector(\"c d\", \"c d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c d\", \"c d\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -172,8 +176,8 @@ mod single { #[test] fn subset() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"c d\", \"c.e d.f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c d\", \"c.e d.f\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -182,8 +186,8 @@ mod single { #[test] fn superset() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"c.e d.f\", \"c d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c.e d.f\", \"c d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -193,7 +197,8 @@ mod single { #[test] fn in_sub() { assert_eq!( - runner().ok("a {b: is-superselector(\"c\", \"d c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"d c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -202,7 +207,8 @@ mod single { #[test] fn in_super() { assert_eq!( - runner().ok("a {b: is-superselector(\"c d\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c d\", \"d\")}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/complex/sibling.rs b/rsass/tests/spec/core_functions/selector/is_superselector/complex/sibling.rs index b1b4c201c..054a77892 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/complex/sibling.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/complex/sibling.rs @@ -16,9 +16,8 @@ mod and_adjacent_sibling { #[test] fn first() { assert_eq!( - runner().ok( - "a {b: is-superselector(\"d ~ c\", \"d + e + c\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"d ~ c\", \"d + e + c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -27,9 +26,8 @@ mod and_adjacent_sibling { #[test] fn neither() { assert_eq!( - runner().ok( - "a {b: is-superselector(\"f ~ c\", \"d + e + c\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"f ~ c\", \"d + e + c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -38,9 +36,8 @@ mod and_adjacent_sibling { #[test] fn second() { assert_eq!( - runner().ok( - "a {b: is-superselector(\"e ~ c\", \"d + e + c\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"e ~ c\", \"d + e + c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -50,7 +47,8 @@ mod and_adjacent_sibling { #[test] fn sub() { assert_eq!( - runner().ok("a {b: is-superselector(\"d + c\", \"d ~ c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"d + c\", \"d ~ c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -59,7 +57,8 @@ mod and_adjacent_sibling { #[test] fn test_super() { assert_eq!( - runner().ok("a {b: is-superselector(\"d ~ c\", \"d + c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"d ~ c\", \"d + c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -78,7 +77,8 @@ mod multiple { fn child() { assert_eq!( runner().ok( - "a {b: is-superselector(\"a ~ b ~ c\", \"a ~ x > b ~ c\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"a ~ b ~ c\", \"a ~ x > b ~ c\")}\n" ), "a {\ \n b: false;\ @@ -89,7 +89,8 @@ mod multiple { fn descendant() { assert_eq!( runner().ok( - "a {b: is-superselector(\"a ~ b ~ c\", \"a ~ x b ~ c\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"a ~ b ~ c\", \"a ~ x b ~ c\")}\n" ), "a {\ \n b: false;\ @@ -100,7 +101,8 @@ mod multiple { fn following_sibling() { assert_eq!( runner().ok( - "a {b: is-superselector(\"a ~ b ~ c\", \"a ~ x ~ b ~ c\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"a ~ b ~ c\", \"a ~ x ~ b ~ c\")}\n" ), "a {\ \n b: true;\ @@ -111,7 +113,8 @@ mod multiple { fn next_sibling() { assert_eq!( runner().ok( - "a {b: is-superselector(\"a ~ b ~ c\", \"a ~ x + b ~ c\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"a ~ b ~ c\", \"a ~ x + b ~ c\")}\n" ), "a {\ \n b: true;\ @@ -122,8 +125,8 @@ mod multiple { #[test] fn first() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"d ~ c\", \"d ~ e ~ c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"d ~ c\", \"d ~ e ~ c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -132,7 +135,8 @@ mod multiple { #[test] fn in_sub() { assert_eq!( - runner().ok("a {b: is-superselector(\"c\", \"d ~ e ~ c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"d ~ e ~ c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -141,8 +145,8 @@ mod multiple { #[test] fn neither() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"f ~ c\", \"d ~ e ~ c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"f ~ c\", \"d ~ e ~ c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -151,8 +155,8 @@ mod multiple { #[test] fn second() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"e ~ c\", \"d ~ e ~ c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"e ~ c\", \"d ~ e ~ c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -170,8 +174,8 @@ mod single { #[test] fn equal() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"c ~ d\", \"c ~ d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c ~ d\", \"c ~ d\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -180,9 +184,8 @@ mod single { #[test] fn subset() { assert_eq!( - runner().ok( - "a {b: is-superselector(\"c ~ d\", \"c.e ~ d.f\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c ~ d\", \"c.e ~ d.f\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -191,9 +194,8 @@ mod single { #[test] fn superset() { assert_eq!( - runner().ok( - "a {b: is-superselector(\"c.e ~ d.f\", \"c ~ d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c.e ~ d.f\", \"c ~ d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -203,7 +205,8 @@ mod single { #[test] fn in_sub() { assert_eq!( - runner().ok("a {b: is-superselector(\"c\", \"d ~ c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"d ~ c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -212,7 +215,8 @@ mod single { #[test] fn in_super() { assert_eq!( - runner().ok("a {b: is-superselector(\"c ~ d\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c ~ d\", \"d\")}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/compound.rs b/rsass/tests/spec/core_functions/selector/is_superselector/compound.rs index fe6702c86..d0c0e00d4 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/compound.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/compound.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn different_order() { assert_eq!( - runner().ok("a {b: is-superselector(\"c.e\", \"c:d.e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c.e\", \"c:d.e\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -25,7 +26,8 @@ mod pseudo_element { #[test] fn in_1() { assert_eq!( - runner().ok("a {b: is-superselector(\"c\", \"c::d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"c::d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -34,7 +36,8 @@ mod pseudo_element { #[test] fn in_2() { assert_eq!( - runner().ok("a {b: is-superselector(\"c::d\", \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c::d\", \"c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -48,7 +51,8 @@ mod pseudo_element { #[test] fn after() { assert_eq!( - runner().ok("a {b: is-superselector(\"c\", \"c:after\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"c:after\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -57,7 +61,8 @@ mod pseudo_element { #[test] fn before() { assert_eq!( - runner().ok("a {b: is-superselector(\"c\", \"c:before\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"c:before\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -67,7 +72,8 @@ mod pseudo_element { fn first_letter() { assert_eq!( runner().ok( - "a {b: is-superselector(\"c\", \"c:first-letter\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"c:first-letter\")}\n" ), "a {\ \n b: false;\ @@ -77,8 +83,8 @@ mod pseudo_element { #[test] fn first_line() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"c\", \"c:first-line\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"c:first-line\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -89,7 +95,8 @@ mod pseudo_element { #[ignore] // wrong result fn different_order() { assert_eq!( - runner().ok("a {b: is-superselector(\":e::d\", \"::d:e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":e::d\", \"::d:e\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -98,7 +105,8 @@ mod pseudo_element { #[test] fn present() { assert_eq!( - runner().ok("a {b: is-superselector(\"::d\", \"c::d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"::d\", \"c::d\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -107,7 +115,8 @@ mod pseudo_element { #[test] fn same_order() { assert_eq!( - runner().ok("a {b: is-superselector(\"::d:e\", \"::d:e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"::d:e\", \"::d:e\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -120,8 +129,8 @@ mod pseudo_element { #[test] fn after() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"::d:c\", \"::d:c:e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"::d:c\", \"::d:c:e\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -130,8 +139,8 @@ mod pseudo_element { #[test] fn before() { assert_eq!( - runner() - .ok("a {b: is-superselector(\".c::d\", \".c.e::d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\".c::d\", \".c.e::d\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -145,8 +154,8 @@ mod pseudo_element { #[test] fn after() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"::d:c:e\", \"::d:c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"::d:c:e\", \"::d:c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -155,8 +164,8 @@ mod pseudo_element { #[test] fn before() { assert_eq!( - runner() - .ok("a {b: is-superselector(\".c.e::d\", \".c::d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\".c.e::d\", \".c::d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -167,7 +176,8 @@ mod pseudo_element { #[test] fn same_order() { assert_eq!( - runner().ok("a {b: is-superselector(\"c\", \"c.d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"c.d\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -176,7 +186,8 @@ fn same_order() { #[test] fn superset() { assert_eq!( - runner().ok("a {b: is-superselector(\"c.d\", \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c.d\", \"c\")}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/error.rs b/rsass/tests/spec/core_functions/selector/is_superselector/error.rs index 299d78752..082f5088d 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/error.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/error.rs @@ -12,7 +12,10 @@ mod sub { #[test] fn invalid() { assert_eq!( - runner().err("a {b: is-superselector(\"c\", \"[d\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"[d\")}\n" + ), "Error: $sub: expected more input.\ \n ,\ \n1 | [d\ @@ -20,16 +23,19 @@ mod sub { \n \'\ \n - 1:3 root stylesheet\ \n ,\ - \n1 | a {b: is-superselector(\"c\", \"[d\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: selector.is-superselector(\"c\", \"[d\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn parent() { assert_eq!( - runner().err("a {b: is-superselector(\"c\", \"&\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"&\")}\n" + ), "Error: $sub: Parent selectors aren\'t allowed here.\ \n ,\ \n1 | &\ @@ -37,23 +43,26 @@ mod sub { \n \'\ \n - 1:1 root stylesheet\ \n ,\ - \n1 | a {b: is-superselector(\"c\", \"&\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: selector.is-superselector(\"c\", \"&\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: is-superselector(\"c\", 1)}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", 1)}\n" + ), "Error: $sub: 1 is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | a {b: is-superselector(\"c\", 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: selector.is-superselector(\"c\", 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -64,7 +73,10 @@ mod test_super { #[test] fn invalid() { assert_eq!( - runner().err("a {b: is-superselector(\"[c\", \"d\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"[c\", \"d\")}\n" + ), "Error: $super: expected more input.\ \n ,\ \n1 | [c\ @@ -72,16 +84,19 @@ mod test_super { \n \'\ \n - 1:3 root stylesheet\ \n ,\ - \n1 | a {b: is-superselector(\"[c\", \"d\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: selector.is-superselector(\"[c\", \"d\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn parent() { assert_eq!( - runner().err("a {b: is-superselector(\"&\", \"c\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"&\", \"c\")}\n" + ), "Error: $super: Parent selectors aren\'t allowed here.\ \n ,\ \n1 | &\ @@ -89,55 +104,64 @@ mod test_super { \n \'\ \n - 1:1 root stylesheet\ \n ,\ - \n1 | a {b: is-superselector(\"&\", \"c\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: selector.is-superselector(\"&\", \"c\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: is-superselector(1, \"c\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(1, \"c\")}\n" + ), "Error: $super: 1 is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | a {b: is-superselector(1, \"c\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: selector.is-superselector(1, \"c\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: is-superselector(\"c\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\")}\n" + ), "Error: Missing argument $sub.\ \n ,--> input.scss\ - \n1 | a {b: is-superselector(\"c\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: selector.is-superselector(\"c\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:selector\ \n1 | @function is-superselector($super, $sub) {\ \n | ============================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: is-superselector(\"c\", \"d\", \"e\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"d\", \"e\")}\n" + ), "Error: Only 2 arguments allowed, but 3 were passed.\ \n ,--> input.scss\ - \n1 | a {b: is-superselector(\"c\", \"d\", \"e\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: selector.is-superselector(\"c\", \"d\", \"e\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:selector\ \n1 | @function is-superselector($super, $sub) {\ \n | ============================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/input.rs b/rsass/tests/spec/core_functions/selector/is_superselector/input.rs index 7cc9cc5d0..9b72bf27b 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/input.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/input.rs @@ -9,9 +9,10 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "// The full set of possible input formats is tested with `selector-parse()`;\ + "@use \"sass:selector\";\ + \n// The full set of possible input formats is tested with `selector-parse()`;\ \n// this spec just verifies one example for `is-superselector()`.\ - \na {b: is-superselector((c, d e), (c, d e))}\n" + \na {b: selector.is-superselector((c, d e), (c, d e))}\n" ), "a {\ \n b: true;\ diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/list.rs b/rsass/tests/spec/core_functions/selector/is_superselector/list.rs index 32ce71143..6b871ad2a 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/list.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/list.rs @@ -12,7 +12,8 @@ mod three { #[test] fn match_one() { assert_eq!( - runner().ok("a {b: is-superselector(\"c, d, e\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c, d, e\", \"d\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -21,8 +22,8 @@ mod three { #[test] fn match_three() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"c, d, e\", \"d, c, e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c, d, e\", \"d, c, e\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -31,7 +32,8 @@ mod three { #[test] fn match_two() { assert_eq!( - runner().ok("a {b: is-superselector(\"c, d, e\", \"e, c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c, d, e\", \"e, c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -40,7 +42,8 @@ mod three { #[test] fn miss_one() { assert_eq!( - runner().ok("a {b: is-superselector(\"c, d, e\", \"c, f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c, d, e\", \"c, f\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -54,7 +57,8 @@ mod two { #[test] fn both_satisfied_by_one_superselector() { assert_eq!( - runner().ok("a {b: is-superselector(\".c\", \"d.c, e.c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\".c\", \"d.c, e.c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -67,7 +71,8 @@ mod two { #[test] fn equal() { assert_eq!( - runner().ok("a {b: is-superselector(\"c, d\", \"c, d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c, d\", \"c, d\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -76,8 +81,8 @@ mod two { #[test] fn subset() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"c, d\", \"c.e, d.f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c, d\", \"c.e, d.f\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -86,8 +91,8 @@ mod two { #[test] fn superset() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"c.e, d.f\", \"c, d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c.e, d.f\", \"c, d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -97,7 +102,8 @@ mod two { #[test] fn in_sub() { assert_eq!( - runner().ok("a {b: is-superselector(\"c\", \"c, d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"c, d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -106,7 +112,8 @@ mod two { #[test] fn in_super() { assert_eq!( - runner().ok("a {b: is-superselector(\"c, d\", \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c, d\", \"c\")}\n"), "a {\ \n b: true;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/named.rs b/rsass/tests/spec/core_functions/selector/is_superselector/named.rs index 6f4b15f3d..7dde76c4c 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/named.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/named.rs @@ -8,8 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner() - .ok("a {b: is-superselector($super: \"c\", $sub: \"c.d\")}\n"), + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector($super: \"c\", $sub: \"c.d\")}\n" + ), "a {\ \n b: true;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/attribute.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/attribute.rs index d96ea7b1c..95c303563 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/attribute.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/attribute.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn equal() { assert_eq!( - runner().ok("a {b: is-superselector(\"[c=d]\", \"[c=d]\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"[c=d]\", \"[c=d]\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -21,7 +22,8 @@ mod unequal { #[test] fn name() { assert_eq!( - runner().ok("a {b: is-superselector(\"[c=d]\", \"[e=d]\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"[c=d]\", \"[e=d]\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -30,7 +32,8 @@ mod unequal { #[test] fn operator() { assert_eq!( - runner().ok("a {b: is-superselector(\"[c=d]\", \"[c^=d]\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"[c=d]\", \"[c^=d]\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -39,7 +42,8 @@ mod unequal { #[test] fn value() { assert_eq!( - runner().ok("a {b: is-superselector(\"[c=d]\", \"[c=e]\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"[c=d]\", \"[c=e]\")}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/class.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/class.rs index 33028b241..b61b3dadd 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/class.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/class.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn equal() { assert_eq!( - runner().ok("a {b: is-superselector(\".c\", \".c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\".c\", \".c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -17,7 +18,8 @@ fn equal() { #[test] fn unequal() { assert_eq!( - runner().ok("a {b: is-superselector(\".c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\".c\", \".d\")}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/id.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/id.rs index 4f9070210..21b4be18a 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/id.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/id.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn equal() { assert_eq!( - runner().ok("a {b: is-superselector(\"#c\", \"#c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"#c\", \"#c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -17,7 +18,8 @@ fn equal() { #[test] fn unequal() { assert_eq!( - runner().ok("a {b: is-superselector(\"#c\", \"#d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"#c\", \"#d\")}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/placeholder.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/placeholder.rs index 412025ea7..7c123b460 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/placeholder.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/placeholder.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn equal() { assert_eq!( - runner().ok("a {b: is-superselector(\"%c\", \"%c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"%c\", \"%c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -17,7 +18,8 @@ fn equal() { #[test] fn unequal() { assert_eq!( - runner().ok("a {b: is-superselector(\"%c\", \"%d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"%c\", \"%d\")}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/arg.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/arg.rs index bff2dceb2..2d86a4fef 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/arg.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/arg.rs @@ -12,8 +12,8 @@ mod class { #[test] fn equal() { assert_eq!( - runner() - .ok("a {b: is-superselector(\":c(@#$)\", \":c(@#$)\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":c(@#$)\", \":c(@#$)\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -26,9 +26,8 @@ mod class { #[test] fn argument() { assert_eq!( - runner().ok( - "a {b: is-superselector(\":c(@#$)\", \":c(*&^)\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":c(@#$)\", \":c(*&^)\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -37,7 +36,8 @@ mod class { #[test] fn has_argument() { assert_eq!( - runner().ok("a {b: is-superselector(\":c(@#$)\", \":c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":c(@#$)\", \":c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -46,9 +46,8 @@ mod class { #[test] fn name() { assert_eq!( - runner().ok( - "a {b: is-superselector(\":c(@#$)\", \":d(@#$)\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":c(@#$)\", \":d(@#$)\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -63,12 +62,14 @@ mod element { #[test] fn equal() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"::c(@#$)\", \"::c(@#$)\")}\n"), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"::c(@#$)\", \"::c(@#$)\")}\n" + ), + "a {\ \n b: true;\ \n}\n" - ); + ); } mod unequal { #[allow(unused)] @@ -77,19 +78,20 @@ mod element { #[test] fn argument() { assert_eq!( - runner().ok( - "a {b: is-superselector(\"::c(@#$)\", \"::c(*&^)\")}\n" - ), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"::c(@#$)\", \"::c(*&^)\")}\n" + ), + "a {\ \n b: false;\ \n}\n" - ); + ); } #[test] fn has_argument() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"::c(@#$)\", \"::c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"::c(@#$)\", \"::c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -99,7 +101,8 @@ mod element { fn name() { assert_eq!( runner().ok( - "a {b: is-superselector(\"::c(@#$)\", \":d(@#$)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"::c(@#$)\", \":d(@#$)\")}\n" ), "a {\ \n b: false;\ diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/no_arg.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/no_arg.rs index e127f17ea..a5c1dc40c 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/no_arg.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/no_arg.rs @@ -12,7 +12,8 @@ mod class { #[test] fn and_element() { assert_eq!( - runner().ok("a {b: is-superselector(\":c\", \"::c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":c\", \"::c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -21,7 +22,8 @@ mod class { #[test] fn equal() { assert_eq!( - runner().ok("a {b: is-superselector(\":c\", \":c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":c\", \":c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -30,7 +32,8 @@ mod class { #[test] fn unequal() { assert_eq!( - runner().ok("a {b: is-superselector(\":c\", \":d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":c\", \":d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -44,7 +47,8 @@ mod element { #[test] fn and_class() { assert_eq!( - runner().ok("a {b: is-superselector(\"::c\", \":c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"::c\", \":c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -53,7 +57,8 @@ mod element { #[test] fn equal() { assert_eq!( - runner().ok("a {b: is-superselector(\"::c\", \"::c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"::c\", \"::c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -62,7 +67,8 @@ mod element { #[test] fn unequal() { assert_eq!( - runner().ok("a {b: is-superselector(\"::c\", \"::d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"::c\", \"::d\")}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/any.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/any.rs index 3229c403b..4dd6f4110 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/any.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/any.rs @@ -13,7 +13,8 @@ mod prefix { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":-pfx-any(c d.i, e j f)\", \"c d, e f, g h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":-pfx-any(c d.i, e j f)\", \"c d, e f, g h\")}\n" ), "a {\ \n b: false;\ @@ -25,7 +26,8 @@ mod prefix { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":-pfx-any(c d, e f, g h)\", \"c d.i, e j f\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":-pfx-any(c d, e f, g h)\", \"c d.i, e j f\")}\n" ), "a {\ \n b: true;\ @@ -37,7 +39,8 @@ mod prefix { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":any(c d.i, e j f)\", \"c d, e f, g h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":any(c d.i, e j f)\", \"c d, e f, g h\")}\n" ), "a {\ \n b: false;\ @@ -49,7 +52,8 @@ fn subset() { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":any(c d, e f, g h)\", \"c d.i, e j f\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":any(c d, e f, g h)\", \"c d.i, e j f\")}\n" ), "a {\ \n b: true;\ diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/current.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/current.rs index 7dd65ce68..ffac6bc5e 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/current.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/current.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn bare_sub() { assert_eq!( runner().ok( - "a {b: is-superselector(\":current(c d, e f)\", \"c d, e f\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":current(c d, e f)\", \"c d, e f\")}\n" ), "a {\ \n b: false;\ @@ -20,7 +21,8 @@ fn bare_sub() { fn equal() { assert_eq!( runner().ok( - "a {b: is-superselector(\":current(c d, e f)\", \":current(c d, e f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":current(c d, e f)\", \":current(c d, e f)\")}\n" ), "a {\ \n b: true;\ @@ -35,7 +37,8 @@ mod prefix { fn equal() { assert_eq!( runner().ok( - "a {b: is-superselector(\":-pfx-current(c d, e f)\", \":-pfx-current(c d, e f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":-pfx-current(c d, e f)\", \":-pfx-current(c d, e f)\")}\n" ), "a {\ \n b: true;\ @@ -45,8 +48,9 @@ mod prefix { #[test] fn subset() { assert_eq!( - runner().ok("a {\ - \n b: is-superselector(\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.is-superselector(\ \n \":-pfx-current(c d.i, e j f)\",\ \n \":-pfx-current(c d, e f, g h)\");\ \n}\n"), @@ -58,8 +62,9 @@ mod prefix { #[test] fn superset() { assert_eq!( - runner().ok("a {\ - \n b: is-superselector(\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.is-superselector(\ \n \":-pfx-current(c d, e f, g h)\",\ \n \":-pfx-current(c d.i, e j f)\");\ \n}\n"), @@ -73,7 +78,8 @@ mod prefix { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":current(c d.i, e j f)\", \":current(c d, e f, g h)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":current(c d.i, e j f)\", \":current(c d, e f, g h)\")}\n" ), "a {\ \n b: false;\ @@ -84,7 +90,8 @@ fn subset() { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":current(c d, e f, g h)\", \":current(c d.i, e j f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":current(c d, e f, g h)\", \":current(c d.i, e j f)\")}\n" ), "a {\ \n b: false;\ diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/has.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/has.rs index 4933c9239..2fa2b446e 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/has.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/has.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn bare_sub() { assert_eq!( runner().ok( - "a {b: is-superselector(\":has(c d, e f, g h)\", \"c d, e f, g h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":has(c d, e f, g h)\", \"c d, e f, g h\")}\n" ), "a {\ \n b: false;\ @@ -24,7 +25,8 @@ mod prefix { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":-pfx-has(c d.i, e j f)\", \":-pfx-has(c d, e f, g h)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":-pfx-has(c d.i, e j f)\", \":-pfx-has(c d, e f, g h)\")}\n" ), "a {\ \n b: false;\ @@ -35,7 +37,8 @@ mod prefix { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":-pfx-has(c d, e f, g h)\", \":-pfx-has(c d.i, e j f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":-pfx-has(c d, e f, g h)\", \":-pfx-has(c d.i, e j f)\")}\n" ), "a {\ \n b: true;\ @@ -47,7 +50,8 @@ mod prefix { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":has(c d.i, e j f)\", \":has(c d, e f, g h)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":has(c d.i, e j f)\", \":has(c d, e f, g h)\")}\n" ), "a {\ \n b: false;\ @@ -58,7 +62,8 @@ fn subset() { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":has(c d, e f, g h)\", \":has(c d.i, e j f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":has(c d, e f, g h)\", \":has(c d.i, e j f)\")}\n" ), "a {\ \n b: true;\ diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/host.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/host.rs index 094141c54..0c415b395 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/host.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/host.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn bare_sub() { assert_eq!( runner().ok( - "a {b: is-superselector(\":host(c d, e f, g h)\", \"c d, e f, g h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":host(c d, e f, g h)\", \"c d, e f, g h\")}\n" ), "a {\ \n b: false;\ @@ -24,7 +25,8 @@ mod prefix { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":-pfx-host(c d.i, e j f)\", \":-pfx-host(c d, e f, g h)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":-pfx-host(c d.i, e j f)\", \":-pfx-host(c d, e f, g h)\")}\n" ), "a {\ \n b: false;\ @@ -35,7 +37,8 @@ mod prefix { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":-pfx-host(c d, e f, g h)\", \":-pfx-host(c d.i, e j f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":-pfx-host(c d, e f, g h)\", \":-pfx-host(c d.i, e j f)\")}\n" ), "a {\ \n b: true;\ @@ -47,7 +50,8 @@ mod prefix { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":host(c d.i, e j f)\", \":host(c d, e f, g h)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":host(c d.i, e j f)\", \":host(c d, e f, g h)\")}\n" ), "a {\ \n b: false;\ @@ -58,7 +62,8 @@ fn subset() { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":host(c d, e f, g h)\", \":host(c d.i, e j f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":host(c d, e f, g h)\", \":host(c d.i, e j f)\")}\n" ), "a {\ \n b: true;\ diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/host_context.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/host_context.rs index c497a1bfc..3a3940f1b 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/host_context.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/host_context.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn bare_sub() { assert_eq!( runner().ok( - "a {b: is-superselector(\":host-context(c d, e f, g h)\", \"c d, e f, g h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":host-context(c d, e f, g h)\", \"c d, e f, g h\")}\n" ), "a {\ \n b: false;\ @@ -24,7 +25,8 @@ mod prefix { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":-pfx-host-context(c d.i, e j f)\", \":-pfx-host-context(c d, e f, g h)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":-pfx-host-context(c d.i, e j f)\", \":-pfx-host-context(c d, e f, g h)\")}\n" ), "a {\ \n b: false;\ @@ -35,7 +37,8 @@ mod prefix { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":-pfx-host-context(c d, e f, g h)\", \":-pfx-host-context(c d.i, e j f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":-pfx-host-context(c d, e f, g h)\", \":-pfx-host-context(c d.i, e j f)\")}\n" ), "a {\ \n b: true;\ @@ -47,7 +50,8 @@ mod prefix { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":host-context(c d.i, e j f)\", \":host-context(c d, e f, g h)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":host-context(c d.i, e j f)\", \":host-context(c d, e f, g h)\")}\n" ), "a {\ \n b: false;\ @@ -58,7 +62,8 @@ fn subset() { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":host-context(c d, e f, g h)\", \":host-context(c d.i, e j f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":host-context(c d, e f, g h)\", \":host-context(c d.i, e j f)\")}\n" ), "a {\ \n b: true;\ diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/is.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/is.rs index 7d984dfba..a69c5d393 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/is.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/is.rs @@ -13,7 +13,8 @@ mod both { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":is(c d.i, e j f)\", \":is(c d, e f, g h)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":is(c d.i, e j f)\", \":is(c d, e f, g h)\")}\n" ), "a {\ \n b: false;\ @@ -24,7 +25,8 @@ mod both { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":is(c d, e f, g h)\", \":is(c d.i, e j f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":is(c d, e f, g h)\", \":is(c d.i, e j f)\")}\n" ), "a {\ \n b: true;\ @@ -39,7 +41,8 @@ mod complex { #[test] fn subset() { assert_eq!( - runner().ok("a {b: is-superselector(\":is(c d e)\", \"c e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":is(c d e)\", \"c e\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -49,7 +52,8 @@ mod complex { #[ignore] // wrong result fn superset() { assert_eq!( - runner().ok("a {b: is-superselector(\":is(c e)\", \"c d e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":is(c e)\", \"c d e\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -63,7 +67,8 @@ mod compound { #[test] fn subset() { assert_eq!( - runner().ok("a {b: is-superselector(\":is(c.d.e)\", \"c e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":is(c.d.e)\", \"c e\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -73,7 +78,8 @@ mod compound { #[ignore] // wrong result fn superset() { assert_eq!( - runner().ok("a {b: is-superselector(\":is(c.e)\", \"c.d.e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":is(c.e)\", \"c.d.e\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -88,7 +94,8 @@ mod list { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":is(c d, e f)\", \"c d, e f, g h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":is(c d, e f)\", \"c d, e f, g h\")}\n" ), "a {\ \n b: false;\ @@ -100,7 +107,8 @@ mod list { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":is(c d, e f, g h)\", \"c d, e f\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":is(c d, e f, g h)\", \"c d, e f\")}\n" ), "a {\ \n b: true;\ @@ -115,19 +123,21 @@ mod not_superselector_of { #[test] fn any() { assert_eq!( - runner().ok( - "a {b: is-superselector(\":is(c, d)\", \":any(c, d)\")}\n" - ), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":is(c, d)\", \":any(c, d)\")}\n" + ), + "a {\ \n b: false;\ \n}\n" - ); + ); } #[test] fn prefixed() { assert_eq!( runner().ok( - "a {b: is-superselector(\":is(c, d)\", \":-pfx-is(c, d)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":is(c, d)\", \":-pfx-is(c, d)\")}\n" ), "a {\ \n b: false;\ @@ -143,7 +153,8 @@ mod prefix { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":-pfx-is(c d.i, e j f)\", \"c d, e f, g h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":-pfx-is(c d.i, e j f)\", \"c d, e f, g h\")}\n" ), "a {\ \n b: false;\ @@ -155,7 +166,8 @@ mod prefix { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":-pfx-is(c d, e f, g h)\", \"c d.i, e j f\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":-pfx-is(c d, e f, g h)\", \"c d.i, e j f\")}\n" ), "a {\ \n b: true;\ @@ -171,7 +183,8 @@ mod simple { #[ignore] // wrong result fn equal() { assert_eq!( - runner().ok("a {b: is-superselector(\":is(c)\", \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":is(c)\", \"c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -180,7 +193,8 @@ mod simple { #[test] fn unequal() { assert_eq!( - runner().ok("a {b: is-superselector(\":is(c)\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":is(c)\", \"d\")}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/matches.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/matches.rs index 92b15eb80..39a20b556 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/matches.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/matches.rs @@ -13,7 +13,8 @@ mod both { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":matches(c d.i, e j f)\", \":matches(c d, e f, g h)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":matches(c d.i, e j f)\", \":matches(c d, e f, g h)\")}\n" ), "a {\ \n b: false;\ @@ -24,7 +25,8 @@ mod both { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":matches(c d, e f, g h)\", \":matches(c d.i, e j f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":matches(c d, e f, g h)\", \":matches(c d.i, e j f)\")}\n" ), "a {\ \n b: true;\ @@ -39,25 +41,27 @@ mod complex { #[test] fn subset() { assert_eq!( - runner().ok( - "a {b: is-superselector(\":matches(c d e)\", \"c e\")}\n" - ), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":matches(c d e)\", \"c e\")}\n" + ), + "a {\ \n b: false;\ \n}\n" - ); + ); } #[test] #[ignore] // wrong result fn superset() { assert_eq!( - runner().ok( - "a {b: is-superselector(\":matches(c e)\", \"c d e\")}\n" - ), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":matches(c e)\", \"c d e\")}\n" + ), + "a {\ \n b: true;\ \n}\n" - ); + ); } } mod compound { @@ -67,25 +71,27 @@ mod compound { #[test] fn subset() { assert_eq!( - runner().ok( - "a {b: is-superselector(\":matches(c.d.e)\", \"c e\")}\n" - ), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":matches(c.d.e)\", \"c e\")}\n" + ), + "a {\ \n b: false;\ \n}\n" - ); + ); } #[test] #[ignore] // wrong result fn superset() { assert_eq!( - runner().ok( - "a {b: is-superselector(\":matches(c.e)\", \"c.d.e\")}\n" - ), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":matches(c.e)\", \"c.d.e\")}\n" + ), + "a {\ \n b: true;\ \n}\n" - ); + ); } } mod list { @@ -96,7 +102,8 @@ mod list { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":matches(c d, e f)\", \"c d, e f, g h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":matches(c d, e f)\", \"c d, e f, g h\")}\n" ), "a {\ \n b: false;\ @@ -108,7 +115,8 @@ mod list { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":matches(c d, e f, g h)\", \"c d, e f\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":matches(c d, e f, g h)\", \"c d, e f\")}\n" ), "a {\ \n b: true;\ @@ -124,7 +132,8 @@ mod not_superselector_of { fn any() { assert_eq!( runner().ok( - "a {b: is-superselector(\":matches(c, d)\", \":any(c, d)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":matches(c, d)\", \":any(c, d)\")}\n" ), "a {\ \n b: false;\ @@ -135,7 +144,8 @@ mod not_superselector_of { fn prefixed() { assert_eq!( runner().ok( - "a {b: is-superselector(\":matches(c, d)\", \":-pfx-matches(c, d)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":matches(c, d)\", \":-pfx-matches(c, d)\")}\n" ), "a {\ \n b: false;\ @@ -151,7 +161,8 @@ mod prefix { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":-pfx-matches(c d.i, e j f)\", \"c d, e f, g h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":-pfx-matches(c d.i, e j f)\", \"c d, e f, g h\")}\n" ), "a {\ \n b: false;\ @@ -163,7 +174,8 @@ mod prefix { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":-pfx-matches(c d, e f, g h)\", \"c d.i, e j f\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":-pfx-matches(c d, e f, g h)\", \"c d.i, e j f\")}\n" ), "a {\ \n b: true;\ @@ -179,7 +191,8 @@ mod simple { #[ignore] // wrong result fn equal() { assert_eq!( - runner().ok("a {b: is-superselector(\":matches(c)\", \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":matches(c)\", \"c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -188,7 +201,8 @@ mod simple { #[test] fn unequal() { assert_eq!( - runner().ok("a {b: is-superselector(\":matches(c)\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":matches(c)\", \"d\")}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/not.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/not.rs index 574a50aa3..7d14368fd 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/not.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/not.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn bare_sub() { assert_eq!( runner().ok( - "a {b: is-superselector(\":not(c d, e f, g h)\", \"c d, e f, g h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":not(c d, e f, g h)\", \"c d, e f, g h\")}\n" ), "a {\ \n b: false;\ @@ -29,7 +30,8 @@ mod equivalence { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":not(c d.i, e j f)\", \":not(c d):not(e f):not(g h)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":not(c d.i, e j f)\", \":not(c d):not(e f):not(g h)\")}\n" ), "a {\ \n b: true;\ @@ -40,7 +42,8 @@ mod equivalence { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":not(c d, e f, g h)\", \":not(c d.i):not(e j f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":not(c d, e f, g h)\", \":not(c d.i):not(e j f)\")}\n" ), "a {\ \n b: false;\ @@ -56,7 +59,8 @@ mod equivalence { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":not(c d.i):not(e j f)\", \":not(c d, e f, g h)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":not(c d.i):not(e j f)\", \":not(c d, e f, g h)\")}\n" ), "a {\ \n b: true;\ @@ -67,7 +71,8 @@ mod equivalence { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":not(c d):not(e f):not(g h)\", \":not(c d.i, e j f)\")}" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":not(c d):not(e f):not(g h)\", \":not(c d.i, e j f)\")}" ), "a {\ \n b: false;\ @@ -80,7 +85,8 @@ mod equivalence { #[ignore] // wrong result fn id() { assert_eq!( - runner().ok("a {b: is-superselector(\":not(#c.d)\", \"#e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":not(#c.d)\", \"#e\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -94,7 +100,8 @@ mod prefix { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":-pfx-not(c d.i, e j f)\", \":-pfx-not(c d, e f, g h)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":-pfx-not(c d.i, e j f)\", \":-pfx-not(c d, e f, g h)\")}\n" ), "a {\ \n b: true;\ @@ -105,7 +112,8 @@ mod prefix { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":-pfx-not(c d, e f, g h)\", \":-pfx-not(c d.i, e j f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":-pfx-not(c d, e f, g h)\", \":-pfx-not(c d.i, e j f)\")}\n" ), "a {\ \n b: false;\ @@ -117,7 +125,8 @@ mod prefix { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":not(c d.i, e j f)\", \":not(c d, e f, g h)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":not(c d.i, e j f)\", \":not(c d, e f, g h)\")}\n" ), "a {\ \n b: true;\ @@ -128,7 +137,8 @@ fn subset() { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":not(c d, e f, g h)\", \":not(c d.i, e j f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":not(c d, e f, g h)\", \":not(c d.i, e j f)\")}\n" ), "a {\ \n b: false;\ @@ -139,7 +149,8 @@ fn superset() { #[ignore] // wrong result fn test_type() { assert_eq!( - runner().ok("a {b: is-superselector(\":not(c.d)\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":not(c.d)\", \"e\")}\n"), "a {\ \n b: true;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/nth_child.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/nth_child.rs index 0da49fc80..d8e68a91c 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/nth_child.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/nth_child.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn bare_sub() { assert_eq!( runner().ok( - "a {b: is-superselector(\":nth-child(n+1 of c d, e f, g h)\", \"c d, e f, g h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":nth-child(n+1 of c d, e f, g h)\", \"c d, e f, g h\")}\n" ), "a {\ \n b: false;\ @@ -20,8 +21,10 @@ fn bare_sub() { #[ignore] // wrong result fn bare_super() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"c\", \":nth-child(n+1 of c)\")}\n"), + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \":nth-child(n+1 of c)\")}\n" + ), "a {\ \n b: true;\ \n}\n" @@ -31,7 +34,8 @@ fn bare_super() { fn different_arg() { assert_eq!( runner().ok( - "a {b: is-superselector(\":nth-child(n+1 of c)\", \":nth-child(n+2 of c)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":nth-child(n+1 of c)\", \":nth-child(n+2 of c)\")}\n" ), "a {\ \n b: false;\ @@ -45,8 +49,9 @@ mod prefix { #[test] fn subset() { assert_eq!( - runner().ok("a {\ - \n b: is-superselector(\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.is-superselector(\ \n \":-pfx-nth-child(n+1 of c d.i, e j f)\",\ \n \":-pfx-nth-child(n+1 of c d, e f, g h)\");\ \n}\n"), @@ -58,8 +63,9 @@ mod prefix { #[test] fn superset() { assert_eq!( - runner().ok("a {\ - \n b: is-superselector(\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.is-superselector(\ \n \":-pfx-nth-child(n+1 of c d, e f, g h)\",\ \n \":-pfx-nth-child(n+1 of c d.i, e j f)\");\ \n}\n"), @@ -72,8 +78,9 @@ mod prefix { #[test] fn subset() { assert_eq!( - runner().ok("a {\ - \n b: is-superselector(\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.is-superselector(\ \n \":nth-child(n+1 of c d.i, e j f)\",\ \n \":nth-child(n+1 of c d, e f, g h)\");\ \n}\n"), @@ -85,8 +92,9 @@ fn subset() { #[test] fn superset() { assert_eq!( - runner().ok("a {\ - \n b: is-superselector(\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.is-superselector(\ \n \":nth-child(n+1 of c d, e f, g h)\",\ \n \":nth-child(n+1 of c d.i, e j f)\");\ \n}\n"), diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/nth_last_child.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/nth_last_child.rs index ed1121af5..0a2b7ef41 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/nth_last_child.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/nth_last_child.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn bare_sub() { assert_eq!( runner().ok( - "a {b: is-superselector(\":nth-last-child(n+1 of c d, e f, g h)\", \"c d, e f, g h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":nth-last-child(n+1 of c d, e f, g h)\", \"c d, e f, g h\")}\n" ), "a {\ \n b: false;\ @@ -21,7 +22,8 @@ fn bare_sub() { fn bare_super() { assert_eq!( runner().ok( - "a {b: is-superselector(\"c\", \":nth-last-child(n+1 of c)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \":nth-last-child(n+1 of c)\")}\n" ), "a {\ \n b: true;\ @@ -31,8 +33,9 @@ fn bare_super() { #[test] fn different_arg() { assert_eq!( - runner().ok("a {\ - \n b: is-superselector(\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.is-superselector(\ \n \":nth-last-child(n+1 of c)\",\ \n \":nth-last-child(n+2 of c)\");\ \n}\n"), @@ -48,8 +51,9 @@ mod prefix { #[test] fn subset() { assert_eq!( - runner().ok("a {\ - \n b: is-superselector(\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.is-superselector(\ \n \":-pfx-nth-last-child(n+1 of c d.i, e j f)\",\ \n \":-pfx-nth-last-child(n+1 of c d, e f, g h)\");\ \n}\n"), @@ -61,8 +65,9 @@ mod prefix { #[test] fn superset() { assert_eq!( - runner().ok("a {\ - \n b: is-superselector(\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.is-superselector(\ \n \":-pfx-nth-last-child(n+1 of c d, e f, g h)\",\ \n \":-pfx-nth-last-child(n+1 of c d.i, e j f)\");\ \n}\n"), @@ -75,8 +80,9 @@ mod prefix { #[test] fn subset() { assert_eq!( - runner().ok("a {\ - \n b: is-superselector(\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.is-superselector(\ \n \":nth-last-child(n+1 of c d.i, e j f)\",\ \n \":nth-last-child(n+1 of c d, e f, g h)\");\ \n}\n"), @@ -88,8 +94,9 @@ fn subset() { #[test] fn superset() { assert_eq!( - runner().ok("a {\ - \n b: is-superselector(\ + runner().ok("@use \"sass:selector\";\ + \na {\ + \n b: selector.is-superselector(\ \n \":nth-last-child(n+1 of c d, e f, g h)\",\ \n \":nth-last-child(n+1 of c d.i, e j f)\");\ \n}\n"), diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/slotted.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/slotted.rs index 020d196d0..f6d23b233 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/slotted.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/slotted.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn bare_sub() { assert_eq!( runner().ok( - "a {b: is-superselector(\"::slotted(c d, e f, g h)\", \"c d, e f, g h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"::slotted(c d, e f, g h)\", \"c d, e f, g h\")}\n" ), "a {\ \n b: false;\ @@ -24,7 +25,8 @@ mod prefix { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\"::-pfx-slotted(c d.i, e j f)\", \"::-pfx-slotted(c d, e f, g h)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"::-pfx-slotted(c d.i, e j f)\", \"::-pfx-slotted(c d, e f, g h)\")}\n" ), "a {\ \n b: false;\ @@ -35,7 +37,8 @@ mod prefix { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\"::-pfx-slotted(c d, e f, g h)\", \"::-pfx-slotted(c d.i, e j f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"::-pfx-slotted(c d, e f, g h)\", \"::-pfx-slotted(c d.i, e j f)\")}\n" ), "a {\ \n b: true;\ @@ -47,7 +50,8 @@ mod prefix { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\"::slotted(c d.i, e j f)\", \"::slotted(c d, e f, g h)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"::slotted(c d.i, e j f)\", \"::slotted(c d, e f, g h)\")}\n" ), "a {\ \n b: false;\ @@ -58,7 +62,8 @@ fn subset() { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\"::slotted(c d, e f, g h)\", \"::slotted(c d.i, e j f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"::slotted(c d, e f, g h)\", \"::slotted(c d.i, e j f)\")}\n" ), "a {\ \n b: true;\ diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/test_where.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/test_where.rs index 3c4b54fc6..986eb04c1 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/test_where.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/pseudo/selector_arg/test_where.rs @@ -13,7 +13,8 @@ mod both { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":where(c d.i, e j f)\", \":where(c d, e f, g h)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":where(c d.i, e j f)\", \":where(c d, e f, g h)\")}\n" ), "a {\ \n b: false;\ @@ -24,7 +25,8 @@ mod both { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":where(c d, e f, g h)\", \":where(c d.i, e j f)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":where(c d, e f, g h)\", \":where(c d.i, e j f)\")}\n" ), "a {\ \n b: true;\ @@ -39,23 +41,27 @@ mod complex { #[test] fn subset() { assert_eq!( - runner() - .ok("a {b: is-superselector(\":where(c d e)\", \"c e\")}\n"), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":where(c d e)\", \"c e\")}\n" + ), + "a {\ \n b: false;\ \n}\n" - ); + ); } #[test] #[ignore] // wrong result fn superset() { assert_eq!( - runner() - .ok("a {b: is-superselector(\":where(c e)\", \"c d e\")}\n"), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":where(c e)\", \"c d e\")}\n" + ), + "a {\ \n b: true;\ \n}\n" - ); + ); } } mod compound { @@ -65,23 +71,27 @@ mod compound { #[test] fn subset() { assert_eq!( - runner() - .ok("a {b: is-superselector(\":where(c.d.e)\", \"c e\")}\n"), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":where(c.d.e)\", \"c e\")}\n" + ), + "a {\ \n b: false;\ \n}\n" - ); + ); } #[test] #[ignore] // wrong result fn superset() { assert_eq!( - runner() - .ok("a {b: is-superselector(\":where(c.e)\", \"c.d.e\")}\n"), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":where(c.e)\", \"c.d.e\")}\n" + ), + "a {\ \n b: true;\ \n}\n" - ); + ); } } mod list { @@ -92,7 +102,8 @@ mod list { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":where(c d, e f)\", \"c d, e f, g h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":where(c d, e f)\", \"c d, e f, g h\")}\n" ), "a {\ \n b: false;\ @@ -104,7 +115,8 @@ mod list { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":where(c d, e f, g h)\", \"c d, e f\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":where(c d, e f, g h)\", \"c d, e f\")}\n" ), "a {\ \n b: true;\ @@ -119,19 +131,21 @@ mod not_superselector_of { #[test] fn any() { assert_eq!( - runner().ok( - "a {b: is-superselector(\":where(c, d)\", \":any(c, d)\")}\n" - ), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":where(c, d)\", \":any(c, d)\")}\n" + ), + "a {\ \n b: false;\ \n}\n" - ); + ); } #[test] fn prefixed() { assert_eq!( runner().ok( - "a {b: is-superselector(\":where(c, d)\", \":-pfx-where(c, d)\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":where(c, d)\", \":-pfx-where(c, d)\")}\n" ), "a {\ \n b: false;\ @@ -147,7 +161,8 @@ mod prefix { fn subset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":-pfx-is(c d.i, e j f)\", \"c d, e f, g h\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":-pfx-is(c d.i, e j f)\", \"c d, e f, g h\")}\n" ), "a {\ \n b: false;\ @@ -159,7 +174,8 @@ mod prefix { fn superset() { assert_eq!( runner().ok( - "a {b: is-superselector(\":-pfx-is(c d, e f, g h)\", \"c d.i, e j f\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":-pfx-is(c d, e f, g h)\", \"c d.i, e j f\")}\n" ), "a {\ \n b: true;\ @@ -175,7 +191,8 @@ mod simple { #[ignore] // wrong result fn equal() { assert_eq!( - runner().ok("a {b: is-superselector(\":where(c)\", \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":where(c)\", \"c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -184,7 +201,8 @@ mod simple { #[test] fn unequal() { assert_eq!( - runner().ok("a {b: is-superselector(\":where(c)\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\":where(c)\", \"d\")}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/test_type.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/test_type.rs index ca0db5afb..c171440bc 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/test_type.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/test_type.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn and_universal() { assert_eq!( - runner().ok("a {b: is-superselector(\"c\", \"*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"*\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -17,7 +18,8 @@ fn and_universal() { #[test] fn equal() { assert_eq!( - runner().ok("a {b: is-superselector(\"c\", \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -34,7 +36,8 @@ mod namespace { #[test] fn and_empty() { assert_eq!( - runner().ok("a {b: is-superselector(\"|c\", \"|c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"|c\", \"|c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -43,7 +46,8 @@ mod namespace { #[test] fn and_explicit() { assert_eq!( - runner().ok("a {b: is-superselector(\"|c\", \"d|c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"|c\", \"d|c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -52,7 +56,8 @@ mod namespace { #[test] fn and_implicit() { assert_eq!( - runner().ok("a {b: is-superselector(\"|c\", \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"|c\", \"c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -61,7 +66,8 @@ mod namespace { #[test] fn and_universal() { assert_eq!( - runner().ok("a {b: is-superselector(\"|c\", \"*|c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"|c\", \"*|c\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -75,7 +81,8 @@ mod namespace { #[test] fn and_empty() { assert_eq!( - runner().ok("a {b: is-superselector(\"c|d\", \"|d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c|d\", \"|d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -88,8 +95,8 @@ mod namespace { #[test] fn equal() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"c|d\", \"c|d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c|d\", \"c|d\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -98,8 +105,8 @@ mod namespace { #[test] fn unequal() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"c|d\", \"e|d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c|d\", \"e|d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -109,7 +116,8 @@ mod namespace { #[test] fn and_implicit() { assert_eq!( - runner().ok("a {b: is-superselector(\"c|d\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c|d\", \"d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -118,7 +126,8 @@ mod namespace { #[test] fn and_universal() { assert_eq!( - runner().ok("a {b: is-superselector(\"c|d\", \"*|d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c|d\", \"*|d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -132,7 +141,8 @@ mod namespace { #[test] fn and_empty() { assert_eq!( - runner().ok("a {b: is-superselector(\"*|c\", \"|c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"*|c\", \"|c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -141,7 +151,8 @@ mod namespace { #[test] fn and_explicit() { assert_eq!( - runner().ok("a {b: is-superselector(\"*|c\", \"d|c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"*|c\", \"d|c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -150,7 +161,8 @@ mod namespace { #[test] fn and_implicit() { assert_eq!( - runner().ok("a {b: is-superselector(\"*|c\", \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"*|c\", \"c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -159,7 +171,8 @@ mod namespace { #[test] fn and_universal() { assert_eq!( - runner().ok("a {b: is-superselector(\"*|c\", \"*|c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"*|c\", \"*|c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -170,7 +183,8 @@ mod namespace { #[test] fn unequal() { assert_eq!( - runner().ok("a {b: is-superselector(\"c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c\", \"d\")}\n"), "a {\ \n b: false;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/is_superselector/simple/universal.rs b/rsass/tests/spec/core_functions/selector/is_superselector/simple/universal.rs index cb1d32df1..2c467f71f 100644 --- a/rsass/tests/spec/core_functions/selector/is_superselector/simple/universal.rs +++ b/rsass/tests/spec/core_functions/selector/is_superselector/simple/universal.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn and_class() { assert_eq!( - runner().ok("a {b: is-superselector(\"*\", \".c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"*\", \".c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -17,7 +18,8 @@ fn and_class() { #[test] fn and_type() { assert_eq!( - runner().ok("a {b: is-superselector(\"*\", \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"*\", \"c\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -26,7 +28,8 @@ fn and_type() { #[test] fn equal() { assert_eq!( - runner().ok("a {b: is-superselector(\"*\", \"*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"*\", \"*\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -43,7 +46,8 @@ mod namespace { #[test] fn and_class() { assert_eq!( - runner().ok("a {b: is-superselector(\"|*\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"|*\", \".d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -56,7 +60,8 @@ mod namespace { #[test] fn empty() { assert_eq!( - runner().ok("a {b: is-superselector(\"|*\", \"|d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"|*\", \"|d\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -65,7 +70,8 @@ mod namespace { #[test] fn explicit() { assert_eq!( - runner().ok("a {b: is-superselector(\"|*\", \"c|d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"|*\", \"c|d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -74,7 +80,8 @@ mod namespace { #[test] fn implicit() { assert_eq!( - runner().ok("a {b: is-superselector(\"|*\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"|*\", \"d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -88,7 +95,8 @@ mod namespace { #[test] fn empty() { assert_eq!( - runner().ok("a {b: is-superselector(\"|*\", \"|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"|*\", \"|*\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -97,7 +105,8 @@ mod namespace { #[test] fn explicit() { assert_eq!( - runner().ok("a {b: is-superselector(\"|*\", \"c|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"|*\", \"c|*\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -106,7 +115,8 @@ mod namespace { #[test] fn implicit() { assert_eq!( - runner().ok("a {b: is-superselector(\"|*\", \"*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"|*\", \"*\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -115,7 +125,8 @@ mod namespace { #[test] fn universal() { assert_eq!( - runner().ok("a {b: is-superselector(\"|*\", \"*|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"|*\", \"*|*\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -130,7 +141,8 @@ mod namespace { #[test] fn and_class() { assert_eq!( - runner().ok("a {b: is-superselector(\"c|*\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c|*\", \".d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -143,7 +155,8 @@ mod namespace { #[test] fn empty() { assert_eq!( - runner().ok("a {b: is-superselector(\"c|*\", \"|d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c|*\", \"|d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -156,9 +169,8 @@ mod namespace { #[test] fn equal() { assert_eq!( - runner().ok( - "a {b: is-superselector(\"c|*\", \"c|d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c|*\", \"c|d\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -167,9 +179,8 @@ mod namespace { #[test] fn unequal() { assert_eq!( - runner().ok( - "a {b: is-superselector(\"c|*\", \"e|d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c|*\", \"e|d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -179,7 +190,8 @@ mod namespace { #[test] fn implicit() { assert_eq!( - runner().ok("a {b: is-superselector(\"c|*\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c|*\", \"d\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -193,7 +205,8 @@ mod namespace { #[test] fn empty() { assert_eq!( - runner().ok("a {b: is-superselector(\"c|*\", \"|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c|*\", \"|*\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -206,9 +219,8 @@ mod namespace { #[test] fn equal() { assert_eq!( - runner().ok( - "a {b: is-superselector(\"c|*\", \"c|*\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c|*\", \"c|*\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -217,9 +229,8 @@ mod namespace { #[test] fn unequal() { assert_eq!( - runner().ok( - "a {b: is-superselector(\"c|*\", \"d|*\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c|*\", \"d|*\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -229,7 +240,8 @@ mod namespace { #[test] fn implicit() { assert_eq!( - runner().ok("a {b: is-superselector(\"c|*\", \"*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c|*\", \"*\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -238,8 +250,8 @@ mod namespace { #[test] fn universal() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"c|*\", \"*|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"c|*\", \"*|*\")}\n"), "a {\ \n b: false;\ \n}\n" @@ -254,7 +266,8 @@ mod namespace { #[test] fn and_class() { assert_eq!( - runner().ok("a {b: is-superselector(\"*|*\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"*|*\", \".d\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -267,7 +280,8 @@ mod namespace { #[test] fn empty() { assert_eq!( - runner().ok("a {b: is-superselector(\"*|*\", \"|d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"*|*\", \"|d\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -276,8 +290,8 @@ mod namespace { #[test] fn explicit() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"*|*\", \"c|d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"*|*\", \"c|d\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -286,7 +300,8 @@ mod namespace { #[test] fn implicit() { assert_eq!( - runner().ok("a {b: is-superselector(\"*|*\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"*|*\", \"d\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -300,7 +315,8 @@ mod namespace { #[test] fn empty() { assert_eq!( - runner().ok("a {b: is-superselector(\"*|*\", \"|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"*|*\", \"|*\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -309,8 +325,8 @@ mod namespace { #[test] fn explicit() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"*|*\", \"c|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"*|*\", \"c|*\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -319,7 +335,8 @@ mod namespace { #[test] fn implicit() { assert_eq!( - runner().ok("a {b: is-superselector(\"*|*\", \"*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"*|*\", \"*\")}\n"), "a {\ \n b: true;\ \n}\n" @@ -328,8 +345,8 @@ mod namespace { #[test] fn universal() { assert_eq!( - runner() - .ok("a {b: is-superselector(\"*|*\", \"*|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.is-superselector(\"*|*\", \"*|*\")}\n"), "a {\ \n b: true;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/nest/combinator.rs b/rsass/tests/spec/core_functions/selector/nest/combinator.rs index ed7682a3f..ffc077422 100644 --- a/rsass/tests/spec/core_functions/selector/nest/combinator.rs +++ b/rsass/tests/spec/core_functions/selector/nest/combinator.rs @@ -12,7 +12,8 @@ mod leading { #[test] fn test_final() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\", \"+ d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \"+ d\")}\n"), "a {\ \n b: c + d;\ \n}\n" @@ -21,7 +22,8 @@ mod leading { #[test] fn initial() { assert_eq!( - runner().ok("a {b: selector-nest(\"> c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"> c\", \"d\")}\n"), "a {\ \n b: > c d;\ \n}\n" @@ -39,7 +41,8 @@ mod multiple { #[test] fn test_final() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\", \"+ > d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \"+ > d\")}\n"), "a {\ \n b: c + > d;\ \n}\n" @@ -48,7 +51,8 @@ mod multiple { #[test] fn initial() { assert_eq!( - runner().ok("a {b: selector-nest(\"~ ~ c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"~ ~ c\", \"d\")}\n"), "a {\ \n b: ~ ~ c d;\ \n}\n" @@ -58,7 +62,8 @@ mod multiple { #[test] fn middle() { assert_eq!( - runner().ok("a {b: selector-nest(\"c > > d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c > > d\", \"e\")}\n"), "a {\ \n b: c > > d e;\ \n}\n" @@ -71,7 +76,8 @@ mod multiple { #[test] fn test_final() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\", \"d + >\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \"d + >\")}\n"), "a {\ \n b: c d + >;\ \n}\n" @@ -80,7 +86,8 @@ mod multiple { #[test] fn initial() { assert_eq!( - runner().ok("a {b: selector-nest(\"c > ~\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c > ~\", \"d\")}\n"), "a {\ \n b: c > ~ d;\ \n}\n" @@ -95,7 +102,8 @@ mod only { #[test] fn after() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\", \"+\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \"+\")}\n"), "a {\ \n b: c +;\ \n}\n" @@ -104,7 +112,8 @@ mod only { #[test] fn before() { assert_eq!( - runner().ok("a {b: selector-nest(\"~\", \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"~\", \"c\")}\n"), "a {\ \n b: ~ c;\ \n}\n" @@ -113,7 +122,8 @@ mod only { #[test] fn between() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\", \">\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \">\", \"d\")}\n"), "a {\ \n b: c > d;\ \n}\n" @@ -127,7 +137,8 @@ mod trailing { #[test] fn test_final() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\", \"d >\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \"d >\")}\n"), "a {\ \n b: c d >;\ \n}\n" @@ -136,7 +147,8 @@ mod trailing { #[test] fn initial() { assert_eq!( - runner().ok("a {b: selector-nest(\"c ~\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c ~\", \"d\")}\n"), "a {\ \n b: c ~ d;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/nest/error.rs b/rsass/tests/spec/core_functions/selector/nest/error.rs index ee1ce165d..10694f774 100644 --- a/rsass/tests/spec/core_functions/selector/nest/error.rs +++ b/rsass/tests/spec/core_functions/selector/nest/error.rs @@ -12,7 +12,10 @@ mod invalid { #[test] fn initial() { assert_eq!( - runner().err("a {b: selector-nest(\"[c\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.nest(\"[c\")}\n" + ), "Error: expected more input.\ \n ,\ \n1 | [c\ @@ -20,16 +23,19 @@ mod invalid { \n \'\ \n - 1:3 root stylesheet\ \n ,\ - \n1 | a {b: selector-nest(\"[c\")}\ + \n2 | a {b: selector.nest(\"[c\")}\ \n | ^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn later() { assert_eq!( - runner().err("a {b: selector-nest(\"c\", \"[d\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \"[d\")}\n" + ), "Error: expected more input.\ \n ,\ \n1 | [d\ @@ -37,10 +43,10 @@ mod invalid { \n \'\ \n - 1:3 root stylesheet\ \n ,\ - \n1 | a {b: selector-nest(\"c\", \"[d\")}\ + \n2 | a {b: selector.nest(\"c\", \"[d\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -51,7 +57,10 @@ mod parent { #[test] fn first_arg() { assert_eq!( - runner().err("a {b: selector-nest(\"&\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.nest(\"&\")}\n" + ), "Error: Parent selectors aren\'t allowed here.\ \n ,\ \n1 | &\ @@ -59,10 +68,10 @@ mod parent { \n \'\ \n - 1:1 root stylesheet\ \n ,\ - \n1 | a {b: selector-nest(\"&\")}\ + \n2 | a {b: selector.nest(\"&\")}\ \n | ^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] @@ -70,7 +79,8 @@ mod parent { fn non_initial() { assert_eq!( runner().err( - "a {b: selector-nest(\"c\", \"[d]&\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \"[d]&\")}\n" ), "Error: \"&\" may only used at the beginning of a compound selector.\ \n ,\ @@ -79,10 +89,10 @@ mod parent { \n \'\ \n - 1:4 root stylesheet\ \n ,\ - \n1 | a {b: selector-nest(\"c\", \"[d]&\")}\ + \n2 | a {b: selector.nest(\"c\", \"[d]&\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] @@ -90,7 +100,8 @@ mod parent { fn prefix() { assert_eq!( runner().err( - "a {b: selector-nest(\"c\", \"d&\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \"d&\")}\n" ), "Error: \"&\" may only used at the beginning of a compound selector.\ \n ,\ @@ -99,23 +110,26 @@ mod parent { \n \'\ \n - 1:2 root stylesheet\ \n ,\ - \n1 | a {b: selector-nest(\"c\", \"d&\")}\ + \n2 | a {b: selector.nest(\"c\", \"d&\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: selector-nest()}\n\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.nest()}\n\n" + ), "Error: $selectors: At least one selector must be passed.\ \n ,\ - \n1 | a {b: selector-nest()}\ + \n2 | a {b: selector.nest()}\ \n | ^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod test_type { @@ -125,27 +139,48 @@ mod test_type { #[test] fn initial() { assert_eq!( - runner().err("a {b: selector-nest(1)}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.nest(1)}\n" + ), "Error: 1 is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | a {b: selector-nest(1)}\ + \n2 | a {b: selector.nest(1)}\ \n | ^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn later() { assert_eq!( - runner().err("a {b: selector-nest(\"c\", 1)}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", 1)}\n" + ), "Error: 1 is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | a {b: selector-nest(\"c\", 1)}\ + \n2 | a {b: selector.nest(\"c\", 1)}\ \n | ^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } +#[test] +fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.selector-nest(c, d)}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: selector.selector-nest(c, d)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/selector/nest/format.rs b/rsass/tests/spec/core_functions/selector/nest/format.rs index c7a574643..301d907d0 100644 --- a/rsass/tests/spec/core_functions/selector/nest/format.rs +++ b/rsass/tests/spec/core_functions/selector/nest/format.rs @@ -16,7 +16,8 @@ mod format { #[test] fn initial() { assert_eq!( - runner().ok("a {b: selector-nest((c, d e), \"f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest((c, d e), \"f\")}\n"), "a {\ \n b: c f, d e f;\ \n}\n" @@ -25,7 +26,8 @@ mod format { #[test] fn later() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\", (d, e f))}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", (d, e f))}\n"), "a {\ \n b: c d, c e f;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/nest/list.rs b/rsass/tests/spec/core_functions/selector/nest/list.rs index b4193875b..5e302a42b 100644 --- a/rsass/tests/spec/core_functions/selector/nest/list.rs +++ b/rsass/tests/spec/core_functions/selector/nest/list.rs @@ -12,7 +12,8 @@ mod list { #[test] fn test_final() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\", \"d, e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \"d, e\")}\n"), "a {\ \n b: c d, c e;\ \n}\n" @@ -21,7 +22,8 @@ mod list { #[test] fn initial() { assert_eq!( - runner().ok("a {b: selector-nest(\"c, d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c, d\", \"e\")}\n"), "a {\ \n b: c e, d e;\ \n}\n" @@ -30,8 +32,8 @@ mod list { #[test] fn many() { assert_eq!( - runner() - .ok("a {b: selector-nest(\"c, d\", \"e, f\", \"g, h\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c, d\", \"e, f\", \"g, h\")}\n"), "a {\ \n b: c e g, c e h, c f g, c f h, d e g, d e h, d f g, d f h;\ \n}\n" @@ -44,7 +46,8 @@ mod list { #[test] fn alone() { assert_eq!( - runner().ok("a {b: selector-nest(\"c, d\", \"&\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c, d\", \"&\")}\n"), "a {\ \n b: c, d;\ \n}\n" @@ -53,7 +56,8 @@ mod list { #[test] fn complex() { assert_eq!( - runner().ok("a {b: selector-nest(\"c, d\", \"e &.f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c, d\", \"e &.f\")}\n"), "a {\ \n b: e c.f, e d.f;\ \n}\n" @@ -62,7 +66,8 @@ mod list { #[test] fn compound() { assert_eq!( - runner().ok("a {b: selector-nest(\"c, d\", \"&.e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c, d\", \"&.e\")}\n"), "a {\ \n b: c.e, d.e;\ \n}\n" @@ -71,7 +76,8 @@ mod list { #[test] fn in_one_complex() { assert_eq!( - runner().ok("a {b: selector-nest(\"c, d\", \"&.e, f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c, d\", \"&.e, f\")}\n"), "a {\ \n b: c.e, c f, d.e, d f;\ \n}\n" @@ -80,7 +86,8 @@ mod list { #[test] fn multiple() { assert_eq!( - runner().ok("a {b: selector-nest(\"c, d\", \"&.e &.f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c, d\", \"&.e &.f\")}\n"), "a {\ \n b: c.e c.f, c.e d.f, d.e c.f, d.e d.f;\ \n}\n" @@ -93,8 +100,8 @@ mod list { #[test] fn is() { assert_eq!( - runner() - .ok("a {b: selector-nest(\"c, d\", \":is(&)\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c, d\", \":is(&)\")}\n"), "a {\ \n b: :is(c, d);\ \n}\n" @@ -103,9 +110,8 @@ mod list { #[test] fn matches() { assert_eq!( - runner().ok( - "a {b: selector-nest(\"c, d\", \":matches(&)\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c, d\", \":matches(&)\")}\n"), "a {\ \n b: :matches(c, d);\ \n}\n" @@ -114,9 +120,8 @@ mod list { #[test] fn test_where() { assert_eq!( - runner().ok( - "a {b: selector-nest(\"c, d\", \":where(&)\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c, d\", \":where(&)\")}\n"), "a {\ \n b: :where(c, d);\ \n}\n" @@ -126,7 +131,8 @@ mod list { #[test] fn suffix() { assert_eq!( - runner().ok("a {b: selector-nest(\"c, d\", \"&e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c, d\", \"&e\")}\n"), "a {\ \n b: ce, de;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/nest/many_args.rs b/rsass/tests/spec/core_functions/selector/nest/many_args.rs index bd3887230..40f289170 100644 --- a/rsass/tests/spec/core_functions/selector/nest/many_args.rs +++ b/rsass/tests/spec/core_functions/selector/nest/many_args.rs @@ -8,8 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner() - .ok("a {b: selector-nest(\"c\", \"d\", \"e\", \"f\", \"g\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \"d\", \"e\", \"f\", \"g\")}\n"), "a {\ \n b: c d e f g;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/nest/one_arg.rs b/rsass/tests/spec/core_functions/selector/nest/one_arg.rs index cd06f1b81..70d5c73f1 100644 --- a/rsass/tests/spec/core_functions/selector/nest/one_arg.rs +++ b/rsass/tests/spec/core_functions/selector/nest/one_arg.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\")}\n"), "a {\ \n b: c;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/nest/parent.rs b/rsass/tests/spec/core_functions/selector/nest/parent.rs index b80b24709..41a1eb721 100644 --- a/rsass/tests/spec/core_functions/selector/nest/parent.rs +++ b/rsass/tests/spec/core_functions/selector/nest/parent.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn alone() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\", \"&\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \"&\")}\n"), "a {\ \n b: c;\ \n}\n" @@ -21,7 +22,8 @@ mod complex { #[test] fn complex_parent() { assert_eq!( - runner().ok("a {b: selector-nest(\"c d\", \"e &.f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c d\", \"e &.f\")}\n"), "a {\ \n b: e c d.f;\ \n}\n" @@ -30,7 +32,8 @@ mod complex { #[test] fn simple_parent() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\", \"d &.e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \"d &.e\")}\n"), "a {\ \n b: d c.e;\ \n}\n" @@ -40,7 +43,8 @@ mod complex { #[test] fn compound() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\", \"&.d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \"&.d\")}\n"), "a {\ \n b: c.d;\ \n}\n" @@ -49,7 +53,8 @@ fn compound() { #[test] fn in_one_complex() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\", \"&.d, e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \"&.d, e\")}\n"), "a {\ \n b: c.d, c e;\ \n}\n" @@ -58,7 +63,8 @@ fn in_one_complex() { #[test] fn multiple() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\", \"&.d &.e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \"&.d &.e\")}\n"), "a {\ \n b: c.d c.e;\ \n}\n" @@ -75,7 +81,8 @@ mod selector_pseudo { #[test] fn is() { assert_eq!( - runner().ok("a {b: selector-nest(\"c d\", \":is(&)\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c d\", \":is(&)\")}\n"), "a {\ \n b: :is(c d);\ \n}\n" @@ -84,8 +91,8 @@ mod selector_pseudo { #[test] fn matches() { assert_eq!( - runner() - .ok("a {b: selector-nest(\"c d\", \":matches(&)\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c d\", \":matches(&)\")}\n"), "a {\ \n b: :matches(c d);\ \n}\n" @@ -94,7 +101,8 @@ mod selector_pseudo { #[test] fn test_where() { assert_eq!( - runner().ok("a {b: selector-nest(\"c d\", \":where(&)\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c d\", \":where(&)\")}\n"), "a {\ \n b: :where(c d);\ \n}\n" @@ -108,7 +116,8 @@ mod selector_pseudo { #[test] fn is() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\", \":is(&)\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \":is(&)\")}\n"), "a {\ \n b: :is(c);\ \n}\n" @@ -117,7 +126,8 @@ mod selector_pseudo { #[test] fn matches() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\", \":matches(&)\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \":matches(&)\")}\n"), "a {\ \n b: :matches(c);\ \n}\n" @@ -126,7 +136,8 @@ mod selector_pseudo { #[test] fn test_where() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\", \":where(&)\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \":where(&)\")}\n"), "a {\ \n b: :where(c);\ \n}\n" @@ -137,7 +148,8 @@ mod selector_pseudo { #[test] fn suffix() { assert_eq!( - runner().ok("a {b: selector-nest(\"c\", \"&d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.nest(\"c\", \"&d\")}\n"), "a {\ \n b: cd;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/parse/error.rs b/rsass/tests/spec/core_functions/selector/parse/error.rs index 32a1cc56a..9276273d8 100644 --- a/rsass/tests/spec/core_functions/selector/parse/error.rs +++ b/rsass/tests/spec/core_functions/selector/parse/error.rs @@ -9,34 +9,43 @@ fn runner() -> crate::TestRunner { fn inner_comma() { assert_eq!( runner().err( - "a {b: selector-parse(((c,),))}\n" + "@use \"sass:selector\";\ + \na {b: selector.parse(((c,),))}\n" ), "Error: $selector: ((c,),) is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | a {b: selector-parse(((c,),))}\ + \n2 | a {b: selector.parse(((c,),))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] +#[ignore] // wrong error fn outer_space() { assert_eq!( - runner().err("a {b: selector-parse(append((), append((), c)))}\n"), - "Error: $selector: c is not a valid selector: it must be a string,\ + runner().err( + "@use \"sass:list\";\ + \n@use \"sass:selector\";\ + \na {b: selector.parse(list.append((), list.append((), c)))}\n" + ), + "Error: $selector: (c) is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | a {b: selector-parse(append((), append((), c)))}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n3 | a {b: selector.parse(list.append((), list.append((), c)))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 3:7 root stylesheet", ); } #[test] fn parent() { assert_eq!( - runner().err("a {b: selector-parse(\"&\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.parse(\"&\")}\n" + ), "Error: $selector: Parent selectors aren\'t allowed here.\ \n ,\ \n1 | &\ @@ -44,10 +53,10 @@ fn parent() { \n \'\ \n - 1:1 root stylesheet\ \n ,\ - \n1 | a {b: selector-parse(\"&\")}\ + \n2 | a {b: selector.parse(\"&\")}\ \n | ^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod parse { @@ -57,7 +66,10 @@ mod parse { #[test] fn extra() { assert_eq!( - runner().err("a {b: selector-parse(\"c {\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.parse(\"c {\")}\n" + ), "Error: $selector: expected selector.\ \n ,\ \n1 | c {\ @@ -65,16 +77,19 @@ mod parse { \n \'\ \n - 1:3 root stylesheet\ \n ,\ - \n1 | a {b: selector-parse(\"c {\")}\ + \n2 | a {b: selector.parse(\"c {\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn invalid() { assert_eq!( - runner().err("a {b: selector-parse(\"[c\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.parse(\"[c\")}\n" + ), "Error: $selector: expected more input.\ \n ,\ \n1 | [c\ @@ -82,10 +97,10 @@ mod parse { \n \'\ \n - 1:3 root stylesheet\ \n ,\ - \n1 | a {b: selector-parse(\"[c\")}\ + \n2 | a {b: selector.parse(\"[c\")}\ \n | ^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -94,95 +109,125 @@ mod slash_list { use super::runner; #[test] + #[ignore] // wrong error fn in_comma_list() { assert_eq!( runner().err( - "@use \"sass:list\";\ - \na {b: selector-parse((list.slash(c, d), list.slash(e, f)))}\n" + "@use \"sass:selector\";\ + \n@use \"sass:list\";\ + \na {b: selector.parse((list.slash(c, d), list.slash(e, f)))}\n" ), - "Error: $selector: c / d, e / f is not a valid selector: it must be a string,\ + "Error: $selector: (c / d, e / f) is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n2 | a {b: selector-parse((list.slash(c, d), list.slash(e, f)))}\ + \n3 | a {b: selector.parse((list.slash(c, d), list.slash(e, f)))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 2:7 root stylesheet", + \n input.scss 3:7 root stylesheet", ); } #[test] + #[ignore] // wrong error fn top_level() { assert_eq!( runner().err( - "@use \"sass:list\";\ - \na {b: selector-parse(list.slash(c d, e f))}\n" + "@use \"sass:selector\";\ + \n@use \"sass:list\";\ + \na {b: selector.parse(list.slash(c d, e f))}\n" ), - "Error: $selector: c d / e f is not a valid selector: it must be a string,\ + "Error: $selector: (c d / e f) is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n2 | a {b: selector-parse(list.slash(c d, e f))}\ + \n3 | a {b: selector.parse(list.slash(c d, e f))}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 2:7 root stylesheet", + \n input.scss 3:7 root stylesheet", ); } } #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: selector-parse()}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.parse()}\n" + ), "Error: Missing argument $selector.\ \n ,--> input.scss\ - \n1 | a {b: selector-parse()}\ + \n2 | a {b: selector.parse()}\ \n | ^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:selector\ \n1 | @function parse($selector) {\ \n | ================ declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: selector-parse(c, d)}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.parse(c, d)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: selector-parse(c, d)}\ + \n2 | a {b: selector.parse(c, d)}\ \n | ^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:selector\ \n1 | @function parse($selector) {\ \n | ================ declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_nested() { assert_eq!( runner().err( - "a {b: selector-parse((append((), append((), c)),))}\n" + "@use \"sass:list\";\ + \n@use \"sass:selector\";\ + \na {b: selector.parse((list.append((), list.append((), c)),))}\n" ), "Error: $selector: (c,) is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | a {b: selector-parse((append((), append((), c)),))}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n3 | a {b: selector.parse((list.append((), list.append((), c)),))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 3:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: selector-parse(1)}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.parse(1)}\n" + ), "Error: $selector: 1 is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | a {b: selector-parse(1)}\ + \n2 | a {b: selector.parse(1)}\ \n | ^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", + ); +} +#[test] +fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.selector-parse(\".c.d\")}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: selector.selector-parse(\".c.d\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", ); } diff --git a/rsass/tests/spec/core_functions/selector/parse/named.rs b/rsass/tests/spec/core_functions/selector/parse/named.rs index 63300878c..82b8ac47b 100644 --- a/rsass/tests/spec/core_functions/selector/parse/named.rs +++ b/rsass/tests/spec/core_functions/selector/parse/named.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("a {b: selector-parse($selector: \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse($selector: \"c\")}\n"), "a {\ \n b: c;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/parse/selector.rs b/rsass/tests/spec/core_functions/selector/parse/selector.rs index 657de00b9..b1ccf5557 100644 --- a/rsass/tests/spec/core_functions/selector/parse/selector.rs +++ b/rsass/tests/spec/core_functions/selector/parse/selector.rs @@ -12,7 +12,8 @@ mod complex { #[test] fn adjacent_sibling() { assert_eq!( - runner().ok("$result: selector-parse(\"b + c + d\");\ + runner().ok("@use \"sass:selector\";\ + \n$result: selector.parse(\"b + c + d\");\ \na {\ \n result: $result;\ \n structure: $result == (b \"+\" c \"+\" d,);\ @@ -30,7 +31,8 @@ mod complex { #[test] fn leading() { assert_eq!( - runner().ok("$result: selector-parse(\"> b\");\ + runner().ok("@use \"sass:selector\";\ + \n$result: selector.parse(\"> b\");\ \na {\ \n result: $result;\ \n structure: $result == (\">\" b,);\ @@ -48,7 +50,8 @@ mod complex { #[test] fn middle() { assert_eq!( - runner().ok("$result: selector-parse(\"b + ~ c\");\ + runner().ok("@use \"sass:selector\";\ + \n$result: selector.parse(\"b + ~ c\");\ \na {\ \n result: $result;\ \n structure: $result == (b \"+\" \"~\" c,);\ @@ -62,7 +65,8 @@ mod complex { #[test] fn trailing() { assert_eq!( - runner().ok("$result: selector-parse(\"b ~~\");\ + runner().ok("@use \"sass:selector\";\ + \n$result: selector.parse(\"b ~~\");\ \na {\ \n result: $result;\ \n structure: $result == (b \"~\" \"~\",);\ @@ -77,10 +81,12 @@ mod complex { #[test] fn only() { assert_eq!( - runner().ok("$result: selector-parse(\">\");\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:selector\";\ + \n$result: selector.parse(\">\");\ \na {\ \n result: $result;\ - \n structure: $result == (append((), \">\"),);\ + \n structure: $result == (list.append((), \">\"),);\ \n}\n"), "a {\ \n result: >;\ @@ -91,7 +97,8 @@ mod complex { #[test] fn trailing() { assert_eq!( - runner().ok("$result: selector-parse(\"b +\");\ + runner().ok("@use \"sass:selector\";\ + \n$result: selector.parse(\"b +\");\ \na {\ \n result: $result;\ \n structure: $result == (b \"+\",);\ @@ -106,7 +113,8 @@ mod complex { #[test] fn child() { assert_eq!( - runner().ok("$result: selector-parse(\"b > c > d\");\ + runner().ok("@use \"sass:selector\";\ + \n$result: selector.parse(\"b > c > d\");\ \na {\ \n result: $result;\ \n structure: $result == (b \">\" c \">\" d,);\ @@ -120,7 +128,8 @@ mod complex { #[test] fn descendant() { assert_eq!( - runner().ok("$result: selector-parse(\"b c d\");\ + runner().ok("@use \"sass:selector\";\ + \n$result: selector.parse(\"b c d\");\ \na {\ \n result: $result;\ \n structure: $result == (b c d,);\ @@ -134,7 +143,8 @@ mod complex { #[test] fn sibling() { assert_eq!( - runner().ok("$result: selector-parse(\"b ~ c ~ d\");\ + runner().ok("@use \"sass:selector\";\ + \n$result: selector.parse(\"b ~ c ~ d\");\ \na {\ \n result: $result;\ \n structure: $result == (b \"~\" c \"~\" d,);\ @@ -149,10 +159,12 @@ mod complex { #[test] fn compound() { assert_eq!( - runner().ok("$result: selector-parse(\"b.c:d\");\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:selector\";\ + \n$result: selector.parse(\"b.c:d\");\ \na {\ \n result: $result;\ - \n structure: $result == (append((), \"b.c:d\"),);\ + \n structure: $result == (list.append((), \"b.c:d\"),);\ \n}\n"), "a {\ \n result: b.c:d;\ @@ -163,7 +175,8 @@ fn compound() { #[test] fn list() { assert_eq!( - runner().ok("$result: selector-parse(\"b c, d e, f g\");\ + runner().ok("@use \"sass:selector\";\ + \n$result: selector.parse(\"b c, d e, f g\");\ \na {\ \n result: $result;\ \n structure: $result == (b c, d e, f g);\ @@ -181,7 +194,8 @@ mod simple { #[test] fn attribute() { assert_eq!( - runner().ok("a {b: selector-parse(\"[c^=d]\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse(\"[c^=d]\")}\n"), "a {\ \n b: [c^=d];\ \n}\n" @@ -190,7 +204,8 @@ mod simple { #[test] fn class() { assert_eq!( - runner().ok("a {b: selector-parse(\".c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse(\".c\")}\n"), "a {\ \n b: .c;\ \n}\n" @@ -199,7 +214,8 @@ mod simple { #[test] fn id() { assert_eq!( - runner().ok("a {b: selector-parse(\"#c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse(\"#c\")}\n"), "a {\ \n b: #c;\ \n}\n" @@ -208,7 +224,8 @@ mod simple { #[test] fn placeholder() { assert_eq!( - runner().ok("a {b: selector-parse(\"%c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse(\"%c\")}\n"), "a {\ \n b: %c;\ \n}\n" @@ -225,7 +242,8 @@ mod simple { #[test] fn arg() { assert_eq!( - runner().ok("a {b: selector-parse(\":c(@#$)\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse(\":c(@#$)\")}\n"), "a {\ \n b: :c(@#$);\ \n}\n" @@ -235,10 +253,12 @@ mod simple { fn combined_arg() { assert_eq!( runner().ok( - "$result: selector-parse(\":nth-child(2n+1 of b, c)\");\ + "@use \"sass:list\";\ + \n@use \"sass:selector\";\ + \n$result: selector.parse(\":nth-child(2n+1 of b, c)\");\ \na {\ \n result: $result;\ - \n structure: $result == (append((), \":nth-child(2n+1 of b, c)\"),);\ + \n structure: $result == (list.append((), \":nth-child(2n+1 of b, c)\"),);\ \n}\n" ), "a {\ @@ -250,7 +270,8 @@ mod simple { #[test] fn no_arg() { assert_eq!( - runner().ok("a {b: selector-parse(\":c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse(\":c\")}\n"), "a {\ \n b: :c;\ \n}\n" @@ -263,13 +284,13 @@ mod simple { #[test] fn is() { assert_eq!( - runner().ok( - "$result: selector-parse(\":is(b, c)\");\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:selector\";\ + \n$result: selector.parse(\":is(b, c)\");\ \na {\ \n result: $result;\ - \n structure: $result == (append((), \":is(b, c)\"),);\ - \n}\n" - ), + \n structure: $result == (list.append((), \":is(b, c)\"),);\ + \n}\n"), "a {\ \n result: :is(b, c);\ \n structure: true;\ @@ -279,29 +300,31 @@ mod simple { #[test] fn matches() { assert_eq!( - runner().ok( - "$result: selector-parse(\":matches(b, c)\");\ + runner().ok( + "@use \"sass:list\";\ + \n@use \"sass:selector\";\ + \n$result: selector.parse(\":matches(b, c)\");\ \na {\ \n result: $result;\ - \n structure: $result == (append((), \":matches(b, c)\"),);\ + \n structure: $result == (list.append((), \":matches(b, c)\"),);\ \n}\n" - ), - "a {\ + ), + "a {\ \n result: :matches(b, c);\ \n structure: true;\ \n}\n" - ); + ); } #[test] fn test_where() { assert_eq!( - runner().ok( - "$result: selector-parse(\":where(b, c)\");\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:selector\";\ + \n$result: selector.parse(\":where(b, c)\");\ \na {\ \n result: $result;\ - \n structure: $result == (append((), \":where(b, c)\"),);\ - \n}\n" - ), + \n structure: $result == (list.append((), \":where(b, c)\"),);\ + \n}\n"), "a {\ \n result: :where(b, c);\ \n structure: true;\ @@ -317,7 +340,8 @@ mod simple { #[test] fn arg() { assert_eq!( - runner().ok("a {b: selector-parse(\"::c(@#$)\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse(\"::c(@#$)\")}\n"), "a {\ \n b: ::c(@#$);\ \n}\n" @@ -326,7 +350,8 @@ mod simple { #[test] fn no_arg() { assert_eq!( - runner().ok("a {b: selector-parse(\"::c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse(\"::c\")}\n"), "a {\ \n b: ::c;\ \n}\n" @@ -335,25 +360,28 @@ mod simple { #[test] fn selector_arg() { assert_eq!( - runner().ok( - "$result: selector-parse(\"::slotted(b, c)\");\ + runner().ok( + "@use \"sass:list\";\ + \n@use \"sass:selector\";\ + \n$result: selector.parse(\"::slotted(b, c)\");\ \na {\ \n result: $result;\ - \n structure: $result == (append((), \"::slotted(b, c)\"),);\ + \n structure: $result == (list.append((), \"::slotted(b, c)\"),);\ \n}\n" - ), - "a {\ + ), + "a {\ \n result: ::slotted(b, c);\ \n structure: true;\ \n}\n" - ); + ); } } } #[test] fn test_type() { assert_eq!( - runner().ok("a {b: selector-parse(\"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse(\"c\")}\n"), "a {\ \n b: c;\ \n}\n" @@ -362,7 +390,8 @@ mod simple { #[test] fn universal() { assert_eq!( - runner().ok("a {b: selector-parse(\"*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse(\"*\")}\n"), "a {\ \n b: *;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/parse/structure.rs b/rsass/tests/spec/core_functions/selector/parse/structure.rs index 7badb4e66..4f9544eb6 100644 --- a/rsass/tests/spec/core_functions/selector/parse/structure.rs +++ b/rsass/tests/spec/core_functions/selector/parse/structure.rs @@ -16,7 +16,8 @@ mod decomposed { #[test] fn mixed() { assert_eq!( - runner().ok("a {b: selector-parse(c \"d\" e)}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse(c \"d\" e)}\n"), "a {\ \n b: c d e;\ \n}\n" @@ -25,7 +26,8 @@ mod decomposed { #[test] fn quoted() { assert_eq!( - runner().ok("a {b: selector-parse(\"c\" \"d\" \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse(\"c\" \"d\" \"e\")}\n"), "a {\ \n b: c d e;\ \n}\n" @@ -34,7 +36,8 @@ mod decomposed { #[test] fn unquoted() { assert_eq!( - runner().ok("a {b: selector-parse(c d e)}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse(c d e)}\n"), "a {\ \n b: c d e;\ \n}\n" @@ -48,7 +51,8 @@ mod decomposed { #[test] fn mixed() { assert_eq!( - runner().ok("a {b: selector-parse((c \"d\", e \"f\"))}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse((c \"d\", e \"f\"))}\n"), "a {\ \n b: c d, e f;\ \n}\n" @@ -57,9 +61,8 @@ mod decomposed { #[test] fn quoted() { assert_eq!( - runner().ok( - "a {b: selector-parse((\"c\" \"d\", \"e\" \"f\"))}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse((\"c\" \"d\", \"e\" \"f\"))}\n"), "a {\ \n b: c d, e f;\ \n}\n" @@ -68,7 +71,8 @@ mod decomposed { #[test] fn unquoted() { assert_eq!( - runner().ok("a {b: selector-parse((c d, e f))}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse((c d, e f))}\n"), "a {\ \n b: c d, e f;\ \n}\n" @@ -82,7 +86,8 @@ mod decomposed { #[test] fn mixed() { assert_eq!( - runner().ok("a {b: selector-parse(c \"d, e\" f)}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse(c \"d, e\" f)}\n"), "a {\ \n b: c d, e f;\ \n}\n" @@ -91,7 +96,8 @@ mod decomposed { #[test] fn quoted() { assert_eq!( - runner().ok("a {b: selector-parse(\"c\" \"d, e\" \"f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse(\"c\" \"d, e\" \"f\")}\n"), "a {\ \n b: c d, e f;\ \n}\n" @@ -100,7 +106,9 @@ mod decomposed { #[test] fn unquoted() { assert_eq!( - runner().ok("a {b: selector-parse(c unquote(\"d, e\") f)}\n"), + runner().ok("@use \"sass:selector\";\ + \n@use \"sass:string\";\ + \na {b: selector.parse(c string.unquote(\"d, e\") f)}\n"), "a {\ \n b: c d, e f;\ \n}\n" @@ -114,8 +122,9 @@ mod decomposed { #[test] fn mixed() { assert_eq!( - runner() - .ok("a {b: selector-parse((c d, unquote(\"e f\")))}\n"), + runner().ok("@use \"sass:selector\";\ + \n@use \"sass:string\";\ + \na {b: selector.parse((c d, string.unquote(\"e f\")))}\n"), "a {\ \n b: c d, e f;\ \n}\n" @@ -124,7 +133,8 @@ mod decomposed { #[test] fn quoted() { assert_eq!( - runner().ok("a {b: selector-parse((\"c d\", \"e f\"))}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse((\"c d\", \"e f\"))}\n"), "a {\ \n b: c d, e f;\ \n}\n" @@ -134,7 +144,9 @@ mod decomposed { fn unquoted() { assert_eq!( runner().ok( - "a {b: selector-parse((unquote(\"c d\"), unquote(\"e f\")))}\n" + "@use \"sass:selector\";\ + \n@use \"sass:string\";\ + \na {b: selector.parse((string.unquote(\"c d\"), string.unquote(\"e f\")))}\n" ), "a {\ \n b: c d, e f;\ @@ -150,7 +162,8 @@ mod full_string { #[test] fn quoted() { assert_eq!( - runner().ok("a {b: selector-parse(\"c d, e f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.parse(\"c d, e f\")}\n"), "a {\ \n b: c d, e f;\ \n}\n" @@ -159,7 +172,9 @@ mod full_string { #[test] fn unquoted() { assert_eq!( - runner().ok("a {b: selector-parse(unquote(\"c d, e f\"))}\n"), + runner().ok("@use \"sass:selector\";\ + \n@use \"sass:string\";\ + \na {b: selector.parse(string.unquote(\"c d, e f\"))}\n"), "a {\ \n b: c d, e f;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/replace.rs b/rsass/tests/spec/core_functions/selector/replace.rs index a94035f36..a23988e31 100644 --- a/rsass/tests/spec/core_functions/selector/replace.rs +++ b/rsass/tests/spec/core_functions/selector/replace.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn complex() { assert_eq!( - runner().ok("a {b: selector-replace(\"c d\", \"d\", \"e f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.replace(\"c d\", \"d\", \"e f\")}\n"), "a {\ \n b: c e f, e c f;\ \n}\n" @@ -17,7 +18,8 @@ fn complex() { #[test] fn compound() { assert_eq!( - runner().ok("a {b: selector-replace(\"c.d\", \"c\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.replace(\"c.d\", \"c\", \"e\")}\n"), "a {\ \n b: e.d;\ \n}\n" @@ -38,36 +40,41 @@ mod error { #[test] fn list() { assert_eq!( - runner() - .err("a {b: selector-replace(\"c\", d e, \"f\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.replace(\"c\", d e, \"f\")}\n" + ), "Error: Can\'t extend complex selector d e.\ \n ,\ - \n1 | a {b: selector-replace(\"c\", d e, \"f\")}\ + \n2 | a {b: selector.replace(\"c\", d e, \"f\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn string() { assert_eq!( runner().err( - "a {b: selector-replace(\"c\", \"d e\", \"f\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.replace(\"c\", \"d e\", \"f\")}\n" ), "Error: Can\'t extend complex selector d e.\ \n ,\ - \n1 | a {b: selector-replace(\"c\", \"d e\", \"f\")}\ + \n2 | a {b: selector.replace(\"c\", \"d e\", \"f\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn invalid() { assert_eq!( - runner() - .err("a {b: selector-replace(\"c\", \"[d\", \"e\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.replace(\"c\", \"[d\", \"e\")}\n" + ), "Error: $original: expected more input.\ \n ,\ \n1 | [d\ @@ -75,17 +82,19 @@ mod error { \n \'\ \n - 1:3 root stylesheet\ \n ,\ - \n1 | a {b: selector-replace(\"c\", \"[d\", \"e\")}\ + \n2 | a {b: selector.replace(\"c\", \"[d\", \"e\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn parent() { assert_eq!( - runner() - .err("a {b: selector-replace(\"c\", \"&\", \"d\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.replace(\"c\", \"&\", \"d\")}\n" + ), "Error: $original: Parent selectors aren\'t allowed here.\ \n ,\ \n1 | &\ @@ -93,25 +102,26 @@ mod error { \n \'\ \n - 1:1 root stylesheet\ \n ,\ - \n1 | a {b: selector-replace(\"c\", \"&\", \"d\")}\ + \n2 | a {b: selector.replace(\"c\", \"&\", \"d\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( runner().err( - "a {b: selector-replace(\"c\", 1, \"d\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.replace(\"c\", 1, \"d\")}\n" ), "Error: $original: 1 is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | a {b: selector-replace(\"c\", 1, \"d\")}\ + \n2 | a {b: selector.replace(\"c\", 1, \"d\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -122,8 +132,10 @@ mod error { #[test] fn invalid() { assert_eq!( - runner() - .err("a {b: selector-replace(\"c\", \"d\", \"[e\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.replace(\"c\", \"d\", \"[e\")}\n" + ), "Error: $replacement: expected more input.\ \n ,\ \n1 | [e\ @@ -131,17 +143,19 @@ mod error { \n \'\ \n - 1:3 root stylesheet\ \n ,\ - \n1 | a {b: selector-replace(\"c\", \"d\", \"[e\")}\ + \n2 | a {b: selector.replace(\"c\", \"d\", \"[e\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn parent() { assert_eq!( - runner() - .err("a {b: selector-replace(\"c\", \"d\", \"&\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.replace(\"c\", \"d\", \"&\")}\n" + ), "Error: $replacement: Parent selectors aren\'t allowed here.\ \n ,\ \n1 | &\ @@ -149,25 +163,26 @@ mod error { \n \'\ \n - 1:1 root stylesheet\ \n ,\ - \n1 | a {b: selector-replace(\"c\", \"d\", \"&\")}\ + \n2 | a {b: selector.replace(\"c\", \"d\", \"&\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( runner().err( - "a {b: selector-replace(\"c\", \"d\", 1)}\n" + "@use \"sass:selector\";\ + \na {b: selector.replace(\"c\", \"d\", 1)}\n" ), "Error: $replacement: 1 is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | a {b: selector-replace(\"c\", \"d\", 1)}\ + \n2 | a {b: selector.replace(\"c\", \"d\", 1)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -178,8 +193,10 @@ mod error { #[test] fn invalid() { assert_eq!( - runner() - .err("a {b: selector-replace(\"[c\", \"d\", \"e\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.replace(\"[c\", \"d\", \"e\")}\n" + ), "Error: $selector: expected more input.\ \n ,\ \n1 | [c\ @@ -187,17 +204,19 @@ mod error { \n \'\ \n - 1:3 root stylesheet\ \n ,\ - \n1 | a {b: selector-replace(\"[c\", \"d\", \"e\")}\ + \n2 | a {b: selector.replace(\"[c\", \"d\", \"e\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn parent() { assert_eq!( - runner() - .err("a {b: selector-replace(\"&\", \"c\", \"d\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.replace(\"&\", \"c\", \"d\")}\n" + ), "Error: $selector: Parent selectors aren\'t allowed here.\ \n ,\ \n1 | &\ @@ -205,25 +224,26 @@ mod error { \n \'\ \n - 1:1 root stylesheet\ \n ,\ - \n1 | a {b: selector-replace(\"&\", \"c\", \"d\")}\ + \n2 | a {b: selector.replace(\"&\", \"c\", \"d\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( runner().err( - "a {b: selector-replace(1, \"c\", \"d\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.replace(1, \"c\", \"d\")}\n" ), "Error: $selector: 1 is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | a {b: selector-replace(1, \"c\", \"d\")}\ + \n2 | a {b: selector.replace(1, \"c\", \"d\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -231,38 +251,55 @@ mod error { fn too_few_args() { assert_eq!( runner().err( - "a {b: selector-replace(\"c\", \"d\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.replace(\"c\", \"d\")}\n" ), "Error: Missing argument $replacement.\ \n ,--> input.scss\ - \n1 | a {b: selector-replace(\"c\", \"d\")}\ + \n2 | a {b: selector.replace(\"c\", \"d\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:selector\ \n1 | @function replace($selector, $original, $replacement) {\ \n | =========================================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( runner().err( - "a {b: selector-replace(\"c\", \"d\", \"e\", \"f\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.replace(\"c\", \"d\", \"e\", \"f\")}\n" ), "Error: Only 3 arguments allowed, but 4 were passed.\ \n ,--> input.scss\ - \n1 | a {b: selector-replace(\"c\", \"d\", \"e\", \"f\")}\ + \n2 | a {b: selector.replace(\"c\", \"d\", \"e\", \"f\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:selector\ \n1 | @function replace($selector, $original, $replacement) {\ \n | =========================================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } + #[test] + fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.selector-replace(c, c, d)}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: selector.selector-replace(c, c, d)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } } mod format { #[allow(unused)] @@ -279,9 +316,8 @@ mod format { #[test] fn compound() { assert_eq!( - runner().ok( - "a {b: selector-replace(\"c.d\", \"c.d\", \".e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.replace(\"c.d\", \"c.d\", \".e\")}\n"), "a {\ \n b: .e;\ \n}\n" @@ -290,24 +326,24 @@ mod format { #[test] fn list() { assert_eq!( - runner().ok( - "a {b: selector-replace(\"c.d\", \"c, .d\", \".e\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.replace(\"c.d\", \"c, .d\", \".e\")}\n"), + "a {\ \n b: .e;\ \n}\n" - ); + ); } #[test] fn list_of_compound() { assert_eq!( - runner().ok( - "a {b: selector-replace(\"c.d.e.f\", \"c.d, .e.f\", \".g\")}\n" - ), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.replace(\"c.d.e.f\", \"c.d, .e.f\", \".g\")}\n" + ), + "a {\ \n b: .g;\ \n}\n" - ); + ); } } mod non_string { @@ -317,20 +353,18 @@ mod format { #[test] fn extendee() { assert_eq!( - runner().ok( - "a {b: selector-replace(\"c.d\", (c, \".d\"), \".e\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.replace(\"c.d\", (c, \".d\"), \".e\")}\n"), + "a {\ \n b: .e;\ \n}\n" - ); + ); } #[test] fn extender() { assert_eq!( - runner().ok( - "a {b: selector-replace(\"c\", \"c\", (d, e f))}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.replace(\"c\", \"c\", (d, e f))}\n"), "a {\ \n b: d, e f;\ \n}\n" @@ -339,9 +373,8 @@ mod format { #[test] fn selector() { assert_eq!( - runner().ok( - "a {b: selector-replace((c, d c), \"c\", \"e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.replace((c, d c), \"c\", \"e\")}\n"), "a {\ \n b: e, d e;\ \n}\n" @@ -352,13 +385,12 @@ mod format { #[test] fn output() { assert_eq!( - runner().ok( - "$result: selector-replace(\"c d, e f\", \"g\", \"g\");\ + runner().ok("@use \"sass:selector\";\ + \n$result: selector.replace(\"c d, e f\", \"g\", \"g\");\ \na {\ \n result: $result;\ \n structure: $result == (\"c\" \"d\", \"e\" \"f\");\ - \n}\n" - ), + \n}\n"), "a {\ \n result: c d, e f;\ \n structure: true;\ @@ -370,7 +402,8 @@ mod format { fn named() { assert_eq!( runner().ok( - "a {b: selector-replace($selector: \"c.d\", $original: \"c\", $replacement: \"e\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.replace($selector: \"c.d\", $original: \"c\", $replacement: \"e\")}\n" ), "a {\ \n b: e.d;\ @@ -380,7 +413,8 @@ fn named() { #[test] fn no_op() { assert_eq!( - runner().ok("a {b: selector-replace(\"c\", \"d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.replace(\"c\", \"d\", \"e\")}\n"), "a {\ \n b: c;\ \n}\n" @@ -389,7 +423,8 @@ fn no_op() { #[test] fn partial_no_op() { assert_eq!( - runner().ok("a {b: selector-replace(\"c, d\", \"d\", \"e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.replace(\"c, d\", \"d\", \"e\")}\n"), "a {\ \n b: c, e;\ \n}\n" @@ -402,8 +437,8 @@ mod selector_pseudo { #[test] fn is() { assert_eq!( - runner() - .ok("a {b: selector-replace(\":is(c)\", \"c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.replace(\":is(c)\", \"c\", \"d\")}\n"), "a {\ \n b: :is(d);\ \n}\n" @@ -412,9 +447,8 @@ mod selector_pseudo { #[test] fn matches() { assert_eq!( - runner().ok( - "a {b: selector-replace(\":matches(c)\", \"c\", \"d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.replace(\":matches(c)\", \"c\", \"d\")}\n"), "a {\ \n b: :matches(d);\ \n}\n" @@ -423,8 +457,8 @@ mod selector_pseudo { #[test] fn not() { assert_eq!( - runner() - .ok("a {b: selector-replace(\":not(c)\", \"c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.replace(\":not(c)\", \"c\", \"d\")}\n"), "a {\ \n b: :not(d);\ \n}\n" @@ -433,8 +467,8 @@ mod selector_pseudo { #[test] fn test_where() { assert_eq!( - runner() - .ok("a {b: selector-replace(\":where(c)\", \"c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.replace(\":where(c)\", \"c\", \"d\")}\n"), "a {\ \n b: :where(d);\ \n}\n" @@ -444,7 +478,8 @@ mod selector_pseudo { #[test] fn simple() { assert_eq!( - runner().ok("a {b: selector-replace(\"c\", \"c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.replace(\"c\", \"c\", \"d\")}\n"), "a {\ \n b: d;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/unify/chooses_superselector.rs b/rsass/tests/spec/core_functions/selector/unify/chooses_superselector.rs index 5a47add03..4ef343c90 100644 --- a/rsass/tests/spec/core_functions/selector/unify/chooses_superselector.rs +++ b/rsass/tests/spec/core_functions/selector/unify/chooses_superselector.rs @@ -12,7 +12,8 @@ mod parent { #[test] fn selector1() { assert_eq!( - runner().ok("a {b: selector-unify(\"c d\", \"c.e .f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"c d\", \"c.e .f\")}\n"), "a {\ \n b: c.e d.f;\ \n}\n" @@ -21,7 +22,8 @@ mod parent { #[test] fn selector2() { assert_eq!( - runner().ok("a {b: selector-unify(\"c.e .f\", \"c d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"c.e .f\", \"c d\")}\n"), "a {\ \n b: c.e d.f;\ \n}\n" @@ -35,7 +37,8 @@ mod whole_selector { #[test] fn selector1() { assert_eq!( - runner().ok("a {b: selector-unify(\"c\", \"d c.e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"c\", \"d c.e\")}\n"), "a {\ \n b: d c.e;\ \n}\n" @@ -44,7 +47,8 @@ mod whole_selector { #[test] fn selector2() { assert_eq!( - runner().ok("a {b: selector-unify(\"d c.e\", \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"d c.e\", \"c\")}\n"), "a {\ \n b: d c.e;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/unify/complex/combinators/child.rs b/rsass/tests/spec/core_functions/selector/unify/complex/combinators/child.rs index fe39e25d4..8a90e37b0 100644 --- a/rsass/tests/spec/core_functions/selector/unify/complex/combinators/child.rs +++ b/rsass/tests/spec/core_functions/selector/unify/complex/combinators/child.rs @@ -13,7 +13,9 @@ mod and_child { fn conflict() { assert_eq!( runner().ok( - "a {b: inspect(selector-unify(\"#s1-1 > .s1-2\", \"#s2-1 > .s2-2\"))}\n" + "@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"#s1-1 > .s1-2\", \"#s2-1 > .s2-2\"))}\n" ), "a {\ \n b: null;\ @@ -23,7 +25,8 @@ mod and_child { #[test] fn distinct() { assert_eq!( - runner().ok("a {b: selector-unify(\".c > .d\", \".e > .f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c > .d\", \".e > .f\")}\n"), "a {\ \n b: .e.c > .d.f;\ \n}\n" @@ -33,7 +36,8 @@ mod and_child { fn overlap() { assert_eq!( runner().ok( - "a {b: selector-unify(\".c.s1-1 > .s1-2\", \".c.s2-1 > .s2-2\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(\".c.s1-1 > .s1-2\", \".c.s2-1 > .s2-2\")}\n" ), "a {\ \n b: .c.s2-1.s1-1 > .s1-2.s2-2;\ @@ -43,9 +47,8 @@ mod and_child { #[test] fn superselector() { assert_eq!( - runner().ok( - "a {b: selector-unify(\".c.s1-1 > .s1-2\", \".c > .s2\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c.s1-1 > .s1-2\", \".c > .s2\")}\n"), "a {\ \n b: .c.s1-1 > .s1-2.s2;\ \n}\n" @@ -59,7 +62,8 @@ mod and_descendant { #[test] fn distinct() { assert_eq!( - runner().ok("a {b: selector-unify(\".c > .d\", \".e .f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c > .d\", \".e .f\")}\n"), "a {\ \n b: .e .c > .d.f;\ \n}\n" @@ -68,7 +72,8 @@ mod and_descendant { #[test] fn identical() { assert_eq!( - runner().ok("a {b: selector-unify(\".c > .s1\", \".c .s2\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c > .s1\", \".c .s2\")}\n"), "a {\ \n b: .c > .s1.s2;\ \n}\n" @@ -78,7 +83,8 @@ mod and_descendant { fn overlap() { assert_eq!( runner().ok( - "a {b: selector-unify(\".c.s1-1 > .s1-2\", \".c.s2-1 .s2-2\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(\".c.s1-1 > .s1-2\", \".c.s2-1 .s2-2\")}\n" ), "a {\ \n b: .c.s2-1 .c.s1-1 > .s1-2.s2-2;\ @@ -88,9 +94,8 @@ mod and_descendant { #[test] fn superselector() { assert_eq!( - runner().ok( - "a {b: selector-unify(\".c.s1-1 > .s1-2\", \".c .s2\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c.s1-1 > .s1-2\", \".c .s2\")}\n"), "a {\ \n b: .c.s1-1 > .s1-2.s2;\ \n}\n" @@ -100,7 +105,8 @@ mod and_descendant { #[test] fn and_next_sibling() { assert_eq!( - runner().ok("a {b: selector-unify(\".c > .s1\", \".c + .s2\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c > .s1\", \".c + .s2\")}\n"), "a {\ \n b: .c > .c + .s1.s2;\ \n}\n" @@ -109,7 +115,8 @@ fn and_next_sibling() { #[test] fn and_sibling() { assert_eq!( - runner().ok("a {b: selector-unify(\".c > .s1\", \".c ~ .s2\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c > .s1\", \".c ~ .s2\")}\n"), "a {\ \n b: .c > .c ~ .s1.s2;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/unify/complex/combinators/initial.rs b/rsass/tests/spec/core_functions/selector/unify/complex/combinators/initial.rs index b45b6d7b5..f8d3ecabe 100644 --- a/rsass/tests/spec/core_functions/selector/unify/complex/combinators/initial.rs +++ b/rsass/tests/spec/core_functions/selector/unify/complex/combinators/initial.rs @@ -9,7 +9,9 @@ fn runner() -> crate::TestRunner { fn different() { assert_eq!( runner().ok( - "a {b: inspect(selector-unify(\"+ ~ > .c\", \"+ > ~ ~ .d\"))}\n" + "@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"+ ~ > .c\", \"+ > ~ ~ .d\"))}\n" ), "a {\ \n b: null;\ @@ -23,7 +25,8 @@ mod only_one { #[test] fn selector1() { assert_eq!( - runner().ok("a {b: selector-unify(\"> .c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"> .c\", \".d\")}\n"), "a {\ \n b: > .c.d;\ \n}\n" @@ -32,7 +35,8 @@ mod only_one { #[test] fn selector2() { assert_eq!( - runner().ok("a {b: selector-unify(\".c\", \"~ .d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c\", \"~ .d\")}\n"), "a {\ \n b: ~ .c.d;\ \n}\n" @@ -42,7 +46,8 @@ mod only_one { #[test] fn same() { assert_eq!( - runner().ok("a {b: selector-unify(\"+ .c\", \"+ .d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"+ .c\", \"+ .d\")}\n"), "a {\ \n b: + .c.d;\ \n}\n" @@ -55,18 +60,16 @@ mod supersequence { #[test] fn contiguous() { assert_eq!( - runner().ok( - "a {b: selector-unify(\"+ ~ > .c\", \"> + ~ > > .d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"+ ~ > .c\", \"> + ~ > > .d\")}\n"), "" ); } #[test] fn non_contiguous() { assert_eq!( - runner().ok( - "a {b: selector-unify(\"+ ~ > .c\", \"+ > ~ ~ > .d\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"+ ~ > .c\", \"+ > ~ ~ > .d\")}\n"), "" ); } diff --git a/rsass/tests/spec/core_functions/selector/unify/complex/combinators/multiple.rs b/rsass/tests/spec/core_functions/selector/unify/complex/combinators/multiple.rs index f8e4ad027..c4b9b17a5 100644 --- a/rsass/tests/spec/core_functions/selector/unify/complex/combinators/multiple.rs +++ b/rsass/tests/spec/core_functions/selector/unify/complex/combinators/multiple.rs @@ -13,7 +13,9 @@ mod in_a_row { fn different() { assert_eq!( runner().ok( - "a {b: inspect(selector-unify(\".c + ~ > .d\", \".e + > ~ ~ .f\"))}\n" + "@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\".c + ~ > .d\", \".e + > ~ ~ .f\"))}\n" ), "a {\ \n b: null;\ @@ -23,9 +25,8 @@ mod in_a_row { #[test] fn same() { assert_eq!( - runner().ok( - "a {b: selector-unify(\".c + ~ > .d\", \".e + ~ > .f\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c + ~ > .d\", \".e + ~ > .f\")}\n"), "" ); } @@ -36,28 +37,30 @@ mod in_a_row { #[test] fn contiguous() { assert_eq!( - runner().ok( - "a {b: selector-unify(\".c + ~ > .d\", \".e > + ~ > > .f\")}\n" - ), - "" - ); + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.unify(\".c + ~ > .d\", \".e > + ~ > > .f\")}\n" + ), + "" + ); } #[test] fn non_contiguous() { assert_eq!( - runner().ok( - "a {b: selector-unify(\".c + ~ > .d\", \".e + > ~ ~ > .f\")}\n" - ), - "" - ); + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.unify(\".c + ~ > .d\", \".e + > ~ ~ > .f\")}\n" + ), + "" + ); } } } #[test] fn isolated() { assert_eq!( - runner() - .ok("a {b: selector-unify(\".c > .d + .e\", \".f .g ~ .h\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c > .d + .e\", \".f .g ~ .h\")}\n"), "a {\ \n b: .f .c > .g ~ .d + .e.h, .f .c > .d.g + .e.h;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/unify/complex/combinators/next_sibling.rs b/rsass/tests/spec/core_functions/selector/unify/complex/combinators/next_sibling.rs index 66184976a..a0fc72948 100644 --- a/rsass/tests/spec/core_functions/selector/unify/complex/combinators/next_sibling.rs +++ b/rsass/tests/spec/core_functions/selector/unify/complex/combinators/next_sibling.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn and_child() { assert_eq!( - runner().ok("a {b: selector-unify(\".c + .s1\", \".c > .s2\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c + .s1\", \".c > .s2\")}\n"), "a {\ \n b: .c > .c + .s1.s2;\ \n}\n" @@ -17,7 +18,8 @@ fn and_child() { #[test] fn and_descendant() { assert_eq!( - runner().ok("a {b: selector-unify(\".c + .s1\", \".c .s2\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c + .s1\", \".c .s2\")}\n"), "a {\ \n b: .c .c + .s1.s2;\ \n}\n" @@ -31,7 +33,9 @@ mod and_next_sibling { fn conflict() { assert_eq!( runner().ok( - "a {b: inspect(selector-unify(\"#s1-1 + .s1-2\", \"#s2-1 + .s2-2\"))}\n" + "@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"#s1-1 + .s1-2\", \"#s2-1 + .s2-2\"))}\n" ), "a {\ \n b: null;\ @@ -41,7 +45,8 @@ mod and_next_sibling { #[test] fn distinct() { assert_eq!( - runner().ok("a {b: selector-unify(\".c + .d\", \".e + .f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c + .d\", \".e + .f\")}\n"), "a {\ \n b: .e.c + .d.f;\ \n}\n" @@ -51,7 +56,8 @@ mod and_next_sibling { fn overlap() { assert_eq!( runner().ok( - "a {b: selector-unify(\".c.s1-1 + .s1-2\", \".c.s2-1 + .s2-2\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(\".c.s1-1 + .s1-2\", \".c.s2-1 + .s2-2\")}\n" ), "a {\ \n b: .c.s2-1.s1-1 + .s1-2.s2-2;\ @@ -61,9 +67,8 @@ mod and_next_sibling { #[test] fn superselector() { assert_eq!( - runner().ok( - "a {b: selector-unify(\".c.s1-1 + .s1-2\", \".c + .s2\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c.s1-1 + .s1-2\", \".c + .s2\")}\n"), "a {\ \n b: .c.s1-1 + .s1-2.s2;\ \n}\n" @@ -77,18 +82,20 @@ mod and_sibling { #[test] fn conflict() { assert_eq!( - runner().ok( - "a {b: selector-unify(\"#s1-1 + .s1-2\", \"#s2-1 ~ .s2-2\")}\n" - ), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.unify(\"#s1-1 + .s1-2\", \"#s2-1 ~ .s2-2\")}\n" + ), + "a {\ \n b: #s2-1 ~ #s1-1 + .s1-2.s2-2;\ \n}\n" - ); + ); } #[test] fn distinct() { assert_eq!( - runner().ok("a {b: selector-unify(\".c + .d\", \".e ~ .f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c + .d\", \".e ~ .f\")}\n"), "a {\ \n b: .e ~ .c + .d.f, .c.e + .d.f;\ \n}\n" @@ -97,8 +104,8 @@ mod and_sibling { #[test] fn identical() { assert_eq!( - runner() - .ok("a {b: selector-unify(\".c + .s1\", \".c ~ .s2\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c + .s1\", \".c ~ .s2\")}\n"), "a {\ \n b: .c + .s1.s2;\ \n}\n" @@ -108,7 +115,8 @@ mod and_sibling { fn overlap() { assert_eq!( runner().ok( - "a {b: selector-unify(\".c.s1-1 + .s1-2\", \".c.s2-1 ~ .s2-2\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(\".c.s1-1 + .s1-2\", \".c.s2-1 ~ .s2-2\")}\n" ), "a {\ \n b: .c.s2-1 ~ .c.s1-1 + .s1-2.s2-2, .c.s1-1.s2-1 + .s1-2.s2-2;\ @@ -118,9 +126,8 @@ mod and_sibling { #[test] fn superselector() { assert_eq!( - runner().ok( - "a {b: selector-unify(\".c.s1-1 + .s1-2\", \".c ~ .s2\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c.s1-1 + .s1-2\", \".c ~ .s2\")}\n"), "a {\ \n b: .c.s1-1 + .s1-2.s2;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/unify/complex/combinators/sibling.rs b/rsass/tests/spec/core_functions/selector/unify/complex/combinators/sibling.rs index 6db5d4378..70cb3bbcd 100644 --- a/rsass/tests/spec/core_functions/selector/unify/complex/combinators/sibling.rs +++ b/rsass/tests/spec/core_functions/selector/unify/complex/combinators/sibling.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn and_child() { assert_eq!( - runner().ok("a {b: selector-unify(\".c ~ .s1\", \".c > .s2\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c ~ .s1\", \".c > .s2\")}\n"), "a {\ \n b: .c > .c ~ .s1.s2;\ \n}\n" @@ -17,7 +18,8 @@ fn and_child() { #[test] fn and_descendant() { assert_eq!( - runner().ok("a {b: selector-unify(\".c ~ .s1\", \".c .s2\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c ~ .s1\", \".c .s2\")}\n"), "a {\ \n b: .c .c ~ .s1.s2;\ \n}\n" @@ -30,18 +32,20 @@ mod and_next_sibling { #[test] fn conflict() { assert_eq!( - runner().ok( - "a {b: selector-unify(\"#s1-1 ~ .s1-2\", \"#s2-1 + .s2-2\")}\n" - ), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.unify(\"#s1-1 ~ .s1-2\", \"#s2-1 + .s2-2\")}\n" + ), + "a {\ \n b: #s1-1 ~ #s2-1 + .s1-2.s2-2;\ \n}\n" - ); + ); } #[test] fn distinct() { assert_eq!( - runner().ok("a {b: selector-unify(\".c ~ .d\", \".e + .f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c ~ .d\", \".e + .f\")}\n"), "a {\ \n b: .c ~ .e + .d.f, .e.c + .d.f;\ \n}\n" @@ -50,8 +54,8 @@ mod and_next_sibling { #[test] fn identical() { assert_eq!( - runner() - .ok("a {b: selector-unify(\".c ~ .s1\", \".c + .s2\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c ~ .s1\", \".c + .s2\")}\n"), "a {\ \n b: .c + .s1.s2;\ \n}\n" @@ -61,7 +65,8 @@ mod and_next_sibling { fn overlap() { assert_eq!( runner().ok( - "a {b: selector-unify(\".c.s1-1 ~ .s1-2\", \".c.s2-1 + .s2-2\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(\".c.s1-1 ~ .s1-2\", \".c.s2-1 + .s2-2\")}\n" ), "a {\ \n b: .c.s1-1 ~ .c.s2-1 + .s1-2.s2-2, .c.s2-1.s1-1 + .s1-2.s2-2;\ @@ -71,9 +76,8 @@ mod and_next_sibling { #[test] fn superselector() { assert_eq!( - runner().ok( - "a {b: selector-unify(\".c.s1-1 ~ .s1-2\", \".c + .s2\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c.s1-1 ~ .s1-2\", \".c + .s2\")}\n"), "a {\ \n b: .c.s1-1 ~ .c + .s1-2.s2, .c.s1-1 + .s1-2.s2;\ \n}\n" @@ -87,18 +91,20 @@ mod and_sibling { #[test] fn conflict() { assert_eq!( - runner().ok( - "a {b: selector-unify(\"#s1-1 ~ .s1-2\", \"#s2-1 ~ .s2-2\")}\n" - ), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.unify(\"#s1-1 ~ .s1-2\", \"#s2-1 ~ .s2-2\")}\n" + ), + "a {\ \n b: #s1-1 ~ #s2-1 ~ .s1-2.s2-2, #s2-1 ~ #s1-1 ~ .s1-2.s2-2;\ \n}\n" - ); + ); } #[test] fn distinct() { assert_eq!( - runner().ok("a {b: selector-unify(\".c ~ .d\", \".e ~ .f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c ~ .d\", \".e ~ .f\")}\n"), "a {\ \n b: .c ~ .e ~ .d.f, .e ~ .c ~ .d.f, .e.c ~ .d.f;\ \n}\n" @@ -107,8 +113,8 @@ mod and_sibling { #[test] fn identical() { assert_eq!( - runner() - .ok("a {b: selector-unify(\".c ~ .s1\", \".c ~ .s2\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c ~ .s1\", \".c ~ .s2\")}\n"), "a {\ \n b: .c ~ .s1.s2;\ \n}\n" @@ -118,7 +124,8 @@ mod and_sibling { fn overlap() { assert_eq!( runner().ok( - "a {b: selector-unify(\".c.s1-1 ~ .s1-2\", \".c.s2-1 ~ .s2-2\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(\".c.s1-1 ~ .s1-2\", \".c.s2-1 ~ .s2-2\")}\n" ), "a {\ \n b: .c.s1-1 ~ .c.s2-1 ~ .s1-2.s2-2, .c.s2-1 ~ .c.s1-1 ~ .s1-2.s2-2, .c.s2-1.s1-1 ~ .s1-2.s2-2;\ @@ -128,9 +135,8 @@ mod and_sibling { #[test] fn superselector() { assert_eq!( - runner().ok( - "a {b: selector-unify(\".c.s1-1 ~ .s1-2\", \".c ~ .s2\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c.s1-1 ~ .s1-2\", \".c ~ .s2\")}\n"), "a {\ \n b: .c.s1-1 ~ .s1-2.s2;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/unify/complex/distinct.rs b/rsass/tests/spec/core_functions/selector/unify/complex/distinct.rs index b7d809966..070535934 100644 --- a/rsass/tests/spec/core_functions/selector/unify/complex/distinct.rs +++ b/rsass/tests/spec/core_functions/selector/unify/complex/distinct.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn three_level() { assert_eq!( - runner().ok("a {b: selector-unify(\".c .d .e\", \".f .g .h\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c .d .e\", \".f .g .h\")}\n"), "a {\ \n b: .c .d .f .g .e.h, .f .g .c .d .e.h;\ \n}\n" @@ -18,7 +19,8 @@ fn three_level() { #[test] fn two_level() { assert_eq!( - runner().ok("a {b: selector-unify(\".c .d\", \".e .f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c .d\", \".e .f\")}\n"), "a {\ \n b: .c .e .d.f, .e .c .d.f;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/unify/complex/identical.rs b/rsass/tests/spec/core_functions/selector/unify/complex/identical.rs index 9bb9d1039..91c030b9f 100644 --- a/rsass/tests/spec/core_functions/selector/unify/complex/identical.rs +++ b/rsass/tests/spec/core_functions/selector/unify/complex/identical.rs @@ -13,7 +13,8 @@ mod three_level { fn inner() { assert_eq!( runner().ok( - "a {b: selector-unify(\".s1-1 .d .s1-2\", \".s2-1 .d .s2-2\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(\".s1-1 .d .s1-2\", \".s2-1 .d .s2-2\")}\n" ), "a {\ \n b: .s1-1 .s2-1 .d .s1-2.s2-2, .s2-1 .s1-1 .d .s1-2.s2-2;\ @@ -25,7 +26,8 @@ mod three_level { fn outer() { assert_eq!( runner().ok( - "a {b: selector-unify(\".c .s1-1 .s1-2\", \".c .s2-1 .s2-2\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(\".c .s1-1 .s1-2\", \".c .s2-1 .s2-2\")}\n" ), "a {\ \n b: .c .s1-1 .s2-1 .s1-2.s2-2, .c .s2-1 .s1-1 .s1-2.s2-2;\ @@ -36,7 +38,8 @@ mod three_level { #[test] fn two_level() { assert_eq!( - runner().ok("a {b: selector-unify(\".c .s1\", \".c .s2\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c .s1\", \".c .s2\")}\n"), "a {\ \n b: .c .s1.s2;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/unify/complex/lcs.rs b/rsass/tests/spec/core_functions/selector/unify/complex/lcs.rs index 5e25ac287..31fb8882e 100644 --- a/rsass/tests/spec/core_functions/selector/unify/complex/lcs.rs +++ b/rsass/tests/spec/core_functions/selector/unify/complex/lcs.rs @@ -14,7 +14,8 @@ mod non_contiguous { fn different_positions() { assert_eq!( runner().ok( - "a {b: selector-unify(\".s1-1 .c .d .s1-2 .e .s1-3\", \".c .s2-1 .d .e .s2-2 .s2-3\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(\".s1-1 .c .d .s1-2 .e .s1-3\", \".c .s2-1 .d .e .s2-2 .s2-3\")}\n" ), "a {\ \n b: .s1-1 .c .s2-1 .d .s1-2 .e .s2-2 .s1-3.s2-3;\ @@ -26,7 +27,8 @@ mod non_contiguous { fn same_positions() { assert_eq!( runner().ok( - "a {b: selector-unify(\".s1-1 .c .d .s1-2 .e .s1-3\", \".s2-1 .c .d .s2-2 .e .s2-3\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(\".s1-1 .c .d .s1-2 .e .s1-3\", \".s2-1 .c .d .s2-2 .e .s2-3\")}\n" ), "a {\ \n b: .s1-1 .s2-1 .c .d .s1-2 .s2-2 .e .s1-3.s2-3, .s2-1 .s1-1 .c .d .s1-2 .s2-2 .e .s1-3.s2-3, .s1-1 .s2-1 .c .d .s2-2 .s1-2 .e .s1-3.s2-3, .s2-1 .s1-1 .c .d .s2-2 .s1-2 .e .s1-3.s2-3;\ @@ -39,9 +41,10 @@ mod non_contiguous { fn three_versus_two() { assert_eq!( runner().ok( - "// The longest common subsequence is `.c .d .e`, which is longer than `.f g`, so\ + "@use \"sass:selector\";\ + \n// The longest common subsequence is `.c .d .e`, which is longer than `.f g`, so\ \n// `.c .d .e` gets unified while `.f .g` gets duplicated.\ - \na {b: selector-unify(\".c .d .e .f .g .s1\", \".f .g .c .d .e .s2\")}\n" + \na {b: selector.unify(\".c .d .e .f .g .s1\", \".f .g .c .d .e .s2\")}\n" ), "a {\ \n b: .f .g .c .d .e .f .g .s1.s2;\ @@ -53,9 +56,10 @@ fn three_versus_two() { fn two_versus_one() { assert_eq!( runner().ok( - "// The longest common subsequence is `.c .d`, which is longer than `.e`, so `.c\ + "@use \"sass:selector\";\ + \n// The longest common subsequence is `.c .d`, which is longer than `.e`, so `.c\ \n// .d` gets unified while `.e` gets duplicated.\ - \na {b: selector-unify(\".c .d .e .s1\", \".e .c .d .s2\")}\n" + \na {b: selector.unify(\".c .d .e .s1\", \".e .c .d .s2\")}\n" ), "a {\ \n b: .e .c .d .e .s1.s2;\ diff --git a/rsass/tests/spec/core_functions/selector/unify/complex/overlap.rs b/rsass/tests/spec/core_functions/selector/unify/complex/overlap.rs index 47b0e8d45..3033cfe87 100644 --- a/rsass/tests/spec/core_functions/selector/unify/complex/overlap.rs +++ b/rsass/tests/spec/core_functions/selector/unify/complex/overlap.rs @@ -9,9 +9,10 @@ fn runner() -> crate::TestRunner { fn class() { assert_eq!( runner().ok( - "// Because neither compound selector containing `.c` is a superselector of the\ + "@use \"sass:selector\";\ + \n// Because neither compound selector containing `.c` is a superselector of the\ \n// other, they aren\'t unified.\ - \na {b: selector-unify(\".c.s1-1 .s1-2\", \".c.s2-1 .s2-2\")}\n" + \na {b: selector.unify(\".c.s1-1 .s1-2\", \".c.s2-1 .s2-2\")}\n" ), "a {\ \n b: .c.s1-1 .c.s2-1 .s1-2.s2-2, .c.s2-1 .c.s1-1 .s1-2.s2-2;\ @@ -26,10 +27,11 @@ mod id { fn forced_unification() { assert_eq!( runner().ok( - "// Even though neither selector containing `#c` is a superselector of the other,\ + "@use \"sass:selector\";\ + \n// Even though neither selector containing `#c` is a superselector of the other,\ \n// they\'re still unified because the selector can\'t meainingfully contain two\ \n// instances of `#c`.\ - \na {b: selector-unify(\"#c.s1-1 .s1-2\", \"#c.s2-1 .s2-2\")}\n" + \na {b: selector.unify(\"#c.s1-1 .s1-2\", \"#c.s2-1 .s2-2\")}\n" ), "a {\ \n b: #c.s2-1.s1-1 .s1-2.s2-2;\ @@ -39,13 +41,14 @@ mod id { #[test] fn no_unification() { assert_eq!( - runner().ok( - "a {b: selector-unify(\"#s1-1.c .s1-2\", \"#s2-1.c .s2-2\")}\n" - ), - "a {\ + runner().ok( + "@use \"sass:selector\";\ + \na {b: selector.unify(\"#s1-1.c .s1-2\", \"#s2-1.c .s2-2\")}\n" + ), + "a {\ \n b: #s1-1.c #s2-1.c .s1-2.s2-2, #s2-1.c #s1-1.c .s1-2.s2-2;\ \n}\n" - ); + ); } } mod pseudo_element { @@ -56,7 +59,8 @@ mod pseudo_element { fn forced_unification() { assert_eq!( runner().ok( - "a {b: selector-unify(\".s1-1::c .s1-2\", \".s2-1::c .s2-2\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(\".s1-1::c .s1-2\", \".s2-1::c .s2-2\")}\n" ), "a {\ \n b: .s2-1.s1-1::c .s1-2.s2-2;\ @@ -68,7 +72,8 @@ mod pseudo_element { fn no_unification() { assert_eq!( runner().ok( - "a {b: selector-unify(\"::s1-1.c .s1-2\", \"::s2-1.c .s2-2\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(\"::s1-1.c .s1-2\", \"::s2-1.c .s2-2\")}\n" ), "a {\ \n b: ::s1-1.c ::s2-1.c .s1-2.s2-2, ::s2-1.c ::s1-1.c .s1-2.s2-2;\ diff --git a/rsass/tests/spec/core_functions/selector/unify/complex/rootish.rs b/rsass/tests/spec/core_functions/selector/unify/complex/rootish.rs index 200e42888..9de257712 100644 --- a/rsass/tests/spec/core_functions/selector/unify/complex/rootish.rs +++ b/rsass/tests/spec/core_functions/selector/unify/complex/rootish.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn host() { assert_eq!( - runner().ok("a {b: selector-unify(\":host .c\", \".d .e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":host .c\", \".d .e\")}\n"), "a {\ \n b: :host .d .c.e;\ \n}\n" @@ -18,7 +19,8 @@ fn host() { fn host_context() { assert_eq!( runner().ok( - "a {b: selector-unify(\":host-context(f g) .c\", \".d .e\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(\":host-context(f g) .c\", \".d .e\")}\n" ), "a {\ \n b: :host-context(f g) .d .c.e;\ @@ -29,8 +31,8 @@ fn host_context() { #[ignore] // wrong result fn mixed() { assert_eq!( - runner() - .ok("a {b: selector-unify(\":root .c .d\", \":scope .e .f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":root .c .d\", \":scope .e .f\")}\n"), "a {\ \n b: :scope:root .c .e .d.f, :scope:root .e .c .d.f;\ \n}\n" @@ -47,9 +49,8 @@ mod root { #[test] fn can_unify() { assert_eq!( - runner().ok( - "a {b: selector-unify(\".c:root .d\", \".e:root .f\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c:root .d\", \".e:root .f\")}\n"), "a {\ \n b: .e.c:root .d.f;\ \n}\n" @@ -59,7 +60,9 @@ mod root { fn cant_unify() { assert_eq!( runner().ok( - "a {b: inspect(selector-unify(\"c:root .d\", \"e:root .f\"))}\n" + "@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c:root .d\", \"e:root .f\"))}\n" ), "a {\ \n b: null;\ @@ -69,9 +72,8 @@ mod root { #[test] fn superselector() { assert_eq!( - runner().ok( - "a {b: selector-unify(\"c:root .d\", \":root .e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"c:root .d\", \":root .e\")}\n"), "a {\ \n b: c:root .d.e;\ \n}\n" @@ -89,9 +91,8 @@ mod root { #[test] fn three_layer() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":root .c .d\", \".e .f\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":root .c .d\", \".e .f\")}\n"), "a {\ \n b: :root .c .e .d.f, :root .e .c .d.f;\ \n}\n" @@ -100,9 +101,8 @@ mod root { #[test] fn two_layer() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":root .c\", \".d .e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":root .c\", \".d .e\")}\n"), "a {\ \n b: :root .d .c.e;\ \n}\n" @@ -116,9 +116,8 @@ mod root { #[test] fn three_layer() { assert_eq!( - runner().ok( - "a {b: selector-unify(\".c .d\", \":root .e .f\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c .d\", \":root .e .f\")}\n"), "a {\ \n b: :root .c .e .d.f, :root .e .c .d.f;\ \n}\n" @@ -127,9 +126,8 @@ mod root { #[test] fn two_layer() { assert_eq!( - runner().ok( - "a {b: selector-unify(\".c .d\", \":root .e\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c .d\", \":root .e\")}\n"), "a {\ \n b: :root .c .d.e;\ \n}\n" @@ -141,7 +139,8 @@ mod root { #[test] fn scope() { assert_eq!( - runner().ok("a {b: selector-unify(\":scope .c\", \".d .e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":scope .c\", \".d .e\")}\n"), "a {\ \n b: :scope .d .c.e;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/unify/complex/superselector.rs b/rsass/tests/spec/core_functions/selector/unify/complex/superselector.rs index 8a65e1ef9..d4ea93c38 100644 --- a/rsass/tests/spec/core_functions/selector/unify/complex/superselector.rs +++ b/rsass/tests/spec/core_functions/selector/unify/complex/superselector.rs @@ -13,7 +13,8 @@ mod three_level { fn inner() { assert_eq!( runner().ok( - "a {b: selector-unify(\".s1-1 .c.s1-2 .s1-3\", \".s2-1 .c .s2-2\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(\".s1-1 .c.s1-2 .s1-3\", \".s2-1 .c .s2-2\")}\n" ), "a {\ \n b: .s1-1 .s2-1 .c.s1-2 .s1-3.s2-2, .s2-1 .s1-1 .c.s1-2 .s1-3.s2-2;\ @@ -25,7 +26,8 @@ mod three_level { fn outer() { assert_eq!( runner().ok( - "a {b: selector-unify(\".c.s1-1 .s1-2 .s1-3\", \".c .s2-1 .s2-2\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(\".c.s1-1 .s1-2 .s1-3\", \".c .s2-1 .s2-2\")}\n" ), "a {\ \n b: .c.s1-1 .s1-2 .s2-1 .s1-3.s2-2, .c.s1-1 .s2-1 .s1-2 .s1-3.s2-2;\ @@ -36,7 +38,8 @@ mod three_level { #[test] fn two_level() { assert_eq!( - runner().ok("a {b: selector-unify(\".c.s1-1 .s1-2\", \".c .s2\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c.s1-1 .s1-2\", \".c .s2\")}\n"), "a {\ \n b: .c.s1-1 .s1-2.s2;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/unify/compound.rs b/rsass/tests/spec/core_functions/selector/unify/compound.rs index bfec9590b..68fdb1273 100644 --- a/rsass/tests/spec/core_functions/selector/unify/compound.rs +++ b/rsass/tests/spec/core_functions/selector/unify/compound.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn full_overlap() { assert_eq!( - runner().ok("a {b: selector-unify(\".c.d\", \".c.d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c.d\", \".c.d\")}\n"), "a {\ \n b: .c.d;\ \n}\n" @@ -17,7 +18,8 @@ fn full_overlap() { #[test] fn no_overlap() { assert_eq!( - runner().ok("a {b: selector-unify(\".c.d\", \".e.f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c.d\", \".e.f\")}\n"), "a {\ \n b: .c.d.e.f;\ \n}\n" @@ -30,7 +32,8 @@ mod order { #[test] fn element_at_start() { assert_eq!( - runner().ok("a {b: selector-unify(\".c\", \"d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c\", \"d\")}\n"), "a {\ \n b: d.c;\ \n}\n" @@ -39,7 +42,8 @@ mod order { #[test] fn preserved_by_default() { assert_eq!( - runner().ok("a {b: selector-unify(\".c.d\", \".e.f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c.d\", \".e.f\")}\n"), "a {\ \n b: .c.d.e.f;\ \n}\n" @@ -48,7 +52,8 @@ mod order { #[test] fn pseudo_class_at_end() { assert_eq!( - runner().ok("a {b: selector-unify(\":c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":c\", \".d\")}\n"), "a {\ \n b: .d:c;\ \n}\n" @@ -61,7 +66,8 @@ mod order { #[test] fn class_first() { assert_eq!( - runner().ok("a {b: selector-unify(\":c\", \"::d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":c\", \"::d\")}\n"), "a {\ \n b: :c::d;\ \n}\n" @@ -70,7 +76,8 @@ mod order { #[test] fn element_first() { assert_eq!( - runner().ok("a {b: selector-unify(\"::c\", \":d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"::c\", \":d\")}\n"), "a {\ \n b: :d::c;\ \n}\n" @@ -80,7 +87,8 @@ mod order { #[test] fn pseudo_element_at_end() { assert_eq!( - runner().ok("a {b: selector-unify(\"::c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"::c\", \".d\")}\n"), "a {\ \n b: .d::c;\ \n}\n" @@ -90,7 +98,8 @@ mod order { #[test] fn partial_overlap() { assert_eq!( - runner().ok("a {b: selector-unify(\".c.d\", \".d.e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c.d\", \".d.e\")}\n"), "a {\ \n b: .c.d.e;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/unify/error.rs b/rsass/tests/spec/core_functions/selector/unify/error.rs index 10bc5c2ca..82c84f29d 100644 --- a/rsass/tests/spec/core_functions/selector/unify/error.rs +++ b/rsass/tests/spec/core_functions/selector/unify/error.rs @@ -12,7 +12,10 @@ mod selector1 { #[test] fn invalid() { assert_eq!( - runner().err("a {b: selector-unify(\"[c\", \"d\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.unify(\"[c\", \"d\")}\n" + ), "Error: $selector1: expected more input.\ \n ,\ \n1 | [c\ @@ -20,16 +23,19 @@ mod selector1 { \n \'\ \n - 1:3 root stylesheet\ \n ,\ - \n1 | a {b: selector-unify(\"[c\", \"d\")}\ + \n2 | a {b: selector.unify(\"[c\", \"d\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn parent() { assert_eq!( - runner().err("a {b: selector-unify(\"&\", \"c\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.unify(\"&\", \"c\")}\n" + ), "Error: $selector1: Parent selectors aren\'t allowed here.\ \n ,\ \n1 | &\ @@ -37,25 +43,26 @@ mod selector1 { \n \'\ \n - 1:1 root stylesheet\ \n ,\ - \n1 | a {b: selector-unify(\"&\", \"c\")}\ + \n2 | a {b: selector.unify(\"&\", \"c\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( runner().err( - "a {b: selector-unify(1, \"c\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(1, \"c\")}\n" ), "Error: $selector1: 1 is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | a {b: selector-unify(1, \"c\")}\ + \n2 | a {b: selector.unify(1, \"c\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -66,7 +73,10 @@ mod selector2 { #[test] fn invalid() { assert_eq!( - runner().err("a {b: selector-unify(\"c\", \"[d\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.unify(\"c\", \"[d\")}\n" + ), "Error: $selector2: expected more input.\ \n ,\ \n1 | [d\ @@ -74,16 +84,19 @@ mod selector2 { \n \'\ \n - 1:3 root stylesheet\ \n ,\ - \n1 | a {b: selector-unify(\"c\", \"[d\")}\ + \n2 | a {b: selector.unify(\"c\", \"[d\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn parent() { assert_eq!( - runner().err("a {b: selector-unify(\"c\", \"&\")}\n"), + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.unify(\"c\", \"&\")}\n" + ), "Error: $selector2: Parent selectors aren\'t allowed here.\ \n ,\ \n1 | &\ @@ -91,25 +104,41 @@ mod selector2 { \n \'\ \n - 1:1 root stylesheet\ \n ,\ - \n1 | a {b: selector-unify(\"c\", \"&\")}\ + \n2 | a {b: selector.unify(\"c\", \"&\")}\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( runner().err( - "a {b: selector-unify(\"c\", 1)}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(\"c\", 1)}\n" ), "Error: $selector2: 1 is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | a {b: selector-unify(\"c\", 1)}\ + \n2 | a {b: selector.unify(\"c\", 1)}\ \n | ^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } +#[test] +fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:selector\";\ + \na {b: selector.selector-unify(\".c\", \".d\")}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: selector.selector-unify(\".c\", \".d\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/selector/unify/format.rs b/rsass/tests/spec/core_functions/selector/unify/format.rs index 147a3159c..66006047f 100644 --- a/rsass/tests/spec/core_functions/selector/unify/format.rs +++ b/rsass/tests/spec/core_functions/selector/unify/format.rs @@ -16,7 +16,8 @@ mod input { #[test] fn selector1() { assert_eq!( - runner().ok("a {b: selector-unify((c, d c), \".e\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify((c, d c), \".e\")}\n"), "a {\ \n b: c.e, d c.e;\ \n}\n" @@ -25,7 +26,8 @@ mod input { #[test] fn selector2() { assert_eq!( - runner().ok("a {b: selector-unify(\".e\", (c, d c))}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".e\", (c, d c))}\n"), "a {\ \n b: c.e, d c.e;\ \n}\n" @@ -35,7 +37,8 @@ mod input { #[test] fn two_lists() { assert_eq!( - runner().ok("a {b: selector-unify(\".c, .d\", \".e, .f\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c, .d\", \".e, .f\")}\n"), "a {\ \n b: .c.e, .c.f, .d.e, .d.f;\ \n}\n" @@ -45,7 +48,8 @@ mod input { #[test] fn output() { assert_eq!( - runner().ok("$result: selector-unify(\"c d, e f\", \".g\");\ + runner().ok("@use \"sass:selector\";\ + \n$result: selector.unify(\"c d, e f\", \".g\");\ \na {\ \n result: $result;\ \n structure: $result == (\"c\" \"d.g\", \"e\" \"f.g\");\ diff --git a/rsass/tests/spec/core_functions/selector/unify/simple/attribute.rs b/rsass/tests/spec/core_functions/selector/unify/simple/attribute.rs index 806650fe4..277dfba58 100644 --- a/rsass/tests/spec/core_functions/selector/unify/simple/attribute.rs +++ b/rsass/tests/spec/core_functions/selector/unify/simple/attribute.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn different() { assert_eq!( - runner().ok("a {b: selector-unify(\"[c]\", \"[d]\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"[c]\", \"[d]\")}\n"), "a {\ \n b: [c][d];\ \n}\n" @@ -17,7 +18,8 @@ fn different() { #[test] fn same() { assert_eq!( - runner().ok("a {b: selector-unify(\"[c]\", \"[c]\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"[c]\", \"[c]\")}\n"), "a {\ \n b: [c];\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/unify/simple/class.rs b/rsass/tests/spec/core_functions/selector/unify/simple/class.rs index 5ab9b1f64..b6a466750 100644 --- a/rsass/tests/spec/core_functions/selector/unify/simple/class.rs +++ b/rsass/tests/spec/core_functions/selector/unify/simple/class.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn different() { assert_eq!( - runner().ok("a {b: selector-unify(\".c\", \".d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c\", \".d\")}\n"), "a {\ \n b: .c.d;\ \n}\n" @@ -17,7 +18,8 @@ fn different() { #[test] fn same() { assert_eq!( - runner().ok("a {b: selector-unify(\".c\", \".c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\".c\", \".c\")}\n"), "a {\ \n b: .c;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/unify/simple/different_types.rs b/rsass/tests/spec/core_functions/selector/unify/simple/different_types.rs index 7b816af1a..440d2f466 100644 --- a/rsass/tests/spec/core_functions/selector/unify/simple/different_types.rs +++ b/rsass/tests/spec/core_functions/selector/unify/simple/different_types.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("a {b: selector-unify(\"c\", \"#d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"c\", \"#d\")}\n"), "a {\ \n b: c#d;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/unify/simple/id.rs b/rsass/tests/spec/core_functions/selector/unify/simple/id.rs index d29be71d5..0219112de 100644 --- a/rsass/tests/spec/core_functions/selector/unify/simple/id.rs +++ b/rsass/tests/spec/core_functions/selector/unify/simple/id.rs @@ -8,7 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn different() { assert_eq!( - runner().ok("a {b: inspect(selector-unify(\"#c\", \"#d\"))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"#c\", \"#d\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -17,7 +19,8 @@ fn different() { #[test] fn same() { assert_eq!( - runner().ok("a {b: selector-unify(\"#c\", \"#c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"#c\", \"#c\")}\n"), "a {\ \n b: #c;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/unify/simple/placeholder.rs b/rsass/tests/spec/core_functions/selector/unify/simple/placeholder.rs index f4ac6ef78..6debd9f83 100644 --- a/rsass/tests/spec/core_functions/selector/unify/simple/placeholder.rs +++ b/rsass/tests/spec/core_functions/selector/unify/simple/placeholder.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn different() { assert_eq!( - runner().ok("a {b: selector-unify(\"%c\", \"%d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"%c\", \"%d\")}\n"), "a {\ \n b: %c%d;\ \n}\n" @@ -17,7 +18,8 @@ fn different() { #[test] fn same() { assert_eq!( - runner().ok("a {b: selector-unify(\"%c\", \"%c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"%c\", \"%c\")}\n"), "a {\ \n b: %c;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/unify/simple/pseudo.rs b/rsass/tests/spec/core_functions/selector/unify/simple/pseudo.rs index 7677173f9..d302c3cf8 100644 --- a/rsass/tests/spec/core_functions/selector/unify/simple/pseudo.rs +++ b/rsass/tests/spec/core_functions/selector/unify/simple/pseudo.rs @@ -16,8 +16,8 @@ mod arg { #[test] fn different() { assert_eq!( - runner() - .ok("a {b: selector-unify(\":c(@#$)\", \":c(*&^)\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":c(@#$)\", \":c(*&^)\")}\n"), "a {\ \n b: :c(@#$):c(*&^);\ \n}\n" @@ -26,8 +26,8 @@ mod arg { #[test] fn same() { assert_eq!( - runner() - .ok("a {b: selector-unify(\":c(@#$)\", \":c(@#$)\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":c(@#$)\", \":c(@#$)\")}\n"), "a {\ \n b: :c(@#$);\ \n}\n" @@ -42,7 +42,9 @@ mod arg { fn different() { assert_eq!( runner().ok( - "a {b: inspect(selector-unify(\"::c(@#$)\", \"::c(*&^)\"))}\n" + "@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"::c(@#$)\", \"::c(*&^)\"))}\n" ), "a {\ \n b: null;\ @@ -52,9 +54,8 @@ mod arg { #[test] fn same() { assert_eq!( - runner().ok( - "a {b: selector-unify(\"::c(@#$)\", \"::c(@#$)\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"::c(@#$)\", \"::c(@#$)\")}\n"), "a {\ \n b: ::c(@#$);\ \n}\n" @@ -78,9 +79,8 @@ mod host { #[ignore] // wrong result fn left() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":host(.c)\", \":is(.d)\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":host(.c)\", \":is(.d)\")}\n"), "a {\ \n b: :is(.d):host(.c);\ \n}\n" @@ -89,9 +89,8 @@ mod host { #[test] fn right() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":is(.c)\", \":host(.d)\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":is(.c)\", \":host(.d)\")}\n"), "a {\ \n b: :is(.c):host(.d);\ \n}\n" @@ -105,24 +104,24 @@ mod host { #[test] fn left() { assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\":host(.c)\", \".d\"))}\n" - ), - "a {\ + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\":host(.c)\", \".d\"))}\n"), + "a {\ \n b: null;\ \n}\n" - ); + ); } #[test] fn right() { assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\".c\", \":host(.d)\"))}\n" - ), - "a {\ + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\".c\", \":host(.d)\"))}\n"), + "a {\ \n b: null;\ \n}\n" - ); + ); } } } @@ -137,9 +136,9 @@ mod host { #[test] fn left() { assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\":host\", \".c\"))}\n" - ), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\":host\", \".c\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -148,9 +147,9 @@ mod host { #[test] fn right() { assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\".c\", \":host\"))}\n" - ), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\".c\", \":host\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -169,7 +168,9 @@ mod host { fn left() { assert_eq!( runner().ok( - "a {b: inspect(selector-unify(\":host\", \".c:is(.d)\"))}\n" + "@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\":host\", \".c:is(.d)\"))}\n" ), "a {\ \n b: null;\ @@ -180,7 +181,9 @@ mod host { fn right() { assert_eq!( runner().ok( - "a {b: inspect(selector-unify(\".c:is(.d)\", \":host\"))}\n" + "@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\".c:is(.d)\", \":host\"))}\n" ), "a {\ \n b: null;\ @@ -195,24 +198,28 @@ mod host { #[test] fn left() { assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\":host\", \":host.c\"))}\n" - ), - "a {\ + runner().ok( + "@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\":host\", \":host.c\"))}\n" + ), + "a {\ \n b: null;\ \n}\n" - ); + ); } #[test] fn right() { assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\":host.c\", \":host\"))}\n" - ), - "a {\ + runner().ok( + "@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\":host.c\", \":host\"))}\n" + ), + "a {\ \n b: null;\ \n}\n" - ); + ); } } mod selector_pseudos { @@ -223,24 +230,22 @@ mod host { #[ignore] // wrong result fn left() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":host\", \":is(.c):is(.d)\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":host\", \":is(.c):is(.d)\")}\n"), + "a {\ \n b: :is(.c):host:is(.d);\ \n}\n" - ); + ); } #[test] fn right() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":is(.c):is(.d)\", \":host\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":is(.c):is(.d)\", \":host\")}\n"), + "a {\ \n b: :is(.c):is(.d):host;\ \n}\n" - ); + ); } } } @@ -251,9 +256,8 @@ mod host { #[test] fn arg() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":host\", \":host(.c)\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":host\", \":host(.c)\")}\n"), "a {\ \n b: :host:host(.c);\ \n}\n" @@ -262,8 +266,8 @@ mod host { #[test] fn argless() { assert_eq!( - runner() - .ok("a {b: selector-unify(\":host\", \":host\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":host\", \":host\")}\n"), "a {\ \n b: :host;\ \n}\n" @@ -277,24 +281,22 @@ mod host { #[test] fn left() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":host\", \":host-context(.c)\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":host\", \":host-context(.c)\")}\n"), + "a {\ \n b: :host:host-context(.c);\ \n}\n" - ); + ); } #[test] fn right() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":host-context(.c)\", \":host\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":host-context(.c)\", \":host\")}\n"), + "a {\ \n b: :host-context(.c):host;\ \n}\n" - ); + ); } } mod pseudo { @@ -304,24 +306,24 @@ mod host { #[test] fn left() { assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\":host\", \":hover\"))}\n" - ), - "a {\ + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\":host\", \":hover\"))}\n"), + "a {\ \n b: null;\ \n}\n" - ); + ); } #[test] fn right() { assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\":hover\", \":host\"))}\n" - ), - "a {\ + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\":hover\", \":host\"))}\n"), + "a {\ \n b: null;\ \n}\n" - ); + ); } } mod selector_pseudo { @@ -332,9 +334,8 @@ mod host { #[ignore] // wrong result fn left() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":host\", \":is(.c)\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":host\", \":is(.c)\")}\n"), "a {\ \n b: :is(.c):host;\ \n}\n" @@ -343,9 +344,8 @@ mod host { #[test] fn right() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":is(.c)\", \":host\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":is(.c)\", \":host\")}\n"), "a {\ \n b: :is(.c):host;\ \n}\n" @@ -359,9 +359,9 @@ mod host { #[test] fn left() { assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\":host\", \"*\"))}\n" - ), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\":host\", \"*\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -370,9 +370,9 @@ mod host { #[test] fn right() { assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\"*\", \":host\"))}\n" - ), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"*\", \":host\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -393,24 +393,22 @@ mod host_context { #[ignore] // wrong result fn left() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":host-context(.c)\", \":is(.d)\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":host-context(.c)\", \":is(.d)\")}\n"), + "a {\ \n b: :is(.d):host-context(.c);\ \n}\n" - ); + ); } #[test] fn right() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":is(.c)\", \":host-context(.d)\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":is(.c)\", \":host-context(.d)\")}\n"), + "a {\ \n b: :is(.c):host-context(.d);\ \n}\n" - ); + ); } } mod removed { @@ -421,7 +419,9 @@ mod host_context { fn left() { assert_eq!( runner().ok( - "a {b: inspect(selector-unify(\":host-context(.c)\", \".d\"))}\n" + "@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\":host-context(.c)\", \".d\"))}\n" ), "a {\ \n b: null;\ @@ -432,7 +432,9 @@ mod host_context { fn right() { assert_eq!( runner().ok( - "a {b: inspect(selector-unify(\".c\", \":host-context(.d)\"))}\n" + "@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\".c\", \":host-context(.d)\"))}\n" ), "a {\ \n b: null;\ @@ -452,7 +454,8 @@ mod no_arg { #[test] fn different() { assert_eq!( - runner().ok("a {b: selector-unify(\":c\", \":d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":c\", \":d\")}\n"), "a {\ \n b: :c:d;\ \n}\n" @@ -461,7 +464,8 @@ mod no_arg { #[test] fn same() { assert_eq!( - runner().ok("a {b: selector-unify(\":c\", \":c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":c\", \":c\")}\n"), "a {\ \n b: :c;\ \n}\n" @@ -475,8 +479,8 @@ mod no_arg { #[test] fn after() { assert_eq!( - runner() - .ok("a {b: selector-unify(\":after\", \"::after\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":after\", \"::after\")}\n"), "a {\ \n b: :after;\ \n}\n" @@ -485,8 +489,8 @@ mod no_arg { #[test] fn before() { assert_eq!( - runner() - .ok("a {b: selector-unify(\":before\", \"::before\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":before\", \"::before\")}\n"), "a {\ \n b: :before;\ \n}\n" @@ -496,7 +500,8 @@ mod no_arg { fn first_letter() { assert_eq!( runner().ok( - "a {b: selector-unify(\":first-letter\", \"::first-letter\")}\n" + "@use \"sass:selector\";\ + \na {b: selector.unify(\":first-letter\", \"::first-letter\")}\n" ), "a {\ \n b: :first-letter;\ @@ -506,13 +511,12 @@ mod no_arg { #[test] fn first_line() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":first-line\", \"::first-line\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":first-line\", \"::first-line\")}\n"), + "a {\ \n b: :first-line;\ \n}\n" - ); + ); } } mod element { @@ -522,8 +526,9 @@ mod no_arg { #[test] fn different() { assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"::c\", \"::d\"))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"::c\", \"::d\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -532,7 +537,8 @@ mod no_arg { #[test] fn same() { assert_eq!( - runner().ok("a {b: selector-unify(\"::c\", \"::c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"::c\", \"::c\")}\n"), "a {\ \n b: ::c;\ \n}\n" @@ -551,8 +557,8 @@ mod selector_arg { #[test] fn different() { assert_eq!( - runner() - .ok("a {b: selector-unify(\":is(.c)\", \":is(.d)\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":is(.c)\", \":is(.d)\")}\n"), "a {\ \n b: :is(.c):is(.d);\ \n}\n" @@ -561,8 +567,8 @@ mod selector_arg { #[test] fn same() { assert_eq!( - runner() - .ok("a {b: selector-unify(\":is(.c)\", \":is(.c)\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":is(.c)\", \":is(.c)\")}\n"), "a {\ \n b: :is(.c);\ \n}\n" @@ -576,24 +582,22 @@ mod selector_arg { #[test] fn different() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":matches(.c)\", \":matches(.d)\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":matches(.c)\", \":matches(.d)\")}\n"), + "a {\ \n b: :matches(.c):matches(.d);\ \n}\n" - ); + ); } #[test] fn same() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":matches(.c)\", \":matches(.c)\")}\n" - ), - "a {\ + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":matches(.c)\", \":matches(.c)\")}\n"), + "a {\ \n b: :matches(.c);\ \n}\n" - ); + ); } } mod test_where { @@ -603,9 +607,8 @@ mod selector_arg { #[test] fn different() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":where(.c)\", \":where(.d)\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":where(.c)\", \":where(.d)\")}\n"), "a {\ \n b: :where(.c):where(.d);\ \n}\n" @@ -614,9 +617,8 @@ mod selector_arg { #[test] fn same() { assert_eq!( - runner().ok( - "a {b: selector-unify(\":where(.c)\", \":where(.c)\")}\n" - ), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\":where(.c)\", \":where(.c)\")}\n"), "a {\ \n b: :where(.c);\ \n}\n" diff --git a/rsass/tests/spec/core_functions/selector/unify/simple/test_type.rs b/rsass/tests/spec/core_functions/selector/unify/simple/test_type.rs deleted file mode 100644 index fd203f2b0..000000000 --- a/rsass/tests/spec/core_functions/selector/unify/simple/test_type.rs +++ /dev/null @@ -1,548 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/core_functions/selector/unify/simple/type.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("type") -} - -mod and_type { - #[allow(unused)] - use super::runner; - - mod any { - #[allow(unused)] - use super::runner; - - mod and_any { - #[allow(unused)] - use super::runner; - - #[test] - fn different() { - assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\"*|c\", \"*|d\"))}\n" - ), - "a {\ - \n b: null;\ - \n}\n" - ); - } - #[test] - fn same() { - assert_eq!( - runner().ok("a {b: selector-unify(\"*|c\", \"*|c\")}\n"), - "a {\ - \n b: *|c;\ - \n}\n" - ); - } - } - mod and_default { - #[allow(unused)] - use super::runner; - - #[test] - fn different_type() { - assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\"*|c\", \"d\"))}\n" - ), - "a {\ - \n b: null;\ - \n}\n" - ); - } - #[test] - fn same_type() { - assert_eq!( - runner().ok("a {b: selector-unify(\"*|c\", \"c\")}\n"), - "a {\ - \n b: c;\ - \n}\n" - ); - } - } - mod and_empty { - #[allow(unused)] - use super::runner; - - #[test] - fn different_type() { - assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\"*|c\", \"|d\"))}\n" - ), - "a {\ - \n b: null;\ - \n}\n" - ); - } - #[test] - fn same_type() { - assert_eq!( - runner().ok("a {b: selector-unify(\"*|c\", \"|c\")}\n"), - "a {\ - \n b: |c;\ - \n}\n" - ); - } - } - mod and_explicit { - #[allow(unused)] - use super::runner; - - #[test] - fn different_type() { - assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\"*|c\", \"d|e\"))}\n" - ), - "a {\ - \n b: null;\ - \n}\n" - ); - } - #[test] - fn same_type() { - assert_eq!( - runner().ok("a {b: selector-unify(\"*|c\", \"d|c\")}\n"), - "a {\ - \n b: d|c;\ - \n}\n" - ); - } - } - } - mod default { - #[allow(unused)] - use super::runner; - - mod and_any { - #[allow(unused)] - use super::runner; - - #[test] - fn different_type() { - assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\"c\", \"*|d\"))}\n" - ), - "a {\ - \n b: null;\ - \n}\n" - ); - } - #[test] - fn same_type() { - assert_eq!( - runner().ok("a {b: selector-unify(\"c\", \"*|c\")}\n"), - "a {\ - \n b: c;\ - \n}\n" - ); - } - } - mod and_default { - #[allow(unused)] - use super::runner; - - #[test] - fn different() { - assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"c\", \"d\"))}\n"), - "a {\ - \n b: null;\ - \n}\n" - ); - } - #[test] - fn same() { - assert_eq!( - runner().ok("a {b: selector-unify(\"c\", \"c\")}\n"), - "a {\ - \n b: c;\ - \n}\n" - ); - } - } - #[test] - fn and_empty() { - assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"c\", \"|c\"))}\n"), - "a {\ - \n b: null;\ - \n}\n" - ); - } - #[test] - fn and_explicit() { - assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"c\", \"d|c\"))}\n"), - "a {\ - \n b: null;\ - \n}\n" - ); - } - } - mod empty { - #[allow(unused)] - use super::runner; - - mod and_any { - #[allow(unused)] - use super::runner; - - #[test] - fn different_type() { - assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\"|c\", \"*|d\"))}\n" - ), - "a {\ - \n b: null;\ - \n}\n" - ); - } - #[test] - fn same_type() { - assert_eq!( - runner().ok("a {b: selector-unify(\"|c\", \"*|c\")}\n"), - "a {\ - \n b: |c;\ - \n}\n" - ); - } - } - #[test] - fn and_default() { - assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"|c\", \"c\"))}\n"), - "a {\ - \n b: null;\ - \n}\n" - ); - } - mod and_empty { - #[allow(unused)] - use super::runner; - - #[test] - fn different() { - assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\"|c\", \"|d\"))}\n" - ), - "a {\ - \n b: null;\ - \n}\n" - ); - } - #[test] - fn same() { - assert_eq!( - runner().ok("a {b: selector-unify(\"|c\", \"|c\")}\n"), - "a {\ - \n b: |c;\ - \n}\n" - ); - } - } - #[test] - fn and_explicit() { - assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"|c\", \"e|c\"))}\n"), - "a {\ - \n b: null;\ - \n}\n" - ); - } - } - mod explicit { - #[allow(unused)] - use super::runner; - - mod and_any { - #[allow(unused)] - use super::runner; - - #[test] - fn different_type() { - assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\"c|d\", \"*|e\"))}\n" - ), - "a {\ - \n b: null;\ - \n}\n" - ); - } - #[test] - fn same_type() { - assert_eq!( - runner().ok("a {b: selector-unify(\"c|d\", \"*|d\")}\n"), - "a {\ - \n b: c|d;\ - \n}\n" - ); - } - } - #[test] - fn and_default() { - assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"c|d\", \"d\"))}\n"), - "a {\ - \n b: null;\ - \n}\n" - ); - } - #[test] - fn and_empty() { - assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"c|d\", \"|d\"))}\n"), - "a {\ - \n b: null;\ - \n}\n" - ); - } - mod and_explicit { - #[allow(unused)] - use super::runner; - - mod different { - #[allow(unused)] - use super::runner; - - #[test] - fn namespace() { - assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\"c|d\", \"e|d\"))}\n" - ), - "a {\ - \n b: null;\ - \n}\n" - ); - } - #[test] - fn test_type() { - assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\"c|d\", \"c|e\"))}\n" - ), - "a {\ - \n b: null;\ - \n}\n" - ); - } - } - #[test] - fn same() { - assert_eq!( - runner().ok("a {b: selector-unify(\"c|d\", \"c|d\")}\n"), - "a {\ - \n b: c|d;\ - \n}\n" - ); - } - } - } -} -mod and_universal { - #[allow(unused)] - use super::runner; - - mod any { - #[allow(unused)] - use super::runner; - - #[test] - fn and_any() { - assert_eq!( - runner().ok("a {b: selector-unify(\"*|c\", \"*|*\")}\n"), - "a {\ - \n b: *|c;\ - \n}\n" - ); - } - #[test] - fn and_default() { - assert_eq!( - runner().ok("a {b: selector-unify(\"*|c\", \"*\")}\n"), - "a {\ - \n b: c;\ - \n}\n" - ); - } - #[test] - fn and_empty() { - assert_eq!( - runner().ok("a {b: selector-unify(\"*|c\", \"|*\")}\n"), - "a {\ - \n b: |c;\ - \n}\n" - ); - } - #[test] - fn and_explicit() { - assert_eq!( - runner().ok("a {b: selector-unify(\"*|c\", \"d|*\")}\n"), - "a {\ - \n b: d|c;\ - \n}\n" - ); - } - } - mod default { - #[allow(unused)] - use super::runner; - - #[test] - fn and_any() { - assert_eq!( - runner().ok("a {b: selector-unify(\"c\", \"*|*\")}\n"), - "a {\ - \n b: c;\ - \n}\n" - ); - } - #[test] - fn and_default() { - assert_eq!( - runner().ok("a {b: selector-unify(\"c\", \"*\")}\n"), - "a {\ - \n b: c;\ - \n}\n" - ); - } - #[test] - fn and_empty() { - assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"c\", \"|*\"))}\n"), - "a {\ - \n b: null;\ - \n}\n" - ); - } - #[test] - fn and_explicit() { - assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"c\", \"e|*\"))}\n"), - "a {\ - \n b: null;\ - \n}\n" - ); - } - } - mod empty { - #[allow(unused)] - use super::runner; - - #[test] - fn and_any() { - assert_eq!( - runner().ok("a {b: selector-unify(\"|c\", \"*|*\")}\n"), - "a {\ - \n b: |c;\ - \n}\n" - ); - } - #[test] - fn and_default() { - assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"|c\", \"*\"))}\n"), - "a {\ - \n b: null;\ - \n}\n" - ); - } - #[test] - fn and_empty() { - assert_eq!( - runner().ok("a {b: selector-unify(\"|c\", \"|*\")}\n"), - "a {\ - \n b: |c;\ - \n}\n" - ); - } - #[test] - fn and_explicit() { - assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"|c\", \"e|*\"))}\n"), - "a {\ - \n b: null;\ - \n}\n" - ); - } - } - mod explicit { - #[allow(unused)] - use super::runner; - - #[test] - fn and_any() { - assert_eq!( - runner().ok("a {b: selector-unify(\"c|d\", \"*|*\")}\n"), - "a {\ - \n b: c|d;\ - \n}\n" - ); - } - #[test] - fn and_default() { - assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"c|d\", \"*\"))}\n"), - "a {\ - \n b: null;\ - \n}\n" - ); - } - #[test] - fn and_empty() { - assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"c|d\", \"|*\"))}\n"), - "a {\ - \n b: null;\ - \n}\n" - ); - } - mod and_explicit { - #[allow(unused)] - use super::runner; - - #[test] - fn different() { - assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\"c|d\", \"e|*\"))}\n" - ), - "a {\ - \n b: null;\ - \n}\n" - ); - } - #[test] - fn same() { - assert_eq!( - runner().ok("a {b: selector-unify(\"c|d\", \"c|*\")}\n"), - "a {\ - \n b: c|d;\ - \n}\n" - ); - } - } - } -} diff --git a/rsass/tests/spec/core_functions/selector/unify/simple/test_type/and_type.rs b/rsass/tests/spec/core_functions/selector/unify/simple/test_type/and_type.rs new file mode 100644 index 000000000..707305c6c --- /dev/null +++ b/rsass/tests/spec/core_functions/selector/unify/simple/test_type/and_type.rs @@ -0,0 +1,369 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/selector/unify/simple/type/and_type.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("and_type") +} + +mod any { + #[allow(unused)] + use super::runner; + + mod and_any { + #[allow(unused)] + use super::runner; + + #[test] + fn different() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"*|c\", \"*|d\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + #[test] + fn same() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*|c\", \"*|c\")}\n"), + "a {\ + \n b: *|c;\ + \n}\n" + ); + } + } + mod and_default { + #[allow(unused)] + use super::runner; + + #[test] + fn different_type() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"*|c\", \"d\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + #[test] + fn same_type() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*|c\", \"c\")}\n"), + "a {\ + \n b: c;\ + \n}\n" + ); + } + } + mod and_empty { + #[allow(unused)] + use super::runner; + + #[test] + fn different_type() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"*|c\", \"|d\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + #[test] + fn same_type() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*|c\", \"|c\")}\n"), + "a {\ + \n b: |c;\ + \n}\n" + ); + } + } + mod and_explicit { + #[allow(unused)] + use super::runner; + + #[test] + fn different_type() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"*|c\", \"d|e\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + #[test] + fn same_type() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*|c\", \"d|c\")}\n"), + "a {\ + \n b: d|c;\ + \n}\n" + ); + } + } +} +mod default { + #[allow(unused)] + use super::runner; + + mod and_any { + #[allow(unused)] + use super::runner; + + #[test] + fn different_type() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c\", \"*|d\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + #[test] + fn same_type() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"c\", \"*|c\")}\n"), + "a {\ + \n b: c;\ + \n}\n" + ); + } + } + mod and_default { + #[allow(unused)] + use super::runner; + + #[test] + fn different() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c\", \"d\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + #[test] + fn same() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"c\", \"c\")}\n"), + "a {\ + \n b: c;\ + \n}\n" + ); + } + } + #[test] + fn and_empty() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c\", \"|c\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + #[test] + fn and_explicit() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c\", \"d|c\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } +} +mod empty { + #[allow(unused)] + use super::runner; + + mod and_any { + #[allow(unused)] + use super::runner; + + #[test] + fn different_type() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"|c\", \"*|d\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + #[test] + fn same_type() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"|c\", \"*|c\")}\n"), + "a {\ + \n b: |c;\ + \n}\n" + ); + } + } + #[test] + fn and_default() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"|c\", \"c\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + mod and_empty { + #[allow(unused)] + use super::runner; + + #[test] + fn different() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"|c\", \"|d\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + #[test] + fn same() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"|c\", \"|c\")}\n"), + "a {\ + \n b: |c;\ + \n}\n" + ); + } + } + #[test] + fn and_explicit() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"|c\", \"e|c\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } +} +mod explicit { + #[allow(unused)] + use super::runner; + + mod and_any { + #[allow(unused)] + use super::runner; + + #[test] + fn different_type() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c|d\", \"*|e\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + #[test] + fn same_type() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"c|d\", \"*|d\")}\n"), + "a {\ + \n b: c|d;\ + \n}\n" + ); + } + } + #[test] + fn and_default() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c|d\", \"d\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + #[test] + fn and_empty() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c|d\", \"|d\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + mod and_explicit { + #[allow(unused)] + use super::runner; + + mod different { + #[allow(unused)] + use super::runner; + + #[test] + fn namespace() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c|d\", \"e|d\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + #[test] + fn test_type() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c|d\", \"c|e\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + } + #[test] + fn same() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"c|d\", \"c|d\")}\n"), + "a {\ + \n b: c|d;\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/core_functions/selector/unify/simple/test_type/and_universal.rs b/rsass/tests/spec/core_functions/selector/unify/simple/test_type/and_universal.rs new file mode 100644 index 000000000..2b7e70073 --- /dev/null +++ b/rsass/tests/spec/core_functions/selector/unify/simple/test_type/and_universal.rs @@ -0,0 +1,209 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/selector/unify/simple/type/and_universal.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("and_universal") +} + +mod any { + #[allow(unused)] + use super::runner; + + #[test] + fn and_any() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*|c\", \"*|*\")}\n"), + "a {\ + \n b: *|c;\ + \n}\n" + ); + } + #[test] + fn and_default() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*|c\", \"*\")}\n"), + "a {\ + \n b: c;\ + \n}\n" + ); + } + #[test] + fn and_empty() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*|c\", \"|*\")}\n"), + "a {\ + \n b: |c;\ + \n}\n" + ); + } + #[test] + fn and_explicit() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*|c\", \"d|*\")}\n"), + "a {\ + \n b: d|c;\ + \n}\n" + ); + } +} +mod default { + #[allow(unused)] + use super::runner; + + #[test] + fn and_any() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"c\", \"*|*\")}\n"), + "a {\ + \n b: c;\ + \n}\n" + ); + } + #[test] + fn and_default() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"c\", \"*\")}\n"), + "a {\ + \n b: c;\ + \n}\n" + ); + } + #[test] + fn and_empty() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c\", \"|*\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + #[test] + fn and_explicit() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c\", \"e|*\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } +} +mod empty { + #[allow(unused)] + use super::runner; + + #[test] + fn and_any() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"|c\", \"*|*\")}\n"), + "a {\ + \n b: |c;\ + \n}\n" + ); + } + #[test] + fn and_default() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"|c\", \"*\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + #[test] + fn and_empty() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"|c\", \"|*\")}\n"), + "a {\ + \n b: |c;\ + \n}\n" + ); + } + #[test] + fn and_explicit() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"|c\", \"e|*\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } +} +mod explicit { + #[allow(unused)] + use super::runner; + + #[test] + fn and_any() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"c|d\", \"*|*\")}\n"), + "a {\ + \n b: c|d;\ + \n}\n" + ); + } + #[test] + fn and_default() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c|d\", \"*\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + #[test] + fn and_empty() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c|d\", \"|*\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + mod and_explicit { + #[allow(unused)] + use super::runner; + + #[test] + fn different() { + assert_eq!( + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c|d\", \"e|*\"))}\n"), + "a {\ + \n b: null;\ + \n}\n" + ); + } + #[test] + fn same() { + assert_eq!( + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"c|d\", \"c|*\")}\n"), + "a {\ + \n b: c|d;\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/core_functions/selector/unify/simple/test_type/mod.rs b/rsass/tests/spec/core_functions/selector/unify/simple/test_type/mod.rs new file mode 100644 index 000000000..522e80460 --- /dev/null +++ b/rsass/tests/spec/core_functions/selector/unify/simple/test_type/mod.rs @@ -0,0 +1,10 @@ +//! Tests auto-converted from "sass-spec/spec/core_functions/selector/unify/simple/type" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("type") +} + +mod and_type; + +mod and_universal; diff --git a/rsass/tests/spec/core_functions/selector/unify/simple/universal.rs b/rsass/tests/spec/core_functions/selector/unify/simple/universal.rs index b525ec3ff..b3dffb431 100644 --- a/rsass/tests/spec/core_functions/selector/unify/simple/universal.rs +++ b/rsass/tests/spec/core_functions/selector/unify/simple/universal.rs @@ -16,7 +16,8 @@ mod and_type { #[test] fn and_any() { assert_eq!( - runner().ok("a {b: selector-unify(\"*|*\", \"*|c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*|*\", \"*|c\")}\n"), "a {\ \n b: *|c;\ \n}\n" @@ -25,7 +26,8 @@ mod and_type { #[test] fn and_default() { assert_eq!( - runner().ok("a {b: selector-unify(\"*|*\", \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*|*\", \"c\")}\n"), "a {\ \n b: c;\ \n}\n" @@ -34,7 +36,8 @@ mod and_type { #[test] fn and_empty() { assert_eq!( - runner().ok("a {b: selector-unify(\"*|*\", \"|c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*|*\", \"|c\")}\n"), "a {\ \n b: |c;\ \n}\n" @@ -43,7 +46,8 @@ mod and_type { #[test] fn and_explicit() { assert_eq!( - runner().ok("a {b: selector-unify(\"*|*\", \"c|d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*|*\", \"c|d\")}\n"), "a {\ \n b: c|d;\ \n}\n" @@ -57,7 +61,8 @@ mod and_type { #[test] fn and_any() { assert_eq!( - runner().ok("a {b: selector-unify(\"*\", \"*|c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*\", \"*|c\")}\n"), "a {\ \n b: c;\ \n}\n" @@ -66,7 +71,8 @@ mod and_type { #[test] fn and_default() { assert_eq!( - runner().ok("a {b: selector-unify(\"*\", \"c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*\", \"c\")}\n"), "a {\ \n b: c;\ \n}\n" @@ -75,8 +81,9 @@ mod and_type { #[test] fn and_empty() { assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"*\", \"|c\"))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"*\", \"|c\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -85,8 +92,9 @@ mod and_type { #[test] fn and_explicit() { assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"*\", \"c|d\"))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"*\", \"c|d\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -100,7 +108,8 @@ mod and_type { #[test] fn and_any() { assert_eq!( - runner().ok("a {b: selector-unify(\"|*\", \"*|c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"|*\", \"*|c\")}\n"), "a {\ \n b: |c;\ \n}\n" @@ -109,8 +118,9 @@ mod and_type { #[test] fn and_default() { assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"|*\", \"c\"))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"|*\", \"c\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -119,7 +129,8 @@ mod and_type { #[test] fn and_empty() { assert_eq!( - runner().ok("a {b: selector-unify(\"|*\", \"|c\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"|*\", \"|c\")}\n"), "a {\ \n b: |c;\ \n}\n" @@ -128,8 +139,9 @@ mod and_type { #[test] fn and_explicit() { assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"|*\", \"c|d\"))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"|*\", \"c|d\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -143,7 +155,8 @@ mod and_type { #[test] fn and_any() { assert_eq!( - runner().ok("a {b: selector-unify(\"c|*\", \"*|d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"c|*\", \"*|d\")}\n"), "a {\ \n b: c|d;\ \n}\n" @@ -152,8 +165,9 @@ mod and_type { #[test] fn and_default() { assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"c|*\", \"d\"))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c|*\", \"d\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -162,8 +176,9 @@ mod and_type { #[test] fn and_empty() { assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"c|*\", \"|d\"))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c|*\", \"|d\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -176,9 +191,9 @@ mod and_type { #[test] fn different() { assert_eq!( - runner().ok( - "a {b: inspect(selector-unify(\"c|*\", \"d|e\"))}\n" - ), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c|*\", \"d|e\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -187,7 +202,8 @@ mod and_type { #[test] fn same() { assert_eq!( - runner().ok("a {b: selector-unify(\"c|*\", \"c|d\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"c|*\", \"c|d\")}\n"), "a {\ \n b: c|d;\ \n}\n" @@ -207,7 +223,8 @@ mod and_universal { #[test] fn and_any() { assert_eq!( - runner().ok("a {b: selector-unify(\"*|*\", \"*|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*|*\", \"*|*\")}\n"), "a {\ \n b: *|*;\ \n}\n" @@ -216,7 +233,8 @@ mod and_universal { #[test] fn and_default() { assert_eq!( - runner().ok("a {b: selector-unify(\"*|*\", \"*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*|*\", \"*\")}\n"), "a {\ \n b: *;\ \n}\n" @@ -225,7 +243,8 @@ mod and_universal { #[test] fn and_empty() { assert_eq!( - runner().ok("a {b: selector-unify(\"*|*\", \"|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*|*\", \"|*\")}\n"), "a {\ \n b: |*;\ \n}\n" @@ -234,7 +253,8 @@ mod and_universal { #[test] fn and_explicit() { assert_eq!( - runner().ok("a {b: selector-unify(\"*|*\", \"c|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*|*\", \"c|*\")}\n"), "a {\ \n b: c|*;\ \n}\n" @@ -248,7 +268,8 @@ mod and_universal { #[test] fn and_any() { assert_eq!( - runner().ok("a {b: selector-unify(\"*\", \"*|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*\", \"*|*\")}\n"), "a {\ \n b: *;\ \n}\n" @@ -257,7 +278,8 @@ mod and_universal { #[test] fn and_default() { assert_eq!( - runner().ok("a {b: selector-unify(\"*\", \"*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"*\", \"*\")}\n"), "a {\ \n b: *;\ \n}\n" @@ -266,8 +288,9 @@ mod and_universal { #[test] fn and_empty() { assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"*\", \"|*\"))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"*\", \"|*\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -276,8 +299,9 @@ mod and_universal { #[test] fn and_explicit() { assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"*\", \"e|*\"))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"*\", \"e|*\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -291,7 +315,8 @@ mod and_universal { #[test] fn and_any() { assert_eq!( - runner().ok("a {b: selector-unify(\"|*\", \"*|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"|*\", \"*|*\")}\n"), "a {\ \n b: |*;\ \n}\n" @@ -300,8 +325,9 @@ mod and_universal { #[test] fn and_default() { assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"|*\", \"*\"))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"|*\", \"*\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -310,7 +336,8 @@ mod and_universal { #[test] fn and_empty() { assert_eq!( - runner().ok("a {b: selector-unify(\"|*\", \"|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"|*\", \"|*\")}\n"), "a {\ \n b: |*;\ \n}\n" @@ -319,8 +346,9 @@ mod and_universal { #[test] fn and_explicit() { assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"|*\", \"e|*\"))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"|*\", \"e|*\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -334,7 +362,8 @@ mod and_universal { #[test] fn and_any() { assert_eq!( - runner().ok("a {b: selector-unify(\"c|*\", \"*|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"c|*\", \"*|*\")}\n"), "a {\ \n b: c|*;\ \n}\n" @@ -343,8 +372,9 @@ mod and_universal { #[test] fn and_default() { assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"c|*\", \"*\"))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c|*\", \"*\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -353,8 +383,9 @@ mod and_universal { #[test] fn and_empty() { assert_eq!( - runner() - .ok("a {b: inspect(selector-unify(\"c|*\", \"|*\"))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \na {b: meta.inspect(selector.unify(\"c|*\", \"|*\"))}\n"), "a {\ \n b: null;\ \n}\n" @@ -363,7 +394,8 @@ mod and_universal { #[test] fn and_explicit() { assert_eq!( - runner().ok("a {b: selector-unify(\"c|*\", \"c|*\")}\n"), + runner().ok("@use \"sass:selector\";\ + \na {b: selector.unify(\"c|*\", \"c|*\")}\n"), "a {\ \n b: c|*;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/string/index.rs b/rsass/tests/spec/core_functions/string/index.rs index b9033e489..892548807 100644 --- a/rsass/tests/spec/core_functions/string/index.rs +++ b/rsass/tests/spec/core_functions/string/index.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn beginning() { assert_eq!( - runner().ok("a {b: str-index(\"cde\", \"c\")}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.index(\"cde\", \"c\")}\n"), "a {\ \n b: 1;\ \n}\n" @@ -17,7 +18,8 @@ fn beginning() { #[test] fn both_empty() { assert_eq!( - runner().ok("a {b: str-index(\"\", \"\")}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.index(\"\", \"\")}\n"), "a {\ \n b: 1;\ \n}\n" @@ -27,10 +29,11 @@ fn both_empty() { fn combining_character() { assert_eq!( runner().ok( - "// Sass does *not* treat strings as sequences of glyphs, so this string which\ + "@use \"sass:string\";\ + \n// Sass does *not* treat strings as sequences of glyphs, so this string which\ \n// contains \"c\" followed by a combining umlaut should be considered two separate\ \n// characters even though it\'s rendered as only one.\ - \na {b: str-index(\"c\\0308 a\", \"a\")}\n" + \na {b: string.index(\"c\\0308 a\", \"a\")}\n" ), "a {\ \n b: 3;\ @@ -41,9 +44,10 @@ fn combining_character() { fn double_width_character() { assert_eq!( runner().ok( - "// Sass treats strings as sequences of Unicode codepoint; it doesn\'t care if a\ + "@use \"sass:string\";\ + \n// Sass treats strings as sequences of Unicode codepoint; it doesn\'t care if a\ \n// character is represented as two UTF-16 code units.\ - \na {b: str-index(\"👭a\", \"a\")}\n" + \na {b: string.index(\"👭a\", \"a\")}\n" ), "a {\ \n b: 2;\ @@ -53,7 +57,8 @@ fn double_width_character() { #[test] fn empty_substring() { assert_eq!( - runner().ok("a {b: str-index(\"cde\", \"\")}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.index(\"cde\", \"\")}\n"), "a {\ \n b: 1;\ \n}\n" @@ -62,7 +67,8 @@ fn empty_substring() { #[test] fn end() { assert_eq!( - runner().ok("a {b: str-index(\"cde\", \"e\")}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.index(\"cde\", \"e\")}\n"), "a {\ \n b: 3;\ \n}\n" @@ -75,33 +81,39 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: str-index(\"c\")}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.index(\"c\")}\n" + ), "Error: Missing argument $substring.\ \n ,--> input.scss\ - \n1 | a {b: str-index(\"c\")}\ - \n | ^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: string.index(\"c\")}\ + \n | ^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:string\ \n1 | @function index($string, $substring) {\ \n | ========================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: str-index(\"c\", \"d\", \"e\")}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.index(\"c\", \"d\", \"e\")}\n" + ), "Error: Only 2 arguments allowed, but 3 were passed.\ \n ,--> input.scss\ - \n1 | a {b: str-index(\"c\", \"d\", \"e\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: string.index(\"c\", \"d\", \"e\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:string\ \n1 | @function index($string, $substring) {\ \n | ========================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod test_type { @@ -111,33 +123,55 @@ mod error { #[test] fn string() { assert_eq!( - runner().err("a {b: str-index(1, \"c\")}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.index(1, \"c\")}\n" + ), "Error: $string: 1 is not a string.\ \n ,\ - \n1 | a {b: str-index(1, \"c\")}\ - \n | ^^^^^^^^^^^^^^^^^\ + \n2 | a {b: string.index(1, \"c\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn substring() { assert_eq!( - runner().err("a {b: str-index(\"c\", 1)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.index(\"c\", 1)}\n" + ), "Error: $substring: 1 is not a string.\ \n ,\ - \n1 | a {b: str-index(\"c\", 1)}\ - \n | ^^^^^^^^^^^^^^^^^\ + \n2 | a {b: string.index(\"c\", 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } + #[test] + fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:string\";\ + \na {b: string.str-index(\"c\", \"c\")}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: string.str-index(\"c\", \"c\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } } #[test] fn middle() { assert_eq!( - runner().ok("a {b: str-index(\"cde\", \"d\")}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.index(\"cde\", \"d\")}\n"), "a {\ \n b: 2;\ \n}\n" @@ -146,8 +180,8 @@ fn middle() { #[test] fn named() { assert_eq!( - runner() - .ok("a {b: str-index($string: \"cde\", $substring: \"c\")}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.index($string: \"cde\", $substring: \"c\")}\n"), "a {\ \n b: 1;\ \n}\n" @@ -156,7 +190,9 @@ fn named() { #[test] fn not_found() { assert_eq!( - runner().ok("a {b: inspect(str-index(\"cde\", \"f\"))}\n"), + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:string\";\ + \na {b: meta.inspect(string.index(\"cde\", \"f\"))}\n"), "a {\ \n b: null;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/string/insert.rs b/rsass/tests/spec/core_functions/string/insert.rs index 5cd1a2f1a..8a2290eb8 100644 --- a/rsass/tests/spec/core_functions/string/insert.rs +++ b/rsass/tests/spec/core_functions/string/insert.rs @@ -9,11 +9,12 @@ fn runner() -> crate::TestRunner { fn combining_character() { assert_eq!( runner().ok( - "// Sass does *not* treat strings as sequences of glyphs, so this string which\ + "@use \"sass:string\";\ + \n// Sass does *not* treat strings as sequences of glyphs, so this string which\ \n// contains \"c\" followed by a combining umlaut should be considered two separate\ \n// characters even though it\'s rendered as only one and the \"d\" should be\ \n// injected between the two.\ - \na {b: str-insert(\"c\\0308\", \"d\", 2)}\n" + \na {b: string.insert(\"c\\0308\", \"d\", 2)}\n" ), "@charset \"UTF-8\";\ \na {\ @@ -25,10 +26,11 @@ fn combining_character() { fn double_width_character() { assert_eq!( runner().ok( - "// Sass treats strings as sequences of Unicode codepoint; it doesn\'t care if a\ + "@use \"sass:string\";\ + \n// Sass treats strings as sequences of Unicode codepoint; it doesn\'t care if a\ \n// character is represented as two UTF-16 code units, so inserting a character\ \n// at index 2 shouldn\'t break this emoji in two.\ - \na {b: str-insert(\"👭\", \"c\", 2)}\n" + \na {b: string.insert(\"👭\", \"c\", 2)}\n" ), "@charset \"UTF-8\";\ \na {\ @@ -43,7 +45,8 @@ mod empty_destination { #[test] fn empty_source() { assert_eq!( - runner().ok("a {b: str-insert(\"\", \"\", 1)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.insert(\"\", \"\", 1)}\n"), "a {\ \n b: \"\";\ \n}\n" @@ -52,7 +55,8 @@ mod empty_destination { #[test] fn index_0() { assert_eq!( - runner().ok("a {b: str-insert(\"\", \"c\", 0)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.insert(\"\", \"c\", 0)}\n"), "a {\ \n b: \"c\";\ \n}\n" @@ -61,7 +65,8 @@ mod empty_destination { #[test] fn index_1() { assert_eq!( - runner().ok("a {b: str-insert(\"\", \"c\", 1)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.insert(\"\", \"c\", 1)}\n"), "a {\ \n b: \"c\";\ \n}\n" @@ -70,7 +75,8 @@ mod empty_destination { #[test] fn index_2() { assert_eq!( - runner().ok("a {b: str-insert(\"\", \"c\", 2)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.insert(\"\", \"c\", 2)}\n"), "a {\ \n b: \"c\";\ \n}\n" @@ -79,7 +85,8 @@ mod empty_destination { #[test] fn index_negative_1() { assert_eq!( - runner().ok("a {b: str-insert(\"\", \"c\", -1)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.insert(\"\", \"c\", -1)}\n"), "a {\ \n b: \"c\";\ \n}\n" @@ -89,7 +96,8 @@ mod empty_destination { #[test] fn empty_insertion() { assert_eq!( - runner().ok("a {b: str-insert(\"cde\", \"\", 1)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.insert(\"cde\", \"\", 1)}\n"), "a {\ \n b: \"cde\";\ \n}\n" @@ -102,45 +110,54 @@ mod error { #[test] fn decimal() { assert_eq!( - runner().err("a {b: str-insert(\"\", \"\", 0.5)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.insert(\"\", \"\", 0.5)}\n" + ), "Error: $index: 0.5 is not an int.\ \n ,\ - \n1 | a {b: str-insert(\"\", \"\", 0.5)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: string.insert(\"\", \"\", 0.5)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: str-insert(\"\", \"\")}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.insert(\"\", \"\")}\n" + ), "Error: Missing argument $index.\ \n ,--> input.scss\ - \n1 | a {b: str-insert(\"\", \"\")}\ - \n | ^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: string.insert(\"\", \"\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:string\ \n1 | @function insert($string, $insert, $index) {\ \n | ================================ declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: str-insert(\"\", \"\", 1, 2)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.insert(\"\", \"\", 1, 2)}\n" + ), "Error: Only 3 arguments allowed, but 4 were passed.\ \n ,--> input.scss\ - \n1 | a {b: str-insert(\"\", \"\", 1, 2)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: string.insert(\"\", \"\", 1, 2)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:string\ \n1 | @function insert($string, $insert, $index) {\ \n | ================================ declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod test_type { @@ -150,40 +167,64 @@ mod error { #[test] fn index() { assert_eq!( - runner().err("a {b: str-insert(\"\", \"\", \"\")}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.insert(\"\", \"\", \"\")}\n" + ), "Error: $index: \"\" is not a number.\ \n ,\ - \n1 | a {b: str-insert(\"\", \"\", \"\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: string.insert(\"\", \"\", \"\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn insert() { assert_eq!( - runner().err("a {b: str-insert(\"\", 1, 1)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.insert(\"\", 1, 1)}\n" + ), "Error: $insert: 1 is not a string.\ \n ,\ - \n1 | a {b: str-insert(\"\", 1, 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: string.insert(\"\", 1, 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn string() { assert_eq!( - runner().err("a {b: str-insert(1, \"\", 1)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.insert(1, \"\", 1)}\n" + ), "Error: $string: 1 is not a string.\ \n ,\ - \n1 | a {b: str-insert(1, \"\", 1)}\ - \n | ^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: string.insert(1, \"\", 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } + #[test] + fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:string\";\ + \na {b: string.str-insert(\"c\", 1, \"d\")}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: string.str-insert(\"c\", 1, \"d\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); + } } mod index { #[allow(unused)] @@ -196,7 +237,8 @@ mod index { #[test] fn t1() { assert_eq!( - runner().ok("a {b: str-insert(\"cde\", \"f\", -1)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.insert(\"cde\", \"f\", -1)}\n"), "a {\ \n b: \"cdef\";\ \n}\n" @@ -205,7 +247,8 @@ mod index { #[test] fn t2() { assert_eq!( - runner().ok("a {b: str-insert(\"cde\", \"f\", -2)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.insert(\"cde\", \"f\", -2)}\n"), "a {\ \n b: \"cdfe\";\ \n}\n" @@ -218,8 +261,9 @@ mod index { #[test] fn less_than_double() { assert_eq!( - runner().ok("// Regression test for sass/dart-sass#1568\ - \na {b: str-insert(\"cdefghijkl\", \"mno\", -15)}\n"), + runner().ok("@use \"sass:string\";\ + \n// Regression test for sass/dart-sass#1568\ + \na {b: string.insert(\"cdefghijkl\", \"mno\", -15)}\n"), "a {\ \n b: \"mnocdefghijkl\";\ \n}\n" @@ -228,7 +272,8 @@ mod index { #[test] fn more_than_double() { assert_eq!( - runner().ok("a {b: str-insert(\"cde\", \"f\", -100)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.insert(\"cde\", \"f\", -100)}\n"), "a {\ \n b: \"fcde\";\ \n}\n" @@ -238,7 +283,8 @@ mod index { #[test] fn last() { assert_eq!( - runner().ok("a {b: str-insert(\"cde\", \"f\", -4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.insert(\"cde\", \"f\", -4)}\n"), "a {\ \n b: \"fcde\";\ \n}\n" @@ -252,7 +298,8 @@ mod index { #[test] fn t0() { assert_eq!( - runner().ok("a {b: str-insert(\"cde\", \"f\", 0)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.insert(\"cde\", \"f\", 0)}\n"), "a {\ \n b: \"fcde\";\ \n}\n" @@ -261,7 +308,8 @@ mod index { #[test] fn t1() { assert_eq!( - runner().ok("a {b: str-insert(\"cde\", \"f\", 1)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.insert(\"cde\", \"f\", 1)}\n"), "a {\ \n b: \"fcde\";\ \n}\n" @@ -270,7 +318,8 @@ mod index { #[test] fn t2() { assert_eq!( - runner().ok("a {b: str-insert(\"cde\", \"f\", 2)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.insert(\"cde\", \"f\", 2)}\n"), "a {\ \n b: \"cfde\";\ \n}\n" @@ -279,7 +328,8 @@ mod index { #[test] fn after_last() { assert_eq!( - runner().ok("a {b: str-insert(\"cde\", \"f\", 100)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.insert(\"cde\", \"f\", 100)}\n"), "a {\ \n b: \"cdef\";\ \n}\n" @@ -288,7 +338,8 @@ mod index { #[test] fn last() { assert_eq!( - runner().ok("a {b: str-insert(\"cde\", \"f\", 4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.insert(\"cde\", \"f\", 4)}\n"), "a {\ \n b: \"cdef\";\ \n}\n" @@ -300,7 +351,8 @@ mod index { fn named() { assert_eq!( runner().ok( - "a {b: str-insert($string: \"cde\", $insert: \"f\", $index: 2)}\n" + "@use \"sass:string\";\ + \na {b: string.insert($string: \"cde\", $insert: \"f\", $index: 2)}\n" ), "a {\ \n b: \"cfde\";\ diff --git a/rsass/tests/spec/core_functions/string/length.rs b/rsass/tests/spec/core_functions/string/length.rs index 8e10efe85..1f5e70f73 100644 --- a/rsass/tests/spec/core_functions/string/length.rs +++ b/rsass/tests/spec/core_functions/string/length.rs @@ -9,10 +9,11 @@ fn runner() -> crate::TestRunner { fn combining_character() { assert_eq!( runner().ok( - "// Sass does *not* treat strings as sequences of glyphs, so this string which\ + "@use \"sass:string\";\ + \n// Sass does *not* treat strings as sequences of glyphs, so this string which\ \n// contains \"c\" followed by a combining umlaut should be considered two separate\ \n// characters even though it\'s rendered as only one.\ - \na {b: str-length(\"c\\0308\")}\n" + \na {b: string.length(\"c\\0308\")}\n" ), "a {\ \n b: 2;\ @@ -23,9 +24,10 @@ fn combining_character() { fn double_width_character() { assert_eq!( runner().ok( - "// Sass treats strings as sequences of Unicode codepoint; it doesn\'t care if a\ + "@use \"sass:string\";\ + \n// Sass treats strings as sequences of Unicode codepoint; it doesn\'t care if a\ \n// character is represented as two UTF-16 code units.\ - \na {b: str-length(\"👭\")}\n" + \na {b: string.length(\"👭\")}\n" ), "a {\ \n b: 1;\ @@ -35,7 +37,8 @@ fn double_width_character() { #[test] fn empty() { assert_eq!( - runner().ok("a {b: str-length(\"\")}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.length(\"\")}\n"), "a {\ \n b: 0;\ \n}\n" @@ -48,52 +51,77 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: str-length()}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.length()}\n" + ), "Error: Missing argument $string.\ \n ,--> input.scss\ - \n1 | a {b: str-length()}\ - \n | ^^^^^^^^^^^^ invocation\ + \n2 | a {b: string.length()}\ + \n | ^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:string\ \n1 | @function length($string) {\ \n | =============== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: str-length(c, d)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.length(c, d)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: str-length(c, d)}\ - \n | ^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: string.length(c, d)}\ + \n | ^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:string\ \n1 | @function length($string) {\ \n | =============== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: str-length(1)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.length(1)}\n" + ), "Error: $string: 1 is not a string.\ \n ,\ - \n1 | a {b: str-length(1)}\ - \n | ^^^^^^^^^^^^^\ + \n2 | a {b: string.length(1)}\ + \n | ^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", + ); + } + #[test] + fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:string\";\ + \na {b: string.str-length(\"c\")}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: string.str-length(\"c\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", ); } } #[test] fn multiple_characters() { assert_eq!( - runner().ok("a {b: str-length(\"fblthp abatement\")}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.length(\"fblthp abatement\")}\n"), "a {\ \n b: 16;\ \n}\n" @@ -102,7 +130,8 @@ fn multiple_characters() { #[test] fn named() { assert_eq!( - runner().ok("a {b: str-length($string: \"c\")}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.length($string: \"c\")}\n"), "a {\ \n b: 1;\ \n}\n" @@ -111,7 +140,8 @@ fn named() { #[test] fn one_character() { assert_eq!( - runner().ok("a {b: str-length(\"c\")}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.length(\"c\")}\n"), "a {\ \n b: 1;\ \n}\n" @@ -121,9 +151,10 @@ fn one_character() { fn private_use_character() { assert_eq!( runner().ok( - "// Dart Sass emits private-use characters as escapes in expanded mode, but it\ + "@use \"sass:string\";\ + \n// Dart Sass emits private-use characters as escapes in expanded mode, but it\ \n// should stil treat them as single characters for the purpose of functions.\ - \na {b: str-length(\"\\E000\")}\n" + \na {b: string.length(\"\\E000\")}\n" ), "a {\ \n b: 1;\ @@ -133,7 +164,8 @@ fn private_use_character() { #[test] fn unquoted() { assert_eq!( - runner().ok("a {b: str-length(loofamonster)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.length(loofamonster)}\n"), "a {\ \n b: 12;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/string/quote.rs b/rsass/tests/spec/core_functions/string/quote.rs index 8f10507a5..f0e3c0530 100644 --- a/rsass/tests/spec/core_functions/string/quote.rs +++ b/rsass/tests/spec/core_functions/string/quote.rs @@ -12,52 +12,63 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: quote()}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.quote()}\n" + ), "Error: Missing argument $string.\ \n ,--> input.scss\ - \n1 | a {b: quote()}\ - \n | ^^^^^^^ invocation\ + \n2 | a {b: string.quote()}\ + \n | ^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:string\ \n1 | @function quote($string) {\ \n | ============== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: quote(c, d)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.quote(c, d)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: quote(c, d)}\ - \n | ^^^^^^^^^^^ invocation\ + \n2 | a {b: string.quote(c, d)}\ + \n | ^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:string\ \n1 | @function quote($string) {\ \n | ============== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] + #[ignore] // wrong error fn test_type() { assert_eq!( - runner().err("a {b: quote((1, 2, 3))}\n"), - "Error: $string: 1, 2, 3 is not a string.\ + runner().err( + "@use \"sass:string\";\ + \na {b: string.quote((1, 2, 3))}\n" + ), + "Error: $string: (1, 2, 3) is not a string.\ \n ,\ - \n1 | a {b: quote((1, 2, 3))}\ - \n | ^^^^^^^^^^^^^^^^\ + \n2 | a {b: string.quote((1, 2, 3))}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn escape() { assert_eq!( - runner().ok("a {b: quote(\\0)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.quote(\\0)}\n"), "a {\ \n b: \"\\\\0 \";\ \n}\n" @@ -66,7 +77,8 @@ fn escape() { #[test] fn named() { assert_eq!( - runner().ok("a {b: quote($string: c)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.quote($string: c)}\n"), "a {\ \n b: \"c\";\ \n}\n" @@ -79,18 +91,22 @@ mod quote_unquoted_quote { #[test] fn double() { assert_eq!( - runner().ok("// See sass/libsass#2873\ - \na {b: quote(unquote(\'\"\') + unquote(\"\'\"))}\n"), - "a {\ + runner().ok( + "@use \"sass:string\";\ + \n// See sass/libsass#2873\ + \na {b: string.quote(string.unquote(\'\"\') + string.unquote(\"\'\"))}\n" + ), + "a {\ \n b: \"\\\"\'\";\ \n}\n" - ); + ); } #[test] fn single() { assert_eq!( - runner().ok("// See sass/libsass#2873\ - \na {b: quote(unquote(\'\"\'))}\n"), + runner().ok("@use \"sass:string\";\ + \n// See sass/libsass#2873\ + \na {b: string.quote(string.unquote(\'\"\'))}\n"), "a {\ \n b: \'\"\';\ \n}\n" @@ -100,7 +116,8 @@ mod quote_unquoted_quote { #[test] fn quoted_double() { assert_eq!( - runner().ok("a {b: quote(\"c\")}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.quote(\"c\")}\n"), "a {\ \n b: \"c\";\ \n}\n" @@ -109,7 +126,8 @@ fn quoted_double() { #[test] fn quoted_single() { assert_eq!( - runner().ok("a {b: quote(\'c\')}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.quote(\'c\')}\n"), "a {\ \n b: \"c\";\ \n}\n" @@ -118,7 +136,8 @@ fn quoted_single() { #[test] fn unquoted() { assert_eq!( - runner().ok("a {b: quote(c)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.quote(c)}\n"), "a {\ \n b: \"c\";\ \n}\n" diff --git a/rsass/tests/spec/core_functions/string/slice/combining_character.rs b/rsass/tests/spec/core_functions/string/slice/combining_character.rs index e4e706259..d44d81c41 100644 --- a/rsass/tests/spec/core_functions/string/slice/combining_character.rs +++ b/rsass/tests/spec/core_functions/string/slice/combining_character.rs @@ -9,11 +9,12 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "// Sass does *not* treat strings as sequences of glyphs, so this string which\ + "@use \"sass:string\";\ + \n// Sass does *not* treat strings as sequences of glyphs, so this string which\ \n// contains \"c\" followed by a combining umlaut should be considered two separate\ \n// characters even though it\'s rendered as only one and only the \"d\" should be\ \n// sliced out.\ - \na {b: str-slice(\"cd\\0308e\", 2, 2)}\n" + \na {b: string.slice(\"cd\\0308e\", 2, 2)}\n" ), "a {\ \n b: \"d\";\ diff --git a/rsass/tests/spec/core_functions/string/slice/double_width_character.rs b/rsass/tests/spec/core_functions/string/slice/double_width_character.rs index b40a0b7fb..5201c1a4d 100644 --- a/rsass/tests/spec/core_functions/string/slice/double_width_character.rs +++ b/rsass/tests/spec/core_functions/string/slice/double_width_character.rs @@ -9,10 +9,11 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "// Sass treats strings as sequences of Unicode codepoint; it doesn\'t care if a\ + "@use \"sass:string\";\ + \n// Sass treats strings as sequences of Unicode codepoint; it doesn\'t care if a\ \n// character is represented as two UTF-16 code units, so inserting a character\ \n// at index 2 shouldn\'t break this emoji in two.\ - \na {b: str-slice(\"c👭d\", 2, 2)}\n" + \na {b: string.slice(\"c👭d\", 2, 2)}\n" ), "@charset \"UTF-8\";\ \na {\ diff --git a/rsass/tests/spec/core_functions/string/slice/empty.rs b/rsass/tests/spec/core_functions/string/slice/empty.rs index 199ef6653..522b1e191 100644 --- a/rsass/tests/spec/core_functions/string/slice/empty.rs +++ b/rsass/tests/spec/core_functions/string/slice/empty.rs @@ -12,7 +12,8 @@ mod end { #[test] fn t0() { assert_eq!( - runner().ok("a {b: str-slice(\"\", 1, 0)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"\", 1, 0)}\n"), "a {\ \n b: \"\";\ \n}\n" @@ -21,7 +22,8 @@ mod end { #[test] fn t1() { assert_eq!( - runner().ok("a {b: str-slice(\"\", 1, 1)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"\", 1, 1)}\n"), "a {\ \n b: \"\";\ \n}\n" @@ -30,7 +32,8 @@ mod end { #[test] fn t2() { assert_eq!( - runner().ok("a {b: str-slice(\"\", 1, 2)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"\", 1, 2)}\n"), "a {\ \n b: \"\";\ \n}\n" @@ -44,7 +47,8 @@ mod start { #[test] fn t0() { assert_eq!( - runner().ok("a {b: str-slice(\"\", 0)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"\", 0)}\n"), "a {\ \n b: \"\";\ \n}\n" @@ -53,7 +57,8 @@ mod start { #[test] fn t1() { assert_eq!( - runner().ok("a {b: str-slice(\"\", 1)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"\", 1)}\n"), "a {\ \n b: \"\";\ \n}\n" @@ -62,7 +67,8 @@ mod start { #[test] fn t2() { assert_eq!( - runner().ok("a {b: str-slice(\"\", 2)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"\", 2)}\n"), "a {\ \n b: \"\";\ \n}\n" @@ -71,7 +77,8 @@ mod start { #[test] fn negative_1() { assert_eq!( - runner().ok("a {b: str-slice(\"\", -1)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"\", -1)}\n"), "a {\ \n b: \"\";\ \n}\n" diff --git a/rsass/tests/spec/core_functions/string/slice/end.rs b/rsass/tests/spec/core_functions/string/slice/end.rs index 0b14d30f9..b094ce326 100644 --- a/rsass/tests/spec/core_functions/string/slice/end.rs +++ b/rsass/tests/spec/core_functions/string/slice/end.rs @@ -12,7 +12,8 @@ mod negative { #[test] fn t1() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", 1, -1)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", 1, -1)}\n"), "a {\ \n b: \"cde\";\ \n}\n" @@ -21,7 +22,8 @@ mod negative { #[test] fn t2() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", 1, -2)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", 1, -2)}\n"), "a {\ \n b: \"cd\";\ \n}\n" @@ -30,7 +32,8 @@ mod negative { #[test] fn after_last() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", 1, -100)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", 1, -100)}\n"), "a {\ \n b: \"\";\ \n}\n" @@ -39,7 +42,8 @@ mod negative { #[test] fn last() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", 1, -4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", 1, -4)}\n"), "a {\ \n b: \"\";\ \n}\n" @@ -53,7 +57,8 @@ mod positive { #[test] fn t0() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", 1, 0)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", 1, 0)}\n"), "a {\ \n b: \"\";\ \n}\n" @@ -62,7 +67,8 @@ mod positive { #[test] fn t1() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", 1, 1)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", 1, 1)}\n"), "a {\ \n b: \"c\";\ \n}\n" @@ -71,7 +77,8 @@ mod positive { #[test] fn t2() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", 1, 2)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", 1, 2)}\n"), "a {\ \n b: \"cd\";\ \n}\n" @@ -80,7 +87,8 @@ mod positive { #[test] fn after_last() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", 1, 100)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", 1, 100)}\n"), "a {\ \n b: \"cde\";\ \n}\n" @@ -89,7 +97,8 @@ mod positive { #[test] fn after_start() { assert_eq!( - runner().ok("a {b: str-slice(\"cdef\", 2, 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cdef\", 2, 3)}\n"), "a {\ \n b: \"de\";\ \n}\n" @@ -98,7 +107,8 @@ mod positive { #[test] fn last() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", 1, 3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", 1, 3)}\n"), "a {\ \n b: \"cde\";\ \n}\n" diff --git a/rsass/tests/spec/core_functions/string/slice/error.rs b/rsass/tests/spec/core_functions/string/slice/error.rs index e2e83c6e3..450448433 100644 --- a/rsass/tests/spec/core_functions/string/slice/error.rs +++ b/rsass/tests/spec/core_functions/string/slice/error.rs @@ -13,59 +13,71 @@ mod decimal { #[ignore] // wrong error fn end() { assert_eq!( - runner().err("a {b: str-slice(\"\", 1, 1.5)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.slice(\"\", 1, 1.5)}\n" + ), "Error: 1.5 is not an int.\ \n ,\ - \n1 | a {b: str-slice(\"\", 1, 1.5)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: string.slice(\"\", 1, 1.5)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] #[ignore] // wrong error fn start() { assert_eq!( - runner().err("a {b: str-slice(\"\", 0.5)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.slice(\"\", 0.5)}\n" + ), "Error: 0.5 is not an int.\ \n ,\ - \n1 | a {b: str-slice(\"\", 0.5)}\ - \n | ^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: string.slice(\"\", 0.5)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: str-slice(\"cde\")}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.slice(\"cde\")}\n" + ), "Error: Missing argument $start-at.\ \n ,--> input.scss\ - \n1 | a {b: str-slice(\"cde\")}\ - \n | ^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: string.slice(\"cde\")}\ + \n | ^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:string\ \n1 | @function slice($string, $start-at, $end-at: -1) {\ \n | ====================================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: str-slice(\"cde\", 1, 2, 3)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.slice(\"cde\", 1, 2, 3)}\n" + ), "Error: Only 3 arguments allowed, but 4 were passed.\ \n ,--> input.scss\ - \n1 | a {b: str-slice(\"cde\", 1, 2, 3)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: string.slice(\"cde\", 1, 2, 3)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:string\ \n1 | @function slice($string, $start-at, $end-at: -1) {\ \n | ====================================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } mod test_type { @@ -75,37 +87,46 @@ mod test_type { #[test] fn end_at() { assert_eq!( - runner().err("a {b: str-slice(\"cde\", 1, \"f\")}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.slice(\"cde\", 1, \"f\")}\n" + ), "Error: $end-at: \"f\" is not a number.\ \n ,\ - \n1 | a {b: str-slice(\"cde\", 1, \"f\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: string.slice(\"cde\", 1, \"f\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn start_at() { assert_eq!( - runner().err("a {b: str-slice(\"cde\", \"f\")}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.slice(\"cde\", \"f\")}\n" + ), "Error: $start-at: \"f\" is not a number.\ \n ,\ - \n1 | a {b: str-slice(\"cde\", \"f\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: string.slice(\"cde\", \"f\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn string() { assert_eq!( - runner().err("a {b: str-slice(1, 2)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.slice(1, 2)}\n" + ), "Error: $string: 1 is not a string.\ \n ,\ - \n1 | a {b: str-slice(1, 2)}\ - \n | ^^^^^^^^^^^^^^^\ + \n2 | a {b: string.slice(1, 2)}\ + \n | ^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -116,25 +137,46 @@ mod unit { #[test] fn end() { assert_eq!( - runner().err("a {b: str-slice(\"\", 1, 2px)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.slice(\"\", 1, 2px)}\n" + ), "Error: $end-at: Expected 2px to have no units.\ \n ,\ - \n1 | a {b: str-slice(\"\", 1, 2px)}\ - \n | ^^^^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: string.slice(\"\", 1, 2px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn start() { assert_eq!( - runner().err("a {b: str-slice(\"\", 1px)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.slice(\"\", 1px)}\n" + ), "Error: $start-at: Expected 1px to have no units.\ \n ,\ - \n1 | a {b: str-slice(\"\", 1px)}\ - \n | ^^^^^^^^^^^^^^^^^^\ + \n2 | a {b: string.slice(\"\", 1px)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } +#[test] +fn wrong_name() { + assert_eq!( + runner().err( + "@use \"sass:string\";\ + \na {b: string.str-slice(\"c\", 1, 1)}\n" + ), + "Error: Undefined function.\ + \n ,\ + \n2 | a {b: string.str-slice(\"c\", 1, 1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n \'\ + \n input.scss 2:7 root stylesheet", + ); +} diff --git a/rsass/tests/spec/core_functions/string/slice/named.rs b/rsass/tests/spec/core_functions/string/slice/named.rs index 9bb33650d..7e8b74c0c 100644 --- a/rsass/tests/spec/core_functions/string/slice/named.rs +++ b/rsass/tests/spec/core_functions/string/slice/named.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "a {b: str-slice($string: \"cde\", $start-at: 2, $end-at: 2)}\n" + "@use \"sass:string\";\ + \na {b: string.slice($string: \"cde\", $start-at: 2, $end-at: 2)}\n" ), "a {\ \n b: \"d\";\ diff --git a/rsass/tests/spec/core_functions/string/slice/start.rs b/rsass/tests/spec/core_functions/string/slice/start.rs index 2e291ebf7..ca915b5e9 100644 --- a/rsass/tests/spec/core_functions/string/slice/start.rs +++ b/rsass/tests/spec/core_functions/string/slice/start.rs @@ -12,7 +12,8 @@ mod negative { #[test] fn t1() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", -1)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", -1)}\n"), "a {\ \n b: \"e\";\ \n}\n" @@ -21,7 +22,8 @@ mod negative { #[test] fn t2() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", -2)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", -2)}\n"), "a {\ \n b: \"de\";\ \n}\n" @@ -30,7 +32,8 @@ mod negative { #[test] fn after_last() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", -100)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", -100)}\n"), "a {\ \n b: \"cde\";\ \n}\n" @@ -39,7 +42,8 @@ mod negative { #[test] fn last() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", -3)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", -3)}\n"), "a {\ \n b: \"cde\";\ \n}\n" @@ -53,7 +57,8 @@ mod positive { #[test] fn t0() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", 0)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", 0)}\n"), "a {\ \n b: \"cde\";\ \n}\n" @@ -62,7 +67,8 @@ mod positive { #[test] fn t1() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", 1)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", 1)}\n"), "a {\ \n b: \"cde\";\ \n}\n" @@ -71,7 +77,8 @@ mod positive { #[test] fn t2() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", 2)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", 2)}\n"), "a {\ \n b: \"de\";\ \n}\n" @@ -80,7 +87,8 @@ mod positive { #[test] fn after_end() { assert_eq!( - runner().ok("a {b: str-slice(\"cdef\", 3, 2)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cdef\", 3, 2)}\n"), "a {\ \n b: \"\";\ \n}\n" @@ -89,7 +97,8 @@ mod positive { #[test] fn after_last() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", 100)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", 100)}\n"), "a {\ \n b: \"\";\ \n}\n" @@ -98,7 +107,8 @@ mod positive { #[test] fn last() { assert_eq!( - runner().ok("a {b: str-slice(\"cde\", 4)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(\"cde\", 4)}\n"), "a {\ \n b: \"\";\ \n}\n" diff --git a/rsass/tests/spec/core_functions/string/slice/unquoted.rs b/rsass/tests/spec/core_functions/string/slice/unquoted.rs index ef7c267ca..0340c4589 100644 --- a/rsass/tests/spec/core_functions/string/slice/unquoted.rs +++ b/rsass/tests/spec/core_functions/string/slice/unquoted.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("a {b: str-slice(cdefgh, 3, 5)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.slice(cdefgh, 3, 5)}\n"), "a {\ \n b: efg;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/string/split.rs b/rsass/tests/spec/core_functions/string/split.rs index 674069c3b..b9a50739b 100644 --- a/rsass/tests/spec/core_functions/string/split.rs +++ b/rsass/tests/spec/core_functions/string/split.rs @@ -33,11 +33,13 @@ fn double_width_character() { #[test] fn empty() { assert_eq!( - runner().ok("@use \"sass:string\";\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"sass:string\";\ \n$result: string.split(\"\", \"/\");\ \na {\ - \n value: inspect($result);\ - \n separator: list-separator($result); \ + \n value: meta.inspect($result);\ + \n separator: list.separator($result); \ \n}\n"), "a {\ \n value: [];\ @@ -264,11 +266,13 @@ fn separator_not_found() { #[test] fn single() { assert_eq!( - runner().ok("@use \"sass:string\";\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"sass:string\";\ \n$result: string.split(\"a\", \"\");\ \na {\ - \n value: inspect($result);\ - \n separator: list-separator($result); \ + \n value: meta.inspect($result);\ + \n separator: list.separator($result); \ \n}\n"), "a {\ \n value: [\"a\",];\ diff --git a/rsass/tests/spec/core_functions/string/to_lower_case.rs b/rsass/tests/spec/core_functions/string/to_lower_case.rs index 7fc5e0f3f..1f45ff848 100644 --- a/rsass/tests/spec/core_functions/string/to_lower_case.rs +++ b/rsass/tests/spec/core_functions/string/to_lower_case.rs @@ -8,7 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn alphabet() { assert_eq!( - runner().ok("a {b: to-lower-case(\"ABCDEFGHIJKLMNOPQRSTUVQXYZ\")}\n"), + runner().ok( + "@use \"sass:string\";\ + \na {b: string.to-lower-case(\"ABCDEFGHIJKLMNOPQRSTUVQXYZ\")}\n" + ), "a {\ \n b: \"abcdefghijklmnopqrstuvqxyz\";\ \n}\n" @@ -17,7 +20,8 @@ fn alphabet() { #[test] fn empty() { assert_eq!( - runner().ok("a {b: to-lower-case(\"\")}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.to-lower-case(\"\")}\n"), "a {\ \n b: \"\";\ \n}\n" @@ -30,52 +34,62 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: to-lower-case()}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.to-lower-case()}\n" + ), "Error: Missing argument $string.\ \n ,--> input.scss\ - \n1 | a {b: to-lower-case()}\ - \n | ^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: string.to-lower-case()}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:string\ \n1 | @function to-lower-case($string) {\ \n | ====================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: to-lower-case(\"\", \"\")}\n\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.to-lower-case(\"\", \"\")}\n\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: to-lower-case(\"\", \"\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: string.to-lower-case(\"\", \"\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:string\ \n1 | @function to-lower-case($string) {\ \n | ====================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: to-lower-case(1)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.to-lower-case(1)}\n" + ), "Error: $string: 1 is not a string.\ \n ,\ - \n1 | a {b: to-lower-case(1)}\ - \n | ^^^^^^^^^^^^^^^^\ + \n2 | a {b: string.to-lower-case(1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn named() { assert_eq!( - runner().ok("a {b: to-lower-case($string: abcDEF)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.to-lower-case($string: abcDEF)}\n"), "a {\ \n b: abcdef;\ \n}\n" @@ -84,8 +98,9 @@ fn named() { #[test] fn non_ascii() { assert_eq!( - runner().ok("// Only ASCII characters have their case changed.\ - \na {b: to-lower-case(\"ÄÇÐØÞ\")}\n"), + runner().ok("@use \"sass:string\";\ + \n// Only ASCII characters have their case changed.\ + \na {b: string.to-lower-case(\"ÄÇÐØÞ\")}\n"), "@charset \"UTF-8\";\ \na {\ \n b: \"ÄÇÐØÞ\";\ @@ -95,7 +110,8 @@ fn non_ascii() { #[test] fn number() { assert_eq!( - runner().ok("a {b: to-lower-case(\"1234567890\")}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.to-lower-case(\"1234567890\")}\n"), "a {\ \n b: \"1234567890\";\ \n}\n" @@ -104,7 +120,8 @@ fn number() { #[test] fn unquoted() { assert_eq!( - runner().ok("a {b: to-lower-case(aBcDeF)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.to-lower-case(aBcDeF)}\n"), "a {\ \n b: abcdef;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/string/to_upper_case.rs b/rsass/tests/spec/core_functions/string/to_upper_case.rs index 4623e0895..202ba4c16 100644 --- a/rsass/tests/spec/core_functions/string/to_upper_case.rs +++ b/rsass/tests/spec/core_functions/string/to_upper_case.rs @@ -8,7 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn alphabet() { assert_eq!( - runner().ok("a {b: to-upper-case(\"abcdefghijklmnopqrstuvqxyz\")}\n"), + runner().ok( + "@use \"sass:string\";\ + \na {b: string.to-upper-case(\"abcdefghijklmnopqrstuvqxyz\")}\n" + ), "a {\ \n b: \"ABCDEFGHIJKLMNOPQRSTUVQXYZ\";\ \n}\n" @@ -17,7 +20,8 @@ fn alphabet() { #[test] fn empty() { assert_eq!( - runner().ok("a {b: to-upper-case(\"\")}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.to-upper-case(\"\")}\n"), "a {\ \n b: \"\";\ \n}\n" @@ -30,52 +34,62 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: to-upper-case()}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.to-upper-case()}\n" + ), "Error: Missing argument $string.\ \n ,--> input.scss\ - \n1 | a {b: to-upper-case()}\ - \n | ^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: string.to-upper-case()}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:string\ \n1 | @function to-upper-case($string) {\ \n | ====================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: to-upper-case(\"\", \"\")}\n\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.to-upper-case(\"\", \"\")}\n\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: to-upper-case(\"\", \"\")}\ - \n | ^^^^^^^^^^^^^^^^^^^^^ invocation\ + \n2 | a {b: string.to-upper-case(\"\", \"\")}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:string\ \n1 | @function to-upper-case($string) {\ \n | ====================== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: to-upper-case(1)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.to-upper-case(1)}\n" + ), "Error: $string: 1 is not a string.\ \n ,\ - \n1 | a {b: to-upper-case(1)}\ - \n | ^^^^^^^^^^^^^^^^\ + \n2 | a {b: string.to-upper-case(1)}\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn named() { assert_eq!( - runner().ok("a {b: to-upper-case($string: abcDEF)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.to-upper-case($string: abcDEF)}\n"), "a {\ \n b: ABCDEF;\ \n}\n" @@ -84,8 +98,9 @@ fn named() { #[test] fn non_ascii() { assert_eq!( - runner().ok("// Only ASCII characters have their case changed.\ - \na {b: to-upper-case(\"äçðøþ\")}\n"), + runner().ok("@use \"sass:string\";\ + \n// Only ASCII characters have their case changed.\ + \na {b: string.to-upper-case(\"äçðøþ\")}\n"), "@charset \"UTF-8\";\ \na {\ \n b: \"äçðøþ\";\ @@ -95,7 +110,8 @@ fn non_ascii() { #[test] fn number() { assert_eq!( - runner().ok("a {b: to-upper-case(\"1234567890\")}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.to-upper-case(\"1234567890\")}\n"), "a {\ \n b: \"1234567890\";\ \n}\n" @@ -104,7 +120,8 @@ fn number() { #[test] fn unquoted() { assert_eq!( - runner().ok("a {b: to-upper-case(aBcDeF)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.to-upper-case(aBcDeF)}\n"), "a {\ \n b: ABCDEF;\ \n}\n" diff --git a/rsass/tests/spec/core_functions/string/unique_id.rs b/rsass/tests/spec/core_functions/string/unique_id.rs index ee084bde8..e57b6a6bd 100644 --- a/rsass/tests/spec/core_functions/string/unique_id.rs +++ b/rsass/tests/spec/core_functions/string/unique_id.rs @@ -12,17 +12,20 @@ mod error { #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: unique-id(c)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.unique-id(c)}\n" + ), "Error: Only 0 arguments allowed, but 1 was passed.\ \n ,--> input.scss\ - \n1 | a {b: unique-id(c)}\ - \n | ^^^^^^^^^^^^ invocation\ + \n2 | a {b: string.unique-id(c)}\ + \n | ^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:string\ \n1 | @function unique-id() {\ \n | =========== declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } @@ -30,11 +33,13 @@ mod error { fn is_identifier() { assert_eq!( runner().ok( - "// Every call to unique-id() should return a valid CSS identifier. We can\'t test\ + "@use \"sass:selector\";\ + \n@use \"sass:string\";\ + \n// Every call to unique-id() should return a valid CSS identifier. We can\'t test\ \n// this directly, so we make sure it can parse as a class selector with\ \n// selector-parse().\ \n@for $i from 1 to 1000 {\ - \n $_: selector-parse(\".#{unique-id()}\");\ + \n $_: selector.parse(\".#{string.unique-id()}\");\ \n}\n" ), "" @@ -44,15 +49,17 @@ fn is_identifier() { fn is_unique() { assert_eq!( runner().ok( - "// As the name suggests, every call to unique-id() should return a different\ + "@use \"sass:map\";\ + \n@use \"sass:string\";\ + \n// As the name suggests, every call to unique-id() should return a different\ \n// value.\ \n$ids: ();\ \n@for $i from 1 to 1000 {\ - \n $id: unique-id();\ - \n @if map-has-key($ids, $id) {\ + \n $id: string.unique-id();\ + \n @if map.has-key($ids, $id) {\ \n @error \"#{$id} generated more than once\";\ \n }\n\ - \n $ids: map-merge($ids, ($id: null));\ + \n $ids: map.merge($ids, ($id: null));\ \n}\n" ), "" diff --git a/rsass/tests/spec/core_functions/string/unquote.rs b/rsass/tests/spec/core_functions/string/unquote.rs index 8a7e58384..3f432fb8b 100644 --- a/rsass/tests/spec/core_functions/string/unquote.rs +++ b/rsass/tests/spec/core_functions/string/unquote.rs @@ -9,10 +9,11 @@ fn runner() -> crate::TestRunner { fn empty() { assert_eq!( runner().ok( - "$result: unquote(\"\");\ + "@use \"sass:string\";\ + \n$result: string.unquote(\"\");\ \na {\ \n result: $result; // This will not be emitted because the contents is empty.\ - \n length: str-length($result);\ + \n length: string.length($result);\ \n same: $result == \"\";\ \n}\n" ), @@ -29,55 +30,65 @@ mod error { #[test] fn too_few_args() { assert_eq!( - runner().err("a {b: unquote()}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.unquote()}\n" + ), "Error: Missing argument $string.\ \n ,--> input.scss\ - \n1 | a {b: unquote()}\ - \n | ^^^^^^^^^ invocation\ + \n2 | a {b: string.unquote()}\ + \n | ^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:string\ \n1 | @function unquote($string) {\ \n | ================ declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn too_many_args() { assert_eq!( - runner().err("a {b: unquote(c, d)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.unquote(c, d)}\n" + ), "Error: Only 1 argument allowed, but 2 were passed.\ \n ,--> input.scss\ - \n1 | a {b: unquote(c, d)}\ - \n | ^^^^^^^^^^^^^ invocation\ + \n2 | a {b: string.unquote(c, d)}\ + \n | ^^^^^^^^^^^^^^^^^^^^ invocation\ \n \'\ \n ,--> sass:string\ \n1 | @function unquote($string) {\ \n | ================ declaration\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } #[test] fn test_type() { assert_eq!( - runner().err("a {b: unquote(1)}\n"), + runner().err( + "@use \"sass:string\";\ + \na {b: string.unquote(1)}\n" + ), "Error: $string: 1 is not a string.\ \n ,\ - \n1 | a {b: unquote(1)}\ - \n | ^^^^^^^^^^\ + \n2 | a {b: string.unquote(1)}\ + \n | ^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:7 root stylesheet", + \n input.scss 2:7 root stylesheet", ); } } #[test] fn escaped_backslash() { assert_eq!( - runner().ok("$result: unquote(\"\\\\0 \");\ + runner().ok("@use \"sass:string\";\ + \n$result: string.unquote(\"\\\\0 \");\ \na {\ \n result: $result;\ - \n length: str-length($result);\ + \n length: string.length($result);\ \n same-as-argument: $result == \"\\\\0 \";\ \n same-as-literal: $result == \\0 ;\ \n}\n"), @@ -97,13 +108,14 @@ mod escaped_quotes { fn quoted() { assert_eq!( runner().ok( - "// Unquoting a quoted string returns an unquoted string with the same code\ + "@use \"sass:string\";\ + \n// Unquoting a quoted string returns an unquoted string with the same code\ \n// points. Code points such as quotes that need to be escaped in the original\ \n// don\'t need escaping in the output.\ - \n$result: unquote(\"\\\"c\\\"\");\ + \n$result: string.unquote(\"\\\"c\\\"\");\ \na {\ \n result: $result;\ - \n length: str-length($result);\ + \n length: string.length($result);\ \n same: $result == \"\\\"c\\\"\";\ \n}\n" ), @@ -118,12 +130,13 @@ mod escaped_quotes { fn unquoted() { assert_eq!( runner().ok( - "// Unquoting an unquoted string returns it exactly as-is, leaving escapes\ + "@use \"sass:string\";\ + \n// Unquoting an unquoted string returns it exactly as-is, leaving escapes\ \n// totally unchanged (whether they\'re quotes or not).\ - \n$result: unquote(\\\"c\\\");\ + \n$result: string.unquote(\\\"c\\\");\ \na {\ \n result: $result;\ - \n length: str-length($result);\ + \n length: string.length($result);\ \n same: $result == \\\"c\\\";\ \n}\n" ), @@ -139,14 +152,15 @@ mod escaped_quotes { fn meaningful_css_characters() { assert_eq!( runner().ok( - "// Unquoted strings aren\'t required to be valid CSS identifiers, and the\ + "@use \"sass:string\";\ + \n// Unquoted strings aren\'t required to be valid CSS identifiers, and the\ \n// `unquote()` function does *not* escape characters that aren\'t valid\ \n// identifier characters. This allows it to be used as an escape hatch to\ \n// produce CSS that Sass doesn\'t otherwise support.\ - \n$result: unquote(\"b; c {d: e\");\ + \n$result: string.unquote(\"b; c {d: e\");\ \na {\ \n result: $result;\ - \n length: str-length($result);\ + \n length: string.length($result);\ \n same: $result == \"b; c {d: e\";\ \n}\n" ), @@ -160,7 +174,8 @@ fn meaningful_css_characters() { #[test] fn named() { assert_eq!( - runner().ok("a {b: unquote($string: c)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.unquote($string: c)}\n"), "a {\ \n b: c;\ \n}\n" @@ -169,7 +184,8 @@ fn named() { #[test] fn quoted() { assert_eq!( - runner().ok("a {b: unquote(\"c\")}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.unquote(\"c\")}\n"), "a {\ \n b: c;\ \n}\n" @@ -178,7 +194,8 @@ fn quoted() { #[test] fn unquoted() { assert_eq!( - runner().ok("a {b: unquote(c)}\n"), + runner().ok("@use \"sass:string\";\ + \na {b: string.unquote(c)}\n"), "a {\ \n b: c;\ \n}\n" diff --git a/rsass/tests/spec/css/functions/special.rs b/rsass/tests/spec/css/functions/special.rs index e30bd034b..a5f3d1457 100644 --- a/rsass/tests/spec/css/functions/special.rs +++ b/rsass/tests/spec/css/functions/special.rs @@ -5,6 +5,247 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("special") } +mod comment { + #[allow(unused)] + use super::runner; + + mod calc { + #[allow(unused)] + use super::runner; + + mod after_open_paren { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("a {b: -a-calc(/**/ c)}\n"), + "a {\ + \n b: -a-calc(/**/ c);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!( + runner().ok("a {\ + \n b: -a-calc(//\ + \n c);\ + \n}\n"), + "a {\ + \n b: -a-calc( c);\ + \n}\n" + ); + } + } + mod before_close_paren { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("a {b: -a-calc(c /**/)}\n"), + "a {\ + \n b: -a-calc(c /**/);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!( + runner().ok("a {\ + \n b: -a-calc(c //\ + \n );\ + \n}\n"), + "a {\ + \n b: -a-calc(c );\ + \n}\n" + ); + } + } + } + mod element { + #[allow(unused)] + use super::runner; + + mod after_open_paren { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("a {b: element(/**/ c)}\n"), + "a {\ + \n b: element(/**/ c);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!( + runner().ok("a {\ + \n b: element(//\ + \n c);\ + \n}\n"), + "a {\ + \n b: element( c);\ + \n}\n" + ); + } + } + mod before_close_paren { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("a {b: element(c /**/)}\n"), + "a {\ + \n b: element(c /**/);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!( + runner().ok("a {\ + \n b: element(c //\ + \n );\ + \n}\n"), + "a {\ + \n b: element(c );\ + \n}\n" + ); + } + } + } + mod expression { + #[allow(unused)] + use super::runner; + + mod after_open_paren { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("a {b: expression(/**/ c)}\n"), + "a {\ + \n b: expression(/**/ c);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!( + runner().ok("a {\ + \n b: expression(//\ + \n c);\ + \n}\n"), + "a {\ + \n b: expression( c);\ + \n}\n" + ); + } + } + mod before_close_paren { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("a {b: expression(c /**/)}\n"), + "a {\ + \n b: expression(c /**/);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!( + runner().ok("a {\ + \n b: expression(c //\ + \n );\ + \n}\n"), + "a {\ + \n b: expression(c );\ + \n}\n" + ); + } + } + } + mod progid { + #[allow(unused)] + use super::runner; + + mod after_open_paren { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("a {b: progid:c(/**/ d)}\n"), + "a {\ + \n b: progid:c(/**/ d);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!( + runner().ok("a {\ + \n b: progid:c(//\ + \n d);\ + \n}\n"), + "a {\ + \n b: progid:c( d);\ + \n}\n" + ); + } + } + mod before_close_paren { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("a {b: progid:c(d /**/)}\n"), + "a {\ + \n b: progid:c(d /**/);\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!( + runner().ok("a {\ + \n b: progid:c(d //\ + \n );\ + \n}\n"), + "a {\ + \n b: progid:c(d );\ + \n}\n" + ); + } + } + } +} mod prefixed { #[allow(unused)] use super::runner; diff --git a/rsass/tests/spec/css/media/comment.rs b/rsass/tests/spec/css/media/comment.rs new file mode 100644 index 000000000..d168c16ef --- /dev/null +++ b/rsass/tests/spec/css/media/comment.rs @@ -0,0 +1,42 @@ +//! Tests auto-converted from "sass-spec/spec/css/media/comment.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("comment") +} + +mod after_query { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!(runner().ok("@media screen /**/ {}\n"), ""); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@media screen //\ + \n {}\n"), + "" + ); + } +} +mod before_query { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!(runner().ok("@media /**/ screen {}\n"), ""); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@media //\ + \n screen {}\n"), + "" + ); + } +} diff --git a/rsass/tests/spec/css/media/mod.rs b/rsass/tests/spec/css/media/mod.rs index 8e03f8e9b..416609939 100644 --- a/rsass/tests/spec/css/media/mod.rs +++ b/rsass/tests/spec/css/media/mod.rs @@ -7,6 +7,8 @@ fn runner() -> crate::TestRunner { mod bubbling; +mod comment; + mod indentation; mod logic; diff --git a/rsass/tests/spec/css/mod.rs b/rsass/tests/spec/css/mod.rs index c7575cef0..a63e67931 100644 --- a/rsass/tests/spec/css/mod.rs +++ b/rsass/tests/spec/css/mod.rs @@ -39,6 +39,8 @@ mod propset; mod selector; +mod style_rule; + mod supports; mod unicode_range; diff --git a/rsass/tests/spec/css/moz_document/comment.rs b/rsass/tests/spec/css/moz_document/comment.rs new file mode 100644 index 000000000..8ccafae17 --- /dev/null +++ b/rsass/tests/spec/css/moz_document/comment.rs @@ -0,0 +1,50 @@ +//! Tests auto-converted from "sass-spec/spec/css/moz_document/comment.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("comment") +} + +mod after_arg { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn loud() { + assert_eq!( + runner().ok("@-moz-document url-prefix(a) /**/ {}\n"), + "@-moz-document url-prefix(a) {}\n" + ); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!( + runner().ok("@-moz-document url-prefix(a) //\ + \n {}\n"), + "@-moz-document url-prefix(a) {}\n" + ); + } +} +mod before_arg { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn loud() { + assert_eq!( + runner().ok("@-moz-document /**/ url-prefix(a) {}\n"), + "@-moz-document url-prefix(a) {}\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@-moz-document //\ + \n url-prefix(a) {}\n"), + "@-moz-document url-prefix(a) {}\n" + ); + } +} diff --git a/rsass/tests/spec/css/moz_document/mod.rs b/rsass/tests/spec/css/moz_document/mod.rs index caf7c0755..0c81904dc 100644 --- a/rsass/tests/spec/css/moz_document/mod.rs +++ b/rsass/tests/spec/css/moz_document/mod.rs @@ -5,6 +5,8 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("moz_document") } +mod comment; + mod empty_prefix; mod functions; diff --git a/rsass/tests/spec/css/plain/boolean_operations.rs b/rsass/tests/spec/css/plain/boolean_operations.rs index 8cfae4b80..6c453b487 100644 --- a/rsass/tests/spec/css/plain/boolean_operations.rs +++ b/rsass/tests/spec/css/plain/boolean_operations.rs @@ -10,7 +10,7 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@import \"plain\";\n"), + runner().ok("@use \"plain\";\n"), "a {\ \n and: true and false;\ \n or: true or false;\ diff --git a/rsass/tests/spec/css/plain/custom_properties.rs b/rsass/tests/spec/css/plain/custom_properties.rs index beab89e7d..d19c7a528 100644 --- a/rsass/tests/spec/css/plain/custom_properties.rs +++ b/rsass/tests/spec/css/plain/custom_properties.rs @@ -17,7 +17,7 @@ fn runner() -> crate::TestRunner { fn arbitrary_tokens() { let runner = runner().with_cwd("arbitrary_tokens"); assert_eq!( - runner.ok("@import \"plain\";\n"), + runner.ok("@use \"plain\";\n"), "a {\ \n --b: `~@#$%^&*()_-+={[]}|?/><;\ \n}\n" @@ -27,7 +27,7 @@ fn arbitrary_tokens() { fn color() { let runner = runner().with_cwd("color"); assert_eq!( - runner.ok("@import \"plain\";\n"), + runner.ok("@use \"plain\";\n"), "a {\ \n --b: #ff0000;\ \n}\n" @@ -37,7 +37,7 @@ fn color() { fn identifier() { let runner = runner().with_cwd("identifier"); assert_eq!( - runner.ok("@import \"plain\";\n"), + runner.ok("@use \"plain\";\n"), "a {\ \n --b: c;\ \n}\n" @@ -47,7 +47,7 @@ fn identifier() { fn nested() { let runner = runner().with_cwd("nested"); assert_eq!( - runner.ok("@import \"plain\";\n"), + runner.ok("@use \"plain\";\n"), "a {\ \n --b: {c: d};\ \n}\n" diff --git a/rsass/tests/spec/css/plain/error/expression/function.rs b/rsass/tests/spec/css/plain/error/expression/function.rs index c4833547a..4569202d4 100644 --- a/rsass/tests/spec/css/plain/error/expression/function.rs +++ b/rsass/tests/spec/css/plain/error/expression/function.rs @@ -20,14 +20,14 @@ fn runner() -> crate::TestRunner { fn built_in() { let runner = runner().with_cwd("built_in"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: This function isn\'t allowed in plain CSS.\ \n ,\ \n2 | x: index(1 2 3, 1);\ \n | ^^^^^^^^^^^^^^^\ \n \'\ - \n plain.css 2:6 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:6 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -35,14 +35,14 @@ fn built_in() { fn keyword_arguments() { let runner = runner().with_cwd("keyword_arguments"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Sass variables aren\'t allowed in plain CSS.\ \n ,\ \n2 | x: hsl(0, 100%, $lightness: 50%);\ \n | ^^^^^^^^^^\ \n \'\ - \n plain.css 2:19 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:19 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -50,13 +50,13 @@ fn keyword_arguments() { fn variable_arguments() { let runner = runner().with_cwd("variable_arguments"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: expected \")\".\ \n ,\ \n2 | x: hsl(0, 100%, 50%...);\ \n | ^\ \n \'\ - \n plain.css 2:22 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:22 @use\ + \n input.scss 1:1 root stylesheet", ); } diff --git a/rsass/tests/spec/css/plain/error/expression/interpolation.rs b/rsass/tests/spec/css/plain/error/expression/interpolation.rs index a5c3b0444..9265796cd 100644 --- a/rsass/tests/spec/css/plain/error/expression/interpolation.rs +++ b/rsass/tests/spec/css/plain/error/expression/interpolation.rs @@ -15,14 +15,14 @@ fn runner() -> crate::TestRunner { fn calc() { let runner = runner().with_cwd("calc"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Interpolation isn\'t allowed in plain CSS.\ \n ,\ \n2 | w: calc(#{1px} + 10%);\ \n | ^^^^^^\ \n \'\ - \n plain.css 2:11 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:11 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -30,14 +30,14 @@ fn calc() { fn identifier() { let runner = runner().with_cwd("identifier"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Interpolation isn\'t allowed in plain CSS.\ \n ,\ \n2 | w: x#{y}z;\ \n | ^^^^\ \n \'\ - \n plain.css 2:7 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:7 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -45,14 +45,14 @@ fn identifier() { fn quoted_string() { let runner = runner().with_cwd("quoted_string"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Interpolation isn\'t allowed in plain CSS.\ \n ,\ \n2 | w: \"x#{y}z\";\ \n | ^^^^\ \n \'\ - \n plain.css 2:8 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:8 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -60,13 +60,13 @@ fn quoted_string() { fn standalone() { let runner = runner().with_cwd("standalone"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Interpolation isn\'t allowed in plain CSS.\ \n ,\ \n2 | w: #{x};\ \n | ^^^^\ \n \'\ - \n plain.css 2:6 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:6 @use\ + \n input.scss 1:1 root stylesheet", ); } diff --git a/rsass/tests/spec/css/plain/error/expression/list.rs b/rsass/tests/spec/css/plain/error/expression/list.rs index a434f4192..9f93e1cf9 100644 --- a/rsass/tests/spec/css/plain/error/expression/list.rs +++ b/rsass/tests/spec/css/plain/error/expression/list.rs @@ -13,14 +13,14 @@ fn runner() -> crate::TestRunner { fn empty() { let runner = runner().with_cwd("empty"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Expected expression.\ \n ,\ \n2 | x: ();\ \n | ^\ \n \'\ - \n plain.css 2:7 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:7 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -28,13 +28,13 @@ fn empty() { fn empty_comma() { let runner = runner().with_cwd("empty_comma"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Expected expression.\ \n ,\ \n2 | x: (,);\ \n | ^\ \n \'\ - \n plain.css 2:7 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:7 @use\ + \n input.scss 1:1 root stylesheet", ); } diff --git a/rsass/tests/spec/css/plain/error/expression/map.rs b/rsass/tests/spec/css/plain/error/expression/map.rs index 713a0bdef..5534c9f15 100644 --- a/rsass/tests/spec/css/plain/error/expression/map.rs +++ b/rsass/tests/spec/css/plain/error/expression/map.rs @@ -11,13 +11,13 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong error fn test() { assert_eq!( - runner().err("@import \'plain\'"), + runner().err("@use \'plain\'"), "Error: expected \")\".\ \n ,\ \n2 | x: (y: z);\ \n | ^\ \n \'\ - \n plain.css 2:8 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:8 @use\ + \n input.scss 1:1 root stylesheet", ); } diff --git a/rsass/tests/spec/css/plain/error/expression/operation.rs b/rsass/tests/spec/css/plain/error/expression/operation.rs index f6dc66c7c..42abf3e87 100644 --- a/rsass/tests/spec/css/plain/error/expression/operation.rs +++ b/rsass/tests/spec/css/plain/error/expression/operation.rs @@ -24,14 +24,14 @@ fn runner() -> crate::TestRunner { fn addition() { let runner = runner().with_cwd("addition"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Operators aren\'t allowed in plain CSS.\ \n ,\ \n2 | x: y + z;\ \n | ^\ \n \'\ - \n plain.css 2:8 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:8 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -39,14 +39,14 @@ fn addition() { fn equals() { let runner = runner().with_cwd("equals"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Operators aren\'t allowed in plain CSS.\ \n ,\ \n2 | x: y == z;\ \n | ^^\ \n \'\ - \n plain.css 2:8 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:8 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -54,14 +54,14 @@ fn equals() { fn greater_than() { let runner = runner().with_cwd("greater_than"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Operators aren\'t allowed in plain CSS.\ \n ,\ \n2 | x: y > z;\ \n | ^\ \n \'\ - \n plain.css 2:8 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:8 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -69,14 +69,14 @@ fn greater_than() { fn greater_than_or_equal() { let runner = runner().with_cwd("greater_than_or_equal"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Operators aren\'t allowed in plain CSS.\ \n ,\ \n2 | x: y >= z;\ \n | ^^\ \n \'\ - \n plain.css 2:8 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:8 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -84,14 +84,14 @@ fn greater_than_or_equal() { fn less_than() { let runner = runner().with_cwd("less_than"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Operators aren\'t allowed in plain CSS.\ \n ,\ \n2 | x: y < z;\ \n | ^\ \n \'\ - \n plain.css 2:8 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:8 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -99,14 +99,14 @@ fn less_than() { fn less_than_or_equal() { let runner = runner().with_cwd("less_than_or_equal"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Operators aren\'t allowed in plain CSS.\ \n ,\ \n2 | x: y <= z;\ \n | ^^\ \n \'\ - \n plain.css 2:8 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:8 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -114,14 +114,14 @@ fn less_than_or_equal() { fn modulo() { let runner = runner().with_cwd("modulo"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Operators aren\'t allowed in plain CSS.\ \n ,\ \n2 | x: y % z;\ \n | ^\ \n \'\ - \n plain.css 2:8 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:8 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -129,14 +129,14 @@ fn modulo() { fn multiplication() { let runner = runner().with_cwd("multiplication"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Operators aren\'t allowed in plain CSS.\ \n ,\ \n2 | x: y * z;\ \n | ^\ \n \'\ - \n plain.css 2:8 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:8 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -144,14 +144,14 @@ fn multiplication() { fn not_equals() { let runner = runner().with_cwd("not_equals"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Operators aren\'t allowed in plain CSS.\ \n ,\ \n2 | x: y != z;\ \n | ^^\ \n \'\ - \n plain.css 2:8 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:8 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -159,13 +159,13 @@ fn not_equals() { fn subtraction() { let runner = runner().with_cwd("subtraction"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Operators aren\'t allowed in plain CSS.\ \n ,\ \n2 | x: y - z;\ \n | ^\ \n \'\ - \n plain.css 2:8 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:8 @use\ + \n input.scss 1:1 root stylesheet", ); } diff --git a/rsass/tests/spec/css/plain/error/expression/parent_selector.rs b/rsass/tests/spec/css/plain/error/expression/parent_selector.rs index bd71a32a9..1b02c12fb 100644 --- a/rsass/tests/spec/css/plain/error/expression/parent_selector.rs +++ b/rsass/tests/spec/css/plain/error/expression/parent_selector.rs @@ -11,13 +11,13 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong error fn test() { assert_eq!( - runner().err("@import \'plain\'"), + runner().err("@use \'plain\'"), "Error: The parent selector isn\'t allowed in plain CSS.\ \n ,\ \n2 | x: &;\ \n | ^\ \n \'\ - \n plain.css 2:6 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:6 @use\ + \n input.scss 1:1 root stylesheet", ); } diff --git a/rsass/tests/spec/css/plain/error/expression/parentheses.rs b/rsass/tests/spec/css/plain/error/expression/parentheses.rs index aa8df327a..02fee55f3 100644 --- a/rsass/tests/spec/css/plain/error/expression/parentheses.rs +++ b/rsass/tests/spec/css/plain/error/expression/parentheses.rs @@ -11,13 +11,13 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong error fn test() { assert_eq!( - runner().err("@import \'plain\'"), + runner().err("@use \'plain\'"), "Error: Parentheses aren\'t allowed in plain CSS.\ \n ,\ \n2 | x: (y);\ \n | ^^^\ \n \'\ - \n plain.css 2:6 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:6 @use\ + \n input.scss 1:1 root stylesheet", ); } diff --git a/rsass/tests/spec/css/plain/error/expression/variable.rs b/rsass/tests/spec/css/plain/error/expression/variable.rs index 47a962755..d41539d63 100644 --- a/rsass/tests/spec/css/plain/error/expression/variable.rs +++ b/rsass/tests/spec/css/plain/error/expression/variable.rs @@ -13,14 +13,14 @@ fn runner() -> crate::TestRunner { fn declaration() { let runner = runner().with_cwd("declaration"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Sass variables aren\'t allowed in plain CSS.\ \n ,\ \n1 | $var: value;\ \n | ^^^^\ \n \'\ - \n plain.css 1:1 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:1 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -28,13 +28,13 @@ fn declaration() { fn test_use() { let runner = runner().with_cwd("use"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Sass variables aren\'t allowed in plain CSS.\ \n ,\ \n2 | x: $var;\ \n | ^^^^\ \n \'\ - \n plain.css 2:6 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:6 @use\ + \n input.scss 1:1 root stylesheet", ); } diff --git a/rsass/tests/spec/css/plain/error/media.rs b/rsass/tests/spec/css/plain/error/media.rs index 23f3671d6..2fdb966f1 100644 --- a/rsass/tests/spec/css/plain/error/media.rs +++ b/rsass/tests/spec/css/plain/error/media.rs @@ -99,14 +99,14 @@ mod logic { fn or() { let runner = runner().with_cwd("or"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: expected \"{\".\ \n ,\ \n1 | @media (a) or (b) and (c) {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:19 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:19 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -114,14 +114,14 @@ mod logic { fn type_and_not() { let runner = runner().with_cwd("type_and_not"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: expected \"{\".\ \n ,\ \n1 | @media a and not (b) and (c) {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:22 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:22 @use\ + \n input.scss 1:1 root stylesheet", ); } } @@ -142,14 +142,14 @@ mod logic { fn after_paren() { let runner = runner().with_cwd("after_paren"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: expected media condition in parentheses.\ \n ,\ \n1 | @media (a) and {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:16 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:16 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -157,14 +157,14 @@ mod logic { fn after_type() { let runner = runner().with_cwd("after_type"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: expected media condition in parentheses.\ \n ,\ \n1 | @media a and {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:14 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:14 @use\ + \n input.scss 1:1 root stylesheet", ); } } @@ -173,14 +173,14 @@ mod logic { fn and_not() { let runner = runner().with_cwd("and_not"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: expected media condition in parentheses.\ \n ,\ \n1 | @media a and not {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:18 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:18 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -188,14 +188,14 @@ mod logic { fn not() { let runner = runner().with_cwd("not"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: expected media condition in parentheses.\ \n ,\ \n1 | @media not {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:12 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:12 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -203,14 +203,14 @@ mod logic { fn or() { let runner = runner().with_cwd("or"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: expected media condition in parentheses.\ \n ,\ \n1 | @media (a) or {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:15 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:15 @use\ + \n input.scss 1:1 root stylesheet", ); } } @@ -225,14 +225,14 @@ mod logic { fn and() { let runner = runner().with_cwd("and"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: expected \"{\".\ \n ,\ \n1 | @media (a) and (b) or (c) {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:20 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:20 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -240,14 +240,14 @@ mod logic { fn test_type() { let runner = runner().with_cwd("type"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: expected \"{\".\ \n ,\ \n1 | @media a or (b) {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:13 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:13 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -255,14 +255,14 @@ mod logic { fn type_and_not() { let runner = runner().with_cwd("type_and_not"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: expected \"{\".\ \n ,\ \n1 | @media a and not (b) or (c) {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:22 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:22 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -270,14 +270,14 @@ mod logic { fn type_then_and() { let runner = runner().with_cwd("type_then_and"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: expected \"{\".\ \n ,\ \n1 | @media a and (b) or (c) {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:18 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:18 @use\ + \n input.scss 1:1 root stylesheet", ); } } @@ -299,14 +299,14 @@ mod missing_whitespace { fn after_type() { let runner = runner().with_cwd("after_type"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: Expected whitespace.\ \n ,\ \n1 | @media a and(b) {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:13 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:13 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -314,14 +314,14 @@ mod missing_whitespace { fn first() { let runner = runner().with_cwd("first"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: Expected whitespace.\ \n ,\ \n1 | @media (a) and(b) {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:15 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:15 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -329,14 +329,14 @@ mod missing_whitespace { fn later() { let runner = runner().with_cwd("later"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: Expected whitespace.\ \n ,\ \n1 | @media (a) and (b) and(c) {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:23 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:23 @use\ + \n input.scss 1:1 root stylesheet", ); } } @@ -351,14 +351,14 @@ mod missing_whitespace { fn test_type() { let runner = runner().with_cwd("type"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: Expected whitespace.\ \n ,\ \n1 | @media a and not(b) {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:17 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:17 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -366,14 +366,14 @@ mod missing_whitespace { fn type_and_modifier() { let runner = runner().with_cwd("type_and_modifier"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: Expected whitespace.\ \n ,\ \n1 | @media only a and not(b) {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:22 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:22 @use\ + \n input.scss 1:1 root stylesheet", ); } } @@ -382,14 +382,14 @@ mod missing_whitespace { fn not() { let runner = runner().with_cwd("not"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: Expected whitespace.\ \n ,\ \n1 | @media not(a) {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:11 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:11 @use\ + \n input.scss 1:1 root stylesheet", ); } mod or { @@ -403,14 +403,14 @@ mod missing_whitespace { fn first() { let runner = runner().with_cwd("first"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: Expected whitespace.\ \n ,\ \n1 | @media (a) or(b) {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:14 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:14 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -418,14 +418,14 @@ mod missing_whitespace { fn later() { let runner = runner().with_cwd("later"); assert_eq!( - runner.err("@import \'plain\';\n"), + runner.err("@use \'plain\';\n"), "Error: Expected whitespace.\ \n ,\ \n1 | @media (a) or (b) or(c) {x {y: z}}\ \n | ^\ \n \'\ - \n plain.css 1:21 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:21 @use\ + \n input.scss 1:1 root stylesheet", ); } } diff --git a/rsass/tests/spec/css/plain/error/statement/at_rule.rs b/rsass/tests/spec/css/plain/error/statement/at_rule.rs index 126aae7a5..c27977026 100644 --- a/rsass/tests/spec/css/plain/error/statement/at_rule.rs +++ b/rsass/tests/spec/css/plain/error/statement/at_rule.rs @@ -35,7 +35,7 @@ fn runner() -> crate::TestRunner { .mock_file("interpolation/plain.css", "@foo a#{b}c;\n") .mock_file( "mixin/plain.css", - "@mixin foo {\n a {\n x: y;\n } \n}\n", + "@mixin foo {\n a {\n x: y;\n }\n}\n", ) .mock_file("return/plain.css", "@return foo;\n") .mock_file("warn/plain.css", "@warn foo;\n") @@ -50,14 +50,14 @@ fn runner() -> crate::TestRunner { fn at_root() { let runner = runner().with_cwd("at_root"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: This at-rule isn\'t allowed in plain CSS.\ \n ,\ \n2 | @at-root b {\ \n | ^^^^^^^^^^^\ \n \'\ - \n plain.css 2:3 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:3 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -65,14 +65,14 @@ fn at_root() { fn content() { let runner = runner().with_cwd("content"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: This at-rule isn\'t allowed in plain CSS.\ \n ,\ \n1 | @content;\ \n | ^^^^^^^^\ \n \'\ - \n plain.css 1:1 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:1 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -80,14 +80,14 @@ fn content() { fn debug() { let runner = runner().with_cwd("debug"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: This at-rule isn\'t allowed in plain CSS.\ \n ,\ \n1 | @debug foo;\ \n | ^^^^^^^^^^\ \n \'\ - \n plain.css 1:1 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:1 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -95,14 +95,14 @@ fn debug() { fn each() { let runner = runner().with_cwd("each"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: This at-rule isn\'t allowed in plain CSS.\ \n ,\ \n1 | @each $i in 1 2 3 {\ \n | ^^^^^^^^^^^^^^^^^^\ \n \'\ - \n plain.css 1:1 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:1 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -110,14 +110,14 @@ fn each() { fn error() { let runner = runner().with_cwd("error"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: This at-rule isn\'t allowed in plain CSS.\ \n ,\ \n1 | @error foo;\ \n | ^^^^^^^^^^\ \n \'\ - \n plain.css 1:1 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:1 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -125,14 +125,14 @@ fn error() { fn extend() { let runner = runner().with_cwd("extend"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: This at-rule isn\'t allowed in plain CSS.\ \n ,\ \n2 | @extend b;\ \n | ^^^^^^^^^\ \n \'\ - \n plain.css 2:3 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:3 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -140,14 +140,14 @@ fn extend() { fn test_for() { let runner = runner().with_cwd("for"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: This at-rule isn\'t allowed in plain CSS.\ \n ,\ \n1 | @for $i from 1 to 5 {\ \n | ^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n plain.css 1:1 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:1 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -155,14 +155,14 @@ fn test_for() { fn function() { let runner = runner().with_cwd("function"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: This at-rule isn\'t allowed in plain CSS.\ \n ,\ \n1 | @function foo() {\ \n | ^^^^^^^^^^^^^^^^\ \n \'\ - \n plain.css 1:1 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:1 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -170,14 +170,14 @@ fn function() { fn test_if() { let runner = runner().with_cwd("if"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: This at-rule isn\'t allowed in plain CSS.\ \n ,\ \n1 | @if true {\ \n | ^^^^^^^^^\ \n \'\ - \n plain.css 1:1 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:1 @use\ + \n input.scss 1:1 root stylesheet", ); } mod import { @@ -191,14 +191,14 @@ mod import { fn interpolated() { let runner = runner().with_cwd("interpolated"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Interpolation isn\'t allowed in plain CSS.\ \n ,\ \n1 | @import url(\"foo#{bar}baz\");\ \n | ^^^^^^\ \n \'\ - \n plain.css 1:17 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:17 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -206,21 +206,21 @@ mod import { fn multi() { let runner = runner().with_cwd("multi"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: expected \";\".\ \n ,\ \n1 | @import \"foo\", \"bar\";\ \n | ^\ \n \'\ - \n plain.css 1:14 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:14 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] fn nested() { let runner = runner().with_cwd("nested"); assert_eq!( - runner.ok("@import \'plain\'"), + runner.ok("@use \'plain\'"), "a {\ \n @import \"foo\";\ \n}\n" @@ -232,14 +232,14 @@ mod import { fn include() { let runner = runner().with_cwd("include"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: This at-rule isn\'t allowed in plain CSS.\ \n ,\ \n1 | @include foo;\ \n | ^^^^^^^^^^^^\ \n \'\ - \n plain.css 1:1 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:1 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -247,14 +247,14 @@ fn include() { fn interpolation() { let runner = runner().with_cwd("interpolation"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Interpolation isn\'t allowed in plain CSS.\ \n ,\ \n1 | @foo a#{b}c;\ \n | ^^^^\ \n \'\ - \n plain.css 1:7 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:7 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -262,14 +262,14 @@ fn interpolation() { fn mixin() { let runner = runner().with_cwd("mixin"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: This at-rule isn\'t allowed in plain CSS.\ \n ,\ \n1 | @mixin foo {\ \n | ^^^^^^^^^^^\ \n \'\ - \n plain.css 1:1 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:1 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -277,14 +277,14 @@ fn mixin() { fn test_return() { let runner = runner().with_cwd("return"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: This at-rule isn\'t allowed in plain CSS.\ \n ,\ \n1 | @return foo;\ \n | ^^^^^^^^^^^\ \n \'\ - \n plain.css 1:1 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:1 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -292,14 +292,14 @@ fn test_return() { fn warn() { let runner = runner().with_cwd("warn"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: This at-rule isn\'t allowed in plain CSS.\ \n ,\ \n1 | @warn foo;\ \n | ^^^^^^^^^\ \n \'\ - \n plain.css 1:1 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:1 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -307,13 +307,13 @@ fn warn() { fn test_while() { let runner = runner().with_cwd("while"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: This at-rule isn\'t allowed in plain CSS.\ \n ,\ \n1 | @while false {\ \n | ^^^^^^^^^^^^^\ \n \'\ - \n plain.css 1:1 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:1 @use\ + \n input.scss 1:1 root stylesheet", ); } diff --git a/rsass/tests/spec/css/plain/error/statement/silent_comment.rs b/rsass/tests/spec/css/plain/error/statement/silent_comment.rs index 1753d48e7..a85b83654 100644 --- a/rsass/tests/spec/css/plain/error/statement/silent_comment.rs +++ b/rsass/tests/spec/css/plain/error/statement/silent_comment.rs @@ -11,13 +11,13 @@ fn runner() -> crate::TestRunner { #[ignore] // missing error fn test() { assert_eq!( - runner().err("@import \'plain\'\n"), + runner().err("@use \'plain\'\n"), "Error: Silent comments aren\'t allowed in plain CSS.\ \n ,\ \n1 | // silent\ \n | ^^^^^^^^^\ \n \'\ - \n plain.css 1:1 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:1 @use\ + \n input.scss 1:1 root stylesheet", ); } diff --git a/rsass/tests/spec/css/plain/error/statement/style_rule.rs b/rsass/tests/spec/css/plain/error/statement/style_rule.rs index 4f48abe90..5769c0f9f 100644 --- a/rsass/tests/spec/css/plain/error/statement/style_rule.rs +++ b/rsass/tests/spec/css/plain/error/statement/style_rule.rs @@ -53,14 +53,14 @@ mod interpolation { fn custom_property() { let runner = runner().with_cwd("custom_property"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Interpolation isn\'t allowed in plain CSS.\ \n ,\ \n2 | --b: #{c};\ \n | ^^^^\ \n \'\ - \n plain.css 2:8 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:8 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -68,14 +68,14 @@ mod interpolation { fn declaration() { let runner = runner().with_cwd("declaration"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Interpolation isn\'t allowed in plain CSS.\ \n ,\ \n2 | w#{x}y: z;\ \n | ^^^^\ \n \'\ - \n plain.css 2:4 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:4 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -83,14 +83,14 @@ mod interpolation { fn selector() { let runner = runner().with_cwd("selector"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Interpolation isn\'t allowed in plain CSS.\ \n ,\ \n1 | a#{b}c {\ \n | ^^^^\ \n \'\ - \n plain.css 1:2 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:2 @use\ + \n input.scss 1:1 root stylesheet", ); } } @@ -164,14 +164,14 @@ mod nested_property { fn no_value() { let runner = runner().with_cwd("no_value"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Nested declarations aren\'t allowed in plain CSS.\ \n ,\ \n2 | x: {\ \n | ^\ \n \'\ - \n plain.css 2:6 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:6 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -179,14 +179,14 @@ mod nested_property { fn value() { let runner = runner().with_cwd("value"); assert_eq!( - runner.err("@import \'plain\'\n"), + runner.err("@use \'plain\'\n"), "Error: Nested declarations aren\'t allowed in plain CSS.\ \n ,\ \n2 | b: c {\ \n | ^\ \n \'\ - \n plain.css 2:8 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 2:8 @use\ + \n input.scss 1:1 root stylesheet", ); } } @@ -217,14 +217,14 @@ mod parent_selector { fn placeholder_selector() { let runner = runner().with_cwd("placeholder_selector"); assert_eq!( - runner.err("@import \'plain\'"), + runner.err("@use \'plain\'"), "Error: Placeholder selectors aren\'t allowed in plain CSS.\ \n ,\ \n1 | %foo {\ \n | ^^^^\ \n \'\ - \n plain.css 1:1 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:1 @use\ + \n input.scss 1:1 root stylesheet", ); } mod trailing_combinator { diff --git a/rsass/tests/spec/css/plain/extend.rs b/rsass/tests/spec/css/plain/extend.rs index 8bd077150..cd950c0e2 100644 --- a/rsass/tests/spec/css/plain/extend.rs +++ b/rsass/tests/spec/css/plain/extend.rs @@ -11,7 +11,7 @@ fn runner() -> crate::TestRunner { #[ignore] // unexepected error fn test() { assert_eq!( - runner().ok("@import \"plain\";\n\ + runner().ok("@use \"plain\";\n\ \na {@extend b}\n"), "b, a {\ \n c: d;\ diff --git a/rsass/tests/spec/css/plain/functions.rs b/rsass/tests/spec/css/plain/functions.rs index d2596123f..78b0cbfbc 100644 --- a/rsass/tests/spec/css/plain/functions.rs +++ b/rsass/tests/spec/css/plain/functions.rs @@ -28,7 +28,7 @@ fn runner() -> crate::TestRunner { fn alpha() { let runner = runner().with_cwd("alpha"); assert_eq!( - runner.ok("@import \"plain\";\n"), + runner.ok("@use \"plain\";\n"), "a {\ \n b: alpha(0.1);\ \n}\n" @@ -49,7 +49,7 @@ fn defined_elsewhere() { fn empty_fallback_var() { let runner = runner().with_cwd("empty_fallback_var"); assert_eq!( - runner.ok("@import \"plain\";\n"), + runner.ok("@use \"plain\";\n"), "a {\ \n b: var(--c, );\ \n}\n" @@ -72,14 +72,14 @@ mod error { fn empty_second_before_third() { let runner = runner().with_cwd("empty_second_before_third"); assert_eq!( - runner.err("@import \"plain\";\n"), + runner.err("@use \"plain\";\n"), "Error: Expected expression.\ \n ,\ \n1 | a {b: var(--c, , d)}\ \n | ^\ \n \'\ - \n plain.css 1:16 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:16 @use\ + \n input.scss 1:1 root stylesheet", ); } #[test] @@ -87,14 +87,14 @@ mod error { fn invalid_second_arg_syntax() { let runner = runner().with_cwd("invalid_second_arg_syntax"); assert_eq!( - runner.err("@import \"plain\";\n"), + runner.err("@use \"plain\";\n"), "Error: Expected expression.\ \n ,\ \n1 | a {b: var(--c, {})}\ \n | ^\ \n \'\ - \n plain.css 1:16 @import\ - \n input.scss 1:9 root stylesheet", + \n plain.css 1:16 @use\ + \n input.scss 1:1 root stylesheet", ); } } @@ -103,7 +103,7 @@ mod error { fn grayscale() { let runner = runner().with_cwd("grayscale"); assert_eq!( - runner.ok("@import \"plain\";\n"), + runner.ok("@use \"plain\";\n"), "a {\ \n b: grayscale(0.1);\ \n}\n" @@ -113,7 +113,7 @@ fn grayscale() { fn hsl() { let runner = runner().with_cwd("hsl"); assert_eq!( - runner.ok("@import \"plain\";\n"), + runner.ok("@use \"plain\";\n"), "a {\ \n b: hsl(0, 100%, 50%);\ \n}\n" @@ -123,7 +123,7 @@ fn hsl() { fn hsla() { let runner = runner().with_cwd("hsla"); assert_eq!( - runner.ok("@import \"plain\";\n"), + runner.ok("@use \"plain\";\n"), "a {\ \n b: hsla(0, 100%, 50%, 0.5);\ \n}\n" @@ -133,7 +133,7 @@ fn hsla() { fn invert() { let runner = runner().with_cwd("invert"); assert_eq!( - runner.ok("@import \"plain\";\n"), + runner.ok("@use \"plain\";\n"), "a {\ \n b: invert(0.1);\ \n}\n" @@ -143,7 +143,7 @@ fn invert() { fn rgb() { let runner = runner().with_cwd("rgb"); assert_eq!( - runner.ok("@import \"plain\";\n"), + runner.ok("@use \"plain\";\n"), "a {\ \n b: rgb(10, 20, 30);\ \n}\n" @@ -153,7 +153,7 @@ fn rgb() { fn rgba() { let runner = runner().with_cwd("rgba"); assert_eq!( - runner.ok("@import \"plain\";\n"), + runner.ok("@use \"plain\";\n"), "a {\ \n b: rgba(10, 20, 30, 0.5);\ \n}\n" @@ -163,7 +163,7 @@ fn rgba() { fn saturate() { let runner = runner().with_cwd("saturate"); assert_eq!( - runner.ok("@import \"plain\";\n"), + runner.ok("@use \"plain\";\n"), "a {\ \n b: saturate(0.1);\ \n}\n" diff --git a/rsass/tests/spec/css/plain/hacks.rs b/rsass/tests/spec/css/plain/hacks.rs index 5497e3db2..51a8bff31 100644 --- a/rsass/tests/spec/css/plain/hacks.rs +++ b/rsass/tests/spec/css/plain/hacks.rs @@ -11,7 +11,7 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@import \"plain\";\n"), + runner().ok("@use \"plain\";\n"), ".hacks {\ \n *x: y;\ \n :x: y;\ diff --git a/rsass/tests/spec/css/plain/media.rs b/rsass/tests/spec/css/plain/media.rs index e2f2faed4..827fb5760 100644 --- a/rsass/tests/spec/css/plain/media.rs +++ b/rsass/tests/spec/css/plain/media.rs @@ -71,7 +71,7 @@ mod logic { fn mixed_case() { let runner = runner().with_cwd("mixed_case"); assert_eq!( - runner.ok("@import \'plain\';\n"), + runner.ok("@use \'plain\';\n"), "@media (a) and (b) {\ \n x {\ \n y: z;\ @@ -83,7 +83,7 @@ mod logic { fn multiple() { let runner = runner().with_cwd("multiple"); assert_eq!( - runner.ok("@import \'plain\';\n"), + runner.ok("@use \'plain\';\n"), "@media (a) and (b) and (c) and (d) {\ \n x {\ \n y: z;\ @@ -95,7 +95,7 @@ mod logic { fn no_whitespace_before() { let runner = runner().with_cwd("no_whitespace_before"); assert_eq!( - runner.ok("@import \'plain\';\n"), + runner.ok("@use \'plain\';\n"), "@media (a) and (b) {\ \n x {\ \n y: z;\ @@ -107,7 +107,7 @@ mod logic { fn one() { let runner = runner().with_cwd("one"); assert_eq!( - runner.ok("@import \'plain\';\n"), + runner.ok("@use \'plain\';\n"), "@media (a) and (b) {\ \n x {\ \n y: z;\ @@ -126,7 +126,7 @@ mod logic { fn after_type_and_modifier() { let runner = runner().with_cwd("after_type_and_modifier"); assert_eq!( - runner.ok("@import \'plain\';\n"), + runner.ok("@use \'plain\';\n"), "@media only a and not (b) {\ \n x {\ \n y: z;\ @@ -138,7 +138,7 @@ mod logic { fn lowercase() { let runner = runner().with_cwd("lowercase"); assert_eq!( - runner.ok("@import \'plain\';\n"), + runner.ok("@use \'plain\';\n"), "@media a and not (b) {\ \n x {\ \n y: z;\ @@ -151,7 +151,7 @@ mod logic { fn mixed_case() { let runner = runner().with_cwd("mixed_case"); assert_eq!( - runner.ok("@import \'plain\';\n"), + runner.ok("@use \'plain\';\n"), "@media a and not (b) {\ \n x {\ \n y: z;\ @@ -170,7 +170,7 @@ mod logic { fn lowercase() { let runner = runner().with_cwd("lowercase"); assert_eq!( - runner.ok("@import \'plain\';\n"), + runner.ok("@use \'plain\';\n"), "@media not (a) {\ \n x {\ \n y: z;\ @@ -183,7 +183,7 @@ mod logic { fn mixed_case() { let runner = runner().with_cwd("mixed_case"); assert_eq!( - runner.ok("@import \'plain\';\n"), + runner.ok("@use \'plain\';\n"), "@media not (a) {\ \n x {\ \n y: z;\ @@ -202,7 +202,7 @@ mod logic { fn mixed_case() { let runner = runner().with_cwd("mixed_case"); assert_eq!( - runner.ok("@import \'plain\';\n"), + runner.ok("@use \'plain\';\n"), "@media (a) or (b) {\ \n x {\ \n y: z;\ @@ -214,7 +214,7 @@ mod logic { fn multiple() { let runner = runner().with_cwd("multiple"); assert_eq!( - runner.ok("@import \'plain\';\n"), + runner.ok("@use \'plain\';\n"), "@media (a) or (b) or (c) or (d) {\ \n x {\ \n y: z;\ @@ -226,7 +226,7 @@ mod logic { fn no_whitespace_before() { let runner = runner().with_cwd("no_whitespace_before"); assert_eq!( - runner.ok("@import \'plain\';\n"), + runner.ok("@use \'plain\';\n"), "@media (a) or (b) {\ \n x {\ \n y: z;\ @@ -238,7 +238,7 @@ mod logic { fn one() { let runner = runner().with_cwd("one"); assert_eq!( - runner.ok("@import \'plain\';\n"), + runner.ok("@use \'plain\';\n"), "@media (a) or (b) {\ \n x {\ \n y: z;\ diff --git a/rsass/tests/spec/css/plain/null.rs b/rsass/tests/spec/css/plain/null.rs index a543bad88..b776c9849 100644 --- a/rsass/tests/spec/css/plain/null.rs +++ b/rsass/tests/spec/css/plain/null.rs @@ -10,7 +10,7 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@import \"plain\";\n"), + runner().ok("@use \"plain\";\n"), "a {\ \n x: null;\ \n}\n" diff --git a/rsass/tests/spec/css/plain/single_equals.rs b/rsass/tests/spec/css/plain/single_equals.rs index ad731e0b5..9ed481455 100644 --- a/rsass/tests/spec/css/plain/single_equals.rs +++ b/rsass/tests/spec/css/plain/single_equals.rs @@ -11,7 +11,7 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@import \"plain\";\n"), + runner().ok("@use \"plain\";\n"), "a {\ \n single-equals: alpha(opacity=65);\ \n}\n" diff --git a/rsass/tests/spec/css/plain/slash.rs b/rsass/tests/spec/css/plain/slash.rs index 7cb5da62d..737b13a20 100644 --- a/rsass/tests/spec/css/plain/slash.rs +++ b/rsass/tests/spec/css/plain/slash.rs @@ -19,7 +19,7 @@ fn runner() -> crate::TestRunner { fn with_intermediate() { let runner = runner().with_cwd("with_intermediate"); assert_eq!( - runner.ok("@import \"plain\";\n"), + runner.ok("@use \"plain\";\n"), "a {\ \n b: 1/2/foo/bar;\ \n}\n" @@ -36,7 +36,7 @@ mod without_intermediate { fn no_whitespace() { let runner = runner().with_cwd("no_whitespace"); assert_eq!( - runner.ok("@import \"plain\";\n"), + runner.ok("@use \"plain\";\n"), "a {\ \n b: 1///bar;\ \n}\n" @@ -47,7 +47,7 @@ mod without_intermediate { fn whitespace() { let runner = runner().with_cwd("whitespace"); assert_eq!( - runner.ok("@import \"plain\";\n"), + runner.ok("@use \"plain\";\n"), "a {\ \n b: 1///bar;\ \n}\n" diff --git a/rsass/tests/spec/css/propset.rs b/rsass/tests/spec/css/propset.rs index c97a9af26..5669915ea 100644 --- a/rsass/tests/spec/css/propset.rs +++ b/rsass/tests/spec/css/propset.rs @@ -5,6 +5,63 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("propset") } +mod comment { + #[allow(unused)] + use super::runner; + + mod after_block { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn loud() { + assert_eq!( + runner().ok("a {b: {c: d} /**/}\n"), + "a {\ + \n b-c: d; /**/\ + \n}\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("a {\ + \n b: {c: d} //\ + \n}\n"), + "a {\ + \n b-c: d;\ + \n}\n" + ); + } + } + mod before_block { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("a {b: /**/ {c: d}}\n"), + "a {\ + \n b-c: d;\ + \n}\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("a {\ + \n b: //\ + \n {c: d}\ + \n}\n"), + "a {\ + \n b-c: d;\ + \n}\n" + ); + } + } +} #[test] fn complex() { assert_eq!( diff --git a/rsass/tests/spec/css/style_rule.rs b/rsass/tests/spec/css/style_rule.rs new file mode 100644 index 000000000..ed26359be --- /dev/null +++ b/rsass/tests/spec/css/style_rule.rs @@ -0,0 +1,290 @@ +//! Tests auto-converted from "sass-spec/spec/css/style_rule.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("style_rule") +} + +mod comment { + #[allow(unused)] + use super::runner; + + mod after_selector { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("a /**/ {b: c}\n"), + "a {\ + \n b: c;\ + \n}\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("a //\ + \n {b: c}\n"), + "a {\ + \n b: c;\ + \n}\n" + ); + } + } +} +mod declaration { + #[allow(unused)] + use super::runner; + + mod comment { + #[allow(unused)] + use super::runner; + + mod after_colon { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("a {b: /**/ c}\n"), + "a {\ + \n b: c;\ + \n}\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("a {b: //\ + \n c}\n"), + "a {\ + \n b: c;\ + \n}\n" + ); + } + } + mod after_value { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("a {b: c /**/}\n"), + "a {\ + \n b: c;\ + \n}\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("a {b: c //\ + \n }\n"), + "a {\ + \n b: c;\ + \n}\n" + ); + } + } + mod before_colon { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("a {b /**/ : c}\n"), + "a {\ + \n b: c;\ + \n}\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("a {b //\ + \n : c}\n"), + "a {\ + \n b: c;\ + \n}\n" + ); + } + } + } + mod interleaved { + #[allow(unused)] + use super::runner; + + mod after_style_rule { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn extended_child() { + assert_eq!( + runner().ok(".a {\ + \n .b {c: d}\ + \n e: f;\ + \n}\n\ + \n:where(.g) {@extend .b}\n"), + ".a {\ + \n e: f;\ + \n}\ + \n.a .b, .a :where(.g) {\ + \n c: d;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn extended_parent() { + assert_eq!( + runner().ok(".a {\ + \n .b {c: d}\ + \n e: f;\ + \n}\n\ + \n:where(.g) {@extend .a}\n"), + ".a, :where(.g) {\ + \n e: f;\ + \n}\ + \n.a .b, :where(.g) .b {\ + \n c: d;\ + \n}\n" + ); + } + #[test] + fn higher_specificity() { + assert_eq!( + runner().ok(".a {\ + \n .b {c: d}\ + \n e: f;\ + \n}\n"), + ".a {\ + \n e: f;\ + \n}\ + \n.a .b {\ + \n c: d;\ + \n}\n" + ); + } + #[test] + fn mixed_specificity_child() { + assert_eq!( + runner().ok(".a {\ + \n .b, :where(.b) {c: d}\ + \n e: f;\ + \n}\n"), + ".a {\ + \n e: f;\ + \n}\ + \n.a .b, .a :where(.b) {\ + \n c: d;\ + \n}\n" + ); + } + #[test] + fn mixed_specificity_parent() { + assert_eq!( + runner().ok(".a, :where(.a) {\ + \n .b {c: d}\ + \n e: f;\ + \n}\n"), + ".a, :where(.a) {\ + \n e: f;\ + \n}\ + \n.a .b, :where(.a) .b {\ + \n c: d;\ + \n}\n" + ); + } + #[test] + fn same_specificity() { + assert_eq!( + runner().ok(".a {\ + \n :where(.b) {c: d}\ + \n e: f;\ + \n}\n"), + ".a {\ + \n e: f;\ + \n}\ + \n.a :where(.b) {\ + \n c: d;\ + \n}\n" + ); + } + } + #[test] + fn around_style_rule() { + assert_eq!( + runner().ok(".a {\ + \n b: c;\ + \n .d {e: f}\ + \n g: h;\ + \n}\n"), + ".a {\ + \n b: c;\ + \n g: h;\ + \n}\ + \n.a .d {\ + \n e: f;\ + \n}\n" + ); + } + #[test] + fn before_style_rule() { + assert_eq!( + runner().ok(".a {\ + \n b: c;\ + \n .d {e: f}\ + \n}\n"), + ".a {\ + \n b: c;\ + \n}\ + \n.a .d {\ + \n e: f;\ + \n}\n" + ); + } + #[test] + fn in_at_rule() { + assert_eq!( + runner().ok("@a {\ + \n .b {\ + \n .c {d: e}\ + \n f: g;\ + \n }\ + \n}\n"), + "@a {\ + \n .b {\ + \n f: g;\ + \n }\ + \n .b .c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + #[test] + fn in_bubbled_rule() { + assert_eq!( + runner().ok(".a {\ + \n .b {c: d}\ + \n @e {f: g}\ + \n}\n"), + ".a .b {\ + \n c: d;\ + \n}\ + \n@e {\ + \n .a {\ + \n f: g;\ + \n }\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/css/supports/comment.rs b/rsass/tests/spec/css/supports/comment.rs new file mode 100644 index 000000000..7d21846b0 --- /dev/null +++ b/rsass/tests/spec/css/supports/comment.rs @@ -0,0 +1,470 @@ +//! Tests auto-converted from "sass-spec/spec/css/supports/comment.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("comment") +} + +mod after_query { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn loud() { + assert_eq!( + runner().ok("@supports (a: b) /**/ {c {d: e}}\n"), + "@supports (a: b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!( + runner().ok("@supports (a: b) //\ + \n {c {d: e}}\n"), + "@supports (a: b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } +} +mod anything { + #[allow(unused)] + use super::runner; + + mod after_ident { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn loud() { + assert_eq!( + runner().ok("@supports (a /**/ b) {c {d: e}}\n"), + "@supports (a /**/ b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!( + runner().ok("@supports (a //\ + \n b) {c {d: e}}\n"), + "@supports (a \ + \n b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + } + mod after_open_paren { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("@supports (/**/ a b) {c {d: e}}\n"), + "@supports (a b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@supports (//\ + \n a b) {c {d: e}}\n"), + "@supports (a b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + } + mod before_close_paren { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("@supports (a b /**/) {c {d: e}}\n"), + "@supports (a b /**/) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!( + runner().ok("@supports (a b //\ + \n ) {c {d: e}}\n"), + "@supports (a b \ + \n ) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + } +} +mod before_query { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn loud() { + assert_eq!( + runner().ok("@supports /**/ (a: b) {c {d: e}}\n"), + "@supports (a: b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@supports //\ + \n (a: b) {c {d: e}}\n"), + "@supports (a: b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } +} +mod declaration { + #[allow(unused)] + use super::runner; + + mod custom_prop { + #[allow(unused)] + use super::runner; + + mod after_colon { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("@supports (--a: /**/ b) {c {d: e}}\n"), + "@supports (--a: /**/ b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!( + runner().ok("@supports (--a: //\ + \n b) {c {d: e}}\n"), + "@supports (--a: b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + } + mod after_open_paren { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn loud() { + assert_eq!( + runner().ok("@supports (/**/ --a: b) {c {d: e}}\n"), + "@supports (--a: b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@supports (//\ + \n --a: b) {c {d: e}}\n"), + "@supports (--a: b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + } + mod before_close_paren { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("@supports (--a: b /**/) {c {d: e}}\n"), + "@supports (--a: b /**/) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!( + runner().ok("@supports (--a: b //\ + \n ) {c {d: e}}\n"), + "@supports (--a: b ) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + } + mod before_colon { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("@supports (--a /**/: b) {c {d: e}}\n"), + "@supports (--a: b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@supports (--a //\ + \n : b) {c {d: e}}\n"), + "@supports (--a: b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + } + } + mod normal_prop { + #[allow(unused)] + use super::runner; + + mod after_colon { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn loud() { + assert_eq!( + runner().ok("@supports (a: /**/ b) {c {d: e}}\n"), + "@supports (a: b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@supports (a: //\ + \n b) {c {d: e}}\n"), + "@supports (a: b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + } + mod after_open_paren { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn loud() { + assert_eq!( + runner().ok("@supports (/**/ a: b) {c {d: e}}\n"), + "@supports (a: b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@supports (//\ + \n a: b) {c {d: e}}\n"), + "@supports (a: b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + } + mod before_close_paren { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn loud() { + assert_eq!( + runner().ok("@supports (a: b /**/) {c {d: e}}\n"), + "@supports (a: b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@supports (a: b //\ + \n ) {c {d: e}}\n"), + "@supports (a: b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + } + mod before_colon { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("@supports (a /**/: b) {c {d: e}}\n"), + "@supports (a: b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@supports (a //\ + \n : b) {c {d: e}}\n"), + "@supports (a: b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + } + } +} +mod function { + #[allow(unused)] + use super::runner; + + mod after_open_paren { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("@supports a(/**/ b) {c {d: e}}\n"), + "@supports a(/**/ b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!( + runner().ok("@supports a(//\ + \n b) {c {d: e}}\n"), + "@supports a(\ + \n b) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + } + mod before_close_paren { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("@supports a(b /**/) {c {d: e}}\n"), + "@supports a(b /**/) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!( + runner().ok("@supports a(b //\ + \n ) {c {d: e}}\n"), + "@supports a(b \ + \n ) {\ + \n c {\ + \n d: e;\ + \n }\ + \n}\n" + ); + } + } +} diff --git a/rsass/tests/spec/css/supports/mod.rs b/rsass/tests/spec/css/supports/mod.rs index 0a70c5fc7..f7092aa33 100644 --- a/rsass/tests/spec/css/supports/mod.rs +++ b/rsass/tests/spec/css/supports/mod.rs @@ -5,6 +5,8 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("supports") } +mod comment; + mod error; mod nesting; diff --git a/rsass/tests/spec/css/unknown_directive/comment.rs b/rsass/tests/spec/css/unknown_directive/comment.rs new file mode 100644 index 000000000..61685f504 --- /dev/null +++ b/rsass/tests/spec/css/unknown_directive/comment.rs @@ -0,0 +1,117 @@ +//! Tests auto-converted from "sass-spec/spec/css/unknown_directive/comment.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("comment") +} + +mod children { + #[allow(unused)] + use super::runner; + + mod after_value { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!(runner().ok("@a b /**/ {}\n"), "@a b /**/ {}\n"); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!( + runner().ok("@a b //\ + \n {}\n"), + "@a b {}\n" + ); + } + } + mod before_value { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn loud() { + assert_eq!(runner().ok("@a /**/ b {}\n"), "@a b {}\n"); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@a //\ + \n b {}\n"), + "@a b {}\n" + ); + } + } + mod no_value { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn loud() { + assert_eq!(runner().ok("@a /**/ {}\n"), "@a {}\n"); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@a //\ + \n {}\n"), + "@a {}\n" + ); + } + } +} +mod no_children { + #[allow(unused)] + use super::runner; + + mod after_value { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!(runner().ok("@a b /**/\n"), "@a b /**/;\n"); + } + #[test] + #[ignore] // wrong result + fn silent() { + assert_eq!(runner().ok("@a b //\n"), "@a b;\n"); + } + } + mod before_value { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn loud() { + assert_eq!(runner().ok("@a /**/ b\n"), "@a b;\n"); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@a //\ + \n b\n"), + "@a b;\n" + ); + } + } + mod no_value { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn loud() { + assert_eq!(runner().ok("@a /**/\n"), "@a;\n"); + } + #[test] + fn silent() { + assert_eq!(runner().ok("@a //\n"), "@a;\n"); + } + } +} diff --git a/rsass/tests/spec/css/unknown_directive/mod.rs b/rsass/tests/spec/css/unknown_directive/mod.rs index 64de8a8a5..cc6aeae77 100644 --- a/rsass/tests/spec/css/unknown_directive/mod.rs +++ b/rsass/tests/spec/css/unknown_directive/mod.rs @@ -5,6 +5,8 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("unknown_directive") } +mod comment; + mod error; mod name_interpolation; diff --git a/rsass/tests/spec/css/unknown_directive/plain.rs b/rsass/tests/spec/css/unknown_directive/plain.rs index 5fe78ec44..0448e878c 100644 --- a/rsass/tests/spec/css/unknown_directive/plain.rs +++ b/rsass/tests/spec/css/unknown_directive/plain.rs @@ -22,7 +22,7 @@ fn test() { ), "@asdf .~@#$%^&*()_-+=[]|:<>,.?/;\ \n@asdf \"f\'o\" \'b\"r\' url(baz) url(\"qux\");\ - \n@asdf foo //\ + \n@asdf foo \ \n bar;\ \n@asdf foo /* bar */ baz;\n" ); diff --git a/rsass/tests/spec/directives/at_root.rs b/rsass/tests/spec/directives/at_root.rs index 50eda7867..dd06fda2a 100644 --- a/rsass/tests/spec/directives/at_root.rs +++ b/rsass/tests/spec/directives/at_root.rs @@ -23,6 +23,172 @@ fn runner() -> crate::TestRunner { .mock_file("nested_import/with_user_use/used.scss", "// nothing\n") } +mod comment { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("comment") + } + + mod after_colon { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("after_colon") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@at-root (without: /**/ media) {}\n"), ""); + } + #[test] + #[ignore] // unexepected error + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@at-root (without: //\ + \n media) {}\n"), + "" + ); + } + } + mod after_open_paren { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("after_open_paren") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@at-root (/**/ without: media) {}\n"), ""); + } + #[test] + #[ignore] // unexepected error + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@at-root (//\ + \n without: media) {}\n"), + "" + ); + } + } + mod after_query { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("after_query") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@at-root (without: media) /**/ {}\n"), ""); + } + #[test] + #[ignore] // unexepected error + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@at-root (without: media) //\ + \n {}\n"), + "" + ); + } + } + mod before_close_paren { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("before_close_paren") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@at-root (without: media /**/) {}\n"), ""); + } + #[test] + #[ignore] // unexepected error + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@at-root (without: media //\ + \n ) {}\n"), + "" + ); + } + } + mod before_colon { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("before_colon") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@at-root (without /**/ : media) {}\n"), ""); + } + #[test] + #[ignore] // unexepected error + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@at-root (without //\ + \n : media) {}\n"), + "" + ); + } + } + mod before_query { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("before_query") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@at-root /**/ (without: media) {}\n"), ""); + } + #[test] + #[ignore] // unexepected error + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@at-root //\ + \n (without: media) {}\n"), + "" + ); + } + } + mod no_query { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("no_query") + } + + #[test] + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@at-root /**/ {}\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@at-root //\ + \n {}\n"), + "" + ); + } + } +} mod keyframes { #[allow(unused)] fn runner() -> crate::TestRunner { @@ -120,3 +286,16 @@ fn property_only() { \n}\n" ); } +mod sass { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("sass") + } + + mod empty { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("empty") + } + } +} diff --git a/rsass/tests/spec/directives/forward/comment.rs b/rsass/tests/spec/directives/forward/comment.rs new file mode 100644 index 000000000..609388300 --- /dev/null +++ b/rsass/tests/spec/directives/forward/comment.rs @@ -0,0 +1,242 @@ +//! Tests auto-converted from "sass-spec/spec/directives/forward/comment.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner() + .with_cwd("comment") + .mock_file("after_close_paren/loud/other.scss", "$a: 1 !default\n") + .mock_file("after_close_paren/silent/other.scss", "$a: 1 !default\n") + .mock_file("after_colon/loud/other.scss", "$a: 1 !default\n") + .mock_file("after_colon/silent/other.scss", "$a: 1 !default\n") + .mock_file("after_keyword/loud/other.scss", "") + .mock_file("after_keyword/silent/other.scss", "") + .mock_file("after_modifier/loud/other.scss", "") + .mock_file("after_modifier/silent/other.scss", "") + .mock_file("after_open_paren/loud/other.scss", "$a: 1 !default\n") + .mock_file("after_paren/silent/other.scss", "$a: 1 !default\n") + .mock_file("after_url/loud/other.scss", "") + .mock_file("after_url/silent/other.scss", "") + .mock_file("before_close_paren/loud/other.scss", "$a: 1 !default\n") + .mock_file("before_close_paren/silent/other.scss", "$a: 1 !default\n") + .mock_file("before_colon/loud/other.scss", "$a: 1 !default\n") + .mock_file("before_colon/silent/other.scss", "$a: 1 !default\n") + .mock_file("before_keyword/loud/other.scss", "") + .mock_file("before_keyword/silent/other.scss", "") + .mock_file("before_url/loud/other.scss", "") + .mock_file("before_url/silent/other.scss", "") +} + +mod after_close_paren { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("after_close_paren") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@forward \"other\" with ($a: b) /**/\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!(runner.ok("@forward \"other\" with ($a: b) //\n"), ""); + } +} +mod after_colon { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("after_colon") + } + + #[test] + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@forward \"other\" with ($a: /**/ b)\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@forward \"other\" with ($a: //\ + \n b)\n"), + "" + ); + } +} +mod after_keyword { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("after_keyword") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@forward \"other\" as /**/ a-*\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@forward \"other\" as //\ + \n a-*\n"), + "" + ); + } +} +mod after_modifier { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("after_modifier") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@forward \"other\" as a-* /**/\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!(runner.ok("@forward \"other\" as a-* //\n"), ""); + } +} +mod after_open_paren { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("after_open_paren") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@forward \"other\" with (/**/ $a: b)\n"), ""); + } +} +mod after_paren { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("after_paren") + } + + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@forward \"other\" with (//\ + \n $a: b)\n"), + "" + ); + } +} +mod after_url { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("after_url") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@forward \"other\" /**/\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!(runner.ok("@forward \"other\" //\n"), ""); + } +} +mod before_close_paren { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("before_close_paren") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@forward \"other\" with ($a: b /**/)\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@forward \"other\" with ($a: b //\ + \n )\n"), + "" + ); + } +} +mod before_colon { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("before_colon") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@forward \"other\" with ($a /**/ : b)\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@forward \"other\" with ($a //\ + \n : b)\n"), + "" + ); + } +} +mod before_keyword { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("before_keyword") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@forward \"other\" /**/ as a-*\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@forward \"other\" //\ + \n as a-*\n"), + "" + ); + } +} +mod before_url { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("before_url") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@forward /**/ \"other\"\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@forward //\ + \n \"other\"\n"), + "" + ); + } +} diff --git a/rsass/tests/spec/directives/forward/mod.rs b/rsass/tests/spec/directives/forward/mod.rs index 309e41ea6..5915cabc0 100644 --- a/rsass/tests/spec/directives/forward/mod.rs +++ b/rsass/tests/spec/directives/forward/mod.rs @@ -5,6 +5,8 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("forward") } +mod comment; + mod css; mod error; diff --git a/rsass/tests/spec/directives/forward/with/variable_exists.rs b/rsass/tests/spec/directives/forward/with/variable_exists.rs index a905b45b3..533266a02 100644 --- a/rsass/tests/spec/directives/forward/with/variable_exists.rs +++ b/rsass/tests/spec/directives/forward/with/variable_exists.rs @@ -5,7 +5,7 @@ fn runner() -> crate::TestRunner { super::runner() .with_cwd("variable_exists") .mock_file("_midstream.scss", "@forward \"upstream\" with ($a: configured);\n") - .mock_file("_upstream.scss", "$before-declaration: variable-exists(a);\n$a: original !default;\nb {\n before-declaration: $before-declaration;\n after-declaration: variable-exists(a);\n}\n") + .mock_file("_upstream.scss", "@use \"sass:meta\";\n$before-declaration: meta.variable-exists(a);\n$a: original !default;\nb {\n before-declaration: $before-declaration;\n after-declaration: meta.variable-exists(a);\n}\n") } #[test] diff --git a/rsass/tests/spec/directives/function.rs b/rsass/tests/spec/directives/function.rs index ae0060e39..9876a71c2 100644 --- a/rsass/tests/spec/directives/function.rs +++ b/rsass/tests/spec/directives/function.rs @@ -5,6 +5,100 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("function") } +mod comment { + #[allow(unused)] + use super::runner; + + mod function { + #[allow(unused)] + use super::runner; + + mod after_args { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!(runner().ok("@function a() /**/ {}\n"), ""); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@function a() //\ + \n {}\n"), + "" + ); + } + } + mod before_name { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!(runner().ok("@function /**/ a() {}\n"), ""); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@function //\ + \n a() {}\n"), + "" + ); + } + } + } + mod test_return { + #[allow(unused)] + use super::runner; + + mod after_value { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("@function a() {@return b /**/}\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@function a() {\ + \n @return b //\ + \n}\n"), + "" + ); + } + } + mod before_value { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("@function a() {@return /**/ b}\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@function a() {\ + \n @return //\ + \n b\ + \n}\n"), + "" + ); + } + } + } +} #[test] #[ignore] // wrong result fn custom_ident_call() { diff --git a/rsass/tests/spec/directives/import/comment.rs b/rsass/tests/spec/directives/import/comment.rs new file mode 100644 index 000000000..fb473df32 --- /dev/null +++ b/rsass/tests/spec/directives/import/comment.rs @@ -0,0 +1,228 @@ +//! Tests auto-converted from "sass-spec/spec/directives/import/comment.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("comment") +} + +mod after_comma { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("@import \"a.css\", /**/ \"b.css\"\n"), + "@import \"a.css\";\ + \n@import \"b.css\";\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@import \"a.css\", //\ + \n \"b.css\"\n"), + "@import \"a.css\";\ + \n@import \"b.css\";\n" + ); + } +} +mod after_url { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@import \"a.css\" /**/\n"), + "@import \"a.css\";\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@import \"a.css\" //\n"), + "@import \"a.css\";\n" + ); + } +} +mod before_comma { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@import \"a.css\" /**/, \"b.css\"\n"), + "@import \"a.css\";\ + \n@import \"b.css\";\n" + ); + } + #[test] + #[ignore] // unexepected error + fn silent() { + assert_eq!( + runner().ok("@import \"a.css\" //\ + \n , \"b.css\"\n"), + "@import \"a.css\";\ + \n@import \"b.css\";\n" + ); + } +} +mod before_url { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn loud() { + assert_eq!( + runner().ok("@import /**/ \"a.css\"\n"), + "@import \"a.css\";\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@import //\ + \n \"a.css\"\n"), + "@import \"a.css\";\n" + ); + } +} +mod modifier { + #[allow(unused)] + use super::runner; + + mod args { + #[allow(unused)] + use super::runner; + + mod after { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@import \"a.css\" b(c) /**/\n"), + "@import \"a.css\" b(c);\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@import \"a.css\" b(c) //\n"), + "@import \"a.css\" b(c);\n" + ); + } + } + mod after_open_paren { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("@import \"a.css\" b(/**/ c)\n"), + "@import \"a.css\" b(/**/ c);\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@import \"a.css\" b(c)\n"), + "@import \"a.css\" b(c);\n" + ); + } + } + mod before { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("@import \"a.css\" /**/ b(c)\n"), + "@import \"a.css\" b(c);\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@import \"a.css\" //\ + \n b(c)\n"), + "@import \"a.css\" b(c);\n" + ); + } + } + mod before_close_paren { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@import \"a.css\" b(c /**/)\n"), + "@import \"a.css\" b(c /**/);\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@import \"a.css\" b(c)\n"), + "@import \"a.css\" b(c);\n" + ); + } + } + } + mod no_args { + #[allow(unused)] + use super::runner; + + mod after { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@import \"a.css\" b /**/\n"), + "@import \"a.css\" b;\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@import \"a.css\" b //\n"), + "@import \"a.css\" b;\n" + ); + } + } + mod before { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("@import \"a.css\" /**/ b\n"), + "@import \"a.css\" b;\n" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@import \"a.css\" //\ + \n b\n"), + "@import \"a.css\" b;\n" + ); + } + } + } +} diff --git a/rsass/tests/spec/directives/import/mod.rs b/rsass/tests/spec/directives/import/mod.rs index 07d7217e4..1dcb59fe7 100644 --- a/rsass/tests/spec/directives/import/mod.rs +++ b/rsass/tests/spec/directives/import/mod.rs @@ -5,6 +5,8 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("import") } +mod comment; + mod configuration; mod css; diff --git a/rsass/tests/spec/directives/mixin.rs b/rsass/tests/spec/directives/mixin.rs index a1a9209b9..ff7b51d50 100644 --- a/rsass/tests/spec/directives/mixin.rs +++ b/rsass/tests/spec/directives/mixin.rs @@ -5,6 +5,257 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("mixin") } +mod comment { + #[allow(unused)] + use super::runner; + + mod content { + #[allow(unused)] + use super::runner; + + mod after_args { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!(runner().ok("@mixin a {@content() /**/}\n"), ""); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@mixin a {\ + \n @content() //\ + \n}\n"), + "" + ); + } + } + mod after_content { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!(runner().ok("@mixin a {@content /**/}\n"), ""); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@mixin a {\ + \n @content //\ + \n}\n"), + "" + ); + } + } + } + mod include { + #[allow(unused)] + use super::runner; + + mod after_args { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn loud() { + assert_eq!( + runner().ok("@mixin a {}\ + \n@include a() /**/\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@mixin a {}\ + \n@include a() //\n"), + "" + ); + } + } + mod after_name { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn loud() { + assert_eq!( + runner().ok("@mixin a {}\ + \n@include a /**/\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@mixin a {}\ + \n@include a //\n"), + "" + ); + } + } + mod after_using { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@mixin a {@content}\ + \n@include a() using /**/ () {}\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@mixin a {@content}\ + \n@include a() using //\ + \n () {}\n"), + "" + ); + } + } + mod after_using_arglist { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@mixin a {@content}\ + \n@include a() using () /**/ {}\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@mixin a {@content}\ + \n@include a() using () //\ + \n {}\n"), + "" + ); + } + } + mod before_block { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@mixin a {@content}\ + \n@include a() /**/ {}\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@mixin a {@content}\ + \n@include a() //\ + \n {}\n"), + "" + ); + } + } + mod before_name { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@mixin a {}\ + \n@include /**/ a\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@mixin a {}\ + \n@include //\ + \n a\n"), + "" + ); + } + } + mod before_using { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@mixin a {@content}\ + \n@include a() /**/ using () {}\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@mixin a {@content}\ + \n@include a() //\ + \n using () {}\n"), + "" + ); + } + } + } + mod mixin { + #[allow(unused)] + use super::runner; + + mod after_args { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!(runner().ok("@mixin a() /**/ {}\n"), ""); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@mixin a() //\ + \n {}\n"), + "" + ); + } + } + mod before_name { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!(runner().ok("@mixin /**/ a {}\n"), ""); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@mixin //\ + \n a {}\n"), + "" + ); + } + } + } +} #[test] fn custom_ident_include() { assert_eq!( diff --git a/rsass/tests/spec/directives/test_for.rs b/rsass/tests/spec/directives/test_for.rs index 5c5b6b6e5..8a57b9c13 100644 --- a/rsass/tests/spec/directives/test_for.rs +++ b/rsass/tests/spec/directives/test_for.rs @@ -5,6 +5,137 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("for") } +mod comment { + #[allow(unused)] + use super::runner; + + mod after_from { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@for $i from /**/ 1 through 10 {}\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@for $i from //\ + \n 1 through 10 {}\n"), + "" + ); + } + } + mod after_through { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@for $i from 1 through /**/ 10 {}\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@for $i from 1 through //\ + \n 10 {}\n"), + "" + ); + } + } + mod before_block { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@for $i from 1 through 10 /**/ {}\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@for $i from 1 through 10 //\ + \n {}\n"), + "" + ); + } + } + mod before_from { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@for $i /**/ from 1 through 10 {}\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@for $i //\ + \n from 1 through 10 {}\n"), + "" + ); + } + } + mod before_through { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@for $i from 1 /**/ through 10 {}\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@for $i from 1 //\ + \n through 10 {}\n"), + "" + ); + } + } + mod before_var { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@for /**/ $i from 1 through 10 {}\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@for //\ + \n $i from 1 through 10 {}\n"), + "" + ); + } + } +} #[test] fn empty() { assert_eq!( diff --git a/rsass/tests/spec/directives/test_if/comment.rs b/rsass/tests/spec/directives/test_if/comment.rs new file mode 100644 index 000000000..ce9af9fc4 --- /dev/null +++ b/rsass/tests/spec/directives/test_if/comment.rs @@ -0,0 +1,151 @@ +//! Tests auto-converted from "sass-spec/spec/directives/if/comment.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("comment") +} + +mod comment { + #[allow(unused)] + use super::runner; + + mod test_else { + #[allow(unused)] + use super::runner; + + mod before_block { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@if true {}\ + \n@else /**/ {}\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@if true {}\ + \n@else //\ + \n {}\n"), + "" + ); + } + } + } + mod else_if { + #[allow(unused)] + use super::runner; + + mod after_condition { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("@if true {}\ + \n@else if true /**/ {}\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@if true {}\ + \n@else if true //\ + \n {}\n"), + "" + ); + } + } + mod before_condition { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!( + runner().ok("@if true {}\ + \n@else if /**/ true {}\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@if true {}\ + \n@else if //\ + \n true {}\n"), + "" + ); + } + } + mod before_if { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!( + runner().ok("@if true {}\ + \n@else /**/ if true {}\n"), + "" + ); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@if true {}\ + \n@else //\ + \n if true {}\n"), + "" + ); + } + } + } + mod test_if { + #[allow(unused)] + use super::runner; + + mod after_condition { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!(runner().ok("@if true /**/ {}\n"), ""); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@if true //\ + \n {}\n"), + "" + ); + } + } + mod before_condition { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!(runner().ok("@if /**/ true {}\n"), ""); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@if //\ + \n true {}\n"), + "" + ); + } + } + } +} diff --git a/rsass/tests/spec/directives/test_if/mod.rs b/rsass/tests/spec/directives/test_if/mod.rs index bfef392a5..3be251059 100644 --- a/rsass/tests/spec/directives/test_if/mod.rs +++ b/rsass/tests/spec/directives/test_if/mod.rs @@ -5,6 +5,8 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("if") } +mod comment; + mod error; mod escaped; diff --git a/rsass/tests/spec/directives/test_use/comment.rs b/rsass/tests/spec/directives/test_use/comment.rs new file mode 100644 index 000000000..64b01ae4a --- /dev/null +++ b/rsass/tests/spec/directives/test_use/comment.rs @@ -0,0 +1,242 @@ +//! Tests auto-converted from "sass-spec/spec/directives/use/comment.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner() + .with_cwd("comment") + .mock_file("after_close_paren/loud/other.scss", "$a: 1 !default\n") + .mock_file("after_close_paren/silent/other.scss", "$a: 1 !default\n") + .mock_file("after_colon/loud/other.scss", "$a: 1 !default\n") + .mock_file("after_colon/silent/other.scss", "$a: 1 !default\n") + .mock_file("after_keyword/loud/other.scss", "") + .mock_file("after_keyword/silent/other.scss", "") + .mock_file("after_modifier/loud/other.scss", "") + .mock_file("after_modifier/silent/other.scss", "") + .mock_file("after_open_paren/loud/other.scss", "$a: 1 !default\n") + .mock_file("after_paren/silent/other.scss", "$a: 1 !default\n") + .mock_file("after_url/loud/other.scss", "") + .mock_file("after_url/silent/other.scss", "") + .mock_file("before_close_paren/loud/other.scss", "$a: 1 !default\n") + .mock_file("before_close_paren/silent/other.scss", "$a: 1 !default\n") + .mock_file("before_colon/loud/other.scss", "$a: 1 !default\n") + .mock_file("before_colon/silent/other.scss", "$a: 1 !default\n") + .mock_file("before_keyword/loud/other.scss", "") + .mock_file("before_keyword/silent/other.scss", "") + .mock_file("before_url/loud/other.scss", "") + .mock_file("before_url/silent/other.scss", "") +} + +mod after_close_paren { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("after_close_paren") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@use \"other\" with ($a: b) /**/\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!(runner.ok("@use \"other\" with ($a: b) //\n"), ""); + } +} +mod after_colon { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("after_colon") + } + + #[test] + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@use \"other\" with ($a: /**/ b)\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@use \"other\" with ($a: //\ + \n b)\n"), + "" + ); + } +} +mod after_keyword { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("after_keyword") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@use \"other\" as /**/ a\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@use \"other\" as //\ + \n a\n"), + "" + ); + } +} +mod after_modifier { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("after_modifier") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@use \"other\" as a /**/\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!(runner.ok("@use \"other\" as a //\n"), ""); + } +} +mod after_open_paren { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("after_open_paren") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@use \"other\" with (/**/ $a: b)\n"), ""); + } +} +mod after_paren { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("after_paren") + } + + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@use \"other\" with (//\ + \n $a: b)\n"), + "" + ); + } +} +mod after_url { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("after_url") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@use \"other\" /**/\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!(runner.ok("@use \"other\" //\n"), ""); + } +} +mod before_close_paren { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("before_close_paren") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@use \"other\" with ($a: b /**/)\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@use \"other\" with ($a: b //\ + \n )\n"), + "" + ); + } +} +mod before_colon { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("before_colon") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@use \"other\" with ($a /**/ : b)\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@use \"other\" with ($a //\ + \n : b)\n"), + "" + ); + } +} +mod before_keyword { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("before_keyword") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@use \"other\" /**/ as a\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@use \"other\" //\ + \n as a\n"), + "" + ); + } +} +mod before_url { + #[allow(unused)] + fn runner() -> crate::TestRunner { + super::runner().with_cwd("before_url") + } + + #[test] + #[ignore] // unexepected error + fn loud() { + let runner = runner().with_cwd("loud"); + assert_eq!(runner.ok("@use /**/ \"other\"\n"), ""); + } + #[test] + fn silent() { + let runner = runner().with_cwd("silent"); + assert_eq!( + runner.ok("@use //\ + \n \"other\"\n"), + "" + ); + } +} diff --git a/rsass/tests/spec/directives/test_use/css/import.rs b/rsass/tests/spec/directives/test_use/css/import.rs index db523080e..c31ca79e7 100644 --- a/rsass/tests/spec/directives/test_use/css/import.rs +++ b/rsass/tests/spec/directives/test_use/css/import.rs @@ -11,8 +11,8 @@ fn runner() -> crate::TestRunner { .mock_file("import_into_use_into_import/_used.scss", "@import \"imported-upstream\";\n\nin-used {a: b}\n") .mock_file("import_module_imported_by_use/_shared.scss", "// This file is imported twice, so this should be printed twice, even though one\n// of those imports came from a use.\n@debug \"evaluating shared\";\n\na {b: c}\n") .mock_file("import_module_imported_by_use/_used.scss", "@import \"shared\";\n") - .mock_file("nested_import_into_use/_imported.scss", "@use \"used\";\n\nin-imported {parent: inspect(&)}\n") - .mock_file("nested_import_into_use/_used.scss", "// This parent selector will be `null`, because used modules are always\n// evaluated in a clean context, even if their CSS is then copied into an\n// imported file.\nin-used {parent: inspect(&)}\n") + .mock_file("nested_import_into_use/_imported.scss", "@use \"sass:meta\";\n@use \"used\";\n\nin-imported {parent: meta.inspect(&)}\n") + .mock_file("nested_import_into_use/_used.scss", "@use \"sass:meta\";\n// This parent selector will be `null`, because used modules are always\n// evaluated in a clean context, even if their CSS is then copied into an\n// imported file.\nin-used {parent: meta.inspect(&)}\n") .mock_file("use_and_import_same/_other.scss", "// Every import always evaluates the file being imported, so this should be\n// printed twice.\n@debug \"evaluating other\";\n\na {b: c}\n") .mock_file("use_into_import/_imported.scss", "in-imported {a: b}\n") .mock_file("use_into_import/_used.scss", "@import \"imported\";\n\nin-used {a: b}\n") diff --git a/rsass/tests/spec/directives/test_use/member/nested_global_variable.rs b/rsass/tests/spec/directives/test_use/member/nested_global_variable.rs index f5ea22448..c83a4bf49 100644 --- a/rsass/tests/spec/directives/test_use/member/nested_global_variable.rs +++ b/rsass/tests/spec/directives/test_use/member/nested_global_variable.rs @@ -14,8 +14,9 @@ fn runner() -> crate::TestRunner { fn direct() { let runner = runner().with_cwd("direct"); assert_eq!( - runner.ok("@use \"other\";\n\ - \na {b: inspect(other.$member)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"other\";\n\ + \na {b: meta.inspect(other.$member)}\n"), "a {\ \n b: null;\ \n}\n" @@ -26,8 +27,9 @@ fn direct() { fn through_import() { let runner = runner().with_cwd("through_import"); assert_eq!( - runner.ok("@use \"used\";\n\ - \na {b: inspect(used.$member)}\n"), + runner.ok("@use \"sass:meta\";\ + \n@use \"used\";\n\ + \na {b: meta.inspect(used.$member)}\n"), "a {\ \n b: null;\ \n}\n" diff --git a/rsass/tests/spec/directives/test_use/mod.rs b/rsass/tests/spec/directives/test_use/mod.rs index faab7b1c5..ccc292a13 100644 --- a/rsass/tests/spec/directives/test_use/mod.rs +++ b/rsass/tests/spec/directives/test_use/mod.rs @@ -5,6 +5,8 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("use") } +mod comment; + mod css; mod error; diff --git a/rsass/tests/spec/directives/test_use/with/variable_exists.rs b/rsass/tests/spec/directives/test_use/with/variable_exists.rs index 5f9bf388d..308855bbe 100644 --- a/rsass/tests/spec/directives/test_use/with/variable_exists.rs +++ b/rsass/tests/spec/directives/test_use/with/variable_exists.rs @@ -4,7 +4,7 @@ fn runner() -> crate::TestRunner { super::runner() .with_cwd("variable_exists") - .mock_file("_other.scss", "$before-declaration: variable-exists(a);\n$a: original !default;\nb {\n before-declaration: $before-declaration;\n after-declaration: variable-exists(a);\n}\n") + .mock_file("_other.scss", "@use \"sass:meta\";\n$before-declaration: meta.variable-exists(a);\n$a: original !default;\nb {\n before-declaration: $before-declaration;\n after-declaration: meta.variable-exists(a);\n}\n") } #[test] diff --git a/rsass/tests/spec/directives/warn.rs b/rsass/tests/spec/directives/warn.rs index 37ec6b069..970e52590 100644 --- a/rsass/tests/spec/directives/warn.rs +++ b/rsass/tests/spec/directives/warn.rs @@ -5,6 +5,41 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("warn") } +mod comment { + #[allow(unused)] + use super::runner; + + mod after_expression { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!(runner().ok("@warn a /**/\n"), ""); + } + #[test] + fn silent() { + assert_eq!(runner().ok("@warn a //\n"), ""); + } + } + mod before_expression { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!(runner().ok("@warn /**/ a\n"), ""); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("@warn //\ + \n a\n"), + "" + ); + } + } +} #[test] fn escaped() { assert_eq!( @@ -18,8 +53,9 @@ fn escaped() { #[test] fn functions_in_stack() { assert_eq!( - runner().ok("@function issues-warning($a) {\ - \n @warn \"From function: #{inspect($a)}\";\ + runner().ok("@use \"sass:meta\";\n\ + \n@function issues-warning($a) {\ + \n @warn \"From function: #{meta.inspect($a)}\";\ \n @return $a;\ \n}\n\ \n@mixin calls-function-that-warns($a) {\ diff --git a/rsass/tests/spec/libsass/arg_eval.rs b/rsass/tests/spec/libsass/arg_eval.rs index 4dd12659c..52d2ec534 100644 --- a/rsass/tests/spec/libsass/arg_eval.rs +++ b/rsass/tests/spec/libsass/arg_eval.rs @@ -8,7 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function foo() {\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@function foo() {\ \n @return 1+2 3/4 5+6;\ \n}\n\ \n@mixin bar($x: 3/4) {\ @@ -16,10 +18,10 @@ fn test() { \n}\n\ \ndiv {\ \n content: foobar(1+2 3/4 5+6, orange);\ - \n content: append(1+2 2/3 5+6, orange);\ + \n content: list.append(1+2 2/3 5+6, orange);\ \n content: 1+2 2/3 5+6;\ - \n content: type-of(2/3);\ - \n content: type-of(orange);\ + \n content: meta.type-of(2/3);\ + \n content: meta.type-of(orange);\ \n content: foo();\ \n @include bar();\ \n}"), diff --git a/rsass/tests/spec/libsass/at_error/feature_test.rs b/rsass/tests/spec/libsass/at_error/feature_test.rs index 45f26f1e4..6e6f2f5cb 100644 --- a/rsass/tests/spec/libsass/at_error/feature_test.rs +++ b/rsass/tests/spec/libsass/at_error/feature_test.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@if feature-exists(at-error) {\ + runner().ok("@use \"sass:meta\";\ + \n@if meta.feature-exists(at-error) {\ \n div {\ \n feature: true;\ \n }\ diff --git a/rsass/tests/spec/libsass/bool.rs b/rsass/tests/spec/libsass/bool.rs index 837d90307..2b502dbed 100644 --- a/rsass/tests/spec/libsass/bool.rs +++ b/rsass/tests/spec/libsass/bool.rs @@ -8,13 +8,14 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("div {\ + runner().ok("@use \"sass:string\";\ + \ndiv {\ \n a: (false and \"hey\");\ \n b: (\"hey\" and \"ho\");\ \n b: (\"hey\" or \"ho\");\ \n a: false and \"hey\";\ \n b: \"hey\" and \"ho\";\ - \n b: unquote(\"hey\") or \"ho\";\ + \n b: string.unquote(\"hey\") or \"ho\";\ \n}"), "div {\ \n a: false;\ diff --git a/rsass/tests/spec/libsass/bourbon.rs b/rsass/tests/spec/libsass/bourbon.rs index 556cec1d5..f74782517 100644 --- a/rsass/tests/spec/libsass/bourbon.rs +++ b/rsass/tests/spec/libsass/bourbon.rs @@ -58,10 +58,12 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok( - "@import \"lib/_bourbon.scss\";\n\ + "@use \"sass:color\";\ + \n@import \"lib/_bourbon.scss\";\n\ \nbox:hover {\ \n @include animation-name(scale, slide);\ \n @include animation-duration(2s);\ @@ -79,7 +81,7 @@ fn test() { \n @include background-image(url(\"/images/a.png\"), linear-gradient(white 0, yellow 50%, transparent 50%));\n\ \n // Multiple linear-gradients - Demo\ \n @include background-image(linear-gradient(hsla(0, 100%, 100%, 0.25) 0%, hsla(0, 100%, 100%, 0.08) 50%, transparent 50%),\ - \n linear-gradient(#4e7ba3, darken(#4e7ba4, 10%)));\n\ + \n linear-gradient(#4e7ba3, color.adjust(#4e7ba4, $lightness: -10%)));\n\ \n // NOT SUPPORTED - Multiple image assets with shorthand notation\ \n @include background-image(url(\"/images/a.png\") center no-repeat, url(\"images/b.png\") left repeat);\ \n}\n" @@ -112,8 +114,8 @@ fn test() { \n background-image: url(\"/images/a.png\"), url(\"images/b.png\");\ \n background-image: url(\"/images/a.png\"), -webkit-linear-gradient(white 0, yellow 50%, transparent 50%);\ \n background-image: url(\"/images/a.png\"), linear-gradient( white 0, yellow 50%, transparent 50%);\ - \n background-image: -webkit-linear-gradient(hsla(0, 100%, 100%, 0.25) 0%, hsla(0, 100%, 100%, 0.08) 50%, transparent 50%), -webkit-linear-gradient(#4e7ba3, #3e6181);\ - \n background-image: linear-gradient( hsla(0, 100%, 100%, 0.25) 0%, hsla(0, 100%, 100%, 0.08) 50%, transparent 50%), linear-gradient( #4e7ba3, #3e6181);\ + \n background-image: -webkit-linear-gradient(hsla(0, 100%, 100%, 0.25) 0%, hsla(0, 100%, 100%, 0.08) 50%, transparent 50%), -webkit-linear-gradient(#4e7ba3, rgb(61.5619834711, 97.0785123967, 129.4380165289));\ + \n background-image: linear-gradient( hsla(0, 100%, 100%, 0.25) 0%, hsla(0, 100%, 100%, 0.08) 50%, transparent 50%), linear-gradient( #4e7ba3, rgb(61.5619834711, 97.0785123967, 129.4380165289));\ \n background-image: -webkit-url(\"/images/a.png\")-gradient(center), -webkit-url(\"images/b.png\")-gradient(left);\ \n background-image: url(\"/images/a.png\")-gradient( center), url(\"images/b.png\")-gradient( left);\ \n}\n" diff --git a/rsass/tests/spec/libsass/charset.rs b/rsass/tests/spec/libsass/charset.rs index 17cbe6277..f46ff6cd3 100644 --- a/rsass/tests/spec/libsass/charset.rs +++ b/rsass/tests/spec/libsass/charset.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("div {\ - \n content: to-upper-case(\"øáéíóúüñ¿éàŤDžǂɊɱʭʬѪ҈ݓ\");\ + runner().ok("@use \"sass:string\";\ + \ndiv {\ + \n content: string.to-upper-case(\"øáéíóúüñ¿éàŤDžǂɊɱʭʬѪ҈ݓ\");\ \n}\n"), "@charset \"UTF-8\";\ \ndiv {\ diff --git a/rsass/tests/spec/libsass/color_functions/opacity/alpha.rs b/rsass/tests/spec/libsass/color_functions/opacity/alpha.rs index 59fad4dec..4b8a43fc8 100644 --- a/rsass/tests/spec/libsass/color_functions/opacity/alpha.rs +++ b/rsass/tests/spec/libsass/color_functions/opacity/alpha.rs @@ -8,18 +8,19 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("foo {\ - \n c0: opacity(rgba(0,0,0,0.0));\ - \n c1: opacity(rgba(0,0,0,0.1));\ - \n c2: opacity(rgba(0,0,0,0.2));\ - \n c3: opacity(rgba(0,0,0,0.3));\ - \n c4: opacity(rgba(0,0,0,0.4));\ - \n c5: opacity(rgba(0,0,0,0.5));\ - \n c6: opacity(rgba(0,0,0,0.6));\ - \n c7: opacity(rgba(0,0,0,0.7));\ - \n c8: opacity(rgba(0,0,0,0.8));\ - \n c9: opacity(rgba(0,0,0,0.9));\ - \n c10: opacity(rgba(0,0,0,1));\ + runner().ok("@use \"sass:color\";\ + \nfoo {\ + \n c0: color.opacity(rgba(0,0,0,0.0));\ + \n c1: color.opacity(rgba(0,0,0,0.1));\ + \n c2: color.opacity(rgba(0,0,0,0.2));\ + \n c3: color.opacity(rgba(0,0,0,0.3));\ + \n c4: color.opacity(rgba(0,0,0,0.4));\ + \n c5: color.opacity(rgba(0,0,0,0.5));\ + \n c6: color.opacity(rgba(0,0,0,0.6));\ + \n c7: color.opacity(rgba(0,0,0,0.7));\ + \n c8: color.opacity(rgba(0,0,0,0.8));\ + \n c9: color.opacity(rgba(0,0,0,0.9));\ + \n c10: color.opacity(rgba(0,0,0,1));\ \n}\n"), "foo {\ \n c0: 0;\ diff --git a/rsass/tests/spec/libsass/color_functions/other/change_color/a.rs b/rsass/tests/spec/libsass/color_functions/other/change_color/a.rs index 8da28203c..0652405ea 100644 --- a/rsass/tests/spec/libsass/color_functions/other/change_color/a.rs +++ b/rsass/tests/spec/libsass/color_functions/other/change_color/a.rs @@ -8,19 +8,20 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("foo {\ + runner().ok("@use \"sass:color\";\ + \nfoo {\ \n // c-1: change-color(black,$alpha:-1);\ - \n c0: change-color(black,$alpha:0.0);\ - \n c1: change-color(black,$alpha:0.1);\ - \n c2: change-color(black,$alpha:0.2);\ - \n c3: change-color(black,$alpha:0.3);\ - \n c4: change-color(black,$alpha:0.4);\ - \n c5: change-color(black,$alpha:0.5);\ - \n c6: change-color(black,$alpha:0.6);\ - \n c7: change-color(black,$alpha:0.7);\ - \n c8: change-color(black,$alpha:0.8);\ - \n c9: change-color(black,$alpha:0.9);\ - \n c10: change-color(black,$alpha:1);\ + \n c0: color.change(black,$alpha:0.0);\ + \n c1: color.change(black,$alpha:0.1);\ + \n c2: color.change(black,$alpha:0.2);\ + \n c3: color.change(black,$alpha:0.3);\ + \n c4: color.change(black,$alpha:0.4);\ + \n c5: color.change(black,$alpha:0.5);\ + \n c6: color.change(black,$alpha:0.6);\ + \n c7: color.change(black,$alpha:0.7);\ + \n c8: color.change(black,$alpha:0.8);\ + \n c9: color.change(black,$alpha:0.9);\ + \n c10: color.change(black,$alpha:1);\ \n // c11: change-color(black,$alpha:1.1);\ \n // c12: change-color(black,$alpha:2);\ \n}\n"), diff --git a/rsass/tests/spec/libsass/color_functions/other/change_color/b.rs b/rsass/tests/spec/libsass/color_functions/other/change_color/b.rs index 5014ec5ca..11d032894 100644 --- a/rsass/tests/spec/libsass/color_functions/other/change_color/b.rs +++ b/rsass/tests/spec/libsass/color_functions/other/change_color/b.rs @@ -8,264 +8,265 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("foo {\ + runner().ok("@use \"sass:color\";\ + \nfoo {\ \n // c-1: change-color(black,$blue:-1);\ - \n c0: change-color(black,$blue:0);\ - \n c1: change-color(black,$blue:1);\ - \n c2: change-color(black,$blue:2);\ - \n c3: change-color(black,$blue:3);\ - \n c4: change-color(black,$blue:4);\ - \n c5: change-color(black,$blue:5);\ - \n c6: change-color(black,$blue:6);\ - \n c7: change-color(black,$blue:7);\ - \n c8: change-color(black,$blue:8);\ - \n c9: change-color(black,$blue:9);\ - \n c10: change-color(black,$blue:10);\ - \n c11: change-color(black,$blue:11);\ - \n c12: change-color(black,$blue:12);\ - \n c13: change-color(black,$blue:13);\ - \n c14: change-color(black,$blue:14);\ - \n c15: change-color(black,$blue:15);\ - \n c16: change-color(black,$blue:16);\ - \n c17: change-color(black,$blue:17);\ - \n c18: change-color(black,$blue:18);\ - \n c19: change-color(black,$blue:19);\ - \n c20: change-color(black,$blue:20);\ - \n c21: change-color(black,$blue:21);\ - \n c22: change-color(black,$blue:22);\ - \n c23: change-color(black,$blue:23);\ - \n c24: change-color(black,$blue:24);\ - \n c25: change-color(black,$blue:25);\ - \n c26: change-color(black,$blue:26);\ - \n c27: change-color(black,$blue:27);\ - \n c28: change-color(black,$blue:28);\ - \n c29: change-color(black,$blue:29);\ - \n c30: change-color(black,$blue:30);\ - \n c31: change-color(black,$blue:31);\ - \n c32: change-color(black,$blue:32);\ - \n c33: change-color(black,$blue:33);\ - \n c34: change-color(black,$blue:34);\ - \n c35: change-color(black,$blue:35);\ - \n c36: change-color(black,$blue:36);\ - \n c37: change-color(black,$blue:37);\ - \n c38: change-color(black,$blue:38);\ - \n c39: change-color(black,$blue:39);\ - \n c40: change-color(black,$blue:40);\ - \n c41: change-color(black,$blue:41);\ - \n c42: change-color(black,$blue:42);\ - \n c43: change-color(black,$blue:43);\ - \n c44: change-color(black,$blue:44);\ - \n c45: change-color(black,$blue:45);\ - \n c46: change-color(black,$blue:46);\ - \n c47: change-color(black,$blue:47);\ - \n c48: change-color(black,$blue:48);\ - \n c49: change-color(black,$blue:49);\ - \n c50: change-color(black,$blue:50);\ - \n c51: change-color(black,$blue:51);\ - \n c52: change-color(black,$blue:52);\ - \n c53: change-color(black,$blue:53);\ - \n c54: change-color(black,$blue:54);\ - \n c55: change-color(black,$blue:55);\ - \n c56: change-color(black,$blue:56);\ - \n c57: change-color(black,$blue:57);\ - \n c58: change-color(black,$blue:58);\ - \n c59: change-color(black,$blue:59);\ - \n c60: change-color(black,$blue:60);\ - \n c61: change-color(black,$blue:61);\ - \n c62: change-color(black,$blue:62);\ - \n c63: change-color(black,$blue:63);\ - \n c64: change-color(black,$blue:64);\ - \n c65: change-color(black,$blue:65);\ - \n c66: change-color(black,$blue:66);\ - \n c67: change-color(black,$blue:67);\ - \n c68: change-color(black,$blue:68);\ - \n c69: change-color(black,$blue:69);\ - \n c70: change-color(black,$blue:70);\ - \n c71: change-color(black,$blue:71);\ - \n c72: change-color(black,$blue:72);\ - \n c73: change-color(black,$blue:73);\ - \n c74: change-color(black,$blue:74);\ - \n c75: change-color(black,$blue:75);\ - \n c76: change-color(black,$blue:76);\ - \n c77: change-color(black,$blue:77);\ - \n c78: change-color(black,$blue:78);\ - \n c79: change-color(black,$blue:79);\ - \n c80: change-color(black,$blue:80);\ - \n c81: change-color(black,$blue:81);\ - \n c82: change-color(black,$blue:82);\ - \n c83: change-color(black,$blue:83);\ - \n c84: change-color(black,$blue:84);\ - \n c85: change-color(black,$blue:85);\ - \n c86: change-color(black,$blue:86);\ - \n c87: change-color(black,$blue:87);\ - \n c88: change-color(black,$blue:88);\ - \n c89: change-color(black,$blue:89);\ - \n c90: change-color(black,$blue:90);\ - \n c91: change-color(black,$blue:91);\ - \n c92: change-color(black,$blue:92);\ - \n c93: change-color(black,$blue:93);\ - \n c94: change-color(black,$blue:94);\ - \n c95: change-color(black,$blue:95);\ - \n c96: change-color(black,$blue:96);\ - \n c97: change-color(black,$blue:97);\ - \n c98: change-color(black,$blue:98);\ - \n c99: change-color(black,$blue:99);\ - \n c100: change-color(black,$blue:100);\ - \n c101: change-color(black,$blue:101);\ - \n c102: change-color(black,$blue:102);\ - \n c103: change-color(black,$blue:103);\ - \n c104: change-color(black,$blue:104);\ - \n c105: change-color(black,$blue:105);\ - \n c106: change-color(black,$blue:106);\ - \n c107: change-color(black,$blue:107);\ - \n c108: change-color(black,$blue:108);\ - \n c109: change-color(black,$blue:109);\ - \n c110: change-color(black,$blue:110);\ - \n c111: change-color(black,$blue:111);\ - \n c112: change-color(black,$blue:112);\ - \n c113: change-color(black,$blue:113);\ - \n c114: change-color(black,$blue:114);\ - \n c115: change-color(black,$blue:115);\ - \n c116: change-color(black,$blue:116);\ - \n c117: change-color(black,$blue:117);\ - \n c118: change-color(black,$blue:118);\ - \n c119: change-color(black,$blue:119);\ - \n c120: change-color(black,$blue:120);\ - \n c121: change-color(black,$blue:121);\ - \n c122: change-color(black,$blue:122);\ - \n c123: change-color(black,$blue:123);\ - \n c124: change-color(black,$blue:124);\ - \n c125: change-color(black,$blue:125);\ - \n c126: change-color(black,$blue:126);\ - \n c127: change-color(black,$blue:127);\ - \n c128: change-color(black,$blue:128);\ - \n c129: change-color(black,$blue:129);\ - \n c130: change-color(black,$blue:130);\ - \n c131: change-color(black,$blue:131);\ - \n c132: change-color(black,$blue:132);\ - \n c133: change-color(black,$blue:133);\ - \n c134: change-color(black,$blue:134);\ - \n c135: change-color(black,$blue:135);\ - \n c136: change-color(black,$blue:136);\ - \n c137: change-color(black,$blue:137);\ - \n c138: change-color(black,$blue:138);\ - \n c139: change-color(black,$blue:139);\ - \n c140: change-color(black,$blue:140);\ - \n c141: change-color(black,$blue:141);\ - \n c142: change-color(black,$blue:142);\ - \n c143: change-color(black,$blue:143);\ - \n c144: change-color(black,$blue:144);\ - \n c145: change-color(black,$blue:145);\ - \n c146: change-color(black,$blue:146);\ - \n c147: change-color(black,$blue:147);\ - \n c148: change-color(black,$blue:148);\ - \n c149: change-color(black,$blue:149);\ - \n c150: change-color(black,$blue:150);\ - \n c151: change-color(black,$blue:151);\ - \n c152: change-color(black,$blue:152);\ - \n c153: change-color(black,$blue:153);\ - \n c154: change-color(black,$blue:154);\ - \n c155: change-color(black,$blue:155);\ - \n c156: change-color(black,$blue:156);\ - \n c157: change-color(black,$blue:157);\ - \n c158: change-color(black,$blue:158);\ - \n c159: change-color(black,$blue:159);\ - \n c160: change-color(black,$blue:160);\ - \n c161: change-color(black,$blue:161);\ - \n c162: change-color(black,$blue:162);\ - \n c163: change-color(black,$blue:163);\ - \n c164: change-color(black,$blue:164);\ - \n c165: change-color(black,$blue:165);\ - \n c166: change-color(black,$blue:166);\ - \n c167: change-color(black,$blue:167);\ - \n c168: change-color(black,$blue:168);\ - \n c169: change-color(black,$blue:169);\ - \n c170: change-color(black,$blue:170);\ - \n c171: change-color(black,$blue:171);\ - \n c172: change-color(black,$blue:172);\ - \n c173: change-color(black,$blue:173);\ - \n c174: change-color(black,$blue:174);\ - \n c175: change-color(black,$blue:175);\ - \n c176: change-color(black,$blue:176);\ - \n c177: change-color(black,$blue:177);\ - \n c178: change-color(black,$blue:178);\ - \n c179: change-color(black,$blue:179);\ - \n c180: change-color(black,$blue:180);\ - \n c181: change-color(black,$blue:181);\ - \n c182: change-color(black,$blue:182);\ - \n c183: change-color(black,$blue:183);\ - \n c184: change-color(black,$blue:184);\ - \n c185: change-color(black,$blue:185);\ - \n c186: change-color(black,$blue:186);\ - \n c187: change-color(black,$blue:187);\ - \n c188: change-color(black,$blue:188);\ - \n c189: change-color(black,$blue:189);\ - \n c190: change-color(black,$blue:190);\ - \n c191: change-color(black,$blue:191);\ - \n c192: change-color(black,$blue:192);\ - \n c193: change-color(black,$blue:193);\ - \n c194: change-color(black,$blue:194);\ - \n c195: change-color(black,$blue:195);\ - \n c196: change-color(black,$blue:196);\ - \n c197: change-color(black,$blue:197);\ - \n c198: change-color(black,$blue:198);\ - \n c199: change-color(black,$blue:199);\ - \n c200: change-color(black,$blue:200);\ - \n c201: change-color(black,$blue:201);\ - \n c202: change-color(black,$blue:202);\ - \n c203: change-color(black,$blue:203);\ - \n c204: change-color(black,$blue:204);\ - \n c205: change-color(black,$blue:205);\ - \n c206: change-color(black,$blue:206);\ - \n c207: change-color(black,$blue:207);\ - \n c208: change-color(black,$blue:208);\ - \n c209: change-color(black,$blue:209);\ - \n c210: change-color(black,$blue:210);\ - \n c211: change-color(black,$blue:211);\ - \n c212: change-color(black,$blue:212);\ - \n c213: change-color(black,$blue:213);\ - \n c214: change-color(black,$blue:214);\ - \n c215: change-color(black,$blue:215);\ - \n c216: change-color(black,$blue:216);\ - \n c217: change-color(black,$blue:217);\ - \n c218: change-color(black,$blue:218);\ - \n c219: change-color(black,$blue:219);\ - \n c220: change-color(black,$blue:220);\ - \n c221: change-color(black,$blue:221);\ - \n c222: change-color(black,$blue:222);\ - \n c223: change-color(black,$blue:223);\ - \n c224: change-color(black,$blue:224);\ - \n c225: change-color(black,$blue:225);\ - \n c226: change-color(black,$blue:226);\ - \n c227: change-color(black,$blue:227);\ - \n c228: change-color(black,$blue:228);\ - \n c229: change-color(black,$blue:229);\ - \n c230: change-color(black,$blue:230);\ - \n c231: change-color(black,$blue:231);\ - \n c232: change-color(black,$blue:232);\ - \n c233: change-color(black,$blue:233);\ - \n c234: change-color(black,$blue:234);\ - \n c235: change-color(black,$blue:235);\ - \n c236: change-color(black,$blue:236);\ - \n c237: change-color(black,$blue:237);\ - \n c238: change-color(black,$blue:238);\ - \n c239: change-color(black,$blue:239);\ - \n c240: change-color(black,$blue:240);\ - \n c241: change-color(black,$blue:241);\ - \n c242: change-color(black,$blue:242);\ - \n c243: change-color(black,$blue:243);\ - \n c244: change-color(black,$blue:244);\ - \n c245: change-color(black,$blue:245);\ - \n c246: change-color(black,$blue:246);\ - \n c247: change-color(black,$blue:247);\ - \n c248: change-color(black,$blue:248);\ - \n c249: change-color(black,$blue:249);\ - \n c250: change-color(black,$blue:250);\ - \n c251: change-color(black,$blue:251);\ - \n c252: change-color(black,$blue:252);\ - \n c253: change-color(black,$blue:253);\ - \n c254: change-color(black,$blue:254);\ - \n c255: change-color(black,$blue:255);\ + \n c0: color.change(black,$blue:0);\ + \n c1: color.change(black,$blue:1);\ + \n c2: color.change(black,$blue:2);\ + \n c3: color.change(black,$blue:3);\ + \n c4: color.change(black,$blue:4);\ + \n c5: color.change(black,$blue:5);\ + \n c6: color.change(black,$blue:6);\ + \n c7: color.change(black,$blue:7);\ + \n c8: color.change(black,$blue:8);\ + \n c9: color.change(black,$blue:9);\ + \n c10: color.change(black,$blue:10);\ + \n c11: color.change(black,$blue:11);\ + \n c12: color.change(black,$blue:12);\ + \n c13: color.change(black,$blue:13);\ + \n c14: color.change(black,$blue:14);\ + \n c15: color.change(black,$blue:15);\ + \n c16: color.change(black,$blue:16);\ + \n c17: color.change(black,$blue:17);\ + \n c18: color.change(black,$blue:18);\ + \n c19: color.change(black,$blue:19);\ + \n c20: color.change(black,$blue:20);\ + \n c21: color.change(black,$blue:21);\ + \n c22: color.change(black,$blue:22);\ + \n c23: color.change(black,$blue:23);\ + \n c24: color.change(black,$blue:24);\ + \n c25: color.change(black,$blue:25);\ + \n c26: color.change(black,$blue:26);\ + \n c27: color.change(black,$blue:27);\ + \n c28: color.change(black,$blue:28);\ + \n c29: color.change(black,$blue:29);\ + \n c30: color.change(black,$blue:30);\ + \n c31: color.change(black,$blue:31);\ + \n c32: color.change(black,$blue:32);\ + \n c33: color.change(black,$blue:33);\ + \n c34: color.change(black,$blue:34);\ + \n c35: color.change(black,$blue:35);\ + \n c36: color.change(black,$blue:36);\ + \n c37: color.change(black,$blue:37);\ + \n c38: color.change(black,$blue:38);\ + \n c39: color.change(black,$blue:39);\ + \n c40: color.change(black,$blue:40);\ + \n c41: color.change(black,$blue:41);\ + \n c42: color.change(black,$blue:42);\ + \n c43: color.change(black,$blue:43);\ + \n c44: color.change(black,$blue:44);\ + \n c45: color.change(black,$blue:45);\ + \n c46: color.change(black,$blue:46);\ + \n c47: color.change(black,$blue:47);\ + \n c48: color.change(black,$blue:48);\ + \n c49: color.change(black,$blue:49);\ + \n c50: color.change(black,$blue:50);\ + \n c51: color.change(black,$blue:51);\ + \n c52: color.change(black,$blue:52);\ + \n c53: color.change(black,$blue:53);\ + \n c54: color.change(black,$blue:54);\ + \n c55: color.change(black,$blue:55);\ + \n c56: color.change(black,$blue:56);\ + \n c57: color.change(black,$blue:57);\ + \n c58: color.change(black,$blue:58);\ + \n c59: color.change(black,$blue:59);\ + \n c60: color.change(black,$blue:60);\ + \n c61: color.change(black,$blue:61);\ + \n c62: color.change(black,$blue:62);\ + \n c63: color.change(black,$blue:63);\ + \n c64: color.change(black,$blue:64);\ + \n c65: color.change(black,$blue:65);\ + \n c66: color.change(black,$blue:66);\ + \n c67: color.change(black,$blue:67);\ + \n c68: color.change(black,$blue:68);\ + \n c69: color.change(black,$blue:69);\ + \n c70: color.change(black,$blue:70);\ + \n c71: color.change(black,$blue:71);\ + \n c72: color.change(black,$blue:72);\ + \n c73: color.change(black,$blue:73);\ + \n c74: color.change(black,$blue:74);\ + \n c75: color.change(black,$blue:75);\ + \n c76: color.change(black,$blue:76);\ + \n c77: color.change(black,$blue:77);\ + \n c78: color.change(black,$blue:78);\ + \n c79: color.change(black,$blue:79);\ + \n c80: color.change(black,$blue:80);\ + \n c81: color.change(black,$blue:81);\ + \n c82: color.change(black,$blue:82);\ + \n c83: color.change(black,$blue:83);\ + \n c84: color.change(black,$blue:84);\ + \n c85: color.change(black,$blue:85);\ + \n c86: color.change(black,$blue:86);\ + \n c87: color.change(black,$blue:87);\ + \n c88: color.change(black,$blue:88);\ + \n c89: color.change(black,$blue:89);\ + \n c90: color.change(black,$blue:90);\ + \n c91: color.change(black,$blue:91);\ + \n c92: color.change(black,$blue:92);\ + \n c93: color.change(black,$blue:93);\ + \n c94: color.change(black,$blue:94);\ + \n c95: color.change(black,$blue:95);\ + \n c96: color.change(black,$blue:96);\ + \n c97: color.change(black,$blue:97);\ + \n c98: color.change(black,$blue:98);\ + \n c99: color.change(black,$blue:99);\ + \n c100: color.change(black,$blue:100);\ + \n c101: color.change(black,$blue:101);\ + \n c102: color.change(black,$blue:102);\ + \n c103: color.change(black,$blue:103);\ + \n c104: color.change(black,$blue:104);\ + \n c105: color.change(black,$blue:105);\ + \n c106: color.change(black,$blue:106);\ + \n c107: color.change(black,$blue:107);\ + \n c108: color.change(black,$blue:108);\ + \n c109: color.change(black,$blue:109);\ + \n c110: color.change(black,$blue:110);\ + \n c111: color.change(black,$blue:111);\ + \n c112: color.change(black,$blue:112);\ + \n c113: color.change(black,$blue:113);\ + \n c114: color.change(black,$blue:114);\ + \n c115: color.change(black,$blue:115);\ + \n c116: color.change(black,$blue:116);\ + \n c117: color.change(black,$blue:117);\ + \n c118: color.change(black,$blue:118);\ + \n c119: color.change(black,$blue:119);\ + \n c120: color.change(black,$blue:120);\ + \n c121: color.change(black,$blue:121);\ + \n c122: color.change(black,$blue:122);\ + \n c123: color.change(black,$blue:123);\ + \n c124: color.change(black,$blue:124);\ + \n c125: color.change(black,$blue:125);\ + \n c126: color.change(black,$blue:126);\ + \n c127: color.change(black,$blue:127);\ + \n c128: color.change(black,$blue:128);\ + \n c129: color.change(black,$blue:129);\ + \n c130: color.change(black,$blue:130);\ + \n c131: color.change(black,$blue:131);\ + \n c132: color.change(black,$blue:132);\ + \n c133: color.change(black,$blue:133);\ + \n c134: color.change(black,$blue:134);\ + \n c135: color.change(black,$blue:135);\ + \n c136: color.change(black,$blue:136);\ + \n c137: color.change(black,$blue:137);\ + \n c138: color.change(black,$blue:138);\ + \n c139: color.change(black,$blue:139);\ + \n c140: color.change(black,$blue:140);\ + \n c141: color.change(black,$blue:141);\ + \n c142: color.change(black,$blue:142);\ + \n c143: color.change(black,$blue:143);\ + \n c144: color.change(black,$blue:144);\ + \n c145: color.change(black,$blue:145);\ + \n c146: color.change(black,$blue:146);\ + \n c147: color.change(black,$blue:147);\ + \n c148: color.change(black,$blue:148);\ + \n c149: color.change(black,$blue:149);\ + \n c150: color.change(black,$blue:150);\ + \n c151: color.change(black,$blue:151);\ + \n c152: color.change(black,$blue:152);\ + \n c153: color.change(black,$blue:153);\ + \n c154: color.change(black,$blue:154);\ + \n c155: color.change(black,$blue:155);\ + \n c156: color.change(black,$blue:156);\ + \n c157: color.change(black,$blue:157);\ + \n c158: color.change(black,$blue:158);\ + \n c159: color.change(black,$blue:159);\ + \n c160: color.change(black,$blue:160);\ + \n c161: color.change(black,$blue:161);\ + \n c162: color.change(black,$blue:162);\ + \n c163: color.change(black,$blue:163);\ + \n c164: color.change(black,$blue:164);\ + \n c165: color.change(black,$blue:165);\ + \n c166: color.change(black,$blue:166);\ + \n c167: color.change(black,$blue:167);\ + \n c168: color.change(black,$blue:168);\ + \n c169: color.change(black,$blue:169);\ + \n c170: color.change(black,$blue:170);\ + \n c171: color.change(black,$blue:171);\ + \n c172: color.change(black,$blue:172);\ + \n c173: color.change(black,$blue:173);\ + \n c174: color.change(black,$blue:174);\ + \n c175: color.change(black,$blue:175);\ + \n c176: color.change(black,$blue:176);\ + \n c177: color.change(black,$blue:177);\ + \n c178: color.change(black,$blue:178);\ + \n c179: color.change(black,$blue:179);\ + \n c180: color.change(black,$blue:180);\ + \n c181: color.change(black,$blue:181);\ + \n c182: color.change(black,$blue:182);\ + \n c183: color.change(black,$blue:183);\ + \n c184: color.change(black,$blue:184);\ + \n c185: color.change(black,$blue:185);\ + \n c186: color.change(black,$blue:186);\ + \n c187: color.change(black,$blue:187);\ + \n c188: color.change(black,$blue:188);\ + \n c189: color.change(black,$blue:189);\ + \n c190: color.change(black,$blue:190);\ + \n c191: color.change(black,$blue:191);\ + \n c192: color.change(black,$blue:192);\ + \n c193: color.change(black,$blue:193);\ + \n c194: color.change(black,$blue:194);\ + \n c195: color.change(black,$blue:195);\ + \n c196: color.change(black,$blue:196);\ + \n c197: color.change(black,$blue:197);\ + \n c198: color.change(black,$blue:198);\ + \n c199: color.change(black,$blue:199);\ + \n c200: color.change(black,$blue:200);\ + \n c201: color.change(black,$blue:201);\ + \n c202: color.change(black,$blue:202);\ + \n c203: color.change(black,$blue:203);\ + \n c204: color.change(black,$blue:204);\ + \n c205: color.change(black,$blue:205);\ + \n c206: color.change(black,$blue:206);\ + \n c207: color.change(black,$blue:207);\ + \n c208: color.change(black,$blue:208);\ + \n c209: color.change(black,$blue:209);\ + \n c210: color.change(black,$blue:210);\ + \n c211: color.change(black,$blue:211);\ + \n c212: color.change(black,$blue:212);\ + \n c213: color.change(black,$blue:213);\ + \n c214: color.change(black,$blue:214);\ + \n c215: color.change(black,$blue:215);\ + \n c216: color.change(black,$blue:216);\ + \n c217: color.change(black,$blue:217);\ + \n c218: color.change(black,$blue:218);\ + \n c219: color.change(black,$blue:219);\ + \n c220: color.change(black,$blue:220);\ + \n c221: color.change(black,$blue:221);\ + \n c222: color.change(black,$blue:222);\ + \n c223: color.change(black,$blue:223);\ + \n c224: color.change(black,$blue:224);\ + \n c225: color.change(black,$blue:225);\ + \n c226: color.change(black,$blue:226);\ + \n c227: color.change(black,$blue:227);\ + \n c228: color.change(black,$blue:228);\ + \n c229: color.change(black,$blue:229);\ + \n c230: color.change(black,$blue:230);\ + \n c231: color.change(black,$blue:231);\ + \n c232: color.change(black,$blue:232);\ + \n c233: color.change(black,$blue:233);\ + \n c234: color.change(black,$blue:234);\ + \n c235: color.change(black,$blue:235);\ + \n c236: color.change(black,$blue:236);\ + \n c237: color.change(black,$blue:237);\ + \n c238: color.change(black,$blue:238);\ + \n c239: color.change(black,$blue:239);\ + \n c240: color.change(black,$blue:240);\ + \n c241: color.change(black,$blue:241);\ + \n c242: color.change(black,$blue:242);\ + \n c243: color.change(black,$blue:243);\ + \n c244: color.change(black,$blue:244);\ + \n c245: color.change(black,$blue:245);\ + \n c246: color.change(black,$blue:246);\ + \n c247: color.change(black,$blue:247);\ + \n c248: color.change(black,$blue:248);\ + \n c249: color.change(black,$blue:249);\ + \n c250: color.change(black,$blue:250);\ + \n c251: color.change(black,$blue:251);\ + \n c252: color.change(black,$blue:252);\ + \n c253: color.change(black,$blue:253);\ + \n c254: color.change(black,$blue:254);\ + \n c255: color.change(black,$blue:255);\ \n // c256: change-color(black,$blue:256);\ \n}\n"), "foo {\ diff --git a/rsass/tests/spec/libsass/color_functions/other/change_color/g.rs b/rsass/tests/spec/libsass/color_functions/other/change_color/g.rs index 9f74b2548..7db8cbc28 100644 --- a/rsass/tests/spec/libsass/color_functions/other/change_color/g.rs +++ b/rsass/tests/spec/libsass/color_functions/other/change_color/g.rs @@ -8,264 +8,265 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("foo {\ + runner().ok("@use \"sass:color\";\ + \nfoo {\ \n // c-1: change-color(black,$green:-1);\ - \n c0: change-color(black,$green:0);\ - \n c1: change-color(black,$green:1);\ - \n c2: change-color(black,$green:2);\ - \n c3: change-color(black,$green:3);\ - \n c4: change-color(black,$green:4);\ - \n c5: change-color(black,$green:5);\ - \n c6: change-color(black,$green:6);\ - \n c7: change-color(black,$green:7);\ - \n c8: change-color(black,$green:8);\ - \n c9: change-color(black,$green:9);\ - \n c10: change-color(black,$green:10);\ - \n c11: change-color(black,$green:11);\ - \n c12: change-color(black,$green:12);\ - \n c13: change-color(black,$green:13);\ - \n c14: change-color(black,$green:14);\ - \n c15: change-color(black,$green:15);\ - \n c16: change-color(black,$green:16);\ - \n c17: change-color(black,$green:17);\ - \n c18: change-color(black,$green:18);\ - \n c19: change-color(black,$green:19);\ - \n c20: change-color(black,$green:20);\ - \n c21: change-color(black,$green:21);\ - \n c22: change-color(black,$green:22);\ - \n c23: change-color(black,$green:23);\ - \n c24: change-color(black,$green:24);\ - \n c25: change-color(black,$green:25);\ - \n c26: change-color(black,$green:26);\ - \n c27: change-color(black,$green:27);\ - \n c28: change-color(black,$green:28);\ - \n c29: change-color(black,$green:29);\ - \n c30: change-color(black,$green:30);\ - \n c31: change-color(black,$green:31);\ - \n c32: change-color(black,$green:32);\ - \n c33: change-color(black,$green:33);\ - \n c34: change-color(black,$green:34);\ - \n c35: change-color(black,$green:35);\ - \n c36: change-color(black,$green:36);\ - \n c37: change-color(black,$green:37);\ - \n c38: change-color(black,$green:38);\ - \n c39: change-color(black,$green:39);\ - \n c40: change-color(black,$green:40);\ - \n c41: change-color(black,$green:41);\ - \n c42: change-color(black,$green:42);\ - \n c43: change-color(black,$green:43);\ - \n c44: change-color(black,$green:44);\ - \n c45: change-color(black,$green:45);\ - \n c46: change-color(black,$green:46);\ - \n c47: change-color(black,$green:47);\ - \n c48: change-color(black,$green:48);\ - \n c49: change-color(black,$green:49);\ - \n c50: change-color(black,$green:50);\ - \n c51: change-color(black,$green:51);\ - \n c52: change-color(black,$green:52);\ - \n c53: change-color(black,$green:53);\ - \n c54: change-color(black,$green:54);\ - \n c55: change-color(black,$green:55);\ - \n c56: change-color(black,$green:56);\ - \n c57: change-color(black,$green:57);\ - \n c58: change-color(black,$green:58);\ - \n c59: change-color(black,$green:59);\ - \n c60: change-color(black,$green:60);\ - \n c61: change-color(black,$green:61);\ - \n c62: change-color(black,$green:62);\ - \n c63: change-color(black,$green:63);\ - \n c64: change-color(black,$green:64);\ - \n c65: change-color(black,$green:65);\ - \n c66: change-color(black,$green:66);\ - \n c67: change-color(black,$green:67);\ - \n c68: change-color(black,$green:68);\ - \n c69: change-color(black,$green:69);\ - \n c70: change-color(black,$green:70);\ - \n c71: change-color(black,$green:71);\ - \n c72: change-color(black,$green:72);\ - \n c73: change-color(black,$green:73);\ - \n c74: change-color(black,$green:74);\ - \n c75: change-color(black,$green:75);\ - \n c76: change-color(black,$green:76);\ - \n c77: change-color(black,$green:77);\ - \n c78: change-color(black,$green:78);\ - \n c79: change-color(black,$green:79);\ - \n c80: change-color(black,$green:80);\ - \n c81: change-color(black,$green:81);\ - \n c82: change-color(black,$green:82);\ - \n c83: change-color(black,$green:83);\ - \n c84: change-color(black,$green:84);\ - \n c85: change-color(black,$green:85);\ - \n c86: change-color(black,$green:86);\ - \n c87: change-color(black,$green:87);\ - \n c88: change-color(black,$green:88);\ - \n c89: change-color(black,$green:89);\ - \n c90: change-color(black,$green:90);\ - \n c91: change-color(black,$green:91);\ - \n c92: change-color(black,$green:92);\ - \n c93: change-color(black,$green:93);\ - \n c94: change-color(black,$green:94);\ - \n c95: change-color(black,$green:95);\ - \n c96: change-color(black,$green:96);\ - \n c97: change-color(black,$green:97);\ - \n c98: change-color(black,$green:98);\ - \n c99: change-color(black,$green:99);\ - \n c100: change-color(black,$green:100);\ - \n c101: change-color(black,$green:101);\ - \n c102: change-color(black,$green:102);\ - \n c103: change-color(black,$green:103);\ - \n c104: change-color(black,$green:104);\ - \n c105: change-color(black,$green:105);\ - \n c106: change-color(black,$green:106);\ - \n c107: change-color(black,$green:107);\ - \n c108: change-color(black,$green:108);\ - \n c109: change-color(black,$green:109);\ - \n c110: change-color(black,$green:110);\ - \n c111: change-color(black,$green:111);\ - \n c112: change-color(black,$green:112);\ - \n c113: change-color(black,$green:113);\ - \n c114: change-color(black,$green:114);\ - \n c115: change-color(black,$green:115);\ - \n c116: change-color(black,$green:116);\ - \n c117: change-color(black,$green:117);\ - \n c118: change-color(black,$green:118);\ - \n c119: change-color(black,$green:119);\ - \n c120: change-color(black,$green:120);\ - \n c121: change-color(black,$green:121);\ - \n c122: change-color(black,$green:122);\ - \n c123: change-color(black,$green:123);\ - \n c124: change-color(black,$green:124);\ - \n c125: change-color(black,$green:125);\ - \n c126: change-color(black,$green:126);\ - \n c127: change-color(black,$green:127);\ - \n c128: change-color(black,$green:128);\ - \n c129: change-color(black,$green:129);\ - \n c130: change-color(black,$green:130);\ - \n c131: change-color(black,$green:131);\ - \n c132: change-color(black,$green:132);\ - \n c133: change-color(black,$green:133);\ - \n c134: change-color(black,$green:134);\ - \n c135: change-color(black,$green:135);\ - \n c136: change-color(black,$green:136);\ - \n c137: change-color(black,$green:137);\ - \n c138: change-color(black,$green:138);\ - \n c139: change-color(black,$green:139);\ - \n c140: change-color(black,$green:140);\ - \n c141: change-color(black,$green:141);\ - \n c142: change-color(black,$green:142);\ - \n c143: change-color(black,$green:143);\ - \n c144: change-color(black,$green:144);\ - \n c145: change-color(black,$green:145);\ - \n c146: change-color(black,$green:146);\ - \n c147: change-color(black,$green:147);\ - \n c148: change-color(black,$green:148);\ - \n c149: change-color(black,$green:149);\ - \n c150: change-color(black,$green:150);\ - \n c151: change-color(black,$green:151);\ - \n c152: change-color(black,$green:152);\ - \n c153: change-color(black,$green:153);\ - \n c154: change-color(black,$green:154);\ - \n c155: change-color(black,$green:155);\ - \n c156: change-color(black,$green:156);\ - \n c157: change-color(black,$green:157);\ - \n c158: change-color(black,$green:158);\ - \n c159: change-color(black,$green:159);\ - \n c160: change-color(black,$green:160);\ - \n c161: change-color(black,$green:161);\ - \n c162: change-color(black,$green:162);\ - \n c163: change-color(black,$green:163);\ - \n c164: change-color(black,$green:164);\ - \n c165: change-color(black,$green:165);\ - \n c166: change-color(black,$green:166);\ - \n c167: change-color(black,$green:167);\ - \n c168: change-color(black,$green:168);\ - \n c169: change-color(black,$green:169);\ - \n c170: change-color(black,$green:170);\ - \n c171: change-color(black,$green:171);\ - \n c172: change-color(black,$green:172);\ - \n c173: change-color(black,$green:173);\ - \n c174: change-color(black,$green:174);\ - \n c175: change-color(black,$green:175);\ - \n c176: change-color(black,$green:176);\ - \n c177: change-color(black,$green:177);\ - \n c178: change-color(black,$green:178);\ - \n c179: change-color(black,$green:179);\ - \n c180: change-color(black,$green:180);\ - \n c181: change-color(black,$green:181);\ - \n c182: change-color(black,$green:182);\ - \n c183: change-color(black,$green:183);\ - \n c184: change-color(black,$green:184);\ - \n c185: change-color(black,$green:185);\ - \n c186: change-color(black,$green:186);\ - \n c187: change-color(black,$green:187);\ - \n c188: change-color(black,$green:188);\ - \n c189: change-color(black,$green:189);\ - \n c190: change-color(black,$green:190);\ - \n c191: change-color(black,$green:191);\ - \n c192: change-color(black,$green:192);\ - \n c193: change-color(black,$green:193);\ - \n c194: change-color(black,$green:194);\ - \n c195: change-color(black,$green:195);\ - \n c196: change-color(black,$green:196);\ - \n c197: change-color(black,$green:197);\ - \n c198: change-color(black,$green:198);\ - \n c199: change-color(black,$green:199);\ - \n c200: change-color(black,$green:200);\ - \n c201: change-color(black,$green:201);\ - \n c202: change-color(black,$green:202);\ - \n c203: change-color(black,$green:203);\ - \n c204: change-color(black,$green:204);\ - \n c205: change-color(black,$green:205);\ - \n c206: change-color(black,$green:206);\ - \n c207: change-color(black,$green:207);\ - \n c208: change-color(black,$green:208);\ - \n c209: change-color(black,$green:209);\ - \n c210: change-color(black,$green:210);\ - \n c211: change-color(black,$green:211);\ - \n c212: change-color(black,$green:212);\ - \n c213: change-color(black,$green:213);\ - \n c214: change-color(black,$green:214);\ - \n c215: change-color(black,$green:215);\ - \n c216: change-color(black,$green:216);\ - \n c217: change-color(black,$green:217);\ - \n c218: change-color(black,$green:218);\ - \n c219: change-color(black,$green:219);\ - \n c220: change-color(black,$green:220);\ - \n c221: change-color(black,$green:221);\ - \n c222: change-color(black,$green:222);\ - \n c223: change-color(black,$green:223);\ - \n c224: change-color(black,$green:224);\ - \n c225: change-color(black,$green:225);\ - \n c226: change-color(black,$green:226);\ - \n c227: change-color(black,$green:227);\ - \n c228: change-color(black,$green:228);\ - \n c229: change-color(black,$green:229);\ - \n c230: change-color(black,$green:230);\ - \n c231: change-color(black,$green:231);\ - \n c232: change-color(black,$green:232);\ - \n c233: change-color(black,$green:233);\ - \n c234: change-color(black,$green:234);\ - \n c235: change-color(black,$green:235);\ - \n c236: change-color(black,$green:236);\ - \n c237: change-color(black,$green:237);\ - \n c238: change-color(black,$green:238);\ - \n c239: change-color(black,$green:239);\ - \n c240: change-color(black,$green:240);\ - \n c241: change-color(black,$green:241);\ - \n c242: change-color(black,$green:242);\ - \n c243: change-color(black,$green:243);\ - \n c244: change-color(black,$green:244);\ - \n c245: change-color(black,$green:245);\ - \n c246: change-color(black,$green:246);\ - \n c247: change-color(black,$green:247);\ - \n c248: change-color(black,$green:248);\ - \n c249: change-color(black,$green:249);\ - \n c250: change-color(black,$green:250);\ - \n c251: change-color(black,$green:251);\ - \n c252: change-color(black,$green:252);\ - \n c253: change-color(black,$green:253);\ - \n c254: change-color(black,$green:254);\ - \n c255: change-color(black,$green:255);\ + \n c0: color.change(black,$green:0);\ + \n c1: color.change(black,$green:1);\ + \n c2: color.change(black,$green:2);\ + \n c3: color.change(black,$green:3);\ + \n c4: color.change(black,$green:4);\ + \n c5: color.change(black,$green:5);\ + \n c6: color.change(black,$green:6);\ + \n c7: color.change(black,$green:7);\ + \n c8: color.change(black,$green:8);\ + \n c9: color.change(black,$green:9);\ + \n c10: color.change(black,$green:10);\ + \n c11: color.change(black,$green:11);\ + \n c12: color.change(black,$green:12);\ + \n c13: color.change(black,$green:13);\ + \n c14: color.change(black,$green:14);\ + \n c15: color.change(black,$green:15);\ + \n c16: color.change(black,$green:16);\ + \n c17: color.change(black,$green:17);\ + \n c18: color.change(black,$green:18);\ + \n c19: color.change(black,$green:19);\ + \n c20: color.change(black,$green:20);\ + \n c21: color.change(black,$green:21);\ + \n c22: color.change(black,$green:22);\ + \n c23: color.change(black,$green:23);\ + \n c24: color.change(black,$green:24);\ + \n c25: color.change(black,$green:25);\ + \n c26: color.change(black,$green:26);\ + \n c27: color.change(black,$green:27);\ + \n c28: color.change(black,$green:28);\ + \n c29: color.change(black,$green:29);\ + \n c30: color.change(black,$green:30);\ + \n c31: color.change(black,$green:31);\ + \n c32: color.change(black,$green:32);\ + \n c33: color.change(black,$green:33);\ + \n c34: color.change(black,$green:34);\ + \n c35: color.change(black,$green:35);\ + \n c36: color.change(black,$green:36);\ + \n c37: color.change(black,$green:37);\ + \n c38: color.change(black,$green:38);\ + \n c39: color.change(black,$green:39);\ + \n c40: color.change(black,$green:40);\ + \n c41: color.change(black,$green:41);\ + \n c42: color.change(black,$green:42);\ + \n c43: color.change(black,$green:43);\ + \n c44: color.change(black,$green:44);\ + \n c45: color.change(black,$green:45);\ + \n c46: color.change(black,$green:46);\ + \n c47: color.change(black,$green:47);\ + \n c48: color.change(black,$green:48);\ + \n c49: color.change(black,$green:49);\ + \n c50: color.change(black,$green:50);\ + \n c51: color.change(black,$green:51);\ + \n c52: color.change(black,$green:52);\ + \n c53: color.change(black,$green:53);\ + \n c54: color.change(black,$green:54);\ + \n c55: color.change(black,$green:55);\ + \n c56: color.change(black,$green:56);\ + \n c57: color.change(black,$green:57);\ + \n c58: color.change(black,$green:58);\ + \n c59: color.change(black,$green:59);\ + \n c60: color.change(black,$green:60);\ + \n c61: color.change(black,$green:61);\ + \n c62: color.change(black,$green:62);\ + \n c63: color.change(black,$green:63);\ + \n c64: color.change(black,$green:64);\ + \n c65: color.change(black,$green:65);\ + \n c66: color.change(black,$green:66);\ + \n c67: color.change(black,$green:67);\ + \n c68: color.change(black,$green:68);\ + \n c69: color.change(black,$green:69);\ + \n c70: color.change(black,$green:70);\ + \n c71: color.change(black,$green:71);\ + \n c72: color.change(black,$green:72);\ + \n c73: color.change(black,$green:73);\ + \n c74: color.change(black,$green:74);\ + \n c75: color.change(black,$green:75);\ + \n c76: color.change(black,$green:76);\ + \n c77: color.change(black,$green:77);\ + \n c78: color.change(black,$green:78);\ + \n c79: color.change(black,$green:79);\ + \n c80: color.change(black,$green:80);\ + \n c81: color.change(black,$green:81);\ + \n c82: color.change(black,$green:82);\ + \n c83: color.change(black,$green:83);\ + \n c84: color.change(black,$green:84);\ + \n c85: color.change(black,$green:85);\ + \n c86: color.change(black,$green:86);\ + \n c87: color.change(black,$green:87);\ + \n c88: color.change(black,$green:88);\ + \n c89: color.change(black,$green:89);\ + \n c90: color.change(black,$green:90);\ + \n c91: color.change(black,$green:91);\ + \n c92: color.change(black,$green:92);\ + \n c93: color.change(black,$green:93);\ + \n c94: color.change(black,$green:94);\ + \n c95: color.change(black,$green:95);\ + \n c96: color.change(black,$green:96);\ + \n c97: color.change(black,$green:97);\ + \n c98: color.change(black,$green:98);\ + \n c99: color.change(black,$green:99);\ + \n c100: color.change(black,$green:100);\ + \n c101: color.change(black,$green:101);\ + \n c102: color.change(black,$green:102);\ + \n c103: color.change(black,$green:103);\ + \n c104: color.change(black,$green:104);\ + \n c105: color.change(black,$green:105);\ + \n c106: color.change(black,$green:106);\ + \n c107: color.change(black,$green:107);\ + \n c108: color.change(black,$green:108);\ + \n c109: color.change(black,$green:109);\ + \n c110: color.change(black,$green:110);\ + \n c111: color.change(black,$green:111);\ + \n c112: color.change(black,$green:112);\ + \n c113: color.change(black,$green:113);\ + \n c114: color.change(black,$green:114);\ + \n c115: color.change(black,$green:115);\ + \n c116: color.change(black,$green:116);\ + \n c117: color.change(black,$green:117);\ + \n c118: color.change(black,$green:118);\ + \n c119: color.change(black,$green:119);\ + \n c120: color.change(black,$green:120);\ + \n c121: color.change(black,$green:121);\ + \n c122: color.change(black,$green:122);\ + \n c123: color.change(black,$green:123);\ + \n c124: color.change(black,$green:124);\ + \n c125: color.change(black,$green:125);\ + \n c126: color.change(black,$green:126);\ + \n c127: color.change(black,$green:127);\ + \n c128: color.change(black,$green:128);\ + \n c129: color.change(black,$green:129);\ + \n c130: color.change(black,$green:130);\ + \n c131: color.change(black,$green:131);\ + \n c132: color.change(black,$green:132);\ + \n c133: color.change(black,$green:133);\ + \n c134: color.change(black,$green:134);\ + \n c135: color.change(black,$green:135);\ + \n c136: color.change(black,$green:136);\ + \n c137: color.change(black,$green:137);\ + \n c138: color.change(black,$green:138);\ + \n c139: color.change(black,$green:139);\ + \n c140: color.change(black,$green:140);\ + \n c141: color.change(black,$green:141);\ + \n c142: color.change(black,$green:142);\ + \n c143: color.change(black,$green:143);\ + \n c144: color.change(black,$green:144);\ + \n c145: color.change(black,$green:145);\ + \n c146: color.change(black,$green:146);\ + \n c147: color.change(black,$green:147);\ + \n c148: color.change(black,$green:148);\ + \n c149: color.change(black,$green:149);\ + \n c150: color.change(black,$green:150);\ + \n c151: color.change(black,$green:151);\ + \n c152: color.change(black,$green:152);\ + \n c153: color.change(black,$green:153);\ + \n c154: color.change(black,$green:154);\ + \n c155: color.change(black,$green:155);\ + \n c156: color.change(black,$green:156);\ + \n c157: color.change(black,$green:157);\ + \n c158: color.change(black,$green:158);\ + \n c159: color.change(black,$green:159);\ + \n c160: color.change(black,$green:160);\ + \n c161: color.change(black,$green:161);\ + \n c162: color.change(black,$green:162);\ + \n c163: color.change(black,$green:163);\ + \n c164: color.change(black,$green:164);\ + \n c165: color.change(black,$green:165);\ + \n c166: color.change(black,$green:166);\ + \n c167: color.change(black,$green:167);\ + \n c168: color.change(black,$green:168);\ + \n c169: color.change(black,$green:169);\ + \n c170: color.change(black,$green:170);\ + \n c171: color.change(black,$green:171);\ + \n c172: color.change(black,$green:172);\ + \n c173: color.change(black,$green:173);\ + \n c174: color.change(black,$green:174);\ + \n c175: color.change(black,$green:175);\ + \n c176: color.change(black,$green:176);\ + \n c177: color.change(black,$green:177);\ + \n c178: color.change(black,$green:178);\ + \n c179: color.change(black,$green:179);\ + \n c180: color.change(black,$green:180);\ + \n c181: color.change(black,$green:181);\ + \n c182: color.change(black,$green:182);\ + \n c183: color.change(black,$green:183);\ + \n c184: color.change(black,$green:184);\ + \n c185: color.change(black,$green:185);\ + \n c186: color.change(black,$green:186);\ + \n c187: color.change(black,$green:187);\ + \n c188: color.change(black,$green:188);\ + \n c189: color.change(black,$green:189);\ + \n c190: color.change(black,$green:190);\ + \n c191: color.change(black,$green:191);\ + \n c192: color.change(black,$green:192);\ + \n c193: color.change(black,$green:193);\ + \n c194: color.change(black,$green:194);\ + \n c195: color.change(black,$green:195);\ + \n c196: color.change(black,$green:196);\ + \n c197: color.change(black,$green:197);\ + \n c198: color.change(black,$green:198);\ + \n c199: color.change(black,$green:199);\ + \n c200: color.change(black,$green:200);\ + \n c201: color.change(black,$green:201);\ + \n c202: color.change(black,$green:202);\ + \n c203: color.change(black,$green:203);\ + \n c204: color.change(black,$green:204);\ + \n c205: color.change(black,$green:205);\ + \n c206: color.change(black,$green:206);\ + \n c207: color.change(black,$green:207);\ + \n c208: color.change(black,$green:208);\ + \n c209: color.change(black,$green:209);\ + \n c210: color.change(black,$green:210);\ + \n c211: color.change(black,$green:211);\ + \n c212: color.change(black,$green:212);\ + \n c213: color.change(black,$green:213);\ + \n c214: color.change(black,$green:214);\ + \n c215: color.change(black,$green:215);\ + \n c216: color.change(black,$green:216);\ + \n c217: color.change(black,$green:217);\ + \n c218: color.change(black,$green:218);\ + \n c219: color.change(black,$green:219);\ + \n c220: color.change(black,$green:220);\ + \n c221: color.change(black,$green:221);\ + \n c222: color.change(black,$green:222);\ + \n c223: color.change(black,$green:223);\ + \n c224: color.change(black,$green:224);\ + \n c225: color.change(black,$green:225);\ + \n c226: color.change(black,$green:226);\ + \n c227: color.change(black,$green:227);\ + \n c228: color.change(black,$green:228);\ + \n c229: color.change(black,$green:229);\ + \n c230: color.change(black,$green:230);\ + \n c231: color.change(black,$green:231);\ + \n c232: color.change(black,$green:232);\ + \n c233: color.change(black,$green:233);\ + \n c234: color.change(black,$green:234);\ + \n c235: color.change(black,$green:235);\ + \n c236: color.change(black,$green:236);\ + \n c237: color.change(black,$green:237);\ + \n c238: color.change(black,$green:238);\ + \n c239: color.change(black,$green:239);\ + \n c240: color.change(black,$green:240);\ + \n c241: color.change(black,$green:241);\ + \n c242: color.change(black,$green:242);\ + \n c243: color.change(black,$green:243);\ + \n c244: color.change(black,$green:244);\ + \n c245: color.change(black,$green:245);\ + \n c246: color.change(black,$green:246);\ + \n c247: color.change(black,$green:247);\ + \n c248: color.change(black,$green:248);\ + \n c249: color.change(black,$green:249);\ + \n c250: color.change(black,$green:250);\ + \n c251: color.change(black,$green:251);\ + \n c252: color.change(black,$green:252);\ + \n c253: color.change(black,$green:253);\ + \n c254: color.change(black,$green:254);\ + \n c255: color.change(black,$green:255);\ \n // c256: change-color(black,$green:256);\ \n}\n"), "foo {\ diff --git a/rsass/tests/spec/libsass/color_functions/other/change_color/h.rs b/rsass/tests/spec/libsass/color_functions/other/change_color/h.rs index f4e07c167..2557904a5 100644 --- a/rsass/tests/spec/libsass/color_functions/other/change_color/h.rs +++ b/rsass/tests/spec/libsass/color_functions/other/change_color/h.rs @@ -6,734 +6,736 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( - runner().ok("foo {\ - \n c-1: change-color(red,$hue:-1);\ - \n c0: change-color(red,$hue:0);\ - \n c1: change-color(red,$hue:1);\ - \n c2: change-color(red,$hue:2);\ - \n c3: change-color(red,$hue:3);\ - \n c4: change-color(red,$hue:4);\ - \n c5: change-color(red,$hue:5);\ - \n c6: change-color(red,$hue:6);\ - \n c7: change-color(red,$hue:7);\ - \n c8: change-color(red,$hue:8);\ - \n c9: change-color(red,$hue:9);\ - \n c10: change-color(red,$hue:10);\ - \n c11: change-color(red,$hue:11);\ - \n c12: change-color(red,$hue:12);\ - \n c13: change-color(red,$hue:13);\ - \n c14: change-color(red,$hue:14);\ - \n c15: change-color(red,$hue:15);\ - \n c16: change-color(red,$hue:16);\ - \n c17: change-color(red,$hue:17);\ - \n c18: change-color(red,$hue:18);\ - \n c19: change-color(red,$hue:19);\ - \n c20: change-color(red,$hue:20);\ - \n c21: change-color(red,$hue:21);\ - \n c22: change-color(red,$hue:22);\ - \n c23: change-color(red,$hue:23);\ - \n c24: change-color(red,$hue:24);\ - \n c25: change-color(red,$hue:25);\ - \n c26: change-color(red,$hue:26);\ - \n c27: change-color(red,$hue:27);\ - \n c28: change-color(red,$hue:28);\ - \n c29: change-color(red,$hue:29);\ - \n c30: change-color(red,$hue:30);\ - \n c31: change-color(red,$hue:31);\ - \n c32: change-color(red,$hue:32);\ - \n c33: change-color(red,$hue:33);\ - \n c34: change-color(red,$hue:34);\ - \n c35: change-color(red,$hue:35);\ - \n c36: change-color(red,$hue:36);\ - \n c37: change-color(red,$hue:37);\ - \n c38: change-color(red,$hue:38);\ - \n c39: change-color(red,$hue:39);\ - \n c40: change-color(red,$hue:40);\ - \n c41: change-color(red,$hue:41);\ - \n c42: change-color(red,$hue:42);\ - \n c43: change-color(red,$hue:43);\ - \n c44: change-color(red,$hue:44);\ - \n c45: change-color(red,$hue:45);\ - \n c46: change-color(red,$hue:46);\ - \n c47: change-color(red,$hue:47);\ - \n c48: change-color(red,$hue:48);\ - \n c49: change-color(red,$hue:49);\ - \n c50: change-color(red,$hue:50);\ - \n c51: change-color(red,$hue:51);\ - \n c52: change-color(red,$hue:52);\ - \n c53: change-color(red,$hue:53);\ - \n c54: change-color(red,$hue:54);\ - \n c55: change-color(red,$hue:55);\ - \n c56: change-color(red,$hue:56);\ - \n c57: change-color(red,$hue:57);\ - \n c58: change-color(red,$hue:58);\ - \n c59: change-color(red,$hue:59);\ - \n c60: change-color(red,$hue:60);\ - \n c61: change-color(red,$hue:61);\ - \n c62: change-color(red,$hue:62);\ - \n c63: change-color(red,$hue:63);\ - \n c64: change-color(red,$hue:64);\ - \n c65: change-color(red,$hue:65);\ - \n c66: change-color(red,$hue:66);\ - \n c67: change-color(red,$hue:67);\ - \n c68: change-color(red,$hue:68);\ - \n c69: change-color(red,$hue:69);\ - \n c70: change-color(red,$hue:70);\ - \n c71: change-color(red,$hue:71);\ - \n c72: change-color(red,$hue:72);\ - \n c73: change-color(red,$hue:73);\ - \n c74: change-color(red,$hue:74);\ - \n c75: change-color(red,$hue:75);\ - \n c76: change-color(red,$hue:76);\ - \n c77: change-color(red,$hue:77);\ - \n c78: change-color(red,$hue:78);\ - \n c79: change-color(red,$hue:79);\ - \n c80: change-color(red,$hue:80);\ - \n c81: change-color(red,$hue:81);\ - \n c82: change-color(red,$hue:82);\ - \n c83: change-color(red,$hue:83);\ - \n c84: change-color(red,$hue:84);\ - \n c85: change-color(red,$hue:85);\ - \n c86: change-color(red,$hue:86);\ - \n c87: change-color(red,$hue:87);\ - \n c88: change-color(red,$hue:88);\ - \n c89: change-color(red,$hue:89);\ - \n c90: change-color(red,$hue:90);\ - \n c91: change-color(red,$hue:91);\ - \n c92: change-color(red,$hue:92);\ - \n c93: change-color(red,$hue:93);\ - \n c94: change-color(red,$hue:94);\ - \n c95: change-color(red,$hue:95);\ - \n c96: change-color(red,$hue:96);\ - \n c97: change-color(red,$hue:97);\ - \n c98: change-color(red,$hue:98);\ - \n c99: change-color(red,$hue:99);\ - \n c100: change-color(red,$hue:100);\ - \n c101: change-color(red,$hue:101);\ - \n c102: change-color(red,$hue:102);\ - \n c103: change-color(red,$hue:103);\ - \n c104: change-color(red,$hue:104);\ - \n c105: change-color(red,$hue:105);\ - \n c106: change-color(red,$hue:106);\ - \n c107: change-color(red,$hue:107);\ - \n c108: change-color(red,$hue:108);\ - \n c109: change-color(red,$hue:109);\ - \n c110: change-color(red,$hue:110);\ - \n c111: change-color(red,$hue:111);\ - \n c112: change-color(red,$hue:112);\ - \n c113: change-color(red,$hue:113);\ - \n c114: change-color(red,$hue:114);\ - \n c115: change-color(red,$hue:115);\ - \n c116: change-color(red,$hue:116);\ - \n c117: change-color(red,$hue:117);\ - \n c118: change-color(red,$hue:118);\ - \n c119: change-color(red,$hue:119);\ - \n c120: change-color(red,$hue:120);\ - \n c121: change-color(red,$hue:121);\ - \n c122: change-color(red,$hue:122);\ - \n c123: change-color(red,$hue:123);\ - \n c124: change-color(red,$hue:124);\ - \n c125: change-color(red,$hue:125);\ - \n c126: change-color(red,$hue:126);\ - \n c127: change-color(red,$hue:127);\ - \n c128: change-color(red,$hue:128);\ - \n c129: change-color(red,$hue:129);\ - \n c130: change-color(red,$hue:130);\ - \n c131: change-color(red,$hue:131);\ - \n c132: change-color(red,$hue:132);\ - \n c133: change-color(red,$hue:133);\ - \n c134: change-color(red,$hue:134);\ - \n c135: change-color(red,$hue:135);\ - \n c136: change-color(red,$hue:136);\ - \n c137: change-color(red,$hue:137);\ - \n c138: change-color(red,$hue:138);\ - \n c139: change-color(red,$hue:139);\ - \n c140: change-color(red,$hue:140);\ - \n c141: change-color(red,$hue:141);\ - \n c142: change-color(red,$hue:142);\ - \n c143: change-color(red,$hue:143);\ - \n c144: change-color(red,$hue:144);\ - \n c145: change-color(red,$hue:145);\ - \n c146: change-color(red,$hue:146);\ - \n c147: change-color(red,$hue:147);\ - \n c148: change-color(red,$hue:148);\ - \n c149: change-color(red,$hue:149);\ - \n c150: change-color(red,$hue:150);\ - \n c151: change-color(red,$hue:151);\ - \n c152: change-color(red,$hue:152);\ - \n c153: change-color(red,$hue:153);\ - \n c154: change-color(red,$hue:154);\ - \n c155: change-color(red,$hue:155);\ - \n c156: change-color(red,$hue:156);\ - \n c157: change-color(red,$hue:157);\ - \n c158: change-color(red,$hue:158);\ - \n c159: change-color(red,$hue:159);\ - \n c160: change-color(red,$hue:160);\ - \n c161: change-color(red,$hue:161);\ - \n c162: change-color(red,$hue:162);\ - \n c163: change-color(red,$hue:163);\ - \n c164: change-color(red,$hue:164);\ - \n c165: change-color(red,$hue:165);\ - \n c166: change-color(red,$hue:166);\ - \n c167: change-color(red,$hue:167);\ - \n c168: change-color(red,$hue:168);\ - \n c169: change-color(red,$hue:169);\ - \n c170: change-color(red,$hue:170);\ - \n c171: change-color(red,$hue:171);\ - \n c172: change-color(red,$hue:172);\ - \n c173: change-color(red,$hue:173);\ - \n c174: change-color(red,$hue:174);\ - \n c175: change-color(red,$hue:175);\ - \n c176: change-color(red,$hue:176);\ - \n c177: change-color(red,$hue:177);\ - \n c178: change-color(red,$hue:178);\ - \n c179: change-color(red,$hue:179);\ - \n c180: change-color(red,$hue:180);\ - \n c181: change-color(red,$hue:181);\ - \n c182: change-color(red,$hue:182);\ - \n c183: change-color(red,$hue:183);\ - \n c184: change-color(red,$hue:184);\ - \n c185: change-color(red,$hue:185);\ - \n c186: change-color(red,$hue:186);\ - \n c187: change-color(red,$hue:187);\ - \n c188: change-color(red,$hue:188);\ - \n c189: change-color(red,$hue:189);\ - \n c190: change-color(red,$hue:190);\ - \n c191: change-color(red,$hue:191);\ - \n c192: change-color(red,$hue:192);\ - \n c193: change-color(red,$hue:193);\ - \n c194: change-color(red,$hue:194);\ - \n c195: change-color(red,$hue:195);\ - \n c196: change-color(red,$hue:196);\ - \n c197: change-color(red,$hue:197);\ - \n c198: change-color(red,$hue:198);\ - \n c199: change-color(red,$hue:199);\ - \n c200: change-color(red,$hue:200);\ - \n c201: change-color(red,$hue:201);\ - \n c202: change-color(red,$hue:202);\ - \n c203: change-color(red,$hue:203);\ - \n c204: change-color(red,$hue:204);\ - \n c205: change-color(red,$hue:205);\ - \n c206: change-color(red,$hue:206);\ - \n c207: change-color(red,$hue:207);\ - \n c208: change-color(red,$hue:208);\ - \n c209: change-color(red,$hue:209);\ - \n c210: change-color(red,$hue:210);\ - \n c211: change-color(red,$hue:211);\ - \n c212: change-color(red,$hue:212);\ - \n c213: change-color(red,$hue:213);\ - \n c214: change-color(red,$hue:214);\ - \n c215: change-color(red,$hue:215);\ - \n c216: change-color(red,$hue:216);\ - \n c217: change-color(red,$hue:217);\ - \n c218: change-color(red,$hue:218);\ - \n c219: change-color(red,$hue:219);\ - \n c220: change-color(red,$hue:220);\ - \n c221: change-color(red,$hue:221);\ - \n c222: change-color(red,$hue:222);\ - \n c223: change-color(red,$hue:223);\ - \n c224: change-color(red,$hue:224);\ - \n c225: change-color(red,$hue:225);\ - \n c226: change-color(red,$hue:226);\ - \n c227: change-color(red,$hue:227);\ - \n c228: change-color(red,$hue:228);\ - \n c229: change-color(red,$hue:229);\ - \n c230: change-color(red,$hue:230);\ - \n c231: change-color(red,$hue:231);\ - \n c232: change-color(red,$hue:232);\ - \n c233: change-color(red,$hue:233);\ - \n c234: change-color(red,$hue:234);\ - \n c235: change-color(red,$hue:235);\ - \n c236: change-color(red,$hue:236);\ - \n c237: change-color(red,$hue:237);\ - \n c238: change-color(red,$hue:238);\ - \n c239: change-color(red,$hue:239);\ - \n c240: change-color(red,$hue:240);\ - \n c241: change-color(red,$hue:241);\ - \n c242: change-color(red,$hue:242);\ - \n c243: change-color(red,$hue:243);\ - \n c244: change-color(red,$hue:244);\ - \n c245: change-color(red,$hue:245);\ - \n c246: change-color(red,$hue:246);\ - \n c247: change-color(red,$hue:247);\ - \n c248: change-color(red,$hue:248);\ - \n c249: change-color(red,$hue:249);\ - \n c250: change-color(red,$hue:250);\ - \n c251: change-color(red,$hue:251);\ - \n c252: change-color(red,$hue:252);\ - \n c253: change-color(red,$hue:253);\ - \n c254: change-color(red,$hue:254);\ - \n c255: change-color(red,$hue:255);\ - \n c256: change-color(red,$hue:256);\ - \n c257: change-color(red,$hue:257);\ - \n c258: change-color(red,$hue:258);\ - \n c259: change-color(red,$hue:259);\ - \n c260: change-color(red,$hue:260);\ - \n c261: change-color(red,$hue:261);\ - \n c262: change-color(red,$hue:262);\ - \n c263: change-color(red,$hue:263);\ - \n c264: change-color(red,$hue:264);\ - \n c265: change-color(red,$hue:265);\ - \n c266: change-color(red,$hue:266);\ - \n c267: change-color(red,$hue:267);\ - \n c268: change-color(red,$hue:268);\ - \n c269: change-color(red,$hue:269);\ - \n c270: change-color(red,$hue:270);\ - \n c271: change-color(red,$hue:271);\ - \n c272: change-color(red,$hue:272);\ - \n c273: change-color(red,$hue:273);\ - \n c274: change-color(red,$hue:274);\ - \n c275: change-color(red,$hue:275);\ - \n c276: change-color(red,$hue:276);\ - \n c277: change-color(red,$hue:277);\ - \n c278: change-color(red,$hue:278);\ - \n c279: change-color(red,$hue:279);\ - \n c280: change-color(red,$hue:280);\ - \n c281: change-color(red,$hue:281);\ - \n c282: change-color(red,$hue:282);\ - \n c283: change-color(red,$hue:283);\ - \n c284: change-color(red,$hue:284);\ - \n c285: change-color(red,$hue:285);\ - \n c286: change-color(red,$hue:286);\ - \n c287: change-color(red,$hue:287);\ - \n c288: change-color(red,$hue:288);\ - \n c289: change-color(red,$hue:289);\ - \n c290: change-color(red,$hue:290);\ - \n c291: change-color(red,$hue:291);\ - \n c292: change-color(red,$hue:292);\ - \n c293: change-color(red,$hue:293);\ - \n c294: change-color(red,$hue:294);\ - \n c295: change-color(red,$hue:295);\ - \n c296: change-color(red,$hue:296);\ - \n c297: change-color(red,$hue:297);\ - \n c298: change-color(red,$hue:298);\ - \n c299: change-color(red,$hue:299);\ - \n c300: change-color(red,$hue:300);\ - \n c301: change-color(red,$hue:301);\ - \n c302: change-color(red,$hue:302);\ - \n c303: change-color(red,$hue:303);\ - \n c304: change-color(red,$hue:304);\ - \n c305: change-color(red,$hue:305);\ - \n c306: change-color(red,$hue:306);\ - \n c307: change-color(red,$hue:307);\ - \n c308: change-color(red,$hue:308);\ - \n c309: change-color(red,$hue:309);\ - \n c310: change-color(red,$hue:310);\ - \n c311: change-color(red,$hue:311);\ - \n c312: change-color(red,$hue:312);\ - \n c313: change-color(red,$hue:313);\ - \n c314: change-color(red,$hue:314);\ - \n c315: change-color(red,$hue:315);\ - \n c316: change-color(red,$hue:316);\ - \n c317: change-color(red,$hue:317);\ - \n c318: change-color(red,$hue:318);\ - \n c319: change-color(red,$hue:319);\ - \n c320: change-color(red,$hue:320);\ - \n c321: change-color(red,$hue:321);\ - \n c322: change-color(red,$hue:322);\ - \n c323: change-color(red,$hue:323);\ - \n c324: change-color(red,$hue:324);\ - \n c325: change-color(red,$hue:325);\ - \n c326: change-color(red,$hue:326);\ - \n c327: change-color(red,$hue:327);\ - \n c328: change-color(red,$hue:328);\ - \n c329: change-color(red,$hue:329);\ - \n c330: change-color(red,$hue:330);\ - \n c331: change-color(red,$hue:331);\ - \n c332: change-color(red,$hue:332);\ - \n c333: change-color(red,$hue:333);\ - \n c334: change-color(red,$hue:334);\ - \n c335: change-color(red,$hue:335);\ - \n c336: change-color(red,$hue:336);\ - \n c337: change-color(red,$hue:337);\ - \n c338: change-color(red,$hue:338);\ - \n c339: change-color(red,$hue:339);\ - \n c340: change-color(red,$hue:340);\ - \n c341: change-color(red,$hue:341);\ - \n c342: change-color(red,$hue:342);\ - \n c343: change-color(red,$hue:343);\ - \n c344: change-color(red,$hue:344);\ - \n c345: change-color(red,$hue:345);\ - \n c346: change-color(red,$hue:346);\ - \n c347: change-color(red,$hue:347);\ - \n c348: change-color(red,$hue:348);\ - \n c349: change-color(red,$hue:349);\ - \n c350: change-color(red,$hue:350);\ - \n c351: change-color(red,$hue:351);\ - \n c352: change-color(red,$hue:352);\ - \n c353: change-color(red,$hue:353);\ - \n c354: change-color(red,$hue:354);\ - \n c355: change-color(red,$hue:355);\ - \n c356: change-color(red,$hue:356);\ - \n c357: change-color(red,$hue:357);\ - \n c358: change-color(red,$hue:358);\ - \n c359: change-color(red,$hue:359);\ - \n c360: change-color(red,$hue:360);\ + runner().ok("@use \"sass:color\";\ + \nfoo {\ + \n c-1: color.change(red,$hue:-1);\ + \n c0: color.change(red,$hue:0);\ + \n c1: color.change(red,$hue:1);\ + \n c2: color.change(red,$hue:2);\ + \n c3: color.change(red,$hue:3);\ + \n c4: color.change(red,$hue:4);\ + \n c5: color.change(red,$hue:5);\ + \n c6: color.change(red,$hue:6);\ + \n c7: color.change(red,$hue:7);\ + \n c8: color.change(red,$hue:8);\ + \n c9: color.change(red,$hue:9);\ + \n c10: color.change(red,$hue:10);\ + \n c11: color.change(red,$hue:11);\ + \n c12: color.change(red,$hue:12);\ + \n c13: color.change(red,$hue:13);\ + \n c14: color.change(red,$hue:14);\ + \n c15: color.change(red,$hue:15);\ + \n c16: color.change(red,$hue:16);\ + \n c17: color.change(red,$hue:17);\ + \n c18: color.change(red,$hue:18);\ + \n c19: color.change(red,$hue:19);\ + \n c20: color.change(red,$hue:20);\ + \n c21: color.change(red,$hue:21);\ + \n c22: color.change(red,$hue:22);\ + \n c23: color.change(red,$hue:23);\ + \n c24: color.change(red,$hue:24);\ + \n c25: color.change(red,$hue:25);\ + \n c26: color.change(red,$hue:26);\ + \n c27: color.change(red,$hue:27);\ + \n c28: color.change(red,$hue:28);\ + \n c29: color.change(red,$hue:29);\ + \n c30: color.change(red,$hue:30);\ + \n c31: color.change(red,$hue:31);\ + \n c32: color.change(red,$hue:32);\ + \n c33: color.change(red,$hue:33);\ + \n c34: color.change(red,$hue:34);\ + \n c35: color.change(red,$hue:35);\ + \n c36: color.change(red,$hue:36);\ + \n c37: color.change(red,$hue:37);\ + \n c38: color.change(red,$hue:38);\ + \n c39: color.change(red,$hue:39);\ + \n c40: color.change(red,$hue:40);\ + \n c41: color.change(red,$hue:41);\ + \n c42: color.change(red,$hue:42);\ + \n c43: color.change(red,$hue:43);\ + \n c44: color.change(red,$hue:44);\ + \n c45: color.change(red,$hue:45);\ + \n c46: color.change(red,$hue:46);\ + \n c47: color.change(red,$hue:47);\ + \n c48: color.change(red,$hue:48);\ + \n c49: color.change(red,$hue:49);\ + \n c50: color.change(red,$hue:50);\ + \n c51: color.change(red,$hue:51);\ + \n c52: color.change(red,$hue:52);\ + \n c53: color.change(red,$hue:53);\ + \n c54: color.change(red,$hue:54);\ + \n c55: color.change(red,$hue:55);\ + \n c56: color.change(red,$hue:56);\ + \n c57: color.change(red,$hue:57);\ + \n c58: color.change(red,$hue:58);\ + \n c59: color.change(red,$hue:59);\ + \n c60: color.change(red,$hue:60);\ + \n c61: color.change(red,$hue:61);\ + \n c62: color.change(red,$hue:62);\ + \n c63: color.change(red,$hue:63);\ + \n c64: color.change(red,$hue:64);\ + \n c65: color.change(red,$hue:65);\ + \n c66: color.change(red,$hue:66);\ + \n c67: color.change(red,$hue:67);\ + \n c68: color.change(red,$hue:68);\ + \n c69: color.change(red,$hue:69);\ + \n c70: color.change(red,$hue:70);\ + \n c71: color.change(red,$hue:71);\ + \n c72: color.change(red,$hue:72);\ + \n c73: color.change(red,$hue:73);\ + \n c74: color.change(red,$hue:74);\ + \n c75: color.change(red,$hue:75);\ + \n c76: color.change(red,$hue:76);\ + \n c77: color.change(red,$hue:77);\ + \n c78: color.change(red,$hue:78);\ + \n c79: color.change(red,$hue:79);\ + \n c80: color.change(red,$hue:80);\ + \n c81: color.change(red,$hue:81);\ + \n c82: color.change(red,$hue:82);\ + \n c83: color.change(red,$hue:83);\ + \n c84: color.change(red,$hue:84);\ + \n c85: color.change(red,$hue:85);\ + \n c86: color.change(red,$hue:86);\ + \n c87: color.change(red,$hue:87);\ + \n c88: color.change(red,$hue:88);\ + \n c89: color.change(red,$hue:89);\ + \n c90: color.change(red,$hue:90);\ + \n c91: color.change(red,$hue:91);\ + \n c92: color.change(red,$hue:92);\ + \n c93: color.change(red,$hue:93);\ + \n c94: color.change(red,$hue:94);\ + \n c95: color.change(red,$hue:95);\ + \n c96: color.change(red,$hue:96);\ + \n c97: color.change(red,$hue:97);\ + \n c98: color.change(red,$hue:98);\ + \n c99: color.change(red,$hue:99);\ + \n c100: color.change(red,$hue:100);\ + \n c101: color.change(red,$hue:101);\ + \n c102: color.change(red,$hue:102);\ + \n c103: color.change(red,$hue:103);\ + \n c104: color.change(red,$hue:104);\ + \n c105: color.change(red,$hue:105);\ + \n c106: color.change(red,$hue:106);\ + \n c107: color.change(red,$hue:107);\ + \n c108: color.change(red,$hue:108);\ + \n c109: color.change(red,$hue:109);\ + \n c110: color.change(red,$hue:110);\ + \n c111: color.change(red,$hue:111);\ + \n c112: color.change(red,$hue:112);\ + \n c113: color.change(red,$hue:113);\ + \n c114: color.change(red,$hue:114);\ + \n c115: color.change(red,$hue:115);\ + \n c116: color.change(red,$hue:116);\ + \n c117: color.change(red,$hue:117);\ + \n c118: color.change(red,$hue:118);\ + \n c119: color.change(red,$hue:119);\ + \n c120: color.change(red,$hue:120);\ + \n c121: color.change(red,$hue:121);\ + \n c122: color.change(red,$hue:122);\ + \n c123: color.change(red,$hue:123);\ + \n c124: color.change(red,$hue:124);\ + \n c125: color.change(red,$hue:125);\ + \n c126: color.change(red,$hue:126);\ + \n c127: color.change(red,$hue:127);\ + \n c128: color.change(red,$hue:128);\ + \n c129: color.change(red,$hue:129);\ + \n c130: color.change(red,$hue:130);\ + \n c131: color.change(red,$hue:131);\ + \n c132: color.change(red,$hue:132);\ + \n c133: color.change(red,$hue:133);\ + \n c134: color.change(red,$hue:134);\ + \n c135: color.change(red,$hue:135);\ + \n c136: color.change(red,$hue:136);\ + \n c137: color.change(red,$hue:137);\ + \n c138: color.change(red,$hue:138);\ + \n c139: color.change(red,$hue:139);\ + \n c140: color.change(red,$hue:140);\ + \n c141: color.change(red,$hue:141);\ + \n c142: color.change(red,$hue:142);\ + \n c143: color.change(red,$hue:143);\ + \n c144: color.change(red,$hue:144);\ + \n c145: color.change(red,$hue:145);\ + \n c146: color.change(red,$hue:146);\ + \n c147: color.change(red,$hue:147);\ + \n c148: color.change(red,$hue:148);\ + \n c149: color.change(red,$hue:149);\ + \n c150: color.change(red,$hue:150);\ + \n c151: color.change(red,$hue:151);\ + \n c152: color.change(red,$hue:152);\ + \n c153: color.change(red,$hue:153);\ + \n c154: color.change(red,$hue:154);\ + \n c155: color.change(red,$hue:155);\ + \n c156: color.change(red,$hue:156);\ + \n c157: color.change(red,$hue:157);\ + \n c158: color.change(red,$hue:158);\ + \n c159: color.change(red,$hue:159);\ + \n c160: color.change(red,$hue:160);\ + \n c161: color.change(red,$hue:161);\ + \n c162: color.change(red,$hue:162);\ + \n c163: color.change(red,$hue:163);\ + \n c164: color.change(red,$hue:164);\ + \n c165: color.change(red,$hue:165);\ + \n c166: color.change(red,$hue:166);\ + \n c167: color.change(red,$hue:167);\ + \n c168: color.change(red,$hue:168);\ + \n c169: color.change(red,$hue:169);\ + \n c170: color.change(red,$hue:170);\ + \n c171: color.change(red,$hue:171);\ + \n c172: color.change(red,$hue:172);\ + \n c173: color.change(red,$hue:173);\ + \n c174: color.change(red,$hue:174);\ + \n c175: color.change(red,$hue:175);\ + \n c176: color.change(red,$hue:176);\ + \n c177: color.change(red,$hue:177);\ + \n c178: color.change(red,$hue:178);\ + \n c179: color.change(red,$hue:179);\ + \n c180: color.change(red,$hue:180);\ + \n c181: color.change(red,$hue:181);\ + \n c182: color.change(red,$hue:182);\ + \n c183: color.change(red,$hue:183);\ + \n c184: color.change(red,$hue:184);\ + \n c185: color.change(red,$hue:185);\ + \n c186: color.change(red,$hue:186);\ + \n c187: color.change(red,$hue:187);\ + \n c188: color.change(red,$hue:188);\ + \n c189: color.change(red,$hue:189);\ + \n c190: color.change(red,$hue:190);\ + \n c191: color.change(red,$hue:191);\ + \n c192: color.change(red,$hue:192);\ + \n c193: color.change(red,$hue:193);\ + \n c194: color.change(red,$hue:194);\ + \n c195: color.change(red,$hue:195);\ + \n c196: color.change(red,$hue:196);\ + \n c197: color.change(red,$hue:197);\ + \n c198: color.change(red,$hue:198);\ + \n c199: color.change(red,$hue:199);\ + \n c200: color.change(red,$hue:200);\ + \n c201: color.change(red,$hue:201);\ + \n c202: color.change(red,$hue:202);\ + \n c203: color.change(red,$hue:203);\ + \n c204: color.change(red,$hue:204);\ + \n c205: color.change(red,$hue:205);\ + \n c206: color.change(red,$hue:206);\ + \n c207: color.change(red,$hue:207);\ + \n c208: color.change(red,$hue:208);\ + \n c209: color.change(red,$hue:209);\ + \n c210: color.change(red,$hue:210);\ + \n c211: color.change(red,$hue:211);\ + \n c212: color.change(red,$hue:212);\ + \n c213: color.change(red,$hue:213);\ + \n c214: color.change(red,$hue:214);\ + \n c215: color.change(red,$hue:215);\ + \n c216: color.change(red,$hue:216);\ + \n c217: color.change(red,$hue:217);\ + \n c218: color.change(red,$hue:218);\ + \n c219: color.change(red,$hue:219);\ + \n c220: color.change(red,$hue:220);\ + \n c221: color.change(red,$hue:221);\ + \n c222: color.change(red,$hue:222);\ + \n c223: color.change(red,$hue:223);\ + \n c224: color.change(red,$hue:224);\ + \n c225: color.change(red,$hue:225);\ + \n c226: color.change(red,$hue:226);\ + \n c227: color.change(red,$hue:227);\ + \n c228: color.change(red,$hue:228);\ + \n c229: color.change(red,$hue:229);\ + \n c230: color.change(red,$hue:230);\ + \n c231: color.change(red,$hue:231);\ + \n c232: color.change(red,$hue:232);\ + \n c233: color.change(red,$hue:233);\ + \n c234: color.change(red,$hue:234);\ + \n c235: color.change(red,$hue:235);\ + \n c236: color.change(red,$hue:236);\ + \n c237: color.change(red,$hue:237);\ + \n c238: color.change(red,$hue:238);\ + \n c239: color.change(red,$hue:239);\ + \n c240: color.change(red,$hue:240);\ + \n c241: color.change(red,$hue:241);\ + \n c242: color.change(red,$hue:242);\ + \n c243: color.change(red,$hue:243);\ + \n c244: color.change(red,$hue:244);\ + \n c245: color.change(red,$hue:245);\ + \n c246: color.change(red,$hue:246);\ + \n c247: color.change(red,$hue:247);\ + \n c248: color.change(red,$hue:248);\ + \n c249: color.change(red,$hue:249);\ + \n c250: color.change(red,$hue:250);\ + \n c251: color.change(red,$hue:251);\ + \n c252: color.change(red,$hue:252);\ + \n c253: color.change(red,$hue:253);\ + \n c254: color.change(red,$hue:254);\ + \n c255: color.change(red,$hue:255);\ + \n c256: color.change(red,$hue:256);\ + \n c257: color.change(red,$hue:257);\ + \n c258: color.change(red,$hue:258);\ + \n c259: color.change(red,$hue:259);\ + \n c260: color.change(red,$hue:260);\ + \n c261: color.change(red,$hue:261);\ + \n c262: color.change(red,$hue:262);\ + \n c263: color.change(red,$hue:263);\ + \n c264: color.change(red,$hue:264);\ + \n c265: color.change(red,$hue:265);\ + \n c266: color.change(red,$hue:266);\ + \n c267: color.change(red,$hue:267);\ + \n c268: color.change(red,$hue:268);\ + \n c269: color.change(red,$hue:269);\ + \n c270: color.change(red,$hue:270);\ + \n c271: color.change(red,$hue:271);\ + \n c272: color.change(red,$hue:272);\ + \n c273: color.change(red,$hue:273);\ + \n c274: color.change(red,$hue:274);\ + \n c275: color.change(red,$hue:275);\ + \n c276: color.change(red,$hue:276);\ + \n c277: color.change(red,$hue:277);\ + \n c278: color.change(red,$hue:278);\ + \n c279: color.change(red,$hue:279);\ + \n c280: color.change(red,$hue:280);\ + \n c281: color.change(red,$hue:281);\ + \n c282: color.change(red,$hue:282);\ + \n c283: color.change(red,$hue:283);\ + \n c284: color.change(red,$hue:284);\ + \n c285: color.change(red,$hue:285);\ + \n c286: color.change(red,$hue:286);\ + \n c287: color.change(red,$hue:287);\ + \n c288: color.change(red,$hue:288);\ + \n c289: color.change(red,$hue:289);\ + \n c290: color.change(red,$hue:290);\ + \n c291: color.change(red,$hue:291);\ + \n c292: color.change(red,$hue:292);\ + \n c293: color.change(red,$hue:293);\ + \n c294: color.change(red,$hue:294);\ + \n c295: color.change(red,$hue:295);\ + \n c296: color.change(red,$hue:296);\ + \n c297: color.change(red,$hue:297);\ + \n c298: color.change(red,$hue:298);\ + \n c299: color.change(red,$hue:299);\ + \n c300: color.change(red,$hue:300);\ + \n c301: color.change(red,$hue:301);\ + \n c302: color.change(red,$hue:302);\ + \n c303: color.change(red,$hue:303);\ + \n c304: color.change(red,$hue:304);\ + \n c305: color.change(red,$hue:305);\ + \n c306: color.change(red,$hue:306);\ + \n c307: color.change(red,$hue:307);\ + \n c308: color.change(red,$hue:308);\ + \n c309: color.change(red,$hue:309);\ + \n c310: color.change(red,$hue:310);\ + \n c311: color.change(red,$hue:311);\ + \n c312: color.change(red,$hue:312);\ + \n c313: color.change(red,$hue:313);\ + \n c314: color.change(red,$hue:314);\ + \n c315: color.change(red,$hue:315);\ + \n c316: color.change(red,$hue:316);\ + \n c317: color.change(red,$hue:317);\ + \n c318: color.change(red,$hue:318);\ + \n c319: color.change(red,$hue:319);\ + \n c320: color.change(red,$hue:320);\ + \n c321: color.change(red,$hue:321);\ + \n c322: color.change(red,$hue:322);\ + \n c323: color.change(red,$hue:323);\ + \n c324: color.change(red,$hue:324);\ + \n c325: color.change(red,$hue:325);\ + \n c326: color.change(red,$hue:326);\ + \n c327: color.change(red,$hue:327);\ + \n c328: color.change(red,$hue:328);\ + \n c329: color.change(red,$hue:329);\ + \n c330: color.change(red,$hue:330);\ + \n c331: color.change(red,$hue:331);\ + \n c332: color.change(red,$hue:332);\ + \n c333: color.change(red,$hue:333);\ + \n c334: color.change(red,$hue:334);\ + \n c335: color.change(red,$hue:335);\ + \n c336: color.change(red,$hue:336);\ + \n c337: color.change(red,$hue:337);\ + \n c338: color.change(red,$hue:338);\ + \n c339: color.change(red,$hue:339);\ + \n c340: color.change(red,$hue:340);\ + \n c341: color.change(red,$hue:341);\ + \n c342: color.change(red,$hue:342);\ + \n c343: color.change(red,$hue:343);\ + \n c344: color.change(red,$hue:344);\ + \n c345: color.change(red,$hue:345);\ + \n c346: color.change(red,$hue:346);\ + \n c347: color.change(red,$hue:347);\ + \n c348: color.change(red,$hue:348);\ + \n c349: color.change(red,$hue:349);\ + \n c350: color.change(red,$hue:350);\ + \n c351: color.change(red,$hue:351);\ + \n c352: color.change(red,$hue:352);\ + \n c353: color.change(red,$hue:353);\ + \n c354: color.change(red,$hue:354);\ + \n c355: color.change(red,$hue:355);\ + \n c356: color.change(red,$hue:356);\ + \n c357: color.change(red,$hue:357);\ + \n c358: color.change(red,$hue:358);\ + \n c359: color.change(red,$hue:359);\ + \n c360: color.change(red,$hue:360);\ \n}\n"), "foo {\ - \n c-1: #ff0004;\ + \n c-1: rgb(255, 0, 4.25);\ \n c0: red;\ - \n c1: #ff0400;\ - \n c2: #ff0900;\ - \n c3: #ff0d00;\ + \n c1: rgb(255, 4.25, 0);\ + \n c2: rgb(255, 8.5, 0);\ + \n c3: rgb(255, 12.75, 0);\ \n c4: #ff1100;\ - \n c5: #ff1500;\ - \n c6: #ff1a00;\ - \n c7: #ff1e00;\ + \n c5: rgb(255, 21.25, 0);\ + \n c6: rgb(255, 25.5, 0);\ + \n c7: rgb(255, 29.75, 0);\ \n c8: #ff2200;\ - \n c9: #ff2600;\ - \n c10: #ff2b00;\ - \n c11: #ff2f00;\ + \n c9: rgb(255, 38.25, 0);\ + \n c10: rgb(255, 42.5, 0);\ + \n c11: rgb(255, 46.75, 0);\ \n c12: #ff3300;\ - \n c13: #ff3700;\ - \n c14: #ff3c00;\ - \n c15: #ff4000;\ + \n c13: rgb(255, 55.25, 0);\ + \n c14: rgb(255, 59.5, 0);\ + \n c15: rgb(255, 63.75, 0);\ \n c16: #ff4400;\ - \n c17: #ff4800;\ - \n c18: #ff4d00;\ - \n c19: #ff5100;\ + \n c17: rgb(255, 72.25, 0);\ + \n c18: rgb(255, 76.5, 0);\ + \n c19: rgb(255, 80.75, 0);\ \n c20: #ff5500;\ - \n c21: #ff5900;\ - \n c22: #ff5e00;\ - \n c23: #ff6200;\ + \n c21: rgb(255, 89.25, 0);\ + \n c22: rgb(255, 93.5, 0);\ + \n c23: rgb(255, 97.75, 0);\ \n c24: #ff6600;\ - \n c25: #ff6a00;\ - \n c26: #ff6f00;\ - \n c27: #ff7300;\ + \n c25: rgb(255, 106.25, 0);\ + \n c26: rgb(255, 110.5, 0);\ + \n c27: rgb(255, 114.75, 0);\ \n c28: #ff7700;\ - \n c29: #ff7b00;\ - \n c30: #ff8000;\ - \n c31: #ff8400;\ + \n c29: rgb(255, 123.25, 0);\ + \n c30: rgb(255, 127.5, 0);\ + \n c31: rgb(255, 131.75, 0);\ \n c32: #ff8800;\ - \n c33: darkorange;\ - \n c34: #ff9100;\ - \n c35: #ff9500;\ + \n c33: rgb(255, 140.25, 0);\ + \n c34: rgb(255, 144.5, 0);\ + \n c35: rgb(255, 148.75, 0);\ \n c36: #ff9900;\ - \n c37: #ff9d00;\ - \n c38: #ffa200;\ - \n c39: #ffa600;\ + \n c37: rgb(255, 157.25, 0);\ + \n c38: rgb(255, 161.5, 0);\ + \n c39: rgb(255, 165.75, 0);\ \n c40: #ffaa00;\ - \n c41: #ffae00;\ - \n c42: #ffb300;\ - \n c43: #ffb700;\ + \n c41: rgb(255, 174.25, 0);\ + \n c42: rgb(255, 178.5, 0);\ + \n c43: rgb(255, 182.75, 0);\ \n c44: #ffbb00;\ - \n c45: #ffbf00;\ - \n c46: #ffc400;\ - \n c47: #ffc800;\ + \n c45: rgb(255, 191.25, 0);\ + \n c46: rgb(255, 195.5, 0);\ + \n c47: rgb(255, 199.75, 0);\ \n c48: #ffcc00;\ - \n c49: #ffd000;\ - \n c50: #ffd500;\ - \n c51: #ffd900;\ + \n c49: rgb(255, 208.25, 0);\ + \n c50: rgb(255, 212.5, 0);\ + \n c51: rgb(255, 216.75, 0);\ \n c52: #ffdd00;\ - \n c53: #ffe100;\ - \n c54: #ffe600;\ - \n c55: #ffea00;\ + \n c53: rgb(255, 225.25, 0);\ + \n c54: rgb(255, 229.5, 0);\ + \n c55: rgb(255, 233.75, 0);\ \n c56: #ffee00;\ - \n c57: #fff200;\ - \n c58: #fff700;\ - \n c59: #fffb00;\ + \n c57: rgb(255, 242.25, 0);\ + \n c58: rgb(255, 246.5, 0);\ + \n c59: rgb(255, 250.75, 0);\ \n c60: yellow;\ - \n c61: #fbff00;\ - \n c62: #f7ff00;\ - \n c63: #f2ff00;\ + \n c61: rgb(250.75, 255, 0);\ + \n c62: rgb(246.5, 255, 0);\ + \n c63: rgb(242.25, 255, 0);\ \n c64: #eeff00;\ - \n c65: #eaff00;\ - \n c66: #e6ff00;\ - \n c67: #e1ff00;\ + \n c65: rgb(233.75, 255, 0);\ + \n c66: rgb(229.5, 255, 0);\ + \n c67: rgb(225.25, 255, 0);\ \n c68: #ddff00;\ - \n c69: #d9ff00;\ - \n c70: #d5ff00;\ - \n c71: #d0ff00;\ + \n c69: rgb(216.75, 255, 0);\ + \n c70: rgb(212.5, 255, 0);\ + \n c71: rgb(208.25, 255, 0);\ \n c72: #ccff00;\ - \n c73: #c8ff00;\ - \n c74: #c4ff00;\ - \n c75: #bfff00;\ + \n c73: rgb(199.75, 255, 0);\ + \n c74: rgb(195.5, 255, 0);\ + \n c75: rgb(191.25, 255, 0);\ \n c76: #bbff00;\ - \n c77: #b7ff00;\ - \n c78: #b3ff00;\ - \n c79: #aeff00;\ + \n c77: rgb(182.75, 255, 0);\ + \n c78: rgb(178.5, 255, 0);\ + \n c79: rgb(174.25, 255, 0);\ \n c80: #aaff00;\ - \n c81: #a6ff00;\ - \n c82: #a2ff00;\ - \n c83: #9dff00;\ + \n c81: rgb(165.75, 255, 0);\ + \n c82: rgb(161.5, 255, 0);\ + \n c83: rgb(157.25, 255, 0);\ \n c84: #99ff00;\ - \n c85: #95ff00;\ - \n c86: #91ff00;\ - \n c87: #8cff00;\ + \n c85: rgb(148.75, 255, 0);\ + \n c86: rgb(144.5, 255, 0);\ + \n c87: rgb(140.25, 255, 0);\ \n c88: #88ff00;\ - \n c89: #84ff00;\ - \n c90: #80ff00;\ - \n c91: #7bff00;\ + \n c89: rgb(131.75, 255, 0);\ + \n c90: rgb(127.5, 255, 0);\ + \n c91: rgb(123.25, 255, 0);\ \n c92: #77ff00;\ - \n c93: #73ff00;\ - \n c94: #6fff00;\ - \n c95: #6aff00;\ + \n c93: rgb(114.75, 255, 0);\ + \n c94: rgb(110.5, 255, 0);\ + \n c95: rgb(106.25, 255, 0);\ \n c96: #66ff00;\ - \n c97: #62ff00;\ - \n c98: #5eff00;\ - \n c99: #59ff00;\ + \n c97: rgb(97.75, 255, 0);\ + \n c98: rgb(93.5, 255, 0);\ + \n c99: rgb(89.25, 255, 0);\ \n c100: #55ff00;\ - \n c101: #51ff00;\ - \n c102: #4dff00;\ - \n c103: #48ff00;\ + \n c101: rgb(80.75, 255, 0);\ + \n c102: rgb(76.5, 255, 0);\ + \n c103: rgb(72.25, 255, 0);\ \n c104: #44ff00;\ - \n c105: #40ff00;\ - \n c106: #3cff00;\ - \n c107: #37ff00;\ + \n c105: rgb(63.75, 255, 0);\ + \n c106: rgb(59.5, 255, 0);\ + \n c107: rgb(55.25, 255, 0);\ \n c108: #33ff00;\ - \n c109: #2fff00;\ - \n c110: #2bff00;\ - \n c111: #26ff00;\ + \n c109: rgb(46.75, 255, 0);\ + \n c110: rgb(42.5, 255, 0);\ + \n c111: rgb(38.25, 255, 0);\ \n c112: #22ff00;\ - \n c113: #1eff00;\ - \n c114: #1aff00;\ - \n c115: #15ff00;\ + \n c113: rgb(29.75, 255, 0);\ + \n c114: rgb(25.5, 255, 0);\ + \n c115: rgb(21.25, 255, 0);\ \n c116: #11ff00;\ - \n c117: #0dff00;\ - \n c118: #09ff00;\ - \n c119: #04ff00;\ + \n c117: rgb(12.75, 255, 0);\ + \n c118: rgb(8.5, 255, 0);\ + \n c119: rgb(4.25, 255, 0);\ \n c120: lime;\ - \n c121: #00ff04;\ - \n c122: #00ff09;\ - \n c123: #00ff0d;\ + \n c121: rgb(0, 255, 4.25);\ + \n c122: rgb(0, 255, 8.5);\ + \n c123: rgb(0, 255, 12.75);\ \n c124: #00ff11;\ - \n c125: #00ff15;\ - \n c126: #00ff1a;\ - \n c127: #00ff1e;\ + \n c125: rgb(0, 255, 21.25);\ + \n c126: rgb(0, 255, 25.5);\ + \n c127: rgb(0, 255, 29.75);\ \n c128: #00ff22;\ - \n c129: #00ff26;\ - \n c130: #00ff2b;\ - \n c131: #00ff2f;\ + \n c129: rgb(0, 255, 38.25);\ + \n c130: rgb(0, 255, 42.5);\ + \n c131: rgb(0, 255, 46.75);\ \n c132: #00ff33;\ - \n c133: #00ff37;\ - \n c134: #00ff3c;\ - \n c135: #00ff40;\ + \n c133: rgb(0, 255, 55.25);\ + \n c134: rgb(0, 255, 59.5);\ + \n c135: rgb(0, 255, 63.75);\ \n c136: #00ff44;\ - \n c137: #00ff48;\ - \n c138: #00ff4d;\ - \n c139: #00ff51;\ + \n c137: rgb(0, 255, 72.25);\ + \n c138: rgb(0, 255, 76.5);\ + \n c139: rgb(0, 255, 80.75);\ \n c140: #00ff55;\ - \n c141: #00ff59;\ - \n c142: #00ff5e;\ - \n c143: #00ff62;\ + \n c141: rgb(0, 255, 89.25);\ + \n c142: rgb(0, 255, 93.5);\ + \n c143: rgb(0, 255, 97.75);\ \n c144: #00ff66;\ - \n c145: #00ff6a;\ - \n c146: #00ff6f;\ - \n c147: #00ff73;\ + \n c145: rgb(0, 255, 106.25);\ + \n c146: rgb(0, 255, 110.5);\ + \n c147: rgb(0, 255, 114.75);\ \n c148: #00ff77;\ - \n c149: #00ff7b;\ - \n c150: #00ff80;\ - \n c151: #00ff84;\ + \n c149: rgb(0, 255, 123.25);\ + \n c150: rgb(0, 255, 127.5);\ + \n c151: rgb(0, 255, 131.75);\ \n c152: #00ff88;\ - \n c153: #00ff8c;\ - \n c154: #00ff91;\ - \n c155: #00ff95;\ + \n c153: rgb(0, 255, 140.25);\ + \n c154: rgb(0, 255, 144.5);\ + \n c155: rgb(0, 255, 148.75);\ \n c156: #00ff99;\ - \n c157: #00ff9d;\ - \n c158: #00ffa2;\ - \n c159: #00ffa6;\ + \n c157: rgb(0, 255, 157.25);\ + \n c158: rgb(0, 255, 161.5);\ + \n c159: rgb(0, 255, 165.75);\ \n c160: #00ffaa;\ - \n c161: #00ffae;\ - \n c162: #00ffb3;\ - \n c163: #00ffb7;\ + \n c161: rgb(0, 255, 174.25);\ + \n c162: rgb(0, 255, 178.5);\ + \n c163: rgb(0, 255, 182.75);\ \n c164: #00ffbb;\ - \n c165: #00ffbf;\ - \n c166: #00ffc4;\ - \n c167: #00ffc8;\ + \n c165: rgb(0, 255, 191.25);\ + \n c166: rgb(0, 255, 195.5);\ + \n c167: rgb(0, 255, 199.75);\ \n c168: #00ffcc;\ - \n c169: #00ffd0;\ - \n c170: #00ffd5;\ - \n c171: #00ffd9;\ + \n c169: rgb(0, 255, 208.25);\ + \n c170: rgb(0, 255, 212.5);\ + \n c171: rgb(0, 255, 216.75);\ \n c172: #00ffdd;\ - \n c173: #00ffe1;\ - \n c174: #00ffe6;\ - \n c175: #00ffea;\ + \n c173: rgb(0, 255, 225.25);\ + \n c174: rgb(0, 255, 229.5);\ + \n c175: rgb(0, 255, 233.75);\ \n c176: #00ffee;\ - \n c177: #00fff2;\ - \n c178: #00fff7;\ - \n c179: #00fffb;\ + \n c177: rgb(0, 255, 242.25);\ + \n c178: rgb(0, 255, 246.5);\ + \n c179: rgb(0, 255, 250.75);\ \n c180: aqua;\ - \n c181: #00fbff;\ - \n c182: #00f7ff;\ - \n c183: #00f2ff;\ + \n c181: rgb(0, 250.75, 255);\ + \n c182: rgb(0, 246.5, 255);\ + \n c183: rgb(0, 242.25, 255);\ \n c184: #00eeff;\ - \n c185: #00eaff;\ - \n c186: #00e6ff;\ - \n c187: #00e1ff;\ + \n c185: rgb(0, 233.75, 255);\ + \n c186: rgb(0, 229.5, 255);\ + \n c187: rgb(0, 225.25, 255);\ \n c188: #00ddff;\ - \n c189: #00d9ff;\ - \n c190: #00d5ff;\ - \n c191: #00d0ff;\ + \n c189: rgb(0, 216.75, 255);\ + \n c190: rgb(0, 212.5, 255);\ + \n c191: rgb(0, 208.25, 255);\ \n c192: #00ccff;\ - \n c193: #00c8ff;\ - \n c194: #00c4ff;\ - \n c195: deepskyblue;\ + \n c193: rgb(0, 199.75, 255);\ + \n c194: rgb(0, 195.5, 255);\ + \n c195: rgb(0, 191.25, 255);\ \n c196: #00bbff;\ - \n c197: #00b7ff;\ - \n c198: #00b3ff;\ - \n c199: #00aeff;\ + \n c197: rgb(0, 182.75, 255);\ + \n c198: rgb(0, 178.5, 255);\ + \n c199: rgb(0, 174.25, 255);\ \n c200: #00aaff;\ - \n c201: #00a6ff;\ - \n c202: #00a2ff;\ - \n c203: #009dff;\ + \n c201: rgb(0, 165.75, 255);\ + \n c202: rgb(0, 161.5, 255);\ + \n c203: rgb(0, 157.25, 255);\ \n c204: #0099ff;\ - \n c205: #0095ff;\ - \n c206: #0091ff;\ - \n c207: #008cff;\ + \n c205: rgb(0, 148.75, 255);\ + \n c206: rgb(0, 144.5, 255);\ + \n c207: rgb(0, 140.25, 255);\ \n c208: #0088ff;\ - \n c209: #0084ff;\ - \n c210: #0080ff;\ - \n c211: #007bff;\ + \n c209: rgb(0, 131.75, 255);\ + \n c210: rgb(0, 127.5, 255);\ + \n c211: rgb(0, 123.25, 255);\ \n c212: #0077ff;\ - \n c213: #0073ff;\ - \n c214: #006fff;\ - \n c215: #006aff;\ + \n c213: rgb(0, 114.75, 255);\ + \n c214: rgb(0, 110.5, 255);\ + \n c215: rgb(0, 106.25, 255);\ \n c216: #0066ff;\ - \n c217: #0062ff;\ - \n c218: #005eff;\ - \n c219: #0059ff;\ + \n c217: rgb(0, 97.75, 255);\ + \n c218: rgb(0, 93.5, 255);\ + \n c219: rgb(0, 89.25, 255);\ \n c220: #0055ff;\ - \n c221: #0051ff;\ - \n c222: #004dff;\ - \n c223: #0048ff;\ + \n c221: rgb(0, 80.75, 255);\ + \n c222: rgb(0, 76.5, 255);\ + \n c223: rgb(0, 72.25, 255);\ \n c224: #0044ff;\ - \n c225: #0040ff;\ - \n c226: #003cff;\ - \n c227: #0037ff;\ + \n c225: rgb(0, 63.75, 255);\ + \n c226: rgb(0, 59.5, 255);\ + \n c227: rgb(0, 55.25, 255);\ \n c228: #0033ff;\ - \n c229: #002fff;\ - \n c230: #002bff;\ - \n c231: #0026ff;\ + \n c229: rgb(0, 46.75, 255);\ + \n c230: rgb(0, 42.5, 255);\ + \n c231: rgb(0, 38.25, 255);\ \n c232: #0022ff;\ - \n c233: #001eff;\ - \n c234: #001aff;\ - \n c235: #0015ff;\ + \n c233: rgb(0, 29.75, 255);\ + \n c234: rgb(0, 25.5, 255);\ + \n c235: rgb(0, 21.25, 255);\ \n c236: #0011ff;\ - \n c237: #000dff;\ - \n c238: #0009ff;\ - \n c239: #0004ff;\ + \n c237: rgb(0, 12.75, 255);\ + \n c238: rgb(0, 8.5, 255);\ + \n c239: rgb(0, 4.25, 255);\ \n c240: blue;\ - \n c241: #0400ff;\ - \n c242: #0900ff;\ - \n c243: #0d00ff;\ + \n c241: rgb(4.25, 0, 255);\ + \n c242: rgb(8.5, 0, 255);\ + \n c243: rgb(12.75, 0, 255);\ \n c244: #1100ff;\ - \n c245: #1500ff;\ - \n c246: #1a00ff;\ - \n c247: #1e00ff;\ + \n c245: rgb(21.25, 0, 255);\ + \n c246: rgb(25.5, 0, 255);\ + \n c247: rgb(29.75, 0, 255);\ \n c248: #2200ff;\ - \n c249: #2600ff;\ - \n c250: #2b00ff;\ - \n c251: #2f00ff;\ + \n c249: rgb(38.25, 0, 255);\ + \n c250: rgb(42.5, 0, 255);\ + \n c251: rgb(46.75, 0, 255);\ \n c252: #3300ff;\ - \n c253: #3700ff;\ - \n c254: #3c00ff;\ - \n c255: #4000ff;\ + \n c253: rgb(55.25, 0, 255);\ + \n c254: rgb(59.5, 0, 255);\ + \n c255: rgb(63.75, 0, 255);\ \n c256: #4400ff;\ - \n c257: #4800ff;\ - \n c258: #4d00ff;\ - \n c259: #5100ff;\ + \n c257: rgb(72.25, 0, 255);\ + \n c258: rgb(76.5, 0, 255);\ + \n c259: rgb(80.75, 0, 255);\ \n c260: #5500ff;\ - \n c261: #5900ff;\ - \n c262: #5e00ff;\ - \n c263: #6200ff;\ + \n c261: rgb(89.25, 0, 255);\ + \n c262: rgb(93.5, 0, 255);\ + \n c263: rgb(97.75, 0, 255);\ \n c264: #6600ff;\ - \n c265: #6a00ff;\ - \n c266: #6f00ff;\ - \n c267: #7300ff;\ + \n c265: rgb(106.25, 0, 255);\ + \n c266: rgb(110.5, 0, 255);\ + \n c267: rgb(114.75, 0, 255);\ \n c268: #7700ff;\ - \n c269: #7b00ff;\ - \n c270: #8000ff;\ - \n c271: #8400ff;\ + \n c269: rgb(123.25, 0, 255);\ + \n c270: rgb(127.5, 0, 255);\ + \n c271: rgb(131.75, 0, 255);\ \n c272: #8800ff;\ - \n c273: #8c00ff;\ - \n c274: #9100ff;\ - \n c275: #9500ff;\ + \n c273: rgb(140.25, 0, 255);\ + \n c274: rgb(144.5, 0, 255);\ + \n c275: rgb(148.75, 0, 255);\ \n c276: #9900ff;\ - \n c277: #9d00ff;\ - \n c278: #a200ff;\ - \n c279: #a600ff;\ + \n c277: rgb(157.25, 0, 255);\ + \n c278: rgb(161.5, 0, 255);\ + \n c279: rgb(165.75, 0, 255);\ \n c280: #aa00ff;\ - \n c281: #ae00ff;\ - \n c282: #b300ff;\ - \n c283: #b700ff;\ + \n c281: rgb(174.25, 0, 255);\ + \n c282: rgb(178.5, 0, 255);\ + \n c283: rgb(182.75, 0, 255);\ \n c284: #bb00ff;\ - \n c285: #bf00ff;\ - \n c286: #c400ff;\ - \n c287: #c800ff;\ + \n c285: rgb(191.25, 0, 255);\ + \n c286: rgb(195.5, 0, 255);\ + \n c287: rgb(199.75, 0, 255);\ \n c288: #cc00ff;\ - \n c289: #d000ff;\ - \n c290: #d500ff;\ - \n c291: #d900ff;\ + \n c289: rgb(208.25, 0, 255);\ + \n c290: rgb(212.5, 0, 255);\ + \n c291: rgb(216.75, 0, 255);\ \n c292: #dd00ff;\ - \n c293: #e100ff;\ - \n c294: #e600ff;\ - \n c295: #ea00ff;\ + \n c293: rgb(225.25, 0, 255);\ + \n c294: rgb(229.5, 0, 255);\ + \n c295: rgb(233.75, 0, 255);\ \n c296: #ee00ff;\ - \n c297: #f200ff;\ - \n c298: #f700ff;\ - \n c299: #fb00ff;\ + \n c297: rgb(242.25, 0, 255);\ + \n c298: rgb(246.5, 0, 255);\ + \n c299: rgb(250.75, 0, 255);\ \n c300: fuchsia;\ - \n c301: #ff00fb;\ - \n c302: #ff00f7;\ - \n c303: #ff00f2;\ + \n c301: rgb(255, 0, 250.75);\ + \n c302: rgb(255, 0, 246.5);\ + \n c303: rgb(255, 0, 242.25);\ \n c304: #ff00ee;\ - \n c305: #ff00ea;\ - \n c306: #ff00e6;\ - \n c307: #ff00e1;\ + \n c305: rgb(255, 0, 233.75);\ + \n c306: rgb(255, 0, 229.5);\ + \n c307: rgb(255, 0, 225.25);\ \n c308: #ff00dd;\ - \n c309: #ff00d9;\ - \n c310: #ff00d5;\ - \n c311: #ff00d0;\ + \n c309: rgb(255, 0, 216.75);\ + \n c310: rgb(255, 0, 212.5);\ + \n c311: rgb(255, 0, 208.25);\ \n c312: #ff00cc;\ - \n c313: #ff00c8;\ - \n c314: #ff00c4;\ - \n c315: #ff00bf;\ + \n c313: rgb(255, 0, 199.75);\ + \n c314: rgb(255, 0, 195.5);\ + \n c315: rgb(255, 0, 191.25);\ \n c316: #ff00bb;\ - \n c317: #ff00b7;\ - \n c318: #ff00b3;\ - \n c319: #ff00ae;\ + \n c317: rgb(255, 0, 182.75);\ + \n c318: rgb(255, 0, 178.5);\ + \n c319: rgb(255, 0, 174.25);\ \n c320: #ff00aa;\ - \n c321: #ff00a6;\ - \n c322: #ff00a2;\ - \n c323: #ff009d;\ + \n c321: rgb(255, 0, 165.75);\ + \n c322: rgb(255, 0, 161.5);\ + \n c323: rgb(255, 0, 157.25);\ \n c324: #ff0099;\ - \n c325: #ff0095;\ - \n c326: #ff0091;\ - \n c327: #ff008c;\ + \n c325: rgb(255, 0, 148.75);\ + \n c326: rgb(255, 0, 144.5);\ + \n c327: rgb(255, 0, 140.25);\ \n c328: #ff0088;\ - \n c329: #ff0084;\ - \n c330: #ff0080;\ - \n c331: #ff007b;\ + \n c329: rgb(255, 0, 131.75);\ + \n c330: rgb(255, 0, 127.5);\ + \n c331: rgb(255, 0, 123.25);\ \n c332: #ff0077;\ - \n c333: #ff0073;\ - \n c334: #ff006f;\ - \n c335: #ff006a;\ + \n c333: rgb(255, 0, 114.75);\ + \n c334: rgb(255, 0, 110.5);\ + \n c335: rgb(255, 0, 106.25);\ \n c336: #ff0066;\ - \n c337: #ff0062;\ - \n c338: #ff005e;\ - \n c339: #ff0059;\ + \n c337: rgb(255, 0, 97.75);\ + \n c338: rgb(255, 0, 93.5);\ + \n c339: rgb(255, 0, 89.25);\ \n c340: #ff0055;\ - \n c341: #ff0051;\ - \n c342: #ff004d;\ - \n c343: #ff0048;\ + \n c341: rgb(255, 0, 80.75);\ + \n c342: rgb(255, 0, 76.5);\ + \n c343: rgb(255, 0, 72.25);\ \n c344: #ff0044;\ - \n c345: #ff0040;\ - \n c346: #ff003c;\ - \n c347: #ff0037;\ + \n c345: rgb(255, 0, 63.75);\ + \n c346: rgb(255, 0, 59.5);\ + \n c347: rgb(255, 0, 55.25);\ \n c348: #ff0033;\ - \n c349: #ff002f;\ - \n c350: #ff002b;\ - \n c351: #ff0026;\ + \n c349: rgb(255, 0, 46.75);\ + \n c350: rgb(255, 0, 42.5);\ + \n c351: rgb(255, 0, 38.25);\ \n c352: #ff0022;\ - \n c353: #ff001e;\ - \n c354: #ff001a;\ - \n c355: #ff0015;\ + \n c353: rgb(255, 0, 29.75);\ + \n c354: rgb(255, 0, 25.5);\ + \n c355: rgb(255, 0, 21.25);\ \n c356: #ff0011;\ - \n c357: #ff000d;\ - \n c358: #ff0009;\ - \n c359: #ff0004;\ + \n c357: rgb(255, 0, 12.75);\ + \n c358: rgb(255, 0, 8.5);\ + \n c359: rgb(255, 0, 4.25);\ \n c360: red;\ \n}\n" ); diff --git a/rsass/tests/spec/libsass/color_functions/other/change_color/l.rs b/rsass/tests/spec/libsass/color_functions/other/change_color/l.rs index 08731ec48..6f4f4566f 100644 --- a/rsass/tests/spec/libsass/color_functions/other/change_color/l.rs +++ b/rsass/tests/spec/libsass/color_functions/other/change_color/l.rs @@ -6,213 +6,215 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( - runner().ok("foo {\ + runner().ok("@use \"sass:color\";\ + \nfoo {\ \n // c-1: change-color(red,$lightness:-1%);\ - \n c0: change-color(red,$lightness:0%);\ - \n c1: change-color(red,$lightness:1%);\ - \n c2: change-color(red,$lightness:2%);\ - \n c3: change-color(red,$lightness:3%);\ - \n c4: change-color(red,$lightness:4%);\ - \n c5: change-color(red,$lightness:5%);\ - \n c6: change-color(red,$lightness:6%);\ - \n c7: change-color(red,$lightness:7%);\ - \n c8: change-color(red,$lightness:8%);\ - \n c9: change-color(red,$lightness:9%);\ - \n c10: change-color(red,$lightness:10%);\ - \n c11: change-color(red,$lightness:11%);\ - \n c12: change-color(red,$lightness:12%);\ - \n c13: change-color(red,$lightness:13%);\ - \n c14: change-color(red,$lightness:14%);\ - \n c15: change-color(red,$lightness:15%);\ - \n c16: change-color(red,$lightness:16%);\ - \n c17: change-color(red,$lightness:17%);\ - \n c18: change-color(red,$lightness:18%);\ - \n c19: change-color(red,$lightness:19%);\ - \n c20: change-color(red,$lightness:20%);\ - \n c21: change-color(red,$lightness:21%);\ - \n c22: change-color(red,$lightness:22%);\ - \n c23: change-color(red,$lightness:23%);\ - \n c24: change-color(red,$lightness:24%);\ - \n c25: change-color(red,$lightness:25%);\ - \n c26: change-color(red,$lightness:26%);\ - \n c27: change-color(red,$lightness:27%);\ - \n c28: change-color(red,$lightness:28%);\ - \n c29: change-color(red,$lightness:29%);\ - \n c30: change-color(red,$lightness:30%);\ - \n c31: change-color(red,$lightness:31%);\ - \n c32: change-color(red,$lightness:32%);\ - \n c33: change-color(red,$lightness:33%);\ - \n c34: change-color(red,$lightness:34%);\ - \n c35: change-color(red,$lightness:35%);\ - \n c36: change-color(red,$lightness:36%);\ - \n c37: change-color(red,$lightness:37%);\ - \n c38: change-color(red,$lightness:38%);\ - \n c39: change-color(red,$lightness:39%);\ - \n c40: change-color(red,$lightness:40%);\ - \n c41: change-color(red,$lightness:41%);\ - \n c42: change-color(red,$lightness:42%);\ - \n c43: change-color(red,$lightness:43%);\ - \n c44: change-color(red,$lightness:44%);\ - \n c45: change-color(red,$lightness:45%);\ - \n c46: change-color(red,$lightness:46%);\ - \n c47: change-color(red,$lightness:47%);\ - \n c48: change-color(red,$lightness:48%);\ - \n c49: change-color(red,$lightness:49%);\ - \n c50: change-color(red,$lightness:50%);\ - \n c51: change-color(red,$lightness:51%);\ - \n c52: change-color(red,$lightness:52%);\ - \n c53: change-color(red,$lightness:53%);\ - \n c54: change-color(red,$lightness:54%);\ - \n c55: change-color(red,$lightness:55%);\ - \n c56: change-color(red,$lightness:56%);\ - \n c57: change-color(red,$lightness:57%);\ - \n c58: change-color(red,$lightness:58%);\ - \n c59: change-color(red,$lightness:59%);\ - \n c60: change-color(red,$lightness:60%);\ - \n c61: change-color(red,$lightness:61%);\ - \n c62: change-color(red,$lightness:62%);\ - \n c63: change-color(red,$lightness:63%);\ - \n c64: change-color(red,$lightness:64%);\ - \n c65: change-color(red,$lightness:65%);\ - \n c66: change-color(red,$lightness:66%);\ - \n c67: change-color(red,$lightness:67%);\ - \n c68: change-color(red,$lightness:68%);\ - \n c69: change-color(red,$lightness:69%);\ - \n c70: change-color(red,$lightness:70%);\ - \n c71: change-color(red,$lightness:71%);\ - \n c72: change-color(red,$lightness:72%);\ - \n c73: change-color(red,$lightness:73%);\ - \n c74: change-color(red,$lightness:74%);\ - \n c75: change-color(red,$lightness:75%);\ - \n c76: change-color(red,$lightness:76%);\ - \n c77: change-color(red,$lightness:77%);\ - \n c78: change-color(red,$lightness:78%);\ - \n c79: change-color(red,$lightness:79%);\ - \n c80: change-color(red,$lightness:80%);\ - \n c81: change-color(red,$lightness:81%);\ - \n c82: change-color(red,$lightness:82%);\ - \n c83: change-color(red,$lightness:83%);\ - \n c84: change-color(red,$lightness:84%);\ - \n c85: change-color(red,$lightness:85%);\ - \n c86: change-color(red,$lightness:86%);\ - \n c87: change-color(red,$lightness:87%);\ - \n c88: change-color(red,$lightness:88%);\ - \n c89: change-color(red,$lightness:89%);\ - \n c90: change-color(red,$lightness:90%);\ - \n c91: change-color(red,$lightness:91%);\ - \n c92: change-color(red,$lightness:92%);\ - \n c93: change-color(red,$lightness:93%);\ - \n c94: change-color(red,$lightness:94%);\ - \n c95: change-color(red,$lightness:95%);\ - \n c96: change-color(red,$lightness:96%);\ - \n c97: change-color(red,$lightness:97%);\ - \n c98: change-color(red,$lightness:98%);\ - \n c99: change-color(red,$lightness:99%);\ + \n c0: color.change(red,$lightness:0%);\ + \n c1: color.change(red,$lightness:1%);\ + \n c2: color.change(red,$lightness:2%);\ + \n c3: color.change(red,$lightness:3%);\ + \n c4: color.change(red,$lightness:4%);\ + \n c5: color.change(red,$lightness:5%);\ + \n c6: color.change(red,$lightness:6%);\ + \n c7: color.change(red,$lightness:7%);\ + \n c8: color.change(red,$lightness:8%);\ + \n c9: color.change(red,$lightness:9%);\ + \n c10: color.change(red,$lightness:10%);\ + \n c11: color.change(red,$lightness:11%);\ + \n c12: color.change(red,$lightness:12%);\ + \n c13: color.change(red,$lightness:13%);\ + \n c14: color.change(red,$lightness:14%);\ + \n c15: color.change(red,$lightness:15%);\ + \n c16: color.change(red,$lightness:16%);\ + \n c17: color.change(red,$lightness:17%);\ + \n c18: color.change(red,$lightness:18%);\ + \n c19: color.change(red,$lightness:19%);\ + \n c20: color.change(red,$lightness:20%);\ + \n c21: color.change(red,$lightness:21%);\ + \n c22: color.change(red,$lightness:22%);\ + \n c23: color.change(red,$lightness:23%);\ + \n c24: color.change(red,$lightness:24%);\ + \n c25: color.change(red,$lightness:25%);\ + \n c26: color.change(red,$lightness:26%);\ + \n c27: color.change(red,$lightness:27%);\ + \n c28: color.change(red,$lightness:28%);\ + \n c29: color.change(red,$lightness:29%);\ + \n c30: color.change(red,$lightness:30%);\ + \n c31: color.change(red,$lightness:31%);\ + \n c32: color.change(red,$lightness:32%);\ + \n c33: color.change(red,$lightness:33%);\ + \n c34: color.change(red,$lightness:34%);\ + \n c35: color.change(red,$lightness:35%);\ + \n c36: color.change(red,$lightness:36%);\ + \n c37: color.change(red,$lightness:37%);\ + \n c38: color.change(red,$lightness:38%);\ + \n c39: color.change(red,$lightness:39%);\ + \n c40: color.change(red,$lightness:40%);\ + \n c41: color.change(red,$lightness:41%);\ + \n c42: color.change(red,$lightness:42%);\ + \n c43: color.change(red,$lightness:43%);\ + \n c44: color.change(red,$lightness:44%);\ + \n c45: color.change(red,$lightness:45%);\ + \n c46: color.change(red,$lightness:46%);\ + \n c47: color.change(red,$lightness:47%);\ + \n c48: color.change(red,$lightness:48%);\ + \n c49: color.change(red,$lightness:49%);\ + \n c50: color.change(red,$lightness:50%);\ + \n c51: color.change(red,$lightness:51%);\ + \n c52: color.change(red,$lightness:52%);\ + \n c53: color.change(red,$lightness:53%);\ + \n c54: color.change(red,$lightness:54%);\ + \n c55: color.change(red,$lightness:55%);\ + \n c56: color.change(red,$lightness:56%);\ + \n c57: color.change(red,$lightness:57%);\ + \n c58: color.change(red,$lightness:58%);\ + \n c59: color.change(red,$lightness:59%);\ + \n c60: color.change(red,$lightness:60%);\ + \n c61: color.change(red,$lightness:61%);\ + \n c62: color.change(red,$lightness:62%);\ + \n c63: color.change(red,$lightness:63%);\ + \n c64: color.change(red,$lightness:64%);\ + \n c65: color.change(red,$lightness:65%);\ + \n c66: color.change(red,$lightness:66%);\ + \n c67: color.change(red,$lightness:67%);\ + \n c68: color.change(red,$lightness:68%);\ + \n c69: color.change(red,$lightness:69%);\ + \n c70: color.change(red,$lightness:70%);\ + \n c71: color.change(red,$lightness:71%);\ + \n c72: color.change(red,$lightness:72%);\ + \n c73: color.change(red,$lightness:73%);\ + \n c74: color.change(red,$lightness:74%);\ + \n c75: color.change(red,$lightness:75%);\ + \n c76: color.change(red,$lightness:76%);\ + \n c77: color.change(red,$lightness:77%);\ + \n c78: color.change(red,$lightness:78%);\ + \n c79: color.change(red,$lightness:79%);\ + \n c80: color.change(red,$lightness:80%);\ + \n c81: color.change(red,$lightness:81%);\ + \n c82: color.change(red,$lightness:82%);\ + \n c83: color.change(red,$lightness:83%);\ + \n c84: color.change(red,$lightness:84%);\ + \n c85: color.change(red,$lightness:85%);\ + \n c86: color.change(red,$lightness:86%);\ + \n c87: color.change(red,$lightness:87%);\ + \n c88: color.change(red,$lightness:88%);\ + \n c89: color.change(red,$lightness:89%);\ + \n c90: color.change(red,$lightness:90%);\ + \n c91: color.change(red,$lightness:91%);\ + \n c92: color.change(red,$lightness:92%);\ + \n c93: color.change(red,$lightness:93%);\ + \n c94: color.change(red,$lightness:94%);\ + \n c95: color.change(red,$lightness:95%);\ + \n c96: color.change(red,$lightness:96%);\ + \n c97: color.change(red,$lightness:97%);\ + \n c98: color.change(red,$lightness:98%);\ + \n c99: color.change(red,$lightness:99%);\ \n // c100: change-color(red,$lightness:100%);\ \n}\n"), "foo {\ \n c0: black;\ - \n c1: #050000;\ - \n c2: #0a0000;\ - \n c3: #0f0000;\ - \n c4: #140000;\ - \n c5: #1a0000;\ - \n c6: #1f0000;\ - \n c7: #240000;\ - \n c8: #290000;\ - \n c9: #2e0000;\ + \n c1: rgb(5.1, 0, 0);\ + \n c2: rgb(10.2, 0, 0);\ + \n c3: rgb(15.3, 0, 0);\ + \n c4: rgb(20.4, 0, 0);\ + \n c5: rgb(25.5, 0, 0);\ + \n c6: rgb(30.6, 0, 0);\ + \n c7: rgb(35.7, 0, 0);\ + \n c8: rgb(40.8, 0, 0);\ + \n c9: rgb(45.9, 0, 0);\ \n c10: #330000;\ - \n c11: #380000;\ - \n c12: #3d0000;\ - \n c13: #420000;\ - \n c14: #470000;\ - \n c15: #4d0000;\ - \n c16: #520000;\ - \n c17: #570000;\ - \n c18: #5c0000;\ - \n c19: #610000;\ + \n c11: rgb(56.1, 0, 0);\ + \n c12: rgb(61.2, 0, 0);\ + \n c13: rgb(66.3, 0, 0);\ + \n c14: rgb(71.4, 0, 0);\ + \n c15: rgb(76.5, 0, 0);\ + \n c16: rgb(81.6, 0, 0);\ + \n c17: rgb(86.7, 0, 0);\ + \n c18: rgb(91.8, 0, 0);\ + \n c19: rgb(96.9, 0, 0);\ \n c20: #660000;\ - \n c21: #6b0000;\ - \n c22: #700000;\ - \n c23: #750000;\ - \n c24: #7a0000;\ - \n c25: maroon;\ - \n c26: #850000;\ - \n c27: #8a0000;\ - \n c28: #8f0000;\ - \n c29: #940000;\ + \n c21: rgb(107.1, 0, 0);\ + \n c22: rgb(112.2, 0, 0);\ + \n c23: rgb(117.3, 0, 0);\ + \n c24: rgb(122.4, 0, 0);\ + \n c25: rgb(127.5, 0, 0);\ + \n c26: rgb(132.6, 0, 0);\ + \n c27: rgb(137.7, 0, 0);\ + \n c28: rgb(142.8, 0, 0);\ + \n c29: rgb(147.9, 0, 0);\ \n c30: #990000;\ - \n c31: #9e0000;\ - \n c32: #a30000;\ - \n c33: #a80000;\ - \n c34: #ad0000;\ - \n c35: #b30000;\ - \n c36: #b80000;\ - \n c37: #bd0000;\ - \n c38: #c20000;\ - \n c39: #c70000;\ + \n c31: rgb(158.1, 0, 0);\ + \n c32: rgb(163.2, 0, 0);\ + \n c33: rgb(168.3, 0, 0);\ + \n c34: rgb(173.4, 0, 0);\ + \n c35: rgb(178.5, 0, 0);\ + \n c36: rgb(183.6, 0, 0);\ + \n c37: rgb(188.7, 0, 0);\ + \n c38: rgb(193.8, 0, 0);\ + \n c39: rgb(198.9, 0, 0);\ \n c40: #cc0000;\ - \n c41: #d10000;\ - \n c42: #d60000;\ - \n c43: #db0000;\ - \n c44: #e00000;\ - \n c45: #e60000;\ - \n c46: #eb0000;\ - \n c47: #f00000;\ - \n c48: #f50000;\ - \n c49: #fa0000;\ + \n c41: rgb(209.1, 0, 0);\ + \n c42: rgb(214.2, 0, 0);\ + \n c43: rgb(219.3, 0, 0);\ + \n c44: rgb(224.4, 0, 0);\ + \n c45: rgb(229.5, 0, 0);\ + \n c46: rgb(234.6, 0, 0);\ + \n c47: rgb(239.7, 0, 0);\ + \n c48: rgb(244.8, 0, 0);\ + \n c49: rgb(249.9, 0, 0);\ \n c50: red;\ - \n c51: #ff0505;\ - \n c52: #ff0a0a;\ - \n c53: #ff0f0f;\ - \n c54: #ff1414;\ - \n c55: #ff1a1a;\ - \n c56: #ff1f1f;\ - \n c57: #ff2424;\ - \n c58: #ff2929;\ - \n c59: #ff2e2e;\ + \n c51: rgb(255, 5.1, 5.1);\ + \n c52: rgb(255, 10.2, 10.2);\ + \n c53: rgb(255, 15.3, 15.3);\ + \n c54: rgb(255, 20.4, 20.4);\ + \n c55: rgb(255, 25.5, 25.5);\ + \n c56: rgb(255, 30.6, 30.6);\ + \n c57: rgb(255, 35.7, 35.7);\ + \n c58: rgb(255, 40.8, 40.8);\ + \n c59: rgb(255, 45.9, 45.9);\ \n c60: #ff3333;\ - \n c61: #ff3838;\ - \n c62: #ff3d3d;\ - \n c63: #ff4242;\ - \n c64: #ff4747;\ - \n c65: #ff4d4d;\ - \n c66: #ff5252;\ - \n c67: #ff5757;\ - \n c68: #ff5c5c;\ - \n c69: #ff6161;\ + \n c61: rgb(255, 56.1, 56.1);\ + \n c62: rgb(255, 61.2, 61.2);\ + \n c63: rgb(255, 66.3, 66.3);\ + \n c64: rgb(255, 71.4, 71.4);\ + \n c65: rgb(255, 76.5, 76.5);\ + \n c66: rgb(255, 81.6, 81.6);\ + \n c67: rgb(255, 86.7, 86.7);\ + \n c68: rgb(255, 91.8, 91.8);\ + \n c69: rgb(255, 96.9, 96.9);\ \n c70: #ff6666;\ - \n c71: #ff6b6b;\ - \n c72: #ff7070;\ - \n c73: #ff7575;\ - \n c74: #ff7a7a;\ - \n c75: #ff8080;\ - \n c76: #ff8585;\ - \n c77: #ff8a8a;\ - \n c78: #ff8f8f;\ - \n c79: #ff9494;\ + \n c71: rgb(255, 107.1, 107.1);\ + \n c72: rgb(255, 112.2, 112.2);\ + \n c73: rgb(255, 117.3, 117.3);\ + \n c74: rgb(255, 122.4, 122.4);\ + \n c75: rgb(255, 127.5, 127.5);\ + \n c76: rgb(255, 132.6, 132.6);\ + \n c77: rgb(255, 137.7, 137.7);\ + \n c78: rgb(255, 142.8, 142.8);\ + \n c79: rgb(255, 147.9, 147.9);\ \n c80: #ff9999;\ - \n c81: #ff9e9e;\ - \n c82: #ffa3a3;\ - \n c83: #ffa8a8;\ - \n c84: #ffadad;\ - \n c85: #ffb3b3;\ - \n c86: #ffb8b8;\ - \n c87: #ffbdbd;\ - \n c88: #ffc2c2;\ - \n c89: #ffc7c7;\ + \n c81: rgb(255, 158.1, 158.1);\ + \n c82: rgb(255, 163.2, 163.2);\ + \n c83: rgb(255, 168.3, 168.3);\ + \n c84: rgb(255, 173.4, 173.4);\ + \n c85: rgb(255, 178.5, 178.5);\ + \n c86: rgb(255, 183.6, 183.6);\ + \n c87: rgb(255, 188.7, 188.7);\ + \n c88: rgb(255, 193.8, 193.8);\ + \n c89: rgb(255, 198.9, 198.9);\ \n c90: #ffcccc;\ - \n c91: #ffd1d1;\ - \n c92: #ffd6d6;\ - \n c93: #ffdbdb;\ - \n c94: #ffe0e0;\ - \n c95: #ffe6e6;\ - \n c96: #ffebeb;\ - \n c97: #fff0f0;\ - \n c98: #fff5f5;\ - \n c99: snow;\ + \n c91: rgb(255, 209.1, 209.1);\ + \n c92: rgb(255, 214.2, 214.2);\ + \n c93: rgb(255, 219.3, 219.3);\ + \n c94: rgb(255, 224.4, 224.4);\ + \n c95: rgb(255, 229.5, 229.5);\ + \n c96: rgb(255, 234.6, 234.6);\ + \n c97: rgb(255, 239.7, 239.7);\ + \n c98: rgb(255, 244.8, 244.8);\ + \n c99: rgb(255, 249.9, 249.9);\ \n}\n" ); } diff --git a/rsass/tests/spec/libsass/color_functions/other/change_color/r.rs b/rsass/tests/spec/libsass/color_functions/other/change_color/r.rs index def312905..85bd718ec 100644 --- a/rsass/tests/spec/libsass/color_functions/other/change_color/r.rs +++ b/rsass/tests/spec/libsass/color_functions/other/change_color/r.rs @@ -8,264 +8,265 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("foo {\ + runner().ok("@use \"sass:color\";\ + \nfoo {\ \n // c-1: change-color(black,$red:-1);\ - \n c0: change-color(black,$red:0);\ - \n c1: change-color(black,$red:1);\ - \n c2: change-color(black,$red:2);\ - \n c3: change-color(black,$red:3);\ - \n c4: change-color(black,$red:4);\ - \n c5: change-color(black,$red:5);\ - \n c6: change-color(black,$red:6);\ - \n c7: change-color(black,$red:7);\ - \n c8: change-color(black,$red:8);\ - \n c9: change-color(black,$red:9);\ - \n c10: change-color(black,$red:10);\ - \n c11: change-color(black,$red:11);\ - \n c12: change-color(black,$red:12);\ - \n c13: change-color(black,$red:13);\ - \n c14: change-color(black,$red:14);\ - \n c15: change-color(black,$red:15);\ - \n c16: change-color(black,$red:16);\ - \n c17: change-color(black,$red:17);\ - \n c18: change-color(black,$red:18);\ - \n c19: change-color(black,$red:19);\ - \n c20: change-color(black,$red:20);\ - \n c21: change-color(black,$red:21);\ - \n c22: change-color(black,$red:22);\ - \n c23: change-color(black,$red:23);\ - \n c24: change-color(black,$red:24);\ - \n c25: change-color(black,$red:25);\ - \n c26: change-color(black,$red:26);\ - \n c27: change-color(black,$red:27);\ - \n c28: change-color(black,$red:28);\ - \n c29: change-color(black,$red:29);\ - \n c30: change-color(black,$red:30);\ - \n c31: change-color(black,$red:31);\ - \n c32: change-color(black,$red:32);\ - \n c33: change-color(black,$red:33);\ - \n c34: change-color(black,$red:34);\ - \n c35: change-color(black,$red:35);\ - \n c36: change-color(black,$red:36);\ - \n c37: change-color(black,$red:37);\ - \n c38: change-color(black,$red:38);\ - \n c39: change-color(black,$red:39);\ - \n c40: change-color(black,$red:40);\ - \n c41: change-color(black,$red:41);\ - \n c42: change-color(black,$red:42);\ - \n c43: change-color(black,$red:43);\ - \n c44: change-color(black,$red:44);\ - \n c45: change-color(black,$red:45);\ - \n c46: change-color(black,$red:46);\ - \n c47: change-color(black,$red:47);\ - \n c48: change-color(black,$red:48);\ - \n c49: change-color(black,$red:49);\ - \n c50: change-color(black,$red:50);\ - \n c51: change-color(black,$red:51);\ - \n c52: change-color(black,$red:52);\ - \n c53: change-color(black,$red:53);\ - \n c54: change-color(black,$red:54);\ - \n c55: change-color(black,$red:55);\ - \n c56: change-color(black,$red:56);\ - \n c57: change-color(black,$red:57);\ - \n c58: change-color(black,$red:58);\ - \n c59: change-color(black,$red:59);\ - \n c60: change-color(black,$red:60);\ - \n c61: change-color(black,$red:61);\ - \n c62: change-color(black,$red:62);\ - \n c63: change-color(black,$red:63);\ - \n c64: change-color(black,$red:64);\ - \n c65: change-color(black,$red:65);\ - \n c66: change-color(black,$red:66);\ - \n c67: change-color(black,$red:67);\ - \n c68: change-color(black,$red:68);\ - \n c69: change-color(black,$red:69);\ - \n c70: change-color(black,$red:70);\ - \n c71: change-color(black,$red:71);\ - \n c72: change-color(black,$red:72);\ - \n c73: change-color(black,$red:73);\ - \n c74: change-color(black,$red:74);\ - \n c75: change-color(black,$red:75);\ - \n c76: change-color(black,$red:76);\ - \n c77: change-color(black,$red:77);\ - \n c78: change-color(black,$red:78);\ - \n c79: change-color(black,$red:79);\ - \n c80: change-color(black,$red:80);\ - \n c81: change-color(black,$red:81);\ - \n c82: change-color(black,$red:82);\ - \n c83: change-color(black,$red:83);\ - \n c84: change-color(black,$red:84);\ - \n c85: change-color(black,$red:85);\ - \n c86: change-color(black,$red:86);\ - \n c87: change-color(black,$red:87);\ - \n c88: change-color(black,$red:88);\ - \n c89: change-color(black,$red:89);\ - \n c90: change-color(black,$red:90);\ - \n c91: change-color(black,$red:91);\ - \n c92: change-color(black,$red:92);\ - \n c93: change-color(black,$red:93);\ - \n c94: change-color(black,$red:94);\ - \n c95: change-color(black,$red:95);\ - \n c96: change-color(black,$red:96);\ - \n c97: change-color(black,$red:97);\ - \n c98: change-color(black,$red:98);\ - \n c99: change-color(black,$red:99);\ - \n c100: change-color(black,$red:100);\ - \n c101: change-color(black,$red:101);\ - \n c102: change-color(black,$red:102);\ - \n c103: change-color(black,$red:103);\ - \n c104: change-color(black,$red:104);\ - \n c105: change-color(black,$red:105);\ - \n c106: change-color(black,$red:106);\ - \n c107: change-color(black,$red:107);\ - \n c108: change-color(black,$red:108);\ - \n c109: change-color(black,$red:109);\ - \n c110: change-color(black,$red:110);\ - \n c111: change-color(black,$red:111);\ - \n c112: change-color(black,$red:112);\ - \n c113: change-color(black,$red:113);\ - \n c114: change-color(black,$red:114);\ - \n c115: change-color(black,$red:115);\ - \n c116: change-color(black,$red:116);\ - \n c117: change-color(black,$red:117);\ - \n c118: change-color(black,$red:118);\ - \n c119: change-color(black,$red:119);\ - \n c120: change-color(black,$red:120);\ - \n c121: change-color(black,$red:121);\ - \n c122: change-color(black,$red:122);\ - \n c123: change-color(black,$red:123);\ - \n c124: change-color(black,$red:124);\ - \n c125: change-color(black,$red:125);\ - \n c126: change-color(black,$red:126);\ - \n c127: change-color(black,$red:127);\ - \n c128: change-color(black,$red:128);\ - \n c129: change-color(black,$red:129);\ - \n c130: change-color(black,$red:130);\ - \n c131: change-color(black,$red:131);\ - \n c132: change-color(black,$red:132);\ - \n c133: change-color(black,$red:133);\ - \n c134: change-color(black,$red:134);\ - \n c135: change-color(black,$red:135);\ - \n c136: change-color(black,$red:136);\ - \n c137: change-color(black,$red:137);\ - \n c138: change-color(black,$red:138);\ - \n c139: change-color(black,$red:139);\ - \n c140: change-color(black,$red:140);\ - \n c141: change-color(black,$red:141);\ - \n c142: change-color(black,$red:142);\ - \n c143: change-color(black,$red:143);\ - \n c144: change-color(black,$red:144);\ - \n c145: change-color(black,$red:145);\ - \n c146: change-color(black,$red:146);\ - \n c147: change-color(black,$red:147);\ - \n c148: change-color(black,$red:148);\ - \n c149: change-color(black,$red:149);\ - \n c150: change-color(black,$red:150);\ - \n c151: change-color(black,$red:151);\ - \n c152: change-color(black,$red:152);\ - \n c153: change-color(black,$red:153);\ - \n c154: change-color(black,$red:154);\ - \n c155: change-color(black,$red:155);\ - \n c156: change-color(black,$red:156);\ - \n c157: change-color(black,$red:157);\ - \n c158: change-color(black,$red:158);\ - \n c159: change-color(black,$red:159);\ - \n c160: change-color(black,$red:160);\ - \n c161: change-color(black,$red:161);\ - \n c162: change-color(black,$red:162);\ - \n c163: change-color(black,$red:163);\ - \n c164: change-color(black,$red:164);\ - \n c165: change-color(black,$red:165);\ - \n c166: change-color(black,$red:166);\ - \n c167: change-color(black,$red:167);\ - \n c168: change-color(black,$red:168);\ - \n c169: change-color(black,$red:169);\ - \n c170: change-color(black,$red:170);\ - \n c171: change-color(black,$red:171);\ - \n c172: change-color(black,$red:172);\ - \n c173: change-color(black,$red:173);\ - \n c174: change-color(black,$red:174);\ - \n c175: change-color(black,$red:175);\ - \n c176: change-color(black,$red:176);\ - \n c177: change-color(black,$red:177);\ - \n c178: change-color(black,$red:178);\ - \n c179: change-color(black,$red:179);\ - \n c180: change-color(black,$red:180);\ - \n c181: change-color(black,$red:181);\ - \n c182: change-color(black,$red:182);\ - \n c183: change-color(black,$red:183);\ - \n c184: change-color(black,$red:184);\ - \n c185: change-color(black,$red:185);\ - \n c186: change-color(black,$red:186);\ - \n c187: change-color(black,$red:187);\ - \n c188: change-color(black,$red:188);\ - \n c189: change-color(black,$red:189);\ - \n c190: change-color(black,$red:190);\ - \n c191: change-color(black,$red:191);\ - \n c192: change-color(black,$red:192);\ - \n c193: change-color(black,$red:193);\ - \n c194: change-color(black,$red:194);\ - \n c195: change-color(black,$red:195);\ - \n c196: change-color(black,$red:196);\ - \n c197: change-color(black,$red:197);\ - \n c198: change-color(black,$red:198);\ - \n c199: change-color(black,$red:199);\ - \n c200: change-color(black,$red:200);\ - \n c201: change-color(black,$red:201);\ - \n c202: change-color(black,$red:202);\ - \n c203: change-color(black,$red:203);\ - \n c204: change-color(black,$red:204);\ - \n c205: change-color(black,$red:205);\ - \n c206: change-color(black,$red:206);\ - \n c207: change-color(black,$red:207);\ - \n c208: change-color(black,$red:208);\ - \n c209: change-color(black,$red:209);\ - \n c210: change-color(black,$red:210);\ - \n c211: change-color(black,$red:211);\ - \n c212: change-color(black,$red:212);\ - \n c213: change-color(black,$red:213);\ - \n c214: change-color(black,$red:214);\ - \n c215: change-color(black,$red:215);\ - \n c216: change-color(black,$red:216);\ - \n c217: change-color(black,$red:217);\ - \n c218: change-color(black,$red:218);\ - \n c219: change-color(black,$red:219);\ - \n c220: change-color(black,$red:220);\ - \n c221: change-color(black,$red:221);\ - \n c222: change-color(black,$red:222);\ - \n c223: change-color(black,$red:223);\ - \n c224: change-color(black,$red:224);\ - \n c225: change-color(black,$red:225);\ - \n c226: change-color(black,$red:226);\ - \n c227: change-color(black,$red:227);\ - \n c228: change-color(black,$red:228);\ - \n c229: change-color(black,$red:229);\ - \n c230: change-color(black,$red:230);\ - \n c231: change-color(black,$red:231);\ - \n c232: change-color(black,$red:232);\ - \n c233: change-color(black,$red:233);\ - \n c234: change-color(black,$red:234);\ - \n c235: change-color(black,$red:235);\ - \n c236: change-color(black,$red:236);\ - \n c237: change-color(black,$red:237);\ - \n c238: change-color(black,$red:238);\ - \n c239: change-color(black,$red:239);\ - \n c240: change-color(black,$red:240);\ - \n c241: change-color(black,$red:241);\ - \n c242: change-color(black,$red:242);\ - \n c243: change-color(black,$red:243);\ - \n c244: change-color(black,$red:244);\ - \n c245: change-color(black,$red:245);\ - \n c246: change-color(black,$red:246);\ - \n c247: change-color(black,$red:247);\ - \n c248: change-color(black,$red:248);\ - \n c249: change-color(black,$red:249);\ - \n c250: change-color(black,$red:250);\ - \n c251: change-color(black,$red:251);\ - \n c252: change-color(black,$red:252);\ - \n c253: change-color(black,$red:253);\ - \n c254: change-color(black,$red:254);\ - \n c255: change-color(black,$red:255);\ + \n c0: color.change(black,$red:0);\ + \n c1: color.change(black,$red:1);\ + \n c2: color.change(black,$red:2);\ + \n c3: color.change(black,$red:3);\ + \n c4: color.change(black,$red:4);\ + \n c5: color.change(black,$red:5);\ + \n c6: color.change(black,$red:6);\ + \n c7: color.change(black,$red:7);\ + \n c8: color.change(black,$red:8);\ + \n c9: color.change(black,$red:9);\ + \n c10: color.change(black,$red:10);\ + \n c11: color.change(black,$red:11);\ + \n c12: color.change(black,$red:12);\ + \n c13: color.change(black,$red:13);\ + \n c14: color.change(black,$red:14);\ + \n c15: color.change(black,$red:15);\ + \n c16: color.change(black,$red:16);\ + \n c17: color.change(black,$red:17);\ + \n c18: color.change(black,$red:18);\ + \n c19: color.change(black,$red:19);\ + \n c20: color.change(black,$red:20);\ + \n c21: color.change(black,$red:21);\ + \n c22: color.change(black,$red:22);\ + \n c23: color.change(black,$red:23);\ + \n c24: color.change(black,$red:24);\ + \n c25: color.change(black,$red:25);\ + \n c26: color.change(black,$red:26);\ + \n c27: color.change(black,$red:27);\ + \n c28: color.change(black,$red:28);\ + \n c29: color.change(black,$red:29);\ + \n c30: color.change(black,$red:30);\ + \n c31: color.change(black,$red:31);\ + \n c32: color.change(black,$red:32);\ + \n c33: color.change(black,$red:33);\ + \n c34: color.change(black,$red:34);\ + \n c35: color.change(black,$red:35);\ + \n c36: color.change(black,$red:36);\ + \n c37: color.change(black,$red:37);\ + \n c38: color.change(black,$red:38);\ + \n c39: color.change(black,$red:39);\ + \n c40: color.change(black,$red:40);\ + \n c41: color.change(black,$red:41);\ + \n c42: color.change(black,$red:42);\ + \n c43: color.change(black,$red:43);\ + \n c44: color.change(black,$red:44);\ + \n c45: color.change(black,$red:45);\ + \n c46: color.change(black,$red:46);\ + \n c47: color.change(black,$red:47);\ + \n c48: color.change(black,$red:48);\ + \n c49: color.change(black,$red:49);\ + \n c50: color.change(black,$red:50);\ + \n c51: color.change(black,$red:51);\ + \n c52: color.change(black,$red:52);\ + \n c53: color.change(black,$red:53);\ + \n c54: color.change(black,$red:54);\ + \n c55: color.change(black,$red:55);\ + \n c56: color.change(black,$red:56);\ + \n c57: color.change(black,$red:57);\ + \n c58: color.change(black,$red:58);\ + \n c59: color.change(black,$red:59);\ + \n c60: color.change(black,$red:60);\ + \n c61: color.change(black,$red:61);\ + \n c62: color.change(black,$red:62);\ + \n c63: color.change(black,$red:63);\ + \n c64: color.change(black,$red:64);\ + \n c65: color.change(black,$red:65);\ + \n c66: color.change(black,$red:66);\ + \n c67: color.change(black,$red:67);\ + \n c68: color.change(black,$red:68);\ + \n c69: color.change(black,$red:69);\ + \n c70: color.change(black,$red:70);\ + \n c71: color.change(black,$red:71);\ + \n c72: color.change(black,$red:72);\ + \n c73: color.change(black,$red:73);\ + \n c74: color.change(black,$red:74);\ + \n c75: color.change(black,$red:75);\ + \n c76: color.change(black,$red:76);\ + \n c77: color.change(black,$red:77);\ + \n c78: color.change(black,$red:78);\ + \n c79: color.change(black,$red:79);\ + \n c80: color.change(black,$red:80);\ + \n c81: color.change(black,$red:81);\ + \n c82: color.change(black,$red:82);\ + \n c83: color.change(black,$red:83);\ + \n c84: color.change(black,$red:84);\ + \n c85: color.change(black,$red:85);\ + \n c86: color.change(black,$red:86);\ + \n c87: color.change(black,$red:87);\ + \n c88: color.change(black,$red:88);\ + \n c89: color.change(black,$red:89);\ + \n c90: color.change(black,$red:90);\ + \n c91: color.change(black,$red:91);\ + \n c92: color.change(black,$red:92);\ + \n c93: color.change(black,$red:93);\ + \n c94: color.change(black,$red:94);\ + \n c95: color.change(black,$red:95);\ + \n c96: color.change(black,$red:96);\ + \n c97: color.change(black,$red:97);\ + \n c98: color.change(black,$red:98);\ + \n c99: color.change(black,$red:99);\ + \n c100: color.change(black,$red:100);\ + \n c101: color.change(black,$red:101);\ + \n c102: color.change(black,$red:102);\ + \n c103: color.change(black,$red:103);\ + \n c104: color.change(black,$red:104);\ + \n c105: color.change(black,$red:105);\ + \n c106: color.change(black,$red:106);\ + \n c107: color.change(black,$red:107);\ + \n c108: color.change(black,$red:108);\ + \n c109: color.change(black,$red:109);\ + \n c110: color.change(black,$red:110);\ + \n c111: color.change(black,$red:111);\ + \n c112: color.change(black,$red:112);\ + \n c113: color.change(black,$red:113);\ + \n c114: color.change(black,$red:114);\ + \n c115: color.change(black,$red:115);\ + \n c116: color.change(black,$red:116);\ + \n c117: color.change(black,$red:117);\ + \n c118: color.change(black,$red:118);\ + \n c119: color.change(black,$red:119);\ + \n c120: color.change(black,$red:120);\ + \n c121: color.change(black,$red:121);\ + \n c122: color.change(black,$red:122);\ + \n c123: color.change(black,$red:123);\ + \n c124: color.change(black,$red:124);\ + \n c125: color.change(black,$red:125);\ + \n c126: color.change(black,$red:126);\ + \n c127: color.change(black,$red:127);\ + \n c128: color.change(black,$red:128);\ + \n c129: color.change(black,$red:129);\ + \n c130: color.change(black,$red:130);\ + \n c131: color.change(black,$red:131);\ + \n c132: color.change(black,$red:132);\ + \n c133: color.change(black,$red:133);\ + \n c134: color.change(black,$red:134);\ + \n c135: color.change(black,$red:135);\ + \n c136: color.change(black,$red:136);\ + \n c137: color.change(black,$red:137);\ + \n c138: color.change(black,$red:138);\ + \n c139: color.change(black,$red:139);\ + \n c140: color.change(black,$red:140);\ + \n c141: color.change(black,$red:141);\ + \n c142: color.change(black,$red:142);\ + \n c143: color.change(black,$red:143);\ + \n c144: color.change(black,$red:144);\ + \n c145: color.change(black,$red:145);\ + \n c146: color.change(black,$red:146);\ + \n c147: color.change(black,$red:147);\ + \n c148: color.change(black,$red:148);\ + \n c149: color.change(black,$red:149);\ + \n c150: color.change(black,$red:150);\ + \n c151: color.change(black,$red:151);\ + \n c152: color.change(black,$red:152);\ + \n c153: color.change(black,$red:153);\ + \n c154: color.change(black,$red:154);\ + \n c155: color.change(black,$red:155);\ + \n c156: color.change(black,$red:156);\ + \n c157: color.change(black,$red:157);\ + \n c158: color.change(black,$red:158);\ + \n c159: color.change(black,$red:159);\ + \n c160: color.change(black,$red:160);\ + \n c161: color.change(black,$red:161);\ + \n c162: color.change(black,$red:162);\ + \n c163: color.change(black,$red:163);\ + \n c164: color.change(black,$red:164);\ + \n c165: color.change(black,$red:165);\ + \n c166: color.change(black,$red:166);\ + \n c167: color.change(black,$red:167);\ + \n c168: color.change(black,$red:168);\ + \n c169: color.change(black,$red:169);\ + \n c170: color.change(black,$red:170);\ + \n c171: color.change(black,$red:171);\ + \n c172: color.change(black,$red:172);\ + \n c173: color.change(black,$red:173);\ + \n c174: color.change(black,$red:174);\ + \n c175: color.change(black,$red:175);\ + \n c176: color.change(black,$red:176);\ + \n c177: color.change(black,$red:177);\ + \n c178: color.change(black,$red:178);\ + \n c179: color.change(black,$red:179);\ + \n c180: color.change(black,$red:180);\ + \n c181: color.change(black,$red:181);\ + \n c182: color.change(black,$red:182);\ + \n c183: color.change(black,$red:183);\ + \n c184: color.change(black,$red:184);\ + \n c185: color.change(black,$red:185);\ + \n c186: color.change(black,$red:186);\ + \n c187: color.change(black,$red:187);\ + \n c188: color.change(black,$red:188);\ + \n c189: color.change(black,$red:189);\ + \n c190: color.change(black,$red:190);\ + \n c191: color.change(black,$red:191);\ + \n c192: color.change(black,$red:192);\ + \n c193: color.change(black,$red:193);\ + \n c194: color.change(black,$red:194);\ + \n c195: color.change(black,$red:195);\ + \n c196: color.change(black,$red:196);\ + \n c197: color.change(black,$red:197);\ + \n c198: color.change(black,$red:198);\ + \n c199: color.change(black,$red:199);\ + \n c200: color.change(black,$red:200);\ + \n c201: color.change(black,$red:201);\ + \n c202: color.change(black,$red:202);\ + \n c203: color.change(black,$red:203);\ + \n c204: color.change(black,$red:204);\ + \n c205: color.change(black,$red:205);\ + \n c206: color.change(black,$red:206);\ + \n c207: color.change(black,$red:207);\ + \n c208: color.change(black,$red:208);\ + \n c209: color.change(black,$red:209);\ + \n c210: color.change(black,$red:210);\ + \n c211: color.change(black,$red:211);\ + \n c212: color.change(black,$red:212);\ + \n c213: color.change(black,$red:213);\ + \n c214: color.change(black,$red:214);\ + \n c215: color.change(black,$red:215);\ + \n c216: color.change(black,$red:216);\ + \n c217: color.change(black,$red:217);\ + \n c218: color.change(black,$red:218);\ + \n c219: color.change(black,$red:219);\ + \n c220: color.change(black,$red:220);\ + \n c221: color.change(black,$red:221);\ + \n c222: color.change(black,$red:222);\ + \n c223: color.change(black,$red:223);\ + \n c224: color.change(black,$red:224);\ + \n c225: color.change(black,$red:225);\ + \n c226: color.change(black,$red:226);\ + \n c227: color.change(black,$red:227);\ + \n c228: color.change(black,$red:228);\ + \n c229: color.change(black,$red:229);\ + \n c230: color.change(black,$red:230);\ + \n c231: color.change(black,$red:231);\ + \n c232: color.change(black,$red:232);\ + \n c233: color.change(black,$red:233);\ + \n c234: color.change(black,$red:234);\ + \n c235: color.change(black,$red:235);\ + \n c236: color.change(black,$red:236);\ + \n c237: color.change(black,$red:237);\ + \n c238: color.change(black,$red:238);\ + \n c239: color.change(black,$red:239);\ + \n c240: color.change(black,$red:240);\ + \n c241: color.change(black,$red:241);\ + \n c242: color.change(black,$red:242);\ + \n c243: color.change(black,$red:243);\ + \n c244: color.change(black,$red:244);\ + \n c245: color.change(black,$red:245);\ + \n c246: color.change(black,$red:246);\ + \n c247: color.change(black,$red:247);\ + \n c248: color.change(black,$red:248);\ + \n c249: color.change(black,$red:249);\ + \n c250: color.change(black,$red:250);\ + \n c251: color.change(black,$red:251);\ + \n c252: color.change(black,$red:252);\ + \n c253: color.change(black,$red:253);\ + \n c254: color.change(black,$red:254);\ + \n c255: color.change(black,$red:255);\ \n // c256: change-color(black,$red:256);\ \n}\n"), "foo {\ diff --git a/rsass/tests/spec/libsass/color_functions/other/change_color/s.rs b/rsass/tests/spec/libsass/color_functions/other/change_color/s.rs index 3462ee00b..d3bd4dfa8 100644 --- a/rsass/tests/spec/libsass/color_functions/other/change_color/s.rs +++ b/rsass/tests/spec/libsass/color_functions/other/change_color/s.rs @@ -6,214 +6,216 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( - runner().ok("foo {\ + runner().ok("@use \"sass:color\";\ + \nfoo {\ \n // c-1: change-color(red,$saturation:-1%);\ - \n c0: change-color(red,$saturation:0%);\ - \n c1: change-color(red,$saturation:1%);\ - \n c2: change-color(red,$saturation:2%);\ - \n c3: change-color(red,$saturation:3%);\ - \n c4: change-color(red,$saturation:4%);\ - \n c5: change-color(red,$saturation:5%);\ - \n c6: change-color(red,$saturation:6%);\ - \n c7: change-color(red,$saturation:7%);\ - \n c8: change-color(red,$saturation:8%);\ - \n c9: change-color(red,$saturation:9%);\ - \n c10: change-color(red,$saturation:10%);\ - \n c11: change-color(red,$saturation:11%);\ - \n c12: change-color(red,$saturation:12%);\ - \n c13: change-color(red,$saturation:13%);\ - \n c14: change-color(red,$saturation:14%);\ - \n c15: change-color(red,$saturation:15%);\ - \n c16: change-color(red,$saturation:16%);\ - \n c17: change-color(red,$saturation:17%);\ - \n c18: change-color(red,$saturation:18%);\ - \n c19: change-color(red,$saturation:19%);\ - \n c20: change-color(red,$saturation:20%);\ - \n c21: change-color(red,$saturation:21%);\ - \n c22: change-color(red,$saturation:22%);\ - \n c23: change-color(red,$saturation:23%);\ - \n c24: change-color(red,$saturation:24%);\ - \n c25: change-color(red,$saturation:25%);\ - \n c26: change-color(red,$saturation:26%);\ - \n c27: change-color(red,$saturation:27%);\ - \n c28: change-color(red,$saturation:28%);\ - \n c29: change-color(red,$saturation:29%);\ - \n c30: change-color(red,$saturation:30%);\ - \n c31: change-color(red,$saturation:31%);\ - \n c32: change-color(red,$saturation:32%);\ - \n c33: change-color(red,$saturation:33%);\ - \n c34: change-color(red,$saturation:34%);\ - \n c35: change-color(red,$saturation:35%);\ - \n c36: change-color(red,$saturation:36%);\ - \n c37: change-color(red,$saturation:37%);\ - \n c38: change-color(red,$saturation:38%);\ - \n c39: change-color(red,$saturation:39%);\ - \n c40: change-color(red,$saturation:40%);\ - \n c41: change-color(red,$saturation:41%);\ - \n c42: change-color(red,$saturation:42%);\ - \n c43: change-color(red,$saturation:43%);\ - \n c44: change-color(red,$saturation:44%);\ - \n c45: change-color(red,$saturation:45%);\ - \n c46: change-color(red,$saturation:46%);\ - \n c47: change-color(red,$saturation:47%);\ - \n c48: change-color(red,$saturation:48%);\ - \n c49: change-color(red,$saturation:49%);\ - \n c50: change-color(red,$saturation:50%);\ - \n c51: change-color(red,$saturation:51%);\ - \n c52: change-color(red,$saturation:52%);\ - \n c53: change-color(red,$saturation:53%);\ - \n c54: change-color(red,$saturation:54%);\ - \n c55: change-color(red,$saturation:55%);\ - \n c56: change-color(red,$saturation:56%);\ - \n c57: change-color(red,$saturation:57%);\ - \n c58: change-color(red,$saturation:58%);\ - \n c59: change-color(red,$saturation:59%);\ - \n c60: change-color(red,$saturation:60%);\ - \n c61: change-color(red,$saturation:61%);\ - \n c62: change-color(red,$saturation:62%);\ - \n c63: change-color(red,$saturation:63%);\ - \n c64: change-color(red,$saturation:64%);\ - \n c65: change-color(red,$saturation:65%);\ - \n c66: change-color(red,$saturation:66%);\ - \n c67: change-color(red,$saturation:67%);\ - \n c68: change-color(red,$saturation:68%);\ - \n c69: change-color(red,$saturation:69%);\ - \n c70: change-color(red,$saturation:70%);\ - \n c71: change-color(red,$saturation:71%);\ - \n c72: change-color(red,$saturation:72%);\ - \n c73: change-color(red,$saturation:73%);\ - \n c74: change-color(red,$saturation:74%);\ - \n c75: change-color(red,$saturation:75%);\ - \n c76: change-color(red,$saturation:76%);\ - \n c77: change-color(red,$saturation:77%);\ - \n c78: change-color(red,$saturation:78%);\ - \n c79: change-color(red,$saturation:79%);\ - \n c80: change-color(red,$saturation:80%);\ - \n c81: change-color(red,$saturation:81%);\ - \n c82: change-color(red,$saturation:82%);\ - \n c83: change-color(red,$saturation:83%);\ - \n c84: change-color(red,$saturation:84%);\ - \n c85: change-color(red,$saturation:85%);\ - \n c86: change-color(red,$saturation:86%);\ - \n c87: change-color(red,$saturation:87%);\ - \n c88: change-color(red,$saturation:88%);\ - \n c89: change-color(red,$saturation:89%);\ - \n c90: change-color(red,$saturation:90%);\ - \n c91: change-color(red,$saturation:91%);\ - \n c92: change-color(red,$saturation:92%);\ - \n c93: change-color(red,$saturation:93%);\ - \n c94: change-color(red,$saturation:94%);\ - \n c95: change-color(red,$saturation:95%);\ - \n c96: change-color(red,$saturation:96%);\ - \n c97: change-color(red,$saturation:97%);\ - \n c98: change-color(red,$saturation:98%);\ - \n c99: change-color(red,$saturation:99%);\ - \n c100: change-color(red,$saturation:100%);\ + \n c0: color.change(red,$saturation:0%);\ + \n c1: color.change(red,$saturation:1%);\ + \n c2: color.change(red,$saturation:2%);\ + \n c3: color.change(red,$saturation:3%);\ + \n c4: color.change(red,$saturation:4%);\ + \n c5: color.change(red,$saturation:5%);\ + \n c6: color.change(red,$saturation:6%);\ + \n c7: color.change(red,$saturation:7%);\ + \n c8: color.change(red,$saturation:8%);\ + \n c9: color.change(red,$saturation:9%);\ + \n c10: color.change(red,$saturation:10%);\ + \n c11: color.change(red,$saturation:11%);\ + \n c12: color.change(red,$saturation:12%);\ + \n c13: color.change(red,$saturation:13%);\ + \n c14: color.change(red,$saturation:14%);\ + \n c15: color.change(red,$saturation:15%);\ + \n c16: color.change(red,$saturation:16%);\ + \n c17: color.change(red,$saturation:17%);\ + \n c18: color.change(red,$saturation:18%);\ + \n c19: color.change(red,$saturation:19%);\ + \n c20: color.change(red,$saturation:20%);\ + \n c21: color.change(red,$saturation:21%);\ + \n c22: color.change(red,$saturation:22%);\ + \n c23: color.change(red,$saturation:23%);\ + \n c24: color.change(red,$saturation:24%);\ + \n c25: color.change(red,$saturation:25%);\ + \n c26: color.change(red,$saturation:26%);\ + \n c27: color.change(red,$saturation:27%);\ + \n c28: color.change(red,$saturation:28%);\ + \n c29: color.change(red,$saturation:29%);\ + \n c30: color.change(red,$saturation:30%);\ + \n c31: color.change(red,$saturation:31%);\ + \n c32: color.change(red,$saturation:32%);\ + \n c33: color.change(red,$saturation:33%);\ + \n c34: color.change(red,$saturation:34%);\ + \n c35: color.change(red,$saturation:35%);\ + \n c36: color.change(red,$saturation:36%);\ + \n c37: color.change(red,$saturation:37%);\ + \n c38: color.change(red,$saturation:38%);\ + \n c39: color.change(red,$saturation:39%);\ + \n c40: color.change(red,$saturation:40%);\ + \n c41: color.change(red,$saturation:41%);\ + \n c42: color.change(red,$saturation:42%);\ + \n c43: color.change(red,$saturation:43%);\ + \n c44: color.change(red,$saturation:44%);\ + \n c45: color.change(red,$saturation:45%);\ + \n c46: color.change(red,$saturation:46%);\ + \n c47: color.change(red,$saturation:47%);\ + \n c48: color.change(red,$saturation:48%);\ + \n c49: color.change(red,$saturation:49%);\ + \n c50: color.change(red,$saturation:50%);\ + \n c51: color.change(red,$saturation:51%);\ + \n c52: color.change(red,$saturation:52%);\ + \n c53: color.change(red,$saturation:53%);\ + \n c54: color.change(red,$saturation:54%);\ + \n c55: color.change(red,$saturation:55%);\ + \n c56: color.change(red,$saturation:56%);\ + \n c57: color.change(red,$saturation:57%);\ + \n c58: color.change(red,$saturation:58%);\ + \n c59: color.change(red,$saturation:59%);\ + \n c60: color.change(red,$saturation:60%);\ + \n c61: color.change(red,$saturation:61%);\ + \n c62: color.change(red,$saturation:62%);\ + \n c63: color.change(red,$saturation:63%);\ + \n c64: color.change(red,$saturation:64%);\ + \n c65: color.change(red,$saturation:65%);\ + \n c66: color.change(red,$saturation:66%);\ + \n c67: color.change(red,$saturation:67%);\ + \n c68: color.change(red,$saturation:68%);\ + \n c69: color.change(red,$saturation:69%);\ + \n c70: color.change(red,$saturation:70%);\ + \n c71: color.change(red,$saturation:71%);\ + \n c72: color.change(red,$saturation:72%);\ + \n c73: color.change(red,$saturation:73%);\ + \n c74: color.change(red,$saturation:74%);\ + \n c75: color.change(red,$saturation:75%);\ + \n c76: color.change(red,$saturation:76%);\ + \n c77: color.change(red,$saturation:77%);\ + \n c78: color.change(red,$saturation:78%);\ + \n c79: color.change(red,$saturation:79%);\ + \n c80: color.change(red,$saturation:80%);\ + \n c81: color.change(red,$saturation:81%);\ + \n c82: color.change(red,$saturation:82%);\ + \n c83: color.change(red,$saturation:83%);\ + \n c84: color.change(red,$saturation:84%);\ + \n c85: color.change(red,$saturation:85%);\ + \n c86: color.change(red,$saturation:86%);\ + \n c87: color.change(red,$saturation:87%);\ + \n c88: color.change(red,$saturation:88%);\ + \n c89: color.change(red,$saturation:89%);\ + \n c90: color.change(red,$saturation:90%);\ + \n c91: color.change(red,$saturation:91%);\ + \n c92: color.change(red,$saturation:92%);\ + \n c93: color.change(red,$saturation:93%);\ + \n c94: color.change(red,$saturation:94%);\ + \n c95: color.change(red,$saturation:95%);\ + \n c96: color.change(red,$saturation:96%);\ + \n c97: color.change(red,$saturation:97%);\ + \n c98: color.change(red,$saturation:98%);\ + \n c99: color.change(red,$saturation:99%);\ + \n c100: color.change(red,$saturation:100%);\ \n // c101: change-color(red,$saturation:101%);\ \n}\n"), "foo {\ - \n c0: gray;\ - \n c1: #817e7e;\ - \n c2: #827d7d;\ - \n c3: #837c7c;\ - \n c4: #857a7a;\ - \n c5: #867979;\ - \n c6: #877878;\ - \n c7: #887777;\ - \n c8: #8a7575;\ - \n c9: #8b7474;\ - \n c10: #8c7373;\ - \n c11: #8e7171;\ - \n c12: #8f7070;\ - \n c13: #906f6f;\ - \n c14: #916e6e;\ - \n c15: #936c6c;\ - \n c16: #946b6b;\ - \n c17: #956a6a;\ - \n c18: #966969;\ - \n c19: #986767;\ + \n c0: rgb(127.5, 127.5, 127.5);\ + \n c1: rgb(128.775, 126.225, 126.225);\ + \n c2: rgb(130.05, 124.95, 124.95);\ + \n c3: rgb(131.325, 123.675, 123.675);\ + \n c4: rgb(132.6, 122.4, 122.4);\ + \n c5: rgb(133.875, 121.125, 121.125);\ + \n c6: rgb(135.15, 119.85, 119.85);\ + \n c7: rgb(136.425, 118.575, 118.575);\ + \n c8: rgb(137.7, 117.3, 117.3);\ + \n c9: rgb(138.975, 116.025, 116.025);\ + \n c10: rgb(140.25, 114.75, 114.75);\ + \n c11: rgb(141.525, 113.475, 113.475);\ + \n c12: rgb(142.8, 112.2, 112.2);\ + \n c13: rgb(144.075, 110.925, 110.925);\ + \n c14: rgb(145.35, 109.65, 109.65);\ + \n c15: rgb(146.625, 108.375, 108.375);\ + \n c16: rgb(147.9, 107.1, 107.1);\ + \n c17: rgb(149.175, 105.825, 105.825);\ + \n c18: rgb(150.45, 104.55, 104.55);\ + \n c19: rgb(151.725, 103.275, 103.275);\ \n c20: #996666;\ - \n c21: #9a6565;\ - \n c22: #9c6363;\ - \n c23: #9d6262;\ - \n c24: #9e6161;\ - \n c25: #9f6060;\ - \n c26: #a15e5e;\ - \n c27: #a25d5d;\ - \n c28: #a35c5c;\ - \n c29: #a45b5b;\ - \n c30: #a65959;\ - \n c31: #a75858;\ - \n c32: #a85757;\ - \n c33: #aa5555;\ - \n c34: #ab5454;\ - \n c35: #ac5353;\ - \n c36: #ad5252;\ - \n c37: #af5050;\ - \n c38: #b04f4f;\ - \n c39: #b14e4e;\ - \n c40: #b34d4d;\ - \n c41: #b44b4b;\ - \n c42: #b54a4a;\ - \n c43: #b64949;\ - \n c44: #b84747;\ - \n c45: #b94646;\ - \n c46: #ba4545;\ - \n c47: #bb4444;\ - \n c48: #bd4242;\ - \n c49: #be4141;\ - \n c50: #bf4040;\ - \n c51: #c13e3e;\ - \n c52: #c23d3d;\ - \n c53: #c33c3c;\ - \n c54: #c43b3b;\ - \n c55: #c63939;\ - \n c56: #c73838;\ - \n c57: #c83737;\ - \n c58: #c93636;\ - \n c59: #cb3434;\ + \n c21: rgb(154.275, 100.725, 100.725);\ + \n c22: rgb(155.55, 99.45, 99.45);\ + \n c23: rgb(156.825, 98.175, 98.175);\ + \n c24: rgb(158.1, 96.9, 96.9);\ + \n c25: rgb(159.375, 95.625, 95.625);\ + \n c26: rgb(160.65, 94.35, 94.35);\ + \n c27: rgb(161.925, 93.075, 93.075);\ + \n c28: rgb(163.2, 91.8, 91.8);\ + \n c29: rgb(164.475, 90.525, 90.525);\ + \n c30: rgb(165.75, 89.25, 89.25);\ + \n c31: rgb(167.025, 87.975, 87.975);\ + \n c32: rgb(168.3, 86.7, 86.7);\ + \n c33: rgb(169.575, 85.425, 85.425);\ + \n c34: rgb(170.85, 84.15, 84.15);\ + \n c35: rgb(172.125, 82.875, 82.875);\ + \n c36: rgb(173.4, 81.6, 81.6);\ + \n c37: rgb(174.675, 80.325, 80.325);\ + \n c38: rgb(175.95, 79.05, 79.05);\ + \n c39: rgb(177.225, 77.775, 77.775);\ + \n c40: rgb(178.5, 76.5, 76.5);\ + \n c41: rgb(179.775, 75.225, 75.225);\ + \n c42: rgb(181.05, 73.95, 73.95);\ + \n c43: rgb(182.325, 72.675, 72.675);\ + \n c44: rgb(183.6, 71.4, 71.4);\ + \n c45: rgb(184.875, 70.125, 70.125);\ + \n c46: rgb(186.15, 68.85, 68.85);\ + \n c47: rgb(187.425, 67.575, 67.575);\ + \n c48: rgb(188.7, 66.3, 66.3);\ + \n c49: rgb(189.975, 65.025, 65.025);\ + \n c50: rgb(191.25, 63.75, 63.75);\ + \n c51: rgb(192.525, 62.475, 62.475);\ + \n c52: rgb(193.8, 61.2, 61.2);\ + \n c53: rgb(195.075, 59.925, 59.925);\ + \n c54: rgb(196.35, 58.65, 58.65);\ + \n c55: rgb(197.625, 57.375, 57.375);\ + \n c56: rgb(198.9, 56.1, 56.1);\ + \n c57: rgb(200.175, 54.825, 54.825);\ + \n c58: rgb(201.45, 53.55, 53.55);\ + \n c59: rgb(202.725, 52.275, 52.275);\ \n c60: #cc3333;\ - \n c61: #cd3232;\ - \n c62: #cf3030;\ - \n c63: #d02f2f;\ - \n c64: #d12e2e;\ - \n c65: #d22d2d;\ - \n c66: #d42b2b;\ - \n c67: #d52a2a;\ - \n c68: #d62929;\ - \n c69: #d72828;\ - \n c70: #d92626;\ - \n c71: #da2525;\ - \n c72: #db2424;\ - \n c73: #dd2222;\ - \n c74: #de2121;\ - \n c75: #df2020;\ - \n c76: #e01f1f;\ - \n c77: #e21d1d;\ - \n c78: #e31c1c;\ - \n c79: #e41b1b;\ - \n c80: #e61a1a;\ - \n c81: #e71818;\ - \n c82: #e81717;\ - \n c83: #e91616;\ - \n c84: #eb1414;\ - \n c85: #ec1313;\ - \n c86: #ed1212;\ - \n c87: #ee1111;\ - \n c88: #f00f0f;\ - \n c89: #f10e0e;\ - \n c90: #f20d0d;\ - \n c91: #f40b0b;\ - \n c92: #f50a0a;\ - \n c93: #f60909;\ - \n c94: #f70808;\ - \n c95: #f90606;\ - \n c96: #fa0505;\ - \n c97: #fb0404;\ - \n c98: #fc0303;\ - \n c99: #fe0101;\ + \n c61: rgb(205.275, 49.725, 49.725);\ + \n c62: rgb(206.55, 48.45, 48.45);\ + \n c63: rgb(207.825, 47.175, 47.175);\ + \n c64: rgb(209.1, 45.9, 45.9);\ + \n c65: rgb(210.375, 44.625, 44.625);\ + \n c66: rgb(211.65, 43.35, 43.35);\ + \n c67: rgb(212.925, 42.075, 42.075);\ + \n c68: rgb(214.2, 40.8, 40.8);\ + \n c69: rgb(215.475, 39.525, 39.525);\ + \n c70: rgb(216.75, 38.25, 38.25);\ + \n c71: rgb(218.025, 36.975, 36.975);\ + \n c72: rgb(219.3, 35.7, 35.7);\ + \n c73: rgb(220.575, 34.425, 34.425);\ + \n c74: rgb(221.85, 33.15, 33.15);\ + \n c75: rgb(223.125, 31.875, 31.875);\ + \n c76: rgb(224.4, 30.6, 30.6);\ + \n c77: rgb(225.675, 29.325, 29.325);\ + \n c78: rgb(226.95, 28.05, 28.05);\ + \n c79: rgb(228.225, 26.775, 26.775);\ + \n c80: rgb(229.5, 25.5, 25.5);\ + \n c81: rgb(230.775, 24.225, 24.225);\ + \n c82: rgb(232.05, 22.95, 22.95);\ + \n c83: rgb(233.325, 21.675, 21.675);\ + \n c84: rgb(234.6, 20.4, 20.4);\ + \n c85: rgb(235.875, 19.125, 19.125);\ + \n c86: rgb(237.15, 17.85, 17.85);\ + \n c87: rgb(238.425, 16.575, 16.575);\ + \n c88: rgb(239.7, 15.3, 15.3);\ + \n c89: rgb(240.975, 14.025, 14.025);\ + \n c90: rgb(242.25, 12.75, 12.75);\ + \n c91: rgb(243.525, 11.475, 11.475);\ + \n c92: rgb(244.8, 10.2, 10.2);\ + \n c93: rgb(246.075, 8.925, 8.925);\ + \n c94: rgb(247.35, 7.65, 7.65);\ + \n c95: rgb(248.625, 6.375, 6.375);\ + \n c96: rgb(249.9, 5.1, 5.1);\ + \n c97: rgb(251.175, 3.825, 3.825);\ + \n c98: rgb(252.45, 2.55, 2.55);\ + \n c99: rgb(253.725, 1.275, 1.275);\ \n c100: red;\ \n}\n" ); diff --git a/rsass/tests/spec/libsass/color_functions/rgb/rgb/b.rs b/rsass/tests/spec/libsass/color_functions/rgb/rgb/b.rs index 8a2b4ecf8..4aa0fb789 100644 --- a/rsass/tests/spec/libsass/color_functions/rgb/rgb/b.rs +++ b/rsass/tests/spec/libsass/color_functions/rgb/rgb/b.rs @@ -6,6 +6,7 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("foo {\ @@ -636,105 +637,105 @@ fn test() { \nfoo {\ \n c-1: rgb(0, 0, 0);\ \n c0: rgb(0, 0, 0);\ - \n c1: rgb(0, 0, 3);\ - \n c2: rgb(0, 0, 5);\ - \n c3: rgb(0, 0, 8);\ - \n c4: rgb(0, 0, 10);\ - \n c5: rgb(0, 0, 13);\ - \n c6: rgb(0, 0, 15);\ - \n c7: rgb(0, 0, 18);\ - \n c8: rgb(0, 0, 20);\ - \n c9: rgb(0, 0, 23);\ - \n c10: rgb(0, 0, 26);\ - \n c11: rgb(0, 0, 28);\ - \n c12: rgb(0, 0, 31);\ - \n c13: rgb(0, 0, 33);\ - \n c14: rgb(0, 0, 36);\ - \n c15: rgb(0, 0, 38);\ - \n c16: rgb(0, 0, 41);\ - \n c17: rgb(0, 0, 43);\ - \n c18: rgb(0, 0, 46);\ - \n c19: rgb(0, 0, 48);\ + \n c1: rgb(0, 0, 2.55);\ + \n c2: rgb(0, 0, 5.1);\ + \n c3: rgb(0, 0, 7.65);\ + \n c4: rgb(0, 0, 10.2);\ + \n c5: rgb(0, 0, 12.75);\ + \n c6: rgb(0, 0, 15.3);\ + \n c7: rgb(0, 0, 17.85);\ + \n c8: rgb(0, 0, 20.4);\ + \n c9: rgb(0, 0, 22.95);\ + \n c10: rgb(0, 0, 25.5);\ + \n c11: rgb(0, 0, 28.05);\ + \n c12: rgb(0, 0, 30.6);\ + \n c13: rgb(0, 0, 33.15);\ + \n c14: rgb(0, 0, 35.7);\ + \n c15: rgb(0, 0, 38.25);\ + \n c16: rgb(0, 0, 40.8);\ + \n c17: rgb(0, 0, 43.35);\ + \n c18: rgb(0, 0, 45.9);\ + \n c19: rgb(0, 0, 48.45);\ \n c20: rgb(0, 0, 51);\ - \n c21: rgb(0, 0, 54);\ - \n c22: rgb(0, 0, 56);\ - \n c23: rgb(0, 0, 59);\ - \n c24: rgb(0, 0, 61);\ - \n c25: rgb(0, 0, 64);\ - \n c26: rgb(0, 0, 66);\ - \n c27: rgb(0, 0, 69);\ - \n c28: rgb(0, 0, 71);\ - \n c29: rgb(0, 0, 74);\ - \n c30: rgb(0, 0, 77);\ - \n c31: rgb(0, 0, 79);\ - \n c32: rgb(0, 0, 82);\ - \n c33: rgb(0, 0, 84);\ - \n c34: rgb(0, 0, 87);\ - \n c35: rgb(0, 0, 89);\ - \n c36: rgb(0, 0, 92);\ - \n c37: rgb(0, 0, 94);\ - \n c38: rgb(0, 0, 97);\ - \n c39: rgb(0, 0, 99);\ + \n c21: rgb(0, 0, 53.55);\ + \n c22: rgb(0, 0, 56.1);\ + \n c23: rgb(0, 0, 58.65);\ + \n c24: rgb(0, 0, 61.2);\ + \n c25: rgb(0, 0, 63.75);\ + \n c26: rgb(0, 0, 66.3);\ + \n c27: rgb(0, 0, 68.85);\ + \n c28: rgb(0, 0, 71.4);\ + \n c29: rgb(0, 0, 73.95);\ + \n c30: rgb(0, 0, 76.5);\ + \n c31: rgb(0, 0, 79.05);\ + \n c32: rgb(0, 0, 81.6);\ + \n c33: rgb(0, 0, 84.15);\ + \n c34: rgb(0, 0, 86.7);\ + \n c35: rgb(0, 0, 89.25);\ + \n c36: rgb(0, 0, 91.8);\ + \n c37: rgb(0, 0, 94.35);\ + \n c38: rgb(0, 0, 96.9);\ + \n c39: rgb(0, 0, 99.45);\ \n c40: rgb(0, 0, 102);\ - \n c41: rgb(0, 0, 105);\ - \n c42: rgb(0, 0, 107);\ - \n c43: rgb(0, 0, 110);\ - \n c44: rgb(0, 0, 112);\ - \n c45: rgb(0, 0, 115);\ - \n c46: rgb(0, 0, 117);\ - \n c47: rgb(0, 0, 120);\ - \n c48: rgb(0, 0, 122);\ - \n c49: rgb(0, 0, 125);\ - \n c50: rgb(0, 0, 128);\ - \n c51: rgb(0, 0, 130);\ - \n c52: rgb(0, 0, 133);\ - \n c53: rgb(0, 0, 135);\ - \n c54: rgb(0, 0, 138);\ - \n c55: rgb(0, 0, 140);\ - \n c56: rgb(0, 0, 143);\ - \n c57: rgb(0, 0, 145);\ - \n c58: rgb(0, 0, 148);\ - \n c59: rgb(0, 0, 150);\ + \n c41: rgb(0, 0, 104.55);\ + \n c42: rgb(0, 0, 107.1);\ + \n c43: rgb(0, 0, 109.65);\ + \n c44: rgb(0, 0, 112.2);\ + \n c45: rgb(0, 0, 114.75);\ + \n c46: rgb(0, 0, 117.3);\ + \n c47: rgb(0, 0, 119.85);\ + \n c48: rgb(0, 0, 122.4);\ + \n c49: rgb(0, 0, 124.95);\ + \n c50: rgb(0, 0, 127.5);\ + \n c51: rgb(0, 0, 130.05);\ + \n c52: rgb(0, 0, 132.6);\ + \n c53: rgb(0, 0, 135.15);\ + \n c54: rgb(0, 0, 137.7);\ + \n c55: rgb(0, 0, 140.25);\ + \n c56: rgb(0, 0, 142.8);\ + \n c57: rgb(0, 0, 145.35);\ + \n c58: rgb(0, 0, 147.9);\ + \n c59: rgb(0, 0, 150.45);\ \n c60: rgb(0, 0, 153);\ - \n c61: rgb(0, 0, 156);\ - \n c62: rgb(0, 0, 158);\ - \n c63: rgb(0, 0, 161);\ - \n c64: rgb(0, 0, 163);\ - \n c65: rgb(0, 0, 166);\ - \n c66: rgb(0, 0, 168);\ - \n c67: rgb(0, 0, 171);\ - \n c68: rgb(0, 0, 173);\ - \n c69: rgb(0, 0, 176);\ - \n c70: rgb(0, 0, 179);\ - \n c71: rgb(0, 0, 181);\ - \n c72: rgb(0, 0, 184);\ - \n c73: rgb(0, 0, 186);\ - \n c74: rgb(0, 0, 189);\ - \n c75: rgb(0, 0, 191);\ - \n c76: rgb(0, 0, 194);\ - \n c77: rgb(0, 0, 196);\ - \n c78: rgb(0, 0, 199);\ - \n c79: rgb(0, 0, 201);\ + \n c61: rgb(0, 0, 155.55);\ + \n c62: rgb(0, 0, 158.1);\ + \n c63: rgb(0, 0, 160.65);\ + \n c64: rgb(0, 0, 163.2);\ + \n c65: rgb(0, 0, 165.75);\ + \n c66: rgb(0, 0, 168.3);\ + \n c67: rgb(0, 0, 170.85);\ + \n c68: rgb(0, 0, 173.4);\ + \n c69: rgb(0, 0, 175.95);\ + \n c70: rgb(0, 0, 178.5);\ + \n c71: rgb(0, 0, 181.05);\ + \n c72: rgb(0, 0, 183.6);\ + \n c73: rgb(0, 0, 186.15);\ + \n c74: rgb(0, 0, 188.7);\ + \n c75: rgb(0, 0, 191.25);\ + \n c76: rgb(0, 0, 193.8);\ + \n c77: rgb(0, 0, 196.35);\ + \n c78: rgb(0, 0, 198.9);\ + \n c79: rgb(0, 0, 201.45);\ \n c80: rgb(0, 0, 204);\ - \n c81: rgb(0, 0, 207);\ - \n c82: rgb(0, 0, 209);\ - \n c83: rgb(0, 0, 212);\ - \n c84: rgb(0, 0, 214);\ - \n c85: rgb(0, 0, 217);\ - \n c86: rgb(0, 0, 219);\ - \n c87: rgb(0, 0, 222);\ - \n c88: rgb(0, 0, 224);\ - \n c89: rgb(0, 0, 227);\ - \n c90: rgb(0, 0, 230);\ - \n c91: rgb(0, 0, 232);\ - \n c92: rgb(0, 0, 235);\ - \n c93: rgb(0, 0, 237);\ - \n c94: rgb(0, 0, 240);\ - \n c95: rgb(0, 0, 242);\ - \n c96: rgb(0, 0, 245);\ - \n c97: rgb(0, 0, 247);\ - \n c98: rgb(0, 0, 250);\ - \n c99: rgb(0, 0, 252);\ + \n c81: rgb(0, 0, 206.55);\ + \n c82: rgb(0, 0, 209.1);\ + \n c83: rgb(0, 0, 211.65);\ + \n c84: rgb(0, 0, 214.2);\ + \n c85: rgb(0, 0, 216.75);\ + \n c86: rgb(0, 0, 219.3);\ + \n c87: rgb(0, 0, 221.85);\ + \n c88: rgb(0, 0, 224.4);\ + \n c89: rgb(0, 0, 226.95);\ + \n c90: rgb(0, 0, 229.5);\ + \n c91: rgb(0, 0, 232.05);\ + \n c92: rgb(0, 0, 234.6);\ + \n c93: rgb(0, 0, 237.15);\ + \n c94: rgb(0, 0, 239.7);\ + \n c95: rgb(0, 0, 242.25);\ + \n c96: rgb(0, 0, 244.8);\ + \n c97: rgb(0, 0, 247.35);\ + \n c98: rgb(0, 0, 249.9);\ + \n c99: rgb(0, 0, 252.45);\ \n c100: rgb(0, 0, 255);\ \n c101: rgb(0, 0, 255);\ \n}\n" diff --git a/rsass/tests/spec/libsass/color_functions/rgb/rgb/g.rs b/rsass/tests/spec/libsass/color_functions/rgb/rgb/g.rs index 0f1c5730d..f781f8d3f 100644 --- a/rsass/tests/spec/libsass/color_functions/rgb/rgb/g.rs +++ b/rsass/tests/spec/libsass/color_functions/rgb/rgb/g.rs @@ -6,6 +6,7 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("foo {\ @@ -636,105 +637,105 @@ fn test() { \nfoo {\ \n c-1: rgb(0, 0, 0);\ \n c0: rgb(0, 0, 0);\ - \n c1: rgb(0, 3, 0);\ - \n c2: rgb(0, 5, 0);\ - \n c3: rgb(0, 8, 0);\ - \n c4: rgb(0, 10, 0);\ - \n c5: rgb(0, 13, 0);\ - \n c6: rgb(0, 15, 0);\ - \n c7: rgb(0, 18, 0);\ - \n c8: rgb(0, 20, 0);\ - \n c9: rgb(0, 23, 0);\ - \n c10: rgb(0, 26, 0);\ - \n c11: rgb(0, 28, 0);\ - \n c12: rgb(0, 31, 0);\ - \n c13: rgb(0, 33, 0);\ - \n c14: rgb(0, 36, 0);\ - \n c15: rgb(0, 38, 0);\ - \n c16: rgb(0, 41, 0);\ - \n c17: rgb(0, 43, 0);\ - \n c18: rgb(0, 46, 0);\ - \n c19: rgb(0, 48, 0);\ + \n c1: rgb(0, 2.55, 0);\ + \n c2: rgb(0, 5.1, 0);\ + \n c3: rgb(0, 7.65, 0);\ + \n c4: rgb(0, 10.2, 0);\ + \n c5: rgb(0, 12.75, 0);\ + \n c6: rgb(0, 15.3, 0);\ + \n c7: rgb(0, 17.85, 0);\ + \n c8: rgb(0, 20.4, 0);\ + \n c9: rgb(0, 22.95, 0);\ + \n c10: rgb(0, 25.5, 0);\ + \n c11: rgb(0, 28.05, 0);\ + \n c12: rgb(0, 30.6, 0);\ + \n c13: rgb(0, 33.15, 0);\ + \n c14: rgb(0, 35.7, 0);\ + \n c15: rgb(0, 38.25, 0);\ + \n c16: rgb(0, 40.8, 0);\ + \n c17: rgb(0, 43.35, 0);\ + \n c18: rgb(0, 45.9, 0);\ + \n c19: rgb(0, 48.45, 0);\ \n c20: rgb(0, 51, 0);\ - \n c21: rgb(0, 54, 0);\ - \n c22: rgb(0, 56, 0);\ - \n c23: rgb(0, 59, 0);\ - \n c24: rgb(0, 61, 0);\ - \n c25: rgb(0, 64, 0);\ - \n c26: rgb(0, 66, 0);\ - \n c27: rgb(0, 69, 0);\ - \n c28: rgb(0, 71, 0);\ - \n c29: rgb(0, 74, 0);\ - \n c30: rgb(0, 77, 0);\ - \n c31: rgb(0, 79, 0);\ - \n c32: rgb(0, 82, 0);\ - \n c33: rgb(0, 84, 0);\ - \n c34: rgb(0, 87, 0);\ - \n c35: rgb(0, 89, 0);\ - \n c36: rgb(0, 92, 0);\ - \n c37: rgb(0, 94, 0);\ - \n c38: rgb(0, 97, 0);\ - \n c39: rgb(0, 99, 0);\ + \n c21: rgb(0, 53.55, 0);\ + \n c22: rgb(0, 56.1, 0);\ + \n c23: rgb(0, 58.65, 0);\ + \n c24: rgb(0, 61.2, 0);\ + \n c25: rgb(0, 63.75, 0);\ + \n c26: rgb(0, 66.3, 0);\ + \n c27: rgb(0, 68.85, 0);\ + \n c28: rgb(0, 71.4, 0);\ + \n c29: rgb(0, 73.95, 0);\ + \n c30: rgb(0, 76.5, 0);\ + \n c31: rgb(0, 79.05, 0);\ + \n c32: rgb(0, 81.6, 0);\ + \n c33: rgb(0, 84.15, 0);\ + \n c34: rgb(0, 86.7, 0);\ + \n c35: rgb(0, 89.25, 0);\ + \n c36: rgb(0, 91.8, 0);\ + \n c37: rgb(0, 94.35, 0);\ + \n c38: rgb(0, 96.9, 0);\ + \n c39: rgb(0, 99.45, 0);\ \n c40: rgb(0, 102, 0);\ - \n c41: rgb(0, 105, 0);\ - \n c42: rgb(0, 107, 0);\ - \n c43: rgb(0, 110, 0);\ - \n c44: rgb(0, 112, 0);\ - \n c45: rgb(0, 115, 0);\ - \n c46: rgb(0, 117, 0);\ - \n c47: rgb(0, 120, 0);\ - \n c48: rgb(0, 122, 0);\ - \n c49: rgb(0, 125, 0);\ - \n c50: rgb(0, 128, 0);\ - \n c51: rgb(0, 130, 0);\ - \n c52: rgb(0, 133, 0);\ - \n c53: rgb(0, 135, 0);\ - \n c54: rgb(0, 138, 0);\ - \n c55: rgb(0, 140, 0);\ - \n c56: rgb(0, 143, 0);\ - \n c57: rgb(0, 145, 0);\ - \n c58: rgb(0, 148, 0);\ - \n c59: rgb(0, 150, 0);\ + \n c41: rgb(0, 104.55, 0);\ + \n c42: rgb(0, 107.1, 0);\ + \n c43: rgb(0, 109.65, 0);\ + \n c44: rgb(0, 112.2, 0);\ + \n c45: rgb(0, 114.75, 0);\ + \n c46: rgb(0, 117.3, 0);\ + \n c47: rgb(0, 119.85, 0);\ + \n c48: rgb(0, 122.4, 0);\ + \n c49: rgb(0, 124.95, 0);\ + \n c50: rgb(0, 127.5, 0);\ + \n c51: rgb(0, 130.05, 0);\ + \n c52: rgb(0, 132.6, 0);\ + \n c53: rgb(0, 135.15, 0);\ + \n c54: rgb(0, 137.7, 0);\ + \n c55: rgb(0, 140.25, 0);\ + \n c56: rgb(0, 142.8, 0);\ + \n c57: rgb(0, 145.35, 0);\ + \n c58: rgb(0, 147.9, 0);\ + \n c59: rgb(0, 150.45, 0);\ \n c60: rgb(0, 153, 0);\ - \n c61: rgb(0, 156, 0);\ - \n c62: rgb(0, 158, 0);\ - \n c63: rgb(0, 161, 0);\ - \n c64: rgb(0, 163, 0);\ - \n c65: rgb(0, 166, 0);\ - \n c66: rgb(0, 168, 0);\ - \n c67: rgb(0, 171, 0);\ - \n c68: rgb(0, 173, 0);\ - \n c69: rgb(0, 176, 0);\ - \n c70: rgb(0, 179, 0);\ - \n c71: rgb(0, 181, 0);\ - \n c72: rgb(0, 184, 0);\ - \n c73: rgb(0, 186, 0);\ - \n c74: rgb(0, 189, 0);\ - \n c75: rgb(0, 191, 0);\ - \n c76: rgb(0, 194, 0);\ - \n c77: rgb(0, 196, 0);\ - \n c78: rgb(0, 199, 0);\ - \n c79: rgb(0, 201, 0);\ + \n c61: rgb(0, 155.55, 0);\ + \n c62: rgb(0, 158.1, 0);\ + \n c63: rgb(0, 160.65, 0);\ + \n c64: rgb(0, 163.2, 0);\ + \n c65: rgb(0, 165.75, 0);\ + \n c66: rgb(0, 168.3, 0);\ + \n c67: rgb(0, 170.85, 0);\ + \n c68: rgb(0, 173.4, 0);\ + \n c69: rgb(0, 175.95, 0);\ + \n c70: rgb(0, 178.5, 0);\ + \n c71: rgb(0, 181.05, 0);\ + \n c72: rgb(0, 183.6, 0);\ + \n c73: rgb(0, 186.15, 0);\ + \n c74: rgb(0, 188.7, 0);\ + \n c75: rgb(0, 191.25, 0);\ + \n c76: rgb(0, 193.8, 0);\ + \n c77: rgb(0, 196.35, 0);\ + \n c78: rgb(0, 198.9, 0);\ + \n c79: rgb(0, 201.45, 0);\ \n c80: rgb(0, 204, 0);\ - \n c81: rgb(0, 207, 0);\ - \n c82: rgb(0, 209, 0);\ - \n c83: rgb(0, 212, 0);\ - \n c84: rgb(0, 214, 0);\ - \n c85: rgb(0, 217, 0);\ - \n c86: rgb(0, 219, 0);\ - \n c87: rgb(0, 222, 0);\ - \n c88: rgb(0, 224, 0);\ - \n c89: rgb(0, 227, 0);\ - \n c90: rgb(0, 230, 0);\ - \n c91: rgb(0, 232, 0);\ - \n c92: rgb(0, 235, 0);\ - \n c93: rgb(0, 237, 0);\ - \n c94: rgb(0, 240, 0);\ - \n c95: rgb(0, 242, 0);\ - \n c96: rgb(0, 245, 0);\ - \n c97: rgb(0, 247, 0);\ - \n c98: rgb(0, 250, 0);\ - \n c99: rgb(0, 252, 0);\ + \n c81: rgb(0, 206.55, 0);\ + \n c82: rgb(0, 209.1, 0);\ + \n c83: rgb(0, 211.65, 0);\ + \n c84: rgb(0, 214.2, 0);\ + \n c85: rgb(0, 216.75, 0);\ + \n c86: rgb(0, 219.3, 0);\ + \n c87: rgb(0, 221.85, 0);\ + \n c88: rgb(0, 224.4, 0);\ + \n c89: rgb(0, 226.95, 0);\ + \n c90: rgb(0, 229.5, 0);\ + \n c91: rgb(0, 232.05, 0);\ + \n c92: rgb(0, 234.6, 0);\ + \n c93: rgb(0, 237.15, 0);\ + \n c94: rgb(0, 239.7, 0);\ + \n c95: rgb(0, 242.25, 0);\ + \n c96: rgb(0, 244.8, 0);\ + \n c97: rgb(0, 247.35, 0);\ + \n c98: rgb(0, 249.9, 0);\ + \n c99: rgb(0, 252.45, 0);\ \n c100: rgb(0, 255, 0);\ \n c101: rgb(0, 255, 0);\ \n}\n" diff --git a/rsass/tests/spec/libsass/color_functions/rgb/rgb/r.rs b/rsass/tests/spec/libsass/color_functions/rgb/rgb/r.rs index 37775c2b2..1b1bb3b0f 100644 --- a/rsass/tests/spec/libsass/color_functions/rgb/rgb/r.rs +++ b/rsass/tests/spec/libsass/color_functions/rgb/rgb/r.rs @@ -6,6 +6,7 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("foo {\ @@ -636,105 +637,105 @@ fn test() { \nfoo {\ \n c-1: rgb(0, 0, 0);\ \n c0: rgb(0, 0, 0);\ - \n c1: rgb(3, 0, 0);\ - \n c2: rgb(5, 0, 0);\ - \n c3: rgb(8, 0, 0);\ - \n c4: rgb(10, 0, 0);\ - \n c5: rgb(13, 0, 0);\ - \n c6: rgb(15, 0, 0);\ - \n c7: rgb(18, 0, 0);\ - \n c8: rgb(20, 0, 0);\ - \n c9: rgb(23, 0, 0);\ - \n c10: rgb(26, 0, 0);\ - \n c11: rgb(28, 0, 0);\ - \n c12: rgb(31, 0, 0);\ - \n c13: rgb(33, 0, 0);\ - \n c14: rgb(36, 0, 0);\ - \n c15: rgb(38, 0, 0);\ - \n c16: rgb(41, 0, 0);\ - \n c17: rgb(43, 0, 0);\ - \n c18: rgb(46, 0, 0);\ - \n c19: rgb(48, 0, 0);\ + \n c1: rgb(2.55, 0, 0);\ + \n c2: rgb(5.1, 0, 0);\ + \n c3: rgb(7.65, 0, 0);\ + \n c4: rgb(10.2, 0, 0);\ + \n c5: rgb(12.75, 0, 0);\ + \n c6: rgb(15.3, 0, 0);\ + \n c7: rgb(17.85, 0, 0);\ + \n c8: rgb(20.4, 0, 0);\ + \n c9: rgb(22.95, 0, 0);\ + \n c10: rgb(25.5, 0, 0);\ + \n c11: rgb(28.05, 0, 0);\ + \n c12: rgb(30.6, 0, 0);\ + \n c13: rgb(33.15, 0, 0);\ + \n c14: rgb(35.7, 0, 0);\ + \n c15: rgb(38.25, 0, 0);\ + \n c16: rgb(40.8, 0, 0);\ + \n c17: rgb(43.35, 0, 0);\ + \n c18: rgb(45.9, 0, 0);\ + \n c19: rgb(48.45, 0, 0);\ \n c20: rgb(51, 0, 0);\ - \n c21: rgb(54, 0, 0);\ - \n c22: rgb(56, 0, 0);\ - \n c23: rgb(59, 0, 0);\ - \n c24: rgb(61, 0, 0);\ - \n c25: rgb(64, 0, 0);\ - \n c26: rgb(66, 0, 0);\ - \n c27: rgb(69, 0, 0);\ - \n c28: rgb(71, 0, 0);\ - \n c29: rgb(74, 0, 0);\ - \n c30: rgb(77, 0, 0);\ - \n c31: rgb(79, 0, 0);\ - \n c32: rgb(82, 0, 0);\ - \n c33: rgb(84, 0, 0);\ - \n c34: rgb(87, 0, 0);\ - \n c35: rgb(89, 0, 0);\ - \n c36: rgb(92, 0, 0);\ - \n c37: rgb(94, 0, 0);\ - \n c38: rgb(97, 0, 0);\ - \n c39: rgb(99, 0, 0);\ + \n c21: rgb(53.55, 0, 0);\ + \n c22: rgb(56.1, 0, 0);\ + \n c23: rgb(58.65, 0, 0);\ + \n c24: rgb(61.2, 0, 0);\ + \n c25: rgb(63.75, 0, 0);\ + \n c26: rgb(66.3, 0, 0);\ + \n c27: rgb(68.85, 0, 0);\ + \n c28: rgb(71.4, 0, 0);\ + \n c29: rgb(73.95, 0, 0);\ + \n c30: rgb(76.5, 0, 0);\ + \n c31: rgb(79.05, 0, 0);\ + \n c32: rgb(81.6, 0, 0);\ + \n c33: rgb(84.15, 0, 0);\ + \n c34: rgb(86.7, 0, 0);\ + \n c35: rgb(89.25, 0, 0);\ + \n c36: rgb(91.8, 0, 0);\ + \n c37: rgb(94.35, 0, 0);\ + \n c38: rgb(96.9, 0, 0);\ + \n c39: rgb(99.45, 0, 0);\ \n c40: rgb(102, 0, 0);\ - \n c41: rgb(105, 0, 0);\ - \n c42: rgb(107, 0, 0);\ - \n c43: rgb(110, 0, 0);\ - \n c44: rgb(112, 0, 0);\ - \n c45: rgb(115, 0, 0);\ - \n c46: rgb(117, 0, 0);\ - \n c47: rgb(120, 0, 0);\ - \n c48: rgb(122, 0, 0);\ - \n c49: rgb(125, 0, 0);\ - \n c50: rgb(128, 0, 0);\ - \n c51: rgb(130, 0, 0);\ - \n c52: rgb(133, 0, 0);\ - \n c53: rgb(135, 0, 0);\ - \n c54: rgb(138, 0, 0);\ - \n c55: rgb(140, 0, 0);\ - \n c56: rgb(143, 0, 0);\ - \n c57: rgb(145, 0, 0);\ - \n c58: rgb(148, 0, 0);\ - \n c59: rgb(150, 0, 0);\ + \n c41: rgb(104.55, 0, 0);\ + \n c42: rgb(107.1, 0, 0);\ + \n c43: rgb(109.65, 0, 0);\ + \n c44: rgb(112.2, 0, 0);\ + \n c45: rgb(114.75, 0, 0);\ + \n c46: rgb(117.3, 0, 0);\ + \n c47: rgb(119.85, 0, 0);\ + \n c48: rgb(122.4, 0, 0);\ + \n c49: rgb(124.95, 0, 0);\ + \n c50: rgb(127.5, 0, 0);\ + \n c51: rgb(130.05, 0, 0);\ + \n c52: rgb(132.6, 0, 0);\ + \n c53: rgb(135.15, 0, 0);\ + \n c54: rgb(137.7, 0, 0);\ + \n c55: rgb(140.25, 0, 0);\ + \n c56: rgb(142.8, 0, 0);\ + \n c57: rgb(145.35, 0, 0);\ + \n c58: rgb(147.9, 0, 0);\ + \n c59: rgb(150.45, 0, 0);\ \n c60: rgb(153, 0, 0);\ - \n c61: rgb(156, 0, 0);\ - \n c62: rgb(158, 0, 0);\ - \n c63: rgb(161, 0, 0);\ - \n c64: rgb(163, 0, 0);\ - \n c65: rgb(166, 0, 0);\ - \n c66: rgb(168, 0, 0);\ - \n c67: rgb(171, 0, 0);\ - \n c68: rgb(173, 0, 0);\ - \n c69: rgb(176, 0, 0);\ - \n c70: rgb(179, 0, 0);\ - \n c71: rgb(181, 0, 0);\ - \n c72: rgb(184, 0, 0);\ - \n c73: rgb(186, 0, 0);\ - \n c74: rgb(189, 0, 0);\ - \n c75: rgb(191, 0, 0);\ - \n c76: rgb(194, 0, 0);\ - \n c77: rgb(196, 0, 0);\ - \n c78: rgb(199, 0, 0);\ - \n c79: rgb(201, 0, 0);\ + \n c61: rgb(155.55, 0, 0);\ + \n c62: rgb(158.1, 0, 0);\ + \n c63: rgb(160.65, 0, 0);\ + \n c64: rgb(163.2, 0, 0);\ + \n c65: rgb(165.75, 0, 0);\ + \n c66: rgb(168.3, 0, 0);\ + \n c67: rgb(170.85, 0, 0);\ + \n c68: rgb(173.4, 0, 0);\ + \n c69: rgb(175.95, 0, 0);\ + \n c70: rgb(178.5, 0, 0);\ + \n c71: rgb(181.05, 0, 0);\ + \n c72: rgb(183.6, 0, 0);\ + \n c73: rgb(186.15, 0, 0);\ + \n c74: rgb(188.7, 0, 0);\ + \n c75: rgb(191.25, 0, 0);\ + \n c76: rgb(193.8, 0, 0);\ + \n c77: rgb(196.35, 0, 0);\ + \n c78: rgb(198.9, 0, 0);\ + \n c79: rgb(201.45, 0, 0);\ \n c80: rgb(204, 0, 0);\ - \n c81: rgb(207, 0, 0);\ - \n c82: rgb(209, 0, 0);\ - \n c83: rgb(212, 0, 0);\ - \n c84: rgb(214, 0, 0);\ - \n c85: rgb(217, 0, 0);\ - \n c86: rgb(219, 0, 0);\ - \n c87: rgb(222, 0, 0);\ - \n c88: rgb(224, 0, 0);\ - \n c89: rgb(227, 0, 0);\ - \n c90: rgb(230, 0, 0);\ - \n c91: rgb(232, 0, 0);\ - \n c92: rgb(235, 0, 0);\ - \n c93: rgb(237, 0, 0);\ - \n c94: rgb(240, 0, 0);\ - \n c95: rgb(242, 0, 0);\ - \n c96: rgb(245, 0, 0);\ - \n c97: rgb(247, 0, 0);\ - \n c98: rgb(250, 0, 0);\ - \n c99: rgb(252, 0, 0);\ + \n c81: rgb(206.55, 0, 0);\ + \n c82: rgb(209.1, 0, 0);\ + \n c83: rgb(211.65, 0, 0);\ + \n c84: rgb(214.2, 0, 0);\ + \n c85: rgb(216.75, 0, 0);\ + \n c86: rgb(219.3, 0, 0);\ + \n c87: rgb(221.85, 0, 0);\ + \n c88: rgb(224.4, 0, 0);\ + \n c89: rgb(226.95, 0, 0);\ + \n c90: rgb(229.5, 0, 0);\ + \n c91: rgb(232.05, 0, 0);\ + \n c92: rgb(234.6, 0, 0);\ + \n c93: rgb(237.15, 0, 0);\ + \n c94: rgb(239.7, 0, 0);\ + \n c95: rgb(242.25, 0, 0);\ + \n c96: rgb(244.8, 0, 0);\ + \n c97: rgb(247.35, 0, 0);\ + \n c98: rgb(249.9, 0, 0);\ + \n c99: rgb(252.45, 0, 0);\ \n c100: rgb(255, 0, 0);\ \n c101: rgb(255, 0, 0);\ \n}\n" diff --git a/rsass/tests/spec/libsass/color_functions/rgb/rgba/b.rs b/rsass/tests/spec/libsass/color_functions/rgb/rgba/b.rs index 861019840..114373c73 100644 --- a/rsass/tests/spec/libsass/color_functions/rgb/rgba/b.rs +++ b/rsass/tests/spec/libsass/color_functions/rgb/rgba/b.rs @@ -6,6 +6,7 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("foo {\ @@ -636,105 +637,105 @@ fn test() { \nfoo {\ \n c-1: rgb(0, 0, 0);\ \n c0: rgb(0, 0, 0);\ - \n c1: rgb(0, 0, 3);\ - \n c2: rgb(0, 0, 5);\ - \n c3: rgb(0, 0, 8);\ - \n c4: rgb(0, 0, 10);\ - \n c5: rgb(0, 0, 13);\ - \n c6: rgb(0, 0, 15);\ - \n c7: rgb(0, 0, 18);\ - \n c8: rgb(0, 0, 20);\ - \n c9: rgb(0, 0, 23);\ - \n c10: rgb(0, 0, 26);\ - \n c11: rgb(0, 0, 28);\ - \n c12: rgb(0, 0, 31);\ - \n c13: rgb(0, 0, 33);\ - \n c14: rgb(0, 0, 36);\ - \n c15: rgb(0, 0, 38);\ - \n c16: rgb(0, 0, 41);\ - \n c17: rgb(0, 0, 43);\ - \n c18: rgb(0, 0, 46);\ - \n c19: rgb(0, 0, 48);\ + \n c1: rgb(0, 0, 2.55);\ + \n c2: rgb(0, 0, 5.1);\ + \n c3: rgb(0, 0, 7.65);\ + \n c4: rgb(0, 0, 10.2);\ + \n c5: rgb(0, 0, 12.75);\ + \n c6: rgb(0, 0, 15.3);\ + \n c7: rgb(0, 0, 17.85);\ + \n c8: rgb(0, 0, 20.4);\ + \n c9: rgb(0, 0, 22.95);\ + \n c10: rgb(0, 0, 25.5);\ + \n c11: rgb(0, 0, 28.05);\ + \n c12: rgb(0, 0, 30.6);\ + \n c13: rgb(0, 0, 33.15);\ + \n c14: rgb(0, 0, 35.7);\ + \n c15: rgb(0, 0, 38.25);\ + \n c16: rgb(0, 0, 40.8);\ + \n c17: rgb(0, 0, 43.35);\ + \n c18: rgb(0, 0, 45.9);\ + \n c19: rgb(0, 0, 48.45);\ \n c20: rgb(0, 0, 51);\ - \n c21: rgb(0, 0, 54);\ - \n c22: rgb(0, 0, 56);\ - \n c23: rgb(0, 0, 59);\ - \n c24: rgb(0, 0, 61);\ - \n c25: rgb(0, 0, 64);\ - \n c26: rgb(0, 0, 66);\ - \n c27: rgb(0, 0, 69);\ - \n c28: rgb(0, 0, 71);\ - \n c29: rgb(0, 0, 74);\ - \n c30: rgb(0, 0, 77);\ - \n c31: rgb(0, 0, 79);\ - \n c32: rgb(0, 0, 82);\ - \n c33: rgb(0, 0, 84);\ - \n c34: rgb(0, 0, 87);\ - \n c35: rgb(0, 0, 89);\ - \n c36: rgb(0, 0, 92);\ - \n c37: rgb(0, 0, 94);\ - \n c38: rgb(0, 0, 97);\ - \n c39: rgb(0, 0, 99);\ + \n c21: rgb(0, 0, 53.55);\ + \n c22: rgb(0, 0, 56.1);\ + \n c23: rgb(0, 0, 58.65);\ + \n c24: rgb(0, 0, 61.2);\ + \n c25: rgb(0, 0, 63.75);\ + \n c26: rgb(0, 0, 66.3);\ + \n c27: rgb(0, 0, 68.85);\ + \n c28: rgb(0, 0, 71.4);\ + \n c29: rgb(0, 0, 73.95);\ + \n c30: rgb(0, 0, 76.5);\ + \n c31: rgb(0, 0, 79.05);\ + \n c32: rgb(0, 0, 81.6);\ + \n c33: rgb(0, 0, 84.15);\ + \n c34: rgb(0, 0, 86.7);\ + \n c35: rgb(0, 0, 89.25);\ + \n c36: rgb(0, 0, 91.8);\ + \n c37: rgb(0, 0, 94.35);\ + \n c38: rgb(0, 0, 96.9);\ + \n c39: rgb(0, 0, 99.45);\ \n c40: rgb(0, 0, 102);\ - \n c41: rgb(0, 0, 105);\ - \n c42: rgb(0, 0, 107);\ - \n c43: rgb(0, 0, 110);\ - \n c44: rgb(0, 0, 112);\ - \n c45: rgb(0, 0, 115);\ - \n c46: rgb(0, 0, 117);\ - \n c47: rgb(0, 0, 120);\ - \n c48: rgb(0, 0, 122);\ - \n c49: rgb(0, 0, 125);\ - \n c50: rgb(0, 0, 128);\ - \n c51: rgb(0, 0, 130);\ - \n c52: rgb(0, 0, 133);\ - \n c53: rgb(0, 0, 135);\ - \n c54: rgb(0, 0, 138);\ - \n c55: rgb(0, 0, 140);\ - \n c56: rgb(0, 0, 143);\ - \n c57: rgb(0, 0, 145);\ - \n c58: rgb(0, 0, 148);\ - \n c59: rgb(0, 0, 150);\ + \n c41: rgb(0, 0, 104.55);\ + \n c42: rgb(0, 0, 107.1);\ + \n c43: rgb(0, 0, 109.65);\ + \n c44: rgb(0, 0, 112.2);\ + \n c45: rgb(0, 0, 114.75);\ + \n c46: rgb(0, 0, 117.3);\ + \n c47: rgb(0, 0, 119.85);\ + \n c48: rgb(0, 0, 122.4);\ + \n c49: rgb(0, 0, 124.95);\ + \n c50: rgb(0, 0, 127.5);\ + \n c51: rgb(0, 0, 130.05);\ + \n c52: rgb(0, 0, 132.6);\ + \n c53: rgb(0, 0, 135.15);\ + \n c54: rgb(0, 0, 137.7);\ + \n c55: rgb(0, 0, 140.25);\ + \n c56: rgb(0, 0, 142.8);\ + \n c57: rgb(0, 0, 145.35);\ + \n c58: rgb(0, 0, 147.9);\ + \n c59: rgb(0, 0, 150.45);\ \n c60: rgb(0, 0, 153);\ - \n c61: rgb(0, 0, 156);\ - \n c62: rgb(0, 0, 158);\ - \n c63: rgb(0, 0, 161);\ - \n c64: rgb(0, 0, 163);\ - \n c65: rgb(0, 0, 166);\ - \n c66: rgb(0, 0, 168);\ - \n c67: rgb(0, 0, 171);\ - \n c68: rgb(0, 0, 173);\ - \n c69: rgb(0, 0, 176);\ - \n c70: rgb(0, 0, 179);\ - \n c71: rgb(0, 0, 181);\ - \n c72: rgb(0, 0, 184);\ - \n c73: rgb(0, 0, 186);\ - \n c74: rgb(0, 0, 189);\ - \n c75: rgb(0, 0, 191);\ - \n c76: rgb(0, 0, 194);\ - \n c77: rgb(0, 0, 196);\ - \n c78: rgb(0, 0, 199);\ - \n c79: rgb(0, 0, 201);\ + \n c61: rgb(0, 0, 155.55);\ + \n c62: rgb(0, 0, 158.1);\ + \n c63: rgb(0, 0, 160.65);\ + \n c64: rgb(0, 0, 163.2);\ + \n c65: rgb(0, 0, 165.75);\ + \n c66: rgb(0, 0, 168.3);\ + \n c67: rgb(0, 0, 170.85);\ + \n c68: rgb(0, 0, 173.4);\ + \n c69: rgb(0, 0, 175.95);\ + \n c70: rgb(0, 0, 178.5);\ + \n c71: rgb(0, 0, 181.05);\ + \n c72: rgb(0, 0, 183.6);\ + \n c73: rgb(0, 0, 186.15);\ + \n c74: rgb(0, 0, 188.7);\ + \n c75: rgb(0, 0, 191.25);\ + \n c76: rgb(0, 0, 193.8);\ + \n c77: rgb(0, 0, 196.35);\ + \n c78: rgb(0, 0, 198.9);\ + \n c79: rgb(0, 0, 201.45);\ \n c80: rgb(0, 0, 204);\ - \n c81: rgb(0, 0, 207);\ - \n c82: rgb(0, 0, 209);\ - \n c83: rgb(0, 0, 212);\ - \n c84: rgb(0, 0, 214);\ - \n c85: rgb(0, 0, 217);\ - \n c86: rgb(0, 0, 219);\ - \n c87: rgb(0, 0, 222);\ - \n c88: rgb(0, 0, 224);\ - \n c89: rgb(0, 0, 227);\ - \n c90: rgb(0, 0, 230);\ - \n c91: rgb(0, 0, 232);\ - \n c92: rgb(0, 0, 235);\ - \n c93: rgb(0, 0, 237);\ - \n c94: rgb(0, 0, 240);\ - \n c95: rgb(0, 0, 242);\ - \n c96: rgb(0, 0, 245);\ - \n c97: rgb(0, 0, 247);\ - \n c98: rgb(0, 0, 250);\ - \n c99: rgb(0, 0, 252);\ + \n c81: rgb(0, 0, 206.55);\ + \n c82: rgb(0, 0, 209.1);\ + \n c83: rgb(0, 0, 211.65);\ + \n c84: rgb(0, 0, 214.2);\ + \n c85: rgb(0, 0, 216.75);\ + \n c86: rgb(0, 0, 219.3);\ + \n c87: rgb(0, 0, 221.85);\ + \n c88: rgb(0, 0, 224.4);\ + \n c89: rgb(0, 0, 226.95);\ + \n c90: rgb(0, 0, 229.5);\ + \n c91: rgb(0, 0, 232.05);\ + \n c92: rgb(0, 0, 234.6);\ + \n c93: rgb(0, 0, 237.15);\ + \n c94: rgb(0, 0, 239.7);\ + \n c95: rgb(0, 0, 242.25);\ + \n c96: rgb(0, 0, 244.8);\ + \n c97: rgb(0, 0, 247.35);\ + \n c98: rgb(0, 0, 249.9);\ + \n c99: rgb(0, 0, 252.45);\ \n c100: rgb(0, 0, 255);\ \n c101: rgb(0, 0, 255);\ \n}\n" diff --git a/rsass/tests/spec/libsass/color_functions/rgb/rgba/g.rs b/rsass/tests/spec/libsass/color_functions/rgb/rgba/g.rs index 36c146f6f..ee39e1309 100644 --- a/rsass/tests/spec/libsass/color_functions/rgb/rgba/g.rs +++ b/rsass/tests/spec/libsass/color_functions/rgb/rgba/g.rs @@ -6,6 +6,7 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("foo {\ @@ -636,105 +637,105 @@ fn test() { \nfoo {\ \n c-1: rgb(0, 0, 0);\ \n c0: rgb(0, 0, 0);\ - \n c1: rgb(0, 3, 0);\ - \n c2: rgb(0, 5, 0);\ - \n c3: rgb(0, 8, 0);\ - \n c4: rgb(0, 10, 0);\ - \n c5: rgb(0, 13, 0);\ - \n c6: rgb(0, 15, 0);\ - \n c7: rgb(0, 18, 0);\ - \n c8: rgb(0, 20, 0);\ - \n c9: rgb(0, 23, 0);\ - \n c10: rgb(0, 26, 0);\ - \n c11: rgb(0, 28, 0);\ - \n c12: rgb(0, 31, 0);\ - \n c13: rgb(0, 33, 0);\ - \n c14: rgb(0, 36, 0);\ - \n c15: rgb(0, 38, 0);\ - \n c16: rgb(0, 41, 0);\ - \n c17: rgb(0, 43, 0);\ - \n c18: rgb(0, 46, 0);\ - \n c19: rgb(0, 48, 0);\ + \n c1: rgb(0, 2.55, 0);\ + \n c2: rgb(0, 5.1, 0);\ + \n c3: rgb(0, 7.65, 0);\ + \n c4: rgb(0, 10.2, 0);\ + \n c5: rgb(0, 12.75, 0);\ + \n c6: rgb(0, 15.3, 0);\ + \n c7: rgb(0, 17.85, 0);\ + \n c8: rgb(0, 20.4, 0);\ + \n c9: rgb(0, 22.95, 0);\ + \n c10: rgb(0, 25.5, 0);\ + \n c11: rgb(0, 28.05, 0);\ + \n c12: rgb(0, 30.6, 0);\ + \n c13: rgb(0, 33.15, 0);\ + \n c14: rgb(0, 35.7, 0);\ + \n c15: rgb(0, 38.25, 0);\ + \n c16: rgb(0, 40.8, 0);\ + \n c17: rgb(0, 43.35, 0);\ + \n c18: rgb(0, 45.9, 0);\ + \n c19: rgb(0, 48.45, 0);\ \n c20: rgb(0, 51, 0);\ - \n c21: rgb(0, 54, 0);\ - \n c22: rgb(0, 56, 0);\ - \n c23: rgb(0, 59, 0);\ - \n c24: rgb(0, 61, 0);\ - \n c25: rgb(0, 64, 0);\ - \n c26: rgb(0, 66, 0);\ - \n c27: rgb(0, 69, 0);\ - \n c28: rgb(0, 71, 0);\ - \n c29: rgb(0, 74, 0);\ - \n c30: rgb(0, 77, 0);\ - \n c31: rgb(0, 79, 0);\ - \n c32: rgb(0, 82, 0);\ - \n c33: rgb(0, 84, 0);\ - \n c34: rgb(0, 87, 0);\ - \n c35: rgb(0, 89, 0);\ - \n c36: rgb(0, 92, 0);\ - \n c37: rgb(0, 94, 0);\ - \n c38: rgb(0, 97, 0);\ - \n c39: rgb(0, 99, 0);\ + \n c21: rgb(0, 53.55, 0);\ + \n c22: rgb(0, 56.1, 0);\ + \n c23: rgb(0, 58.65, 0);\ + \n c24: rgb(0, 61.2, 0);\ + \n c25: rgb(0, 63.75, 0);\ + \n c26: rgb(0, 66.3, 0);\ + \n c27: rgb(0, 68.85, 0);\ + \n c28: rgb(0, 71.4, 0);\ + \n c29: rgb(0, 73.95, 0);\ + \n c30: rgb(0, 76.5, 0);\ + \n c31: rgb(0, 79.05, 0);\ + \n c32: rgb(0, 81.6, 0);\ + \n c33: rgb(0, 84.15, 0);\ + \n c34: rgb(0, 86.7, 0);\ + \n c35: rgb(0, 89.25, 0);\ + \n c36: rgb(0, 91.8, 0);\ + \n c37: rgb(0, 94.35, 0);\ + \n c38: rgb(0, 96.9, 0);\ + \n c39: rgb(0, 99.45, 0);\ \n c40: rgb(0, 102, 0);\ - \n c41: rgb(0, 105, 0);\ - \n c42: rgb(0, 107, 0);\ - \n c43: rgb(0, 110, 0);\ - \n c44: rgb(0, 112, 0);\ - \n c45: rgb(0, 115, 0);\ - \n c46: rgb(0, 117, 0);\ - \n c47: rgb(0, 120, 0);\ - \n c48: rgb(0, 122, 0);\ - \n c49: rgb(0, 125, 0);\ - \n c50: rgb(0, 128, 0);\ - \n c51: rgb(0, 130, 0);\ - \n c52: rgb(0, 133, 0);\ - \n c53: rgb(0, 135, 0);\ - \n c54: rgb(0, 138, 0);\ - \n c55: rgb(0, 140, 0);\ - \n c56: rgb(0, 143, 0);\ - \n c57: rgb(0, 145, 0);\ - \n c58: rgb(0, 148, 0);\ - \n c59: rgb(0, 150, 0);\ + \n c41: rgb(0, 104.55, 0);\ + \n c42: rgb(0, 107.1, 0);\ + \n c43: rgb(0, 109.65, 0);\ + \n c44: rgb(0, 112.2, 0);\ + \n c45: rgb(0, 114.75, 0);\ + \n c46: rgb(0, 117.3, 0);\ + \n c47: rgb(0, 119.85, 0);\ + \n c48: rgb(0, 122.4, 0);\ + \n c49: rgb(0, 124.95, 0);\ + \n c50: rgb(0, 127.5, 0);\ + \n c51: rgb(0, 130.05, 0);\ + \n c52: rgb(0, 132.6, 0);\ + \n c53: rgb(0, 135.15, 0);\ + \n c54: rgb(0, 137.7, 0);\ + \n c55: rgb(0, 140.25, 0);\ + \n c56: rgb(0, 142.8, 0);\ + \n c57: rgb(0, 145.35, 0);\ + \n c58: rgb(0, 147.9, 0);\ + \n c59: rgb(0, 150.45, 0);\ \n c60: rgb(0, 153, 0);\ - \n c61: rgb(0, 156, 0);\ - \n c62: rgb(0, 158, 0);\ - \n c63: rgb(0, 161, 0);\ - \n c64: rgb(0, 163, 0);\ - \n c65: rgb(0, 166, 0);\ - \n c66: rgb(0, 168, 0);\ - \n c67: rgb(0, 171, 0);\ - \n c68: rgb(0, 173, 0);\ - \n c69: rgb(0, 176, 0);\ - \n c70: rgb(0, 179, 0);\ - \n c71: rgb(0, 181, 0);\ - \n c72: rgb(0, 184, 0);\ - \n c73: rgb(0, 186, 0);\ - \n c74: rgb(0, 189, 0);\ - \n c75: rgb(0, 191, 0);\ - \n c76: rgb(0, 194, 0);\ - \n c77: rgb(0, 196, 0);\ - \n c78: rgb(0, 199, 0);\ - \n c79: rgb(0, 201, 0);\ + \n c61: rgb(0, 155.55, 0);\ + \n c62: rgb(0, 158.1, 0);\ + \n c63: rgb(0, 160.65, 0);\ + \n c64: rgb(0, 163.2, 0);\ + \n c65: rgb(0, 165.75, 0);\ + \n c66: rgb(0, 168.3, 0);\ + \n c67: rgb(0, 170.85, 0);\ + \n c68: rgb(0, 173.4, 0);\ + \n c69: rgb(0, 175.95, 0);\ + \n c70: rgb(0, 178.5, 0);\ + \n c71: rgb(0, 181.05, 0);\ + \n c72: rgb(0, 183.6, 0);\ + \n c73: rgb(0, 186.15, 0);\ + \n c74: rgb(0, 188.7, 0);\ + \n c75: rgb(0, 191.25, 0);\ + \n c76: rgb(0, 193.8, 0);\ + \n c77: rgb(0, 196.35, 0);\ + \n c78: rgb(0, 198.9, 0);\ + \n c79: rgb(0, 201.45, 0);\ \n c80: rgb(0, 204, 0);\ - \n c81: rgb(0, 207, 0);\ - \n c82: rgb(0, 209, 0);\ - \n c83: rgb(0, 212, 0);\ - \n c84: rgb(0, 214, 0);\ - \n c85: rgb(0, 217, 0);\ - \n c86: rgb(0, 219, 0);\ - \n c87: rgb(0, 222, 0);\ - \n c88: rgb(0, 224, 0);\ - \n c89: rgb(0, 227, 0);\ - \n c90: rgb(0, 230, 0);\ - \n c91: rgb(0, 232, 0);\ - \n c92: rgb(0, 235, 0);\ - \n c93: rgb(0, 237, 0);\ - \n c94: rgb(0, 240, 0);\ - \n c95: rgb(0, 242, 0);\ - \n c96: rgb(0, 245, 0);\ - \n c97: rgb(0, 247, 0);\ - \n c98: rgb(0, 250, 0);\ - \n c99: rgb(0, 252, 0);\ + \n c81: rgb(0, 206.55, 0);\ + \n c82: rgb(0, 209.1, 0);\ + \n c83: rgb(0, 211.65, 0);\ + \n c84: rgb(0, 214.2, 0);\ + \n c85: rgb(0, 216.75, 0);\ + \n c86: rgb(0, 219.3, 0);\ + \n c87: rgb(0, 221.85, 0);\ + \n c88: rgb(0, 224.4, 0);\ + \n c89: rgb(0, 226.95, 0);\ + \n c90: rgb(0, 229.5, 0);\ + \n c91: rgb(0, 232.05, 0);\ + \n c92: rgb(0, 234.6, 0);\ + \n c93: rgb(0, 237.15, 0);\ + \n c94: rgb(0, 239.7, 0);\ + \n c95: rgb(0, 242.25, 0);\ + \n c96: rgb(0, 244.8, 0);\ + \n c97: rgb(0, 247.35, 0);\ + \n c98: rgb(0, 249.9, 0);\ + \n c99: rgb(0, 252.45, 0);\ \n c100: rgb(0, 255, 0);\ \n c101: rgb(0, 255, 0);\ \n}\n" diff --git a/rsass/tests/spec/libsass/color_functions/rgb/rgba/r.rs b/rsass/tests/spec/libsass/color_functions/rgb/rgba/r.rs index d919e067d..7bcb6dcf5 100644 --- a/rsass/tests/spec/libsass/color_functions/rgb/rgba/r.rs +++ b/rsass/tests/spec/libsass/color_functions/rgb/rgba/r.rs @@ -6,6 +6,7 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("foo {\ @@ -636,105 +637,105 @@ fn test() { \nfoo {\ \n c-1: rgb(0, 0, 0);\ \n c0: rgb(0, 0, 0);\ - \n c1: rgb(3, 0, 0);\ - \n c2: rgb(5, 0, 0);\ - \n c3: rgb(8, 0, 0);\ - \n c4: rgb(10, 0, 0);\ - \n c5: rgb(13, 0, 0);\ - \n c6: rgb(15, 0, 0);\ - \n c7: rgb(18, 0, 0);\ - \n c8: rgb(20, 0, 0);\ - \n c9: rgb(23, 0, 0);\ - \n c10: rgb(26, 0, 0);\ - \n c11: rgb(28, 0, 0);\ - \n c12: rgb(31, 0, 0);\ - \n c13: rgb(33, 0, 0);\ - \n c14: rgb(36, 0, 0);\ - \n c15: rgb(38, 0, 0);\ - \n c16: rgb(41, 0, 0);\ - \n c17: rgb(43, 0, 0);\ - \n c18: rgb(46, 0, 0);\ - \n c19: rgb(48, 0, 0);\ + \n c1: rgb(2.55, 0, 0);\ + \n c2: rgb(5.1, 0, 0);\ + \n c3: rgb(7.65, 0, 0);\ + \n c4: rgb(10.2, 0, 0);\ + \n c5: rgb(12.75, 0, 0);\ + \n c6: rgb(15.3, 0, 0);\ + \n c7: rgb(17.85, 0, 0);\ + \n c8: rgb(20.4, 0, 0);\ + \n c9: rgb(22.95, 0, 0);\ + \n c10: rgb(25.5, 0, 0);\ + \n c11: rgb(28.05, 0, 0);\ + \n c12: rgb(30.6, 0, 0);\ + \n c13: rgb(33.15, 0, 0);\ + \n c14: rgb(35.7, 0, 0);\ + \n c15: rgb(38.25, 0, 0);\ + \n c16: rgb(40.8, 0, 0);\ + \n c17: rgb(43.35, 0, 0);\ + \n c18: rgb(45.9, 0, 0);\ + \n c19: rgb(48.45, 0, 0);\ \n c20: rgb(51, 0, 0);\ - \n c21: rgb(54, 0, 0);\ - \n c22: rgb(56, 0, 0);\ - \n c23: rgb(59, 0, 0);\ - \n c24: rgb(61, 0, 0);\ - \n c25: rgb(64, 0, 0);\ - \n c26: rgb(66, 0, 0);\ - \n c27: rgb(69, 0, 0);\ - \n c28: rgb(71, 0, 0);\ - \n c29: rgb(74, 0, 0);\ - \n c30: rgb(77, 0, 0);\ - \n c31: rgb(79, 0, 0);\ - \n c32: rgb(82, 0, 0);\ - \n c33: rgb(84, 0, 0);\ - \n c34: rgb(87, 0, 0);\ - \n c35: rgb(89, 0, 0);\ - \n c36: rgb(92, 0, 0);\ - \n c37: rgb(94, 0, 0);\ - \n c38: rgb(97, 0, 0);\ - \n c39: rgb(99, 0, 0);\ + \n c21: rgb(53.55, 0, 0);\ + \n c22: rgb(56.1, 0, 0);\ + \n c23: rgb(58.65, 0, 0);\ + \n c24: rgb(61.2, 0, 0);\ + \n c25: rgb(63.75, 0, 0);\ + \n c26: rgb(66.3, 0, 0);\ + \n c27: rgb(68.85, 0, 0);\ + \n c28: rgb(71.4, 0, 0);\ + \n c29: rgb(73.95, 0, 0);\ + \n c30: rgb(76.5, 0, 0);\ + \n c31: rgb(79.05, 0, 0);\ + \n c32: rgb(81.6, 0, 0);\ + \n c33: rgb(84.15, 0, 0);\ + \n c34: rgb(86.7, 0, 0);\ + \n c35: rgb(89.25, 0, 0);\ + \n c36: rgb(91.8, 0, 0);\ + \n c37: rgb(94.35, 0, 0);\ + \n c38: rgb(96.9, 0, 0);\ + \n c39: rgb(99.45, 0, 0);\ \n c40: rgb(102, 0, 0);\ - \n c41: rgb(105, 0, 0);\ - \n c42: rgb(107, 0, 0);\ - \n c43: rgb(110, 0, 0);\ - \n c44: rgb(112, 0, 0);\ - \n c45: rgb(115, 0, 0);\ - \n c46: rgb(117, 0, 0);\ - \n c47: rgb(120, 0, 0);\ - \n c48: rgb(122, 0, 0);\ - \n c49: rgb(125, 0, 0);\ - \n c50: rgb(128, 0, 0);\ - \n c51: rgb(130, 0, 0);\ - \n c52: rgb(133, 0, 0);\ - \n c53: rgb(135, 0, 0);\ - \n c54: rgb(138, 0, 0);\ - \n c55: rgb(140, 0, 0);\ - \n c56: rgb(143, 0, 0);\ - \n c57: rgb(145, 0, 0);\ - \n c58: rgb(148, 0, 0);\ - \n c59: rgb(150, 0, 0);\ + \n c41: rgb(104.55, 0, 0);\ + \n c42: rgb(107.1, 0, 0);\ + \n c43: rgb(109.65, 0, 0);\ + \n c44: rgb(112.2, 0, 0);\ + \n c45: rgb(114.75, 0, 0);\ + \n c46: rgb(117.3, 0, 0);\ + \n c47: rgb(119.85, 0, 0);\ + \n c48: rgb(122.4, 0, 0);\ + \n c49: rgb(124.95, 0, 0);\ + \n c50: rgb(127.5, 0, 0);\ + \n c51: rgb(130.05, 0, 0);\ + \n c52: rgb(132.6, 0, 0);\ + \n c53: rgb(135.15, 0, 0);\ + \n c54: rgb(137.7, 0, 0);\ + \n c55: rgb(140.25, 0, 0);\ + \n c56: rgb(142.8, 0, 0);\ + \n c57: rgb(145.35, 0, 0);\ + \n c58: rgb(147.9, 0, 0);\ + \n c59: rgb(150.45, 0, 0);\ \n c60: rgb(153, 0, 0);\ - \n c61: rgb(156, 0, 0);\ - \n c62: rgb(158, 0, 0);\ - \n c63: rgb(161, 0, 0);\ - \n c64: rgb(163, 0, 0);\ - \n c65: rgb(166, 0, 0);\ - \n c66: rgb(168, 0, 0);\ - \n c67: rgb(171, 0, 0);\ - \n c68: rgb(173, 0, 0);\ - \n c69: rgb(176, 0, 0);\ - \n c70: rgb(179, 0, 0);\ - \n c71: rgb(181, 0, 0);\ - \n c72: rgb(184, 0, 0);\ - \n c73: rgb(186, 0, 0);\ - \n c74: rgb(189, 0, 0);\ - \n c75: rgb(191, 0, 0);\ - \n c76: rgb(194, 0, 0);\ - \n c77: rgb(196, 0, 0);\ - \n c78: rgb(199, 0, 0);\ - \n c79: rgb(201, 0, 0);\ + \n c61: rgb(155.55, 0, 0);\ + \n c62: rgb(158.1, 0, 0);\ + \n c63: rgb(160.65, 0, 0);\ + \n c64: rgb(163.2, 0, 0);\ + \n c65: rgb(165.75, 0, 0);\ + \n c66: rgb(168.3, 0, 0);\ + \n c67: rgb(170.85, 0, 0);\ + \n c68: rgb(173.4, 0, 0);\ + \n c69: rgb(175.95, 0, 0);\ + \n c70: rgb(178.5, 0, 0);\ + \n c71: rgb(181.05, 0, 0);\ + \n c72: rgb(183.6, 0, 0);\ + \n c73: rgb(186.15, 0, 0);\ + \n c74: rgb(188.7, 0, 0);\ + \n c75: rgb(191.25, 0, 0);\ + \n c76: rgb(193.8, 0, 0);\ + \n c77: rgb(196.35, 0, 0);\ + \n c78: rgb(198.9, 0, 0);\ + \n c79: rgb(201.45, 0, 0);\ \n c80: rgb(204, 0, 0);\ - \n c81: rgb(207, 0, 0);\ - \n c82: rgb(209, 0, 0);\ - \n c83: rgb(212, 0, 0);\ - \n c84: rgb(214, 0, 0);\ - \n c85: rgb(217, 0, 0);\ - \n c86: rgb(219, 0, 0);\ - \n c87: rgb(222, 0, 0);\ - \n c88: rgb(224, 0, 0);\ - \n c89: rgb(227, 0, 0);\ - \n c90: rgb(230, 0, 0);\ - \n c91: rgb(232, 0, 0);\ - \n c92: rgb(235, 0, 0);\ - \n c93: rgb(237, 0, 0);\ - \n c94: rgb(240, 0, 0);\ - \n c95: rgb(242, 0, 0);\ - \n c96: rgb(245, 0, 0);\ - \n c97: rgb(247, 0, 0);\ - \n c98: rgb(250, 0, 0);\ - \n c99: rgb(252, 0, 0);\ + \n c81: rgb(206.55, 0, 0);\ + \n c82: rgb(209.1, 0, 0);\ + \n c83: rgb(211.65, 0, 0);\ + \n c84: rgb(214.2, 0, 0);\ + \n c85: rgb(216.75, 0, 0);\ + \n c86: rgb(219.3, 0, 0);\ + \n c87: rgb(221.85, 0, 0);\ + \n c88: rgb(224.4, 0, 0);\ + \n c89: rgb(226.95, 0, 0);\ + \n c90: rgb(229.5, 0, 0);\ + \n c91: rgb(232.05, 0, 0);\ + \n c92: rgb(234.6, 0, 0);\ + \n c93: rgb(237.15, 0, 0);\ + \n c94: rgb(239.7, 0, 0);\ + \n c95: rgb(242.25, 0, 0);\ + \n c96: rgb(244.8, 0, 0);\ + \n c97: rgb(247.35, 0, 0);\ + \n c98: rgb(249.9, 0, 0);\ + \n c99: rgb(252.45, 0, 0);\ \n c100: rgb(255, 0, 0);\ \n c101: rgb(255, 0, 0);\ \n}\n" diff --git a/rsass/tests/spec/libsass/color_functions/saturate.rs b/rsass/tests/spec/libsass/color_functions/saturate.rs index 299db62b8..a5e2fbc17 100644 --- a/rsass/tests/spec/libsass/color_functions/saturate.rs +++ b/rsass/tests/spec/libsass/color_functions/saturate.rs @@ -8,209 +8,210 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("foo {\ - \n c0: saturate(hsl(100, 0%, 50%), 0%);\ - \n c1: saturate(hsl(100, 0%, 50%), 1%);\ - \n c2: saturate(hsl(100, 0%, 50%), 2%);\ - \n c3: saturate(hsl(100, 0%, 50%), 3%);\ - \n c4: saturate(hsl(100, 0%, 50%), 4%);\ - \n c5: saturate(hsl(100, 0%, 50%), 5%);\ - \n c6: saturate(hsl(100, 0%, 50%), 6%);\ - \n c7: saturate(hsl(100, 0%, 50%), 7%);\ - \n c8: saturate(hsl(100, 0%, 50%), 8%);\ - \n c9: saturate(hsl(100, 0%, 50%), 9%);\ - \n c10: saturate(hsl(100, 0%, 50%), 10%);\ - \n c11: saturate(hsl(100, 0%, 50%), 11%);\ - \n c12: saturate(hsl(100, 0%, 50%), 12%);\ - \n c13: saturate(hsl(100, 0%, 50%), 13%);\ - \n c14: saturate(hsl(100, 0%, 50%), 14%);\ - \n c15: saturate(hsl(100, 0%, 50%), 15%);\ - \n c16: saturate(hsl(100, 0%, 50%), 16%);\ - \n c17: saturate(hsl(100, 0%, 50%), 17%);\ - \n c18: saturate(hsl(100, 0%, 50%), 18%);\ - \n c19: saturate(hsl(100, 0%, 50%), 19%);\ - \n c20: saturate(hsl(100, 0%, 50%), 20%);\ - \n c21: saturate(hsl(100, 0%, 50%), 21%);\ - \n c22: saturate(hsl(100, 0%, 50%), 22%);\ - \n c23: saturate(hsl(100, 0%, 50%), 23%);\ - \n c24: saturate(hsl(100, 0%, 50%), 24%);\ - \n c25: saturate(hsl(100, 0%, 50%), 25%);\ - \n c26: saturate(hsl(100, 0%, 50%), 26%);\ - \n c27: saturate(hsl(100, 0%, 50%), 27%);\ - \n c28: saturate(hsl(100, 0%, 50%), 28%);\ - \n c29: saturate(hsl(100, 0%, 50%), 29%);\ - \n c30: saturate(hsl(100, 0%, 50%), 30%);\ - \n c31: saturate(hsl(100, 0%, 50%), 31%);\ - \n c32: saturate(hsl(100, 0%, 50%), 32%);\ - \n c33: saturate(hsl(100, 0%, 50%), 33%);\ - \n c34: saturate(hsl(100, 0%, 50%), 34%);\ - \n c35: saturate(hsl(100, 0%, 50%), 35%);\ - \n c36: saturate(hsl(100, 0%, 50%), 36%);\ - \n c37: saturate(hsl(100, 0%, 50%), 37%);\ - \n c38: saturate(hsl(100, 0%, 50%), 38%);\ - \n c39: saturate(hsl(100, 0%, 50%), 39%);\ + runner().ok("@use \"sass:color\";\ + \nfoo {\ + \n c0: color.adjust(hsl(100, 0%, 50%), $saturation: 0%);\ + \n c1: color.adjust(hsl(100, 0%, 50%), $saturation: 1%);\ + \n c2: color.adjust(hsl(100, 0%, 50%), $saturation: 2%);\ + \n c3: color.adjust(hsl(100, 0%, 50%), $saturation: 3%);\ + \n c4: color.adjust(hsl(100, 0%, 50%), $saturation: 4%);\ + \n c5: color.adjust(hsl(100, 0%, 50%), $saturation: 5%);\ + \n c6: color.adjust(hsl(100, 0%, 50%), $saturation: 6%);\ + \n c7: color.adjust(hsl(100, 0%, 50%), $saturation: 7%);\ + \n c8: color.adjust(hsl(100, 0%, 50%), $saturation: 8%);\ + \n c9: color.adjust(hsl(100, 0%, 50%), $saturation: 9%);\ + \n c10: color.adjust(hsl(100, 0%, 50%), $saturation: 10%);\ + \n c11: color.adjust(hsl(100, 0%, 50%), $saturation: 11%);\ + \n c12: color.adjust(hsl(100, 0%, 50%), $saturation: 12%);\ + \n c13: color.adjust(hsl(100, 0%, 50%), $saturation: 13%);\ + \n c14: color.adjust(hsl(100, 0%, 50%), $saturation: 14%);\ + \n c15: color.adjust(hsl(100, 0%, 50%), $saturation: 15%);\ + \n c16: color.adjust(hsl(100, 0%, 50%), $saturation: 16%);\ + \n c17: color.adjust(hsl(100, 0%, 50%), $saturation: 17%);\ + \n c18: color.adjust(hsl(100, 0%, 50%), $saturation: 18%);\ + \n c19: color.adjust(hsl(100, 0%, 50%), $saturation: 19%);\ + \n c20: color.adjust(hsl(100, 0%, 50%), $saturation: 20%);\ + \n c21: color.adjust(hsl(100, 0%, 50%), $saturation: 21%);\ + \n c22: color.adjust(hsl(100, 0%, 50%), $saturation: 22%);\ + \n c23: color.adjust(hsl(100, 0%, 50%), $saturation: 23%);\ + \n c24: color.adjust(hsl(100, 0%, 50%), $saturation: 24%);\ + \n c25: color.adjust(hsl(100, 0%, 50%), $saturation: 25%);\ + \n c26: color.adjust(hsl(100, 0%, 50%), $saturation: 26%);\ + \n c27: color.adjust(hsl(100, 0%, 50%), $saturation: 27%);\ + \n c28: color.adjust(hsl(100, 0%, 50%), $saturation: 28%);\ + \n c29: color.adjust(hsl(100, 0%, 50%), $saturation: 29%);\ + \n c30: color.adjust(hsl(100, 0%, 50%), $saturation: 30%);\ + \n c31: color.adjust(hsl(100, 0%, 50%), $saturation: 31%);\ + \n c32: color.adjust(hsl(100, 0%, 50%), $saturation: 32%);\ + \n c33: color.adjust(hsl(100, 0%, 50%), $saturation: 33%);\ + \n c34: color.adjust(hsl(100, 0%, 50%), $saturation: 34%);\ + \n c35: color.adjust(hsl(100, 0%, 50%), $saturation: 35%);\ + \n c36: color.adjust(hsl(100, 0%, 50%), $saturation: 36%);\ + \n c37: color.adjust(hsl(100, 0%, 50%), $saturation: 37%);\ + \n c38: color.adjust(hsl(100, 0%, 50%), $saturation: 38%);\ + \n c39: color.adjust(hsl(100, 0%, 50%), $saturation: 39%);\ \n // c40: saturate(hsl(100, 0%, 50%), 40%);\ - \n c41: saturate(hsl(100, 0%, 50%), 41%);\ - \n c42: saturate(hsl(100, 0%, 50%), 42%);\ - \n c43: saturate(hsl(100, 0%, 50%), 43%);\ - \n c44: saturate(hsl(100, 0%, 50%), 44%);\ - \n c45: saturate(hsl(100, 0%, 50%), 45%);\ - \n c46: saturate(hsl(100, 0%, 50%), 46%);\ - \n c47: saturate(hsl(100, 0%, 50%), 47%);\ - \n c48: saturate(hsl(100, 0%, 50%), 48%);\ - \n c49: saturate(hsl(100, 0%, 50%), 49%);\ - \n c50: saturate(hsl(100, 0%, 50%), 50%);\ - \n c51: saturate(hsl(100, 0%, 50%), 51%);\ - \n c52: saturate(hsl(100, 0%, 50%), 52%);\ - \n c53: saturate(hsl(100, 0%, 50%), 53%);\ - \n c54: saturate(hsl(100, 0%, 50%), 54%);\ - \n c55: saturate(hsl(100, 0%, 50%), 55%);\ - \n c56: saturate(hsl(100, 0%, 50%), 56%);\ - \n c57: saturate(hsl(100, 0%, 50%), 57%);\ - \n c58: saturate(hsl(100, 0%, 50%), 58%);\ - \n c59: saturate(hsl(100, 0%, 50%), 59%);\ - \n c60: saturate(hsl(100, 0%, 50%), 60%);\ - \n c61: saturate(hsl(100, 0%, 50%), 61%);\ - \n c62: saturate(hsl(100, 0%, 50%), 62%);\ - \n c63: saturate(hsl(100, 0%, 50%), 63%);\ - \n c64: saturate(hsl(100, 0%, 50%), 64%);\ - \n c65: saturate(hsl(100, 0%, 50%), 65%);\ - \n c66: saturate(hsl(100, 0%, 50%), 66%);\ - \n c67: saturate(hsl(100, 0%, 50%), 67%);\ - \n c68: saturate(hsl(100, 0%, 50%), 68%);\ - \n c69: saturate(hsl(100, 0%, 50%), 69%);\ - \n c70: saturate(hsl(100, 0%, 50%), 70%);\ - \n c71: saturate(hsl(100, 0%, 50%), 71%);\ - \n c72: saturate(hsl(100, 0%, 50%), 72%);\ - \n c73: saturate(hsl(100, 0%, 50%), 73%);\ - \n c74: saturate(hsl(100, 0%, 50%), 74%);\ - \n c75: saturate(hsl(100, 0%, 50%), 75%);\ - \n c76: saturate(hsl(100, 0%, 50%), 76%);\ - \n c77: saturate(hsl(100, 0%, 50%), 77%);\ - \n c78: saturate(hsl(100, 0%, 50%), 78%);\ - \n c79: saturate(hsl(100, 0%, 50%), 79%);\ + \n c41: color.adjust(hsl(100, 0%, 50%), $saturation: 41%);\ + \n c42: color.adjust(hsl(100, 0%, 50%), $saturation: 42%);\ + \n c43: color.adjust(hsl(100, 0%, 50%), $saturation: 43%);\ + \n c44: color.adjust(hsl(100, 0%, 50%), $saturation: 44%);\ + \n c45: color.adjust(hsl(100, 0%, 50%), $saturation: 45%);\ + \n c46: color.adjust(hsl(100, 0%, 50%), $saturation: 46%);\ + \n c47: color.adjust(hsl(100, 0%, 50%), $saturation: 47%);\ + \n c48: color.adjust(hsl(100, 0%, 50%), $saturation: 48%);\ + \n c49: color.adjust(hsl(100, 0%, 50%), $saturation: 49%);\ + \n c50: color.adjust(hsl(100, 0%, 50%), $saturation: 50%);\ + \n c51: color.adjust(hsl(100, 0%, 50%), $saturation: 51%);\ + \n c52: color.adjust(hsl(100, 0%, 50%), $saturation: 52%);\ + \n c53: color.adjust(hsl(100, 0%, 50%), $saturation: 53%);\ + \n c54: color.adjust(hsl(100, 0%, 50%), $saturation: 54%);\ + \n c55: color.adjust(hsl(100, 0%, 50%), $saturation: 55%);\ + \n c56: color.adjust(hsl(100, 0%, 50%), $saturation: 56%);\ + \n c57: color.adjust(hsl(100, 0%, 50%), $saturation: 57%);\ + \n c58: color.adjust(hsl(100, 0%, 50%), $saturation: 58%);\ + \n c59: color.adjust(hsl(100, 0%, 50%), $saturation: 59%);\ + \n c60: color.adjust(hsl(100, 0%, 50%), $saturation: 60%);\ + \n c61: color.adjust(hsl(100, 0%, 50%), $saturation: 61%);\ + \n c62: color.adjust(hsl(100, 0%, 50%), $saturation: 62%);\ + \n c63: color.adjust(hsl(100, 0%, 50%), $saturation: 63%);\ + \n c64: color.adjust(hsl(100, 0%, 50%), $saturation: 64%);\ + \n c65: color.adjust(hsl(100, 0%, 50%), $saturation: 65%);\ + \n c66: color.adjust(hsl(100, 0%, 50%), $saturation: 66%);\ + \n c67: color.adjust(hsl(100, 0%, 50%), $saturation: 67%);\ + \n c68: color.adjust(hsl(100, 0%, 50%), $saturation: 68%);\ + \n c69: color.adjust(hsl(100, 0%, 50%), $saturation: 69%);\ + \n c70: color.adjust(hsl(100, 0%, 50%), $saturation: 70%);\ + \n c71: color.adjust(hsl(100, 0%, 50%), $saturation: 71%);\ + \n c72: color.adjust(hsl(100, 0%, 50%), $saturation: 72%);\ + \n c73: color.adjust(hsl(100, 0%, 50%), $saturation: 73%);\ + \n c74: color.adjust(hsl(100, 0%, 50%), $saturation: 74%);\ + \n c75: color.adjust(hsl(100, 0%, 50%), $saturation: 75%);\ + \n c76: color.adjust(hsl(100, 0%, 50%), $saturation: 76%);\ + \n c77: color.adjust(hsl(100, 0%, 50%), $saturation: 77%);\ + \n c78: color.adjust(hsl(100, 0%, 50%), $saturation: 78%);\ + \n c79: color.adjust(hsl(100, 0%, 50%), $saturation: 79%);\ \n // c80: saturate(hsl(100, 0%, 50%), 80%);\ - \n c81: saturate(hsl(100, 0%, 50%), 81%);\ - \n c82: saturate(hsl(100, 0%, 50%), 82%);\ - \n c83: saturate(hsl(100, 0%, 50%), 83%);\ - \n c84: saturate(hsl(100, 0%, 50%), 84%);\ - \n c85: saturate(hsl(100, 0%, 50%), 85%);\ - \n c86: saturate(hsl(100, 0%, 50%), 86%);\ - \n c87: saturate(hsl(100, 0%, 50%), 87%);\ - \n c88: saturate(hsl(100, 0%, 50%), 88%);\ - \n c89: saturate(hsl(100, 0%, 50%), 89%);\ - \n c90: saturate(hsl(100, 0%, 50%), 90%);\ - \n c91: saturate(hsl(100, 0%, 50%), 91%);\ - \n c92: saturate(hsl(100, 0%, 50%), 92%);\ - \n c93: saturate(hsl(100, 0%, 50%), 93%);\ - \n c94: saturate(hsl(100, 0%, 50%), 94%);\ - \n c95: saturate(hsl(100, 0%, 50%), 95%);\ - \n c96: saturate(hsl(100, 0%, 50%), 96%);\ - \n c97: saturate(hsl(100, 0%, 50%), 97%);\ - \n c98: saturate(hsl(100, 0%, 50%), 98%);\ - \n c99: saturate(hsl(100, 0%, 50%), 99%);\ - \n c100: saturate(hsl(100, 0%, 50%), 100%);\ + \n c81: color.adjust(hsl(100, 0%, 50%), $saturation: 81%);\ + \n c82: color.adjust(hsl(100, 0%, 50%), $saturation: 82%);\ + \n c83: color.adjust(hsl(100, 0%, 50%), $saturation: 83%);\ + \n c84: color.adjust(hsl(100, 0%, 50%), $saturation: 84%);\ + \n c85: color.adjust(hsl(100, 0%, 50%), $saturation: 85%);\ + \n c86: color.adjust(hsl(100, 0%, 50%), $saturation: 86%);\ + \n c87: color.adjust(hsl(100, 0%, 50%), $saturation: 87%);\ + \n c88: color.adjust(hsl(100, 0%, 50%), $saturation: 88%);\ + \n c89: color.adjust(hsl(100, 0%, 50%), $saturation: 89%);\ + \n c90: color.adjust(hsl(100, 0%, 50%), $saturation: 90%);\ + \n c91: color.adjust(hsl(100, 0%, 50%), $saturation: 91%);\ + \n c92: color.adjust(hsl(100, 0%, 50%), $saturation: 92%);\ + \n c93: color.adjust(hsl(100, 0%, 50%), $saturation: 93%);\ + \n c94: color.adjust(hsl(100, 0%, 50%), $saturation: 94%);\ + \n c95: color.adjust(hsl(100, 0%, 50%), $saturation: 95%);\ + \n c96: color.adjust(hsl(100, 0%, 50%), $saturation: 96%);\ + \n c97: color.adjust(hsl(100, 0%, 50%), $saturation: 97%);\ + \n c98: color.adjust(hsl(100, 0%, 50%), $saturation: 98%);\ + \n c99: color.adjust(hsl(100, 0%, 50%), $saturation: 99%);\ + \n c100: color.adjust(hsl(100, 0%, 50%), $saturation: 100%);\ \n}\n"), "foo {\ - \n c0: gray;\ - \n c1: #7f817e;\ - \n c2: #7f827d;\ - \n c3: #7e837c;\ - \n c4: #7e857a;\ - \n c5: #7d8679;\ - \n c6: #7d8778;\ - \n c7: #7d8877;\ - \n c8: #7c8a75;\ - \n c9: #7c8b74;\ - \n c10: #7b8c73;\ - \n c11: #7b8e71;\ - \n c12: #7a8f70;\ - \n c13: #7a906f;\ - \n c14: #7a916e;\ - \n c15: #79936c;\ - \n c16: #79946b;\ - \n c17: #78956a;\ - \n c18: #789669;\ - \n c19: #779867;\ - \n c20: #779966;\ - \n c21: #779a65;\ - \n c22: #769c63;\ - \n c23: #769d62;\ - \n c24: #759e61;\ - \n c25: #759f60;\ - \n c26: #74a15e;\ - \n c27: #74a25d;\ - \n c28: #74a35c;\ - \n c29: #73a45b;\ - \n c30: #73a659;\ - \n c31: #72a758;\ - \n c32: #72a857;\ - \n c33: #71aa55;\ - \n c34: #71ab54;\ - \n c35: #71ac53;\ - \n c36: #70ad52;\ - \n c37: #70af50;\ - \n c38: #6fb04f;\ - \n c39: #6fb14e;\ - \n c41: #6eb44b;\ - \n c42: #6eb54a;\ - \n c43: #6db649;\ - \n c44: #6db847;\ - \n c45: #6cb946;\ - \n c46: #6cba45;\ - \n c47: #6cbb44;\ - \n c48: #6bbd42;\ - \n c49: #6bbe41;\ - \n c50: #6abf40;\ - \n c51: #6ac13e;\ - \n c52: #69c23d;\ - \n c53: #69c33c;\ - \n c54: #69c43b;\ - \n c55: #68c639;\ - \n c56: #68c738;\ - \n c57: #67c837;\ - \n c58: #67c936;\ - \n c59: #66cb34;\ - \n c60: #66cc33;\ - \n c61: #66cd32;\ - \n c62: #65cf30;\ - \n c63: #65d02f;\ - \n c64: #64d12e;\ - \n c65: #64d22d;\ - \n c66: #63d42b;\ - \n c67: #63d52a;\ - \n c68: #63d629;\ - \n c69: #62d728;\ - \n c70: #62d926;\ - \n c71: #61da25;\ - \n c72: #61db24;\ - \n c73: #60dd22;\ - \n c74: #60de21;\ - \n c75: #60df20;\ - \n c76: #5fe01f;\ - \n c77: #5fe21d;\ - \n c78: #5ee31c;\ - \n c79: #5ee41b;\ - \n c81: #5de718;\ - \n c82: #5de817;\ - \n c83: #5ce916;\ - \n c84: #5ceb14;\ - \n c85: #5bec13;\ - \n c86: #5bed12;\ - \n c87: #5bee11;\ - \n c88: #5af00f;\ - \n c89: #5af10e;\ - \n c90: #59f20d;\ - \n c91: #59f40b;\ - \n c92: #58f50a;\ - \n c93: #58f609;\ - \n c94: #58f708;\ - \n c95: #57f906;\ - \n c96: #57fa05;\ - \n c97: #56fb04;\ - \n c98: #56fc03;\ - \n c99: #55fe01;\ - \n c100: #55ff00;\ + \n c0: hsl(100, 0%, 50%);\ + \n c1: hsl(100, 1%, 50%);\ + \n c2: hsl(100, 2%, 50%);\ + \n c3: hsl(100, 3%, 50%);\ + \n c4: hsl(100, 4%, 50%);\ + \n c5: hsl(100, 5%, 50%);\ + \n c6: hsl(100, 6%, 50%);\ + \n c7: hsl(100, 7%, 50%);\ + \n c8: hsl(100, 8%, 50%);\ + \n c9: hsl(100, 9%, 50%);\ + \n c10: hsl(100, 10%, 50%);\ + \n c11: hsl(100, 11%, 50%);\ + \n c12: hsl(100, 12%, 50%);\ + \n c13: hsl(100, 13%, 50%);\ + \n c14: hsl(100, 14%, 50%);\ + \n c15: hsl(100, 15%, 50%);\ + \n c16: hsl(100, 16%, 50%);\ + \n c17: hsl(100, 17%, 50%);\ + \n c18: hsl(100, 18%, 50%);\ + \n c19: hsl(100, 19%, 50%);\ + \n c20: hsl(100, 20%, 50%);\ + \n c21: hsl(100, 21%, 50%);\ + \n c22: hsl(100, 22%, 50%);\ + \n c23: hsl(100, 23%, 50%);\ + \n c24: hsl(100, 24%, 50%);\ + \n c25: hsl(100, 25%, 50%);\ + \n c26: hsl(100, 26%, 50%);\ + \n c27: hsl(100, 27%, 50%);\ + \n c28: hsl(100, 28%, 50%);\ + \n c29: hsl(100, 29%, 50%);\ + \n c30: hsl(100, 30%, 50%);\ + \n c31: hsl(100, 31%, 50%);\ + \n c32: hsl(100, 32%, 50%);\ + \n c33: hsl(100, 33%, 50%);\ + \n c34: hsl(100, 34%, 50%);\ + \n c35: hsl(100, 35%, 50%);\ + \n c36: hsl(100, 36%, 50%);\ + \n c37: hsl(100, 37%, 50%);\ + \n c38: hsl(100, 38%, 50%);\ + \n c39: hsl(100, 39%, 50%);\ + \n c41: hsl(100, 41%, 50%);\ + \n c42: hsl(100, 42%, 50%);\ + \n c43: hsl(100, 43%, 50%);\ + \n c44: hsl(100, 44%, 50%);\ + \n c45: hsl(100, 45%, 50%);\ + \n c46: hsl(100, 46%, 50%);\ + \n c47: hsl(100, 47%, 50%);\ + \n c48: hsl(100, 48%, 50%);\ + \n c49: hsl(100, 49%, 50%);\ + \n c50: hsl(100, 50%, 50%);\ + \n c51: hsl(100, 51%, 50%);\ + \n c52: hsl(100, 52%, 50%);\ + \n c53: hsl(100, 53%, 50%);\ + \n c54: hsl(100, 54%, 50%);\ + \n c55: hsl(100, 55%, 50%);\ + \n c56: hsl(100, 56%, 50%);\ + \n c57: hsl(100, 57%, 50%);\ + \n c58: hsl(100, 58%, 50%);\ + \n c59: hsl(100, 59%, 50%);\ + \n c60: hsl(100, 60%, 50%);\ + \n c61: hsl(100, 61%, 50%);\ + \n c62: hsl(100, 62%, 50%);\ + \n c63: hsl(100, 63%, 50%);\ + \n c64: hsl(100, 64%, 50%);\ + \n c65: hsl(100, 65%, 50%);\ + \n c66: hsl(100, 66%, 50%);\ + \n c67: hsl(100, 67%, 50%);\ + \n c68: hsl(100, 68%, 50%);\ + \n c69: hsl(100, 69%, 50%);\ + \n c70: hsl(100, 70%, 50%);\ + \n c71: hsl(100, 71%, 50%);\ + \n c72: hsl(100, 72%, 50%);\ + \n c73: hsl(100, 73%, 50%);\ + \n c74: hsl(100, 74%, 50%);\ + \n c75: hsl(100, 75%, 50%);\ + \n c76: hsl(100, 76%, 50%);\ + \n c77: hsl(100, 77%, 50%);\ + \n c78: hsl(100, 78%, 50%);\ + \n c79: hsl(100, 79%, 50%);\ + \n c81: hsl(100, 81%, 50%);\ + \n c82: hsl(100, 82%, 50%);\ + \n c83: hsl(100, 83%, 50%);\ + \n c84: hsl(100, 84%, 50%);\ + \n c85: hsl(100, 85%, 50%);\ + \n c86: hsl(100, 86%, 50%);\ + \n c87: hsl(100, 87%, 50%);\ + \n c88: hsl(100, 88%, 50%);\ + \n c89: hsl(100, 89%, 50%);\ + \n c90: hsl(100, 90%, 50%);\ + \n c91: hsl(100, 91%, 50%);\ + \n c92: hsl(100, 92%, 50%);\ + \n c93: hsl(100, 93%, 50%);\ + \n c94: hsl(100, 94%, 50%);\ + \n c95: hsl(100, 95%, 50%);\ + \n c96: hsl(100, 96%, 50%);\ + \n c97: hsl(100, 97%, 50%);\ + \n c98: hsl(100, 98%, 50%);\ + \n c99: hsl(100, 99%, 50%);\ + \n c100: hsl(100, 100%, 50%);\ \n}\n" ); } diff --git a/rsass/tests/spec/libsass/delayed.rs b/rsass/tests/spec/libsass/delayed.rs index b17a0245a..cd8275568 100644 --- a/rsass/tests/spec/libsass/delayed.rs +++ b/rsass/tests/spec/libsass/delayed.rs @@ -8,17 +8,18 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$x: a 3/4 b;\ + runner().ok("@use \"sass:list\";\ + \n$x: a 3/4 b;\ \n$y: hey;\n\ \n@function foo() {\ \n @return 3/4;\ \n}\n\ \ndiv {\ \n hoo: 3/4;\ - \n goo: nth($x, 2);\ - \n foo: 15 / nth($x, 2);\ - \n foo: .25 + nth($x, 2);\ - \n coo: 2/3 / nth($x, 2);\ + \n goo: list.nth($x, 2);\ + \n foo: 15 / list.nth($x, 2);\ + \n foo: .25 + list.nth($x, 2);\ + \n coo: 2/3 / list.nth($x, 2);\ \n bar: $y and true;\ \n bar: false and true;\ \n bar: (false) and true;\ @@ -27,7 +28,7 @@ fn test() { \n }\ \n bloo: foo();\ \n @warn 2/3;\ - \n blix: \"hey #{nth($x, 2)} ho\";\ + \n blix: \"hey #{list.nth($x, 2)} ho\";\ \n}\n\ \n@media screen and (hux: 3/4) {\ \n div {\ @@ -36,7 +37,7 @@ fn test() { \n}\n\ \n@warn \"blah blah\";\n\ \ndiv {\ - \n blah: \"ho #{nth($x, 2) } ho\";\ + \n blah: \"ho #{list.nth($x, 2) } ho\";\ \n}\n\ \nspan {\ \n fludge: (true and 3/4);\ diff --git a/rsass/tests/spec/libsass/div.rs b/rsass/tests/spec/libsass/div.rs index f081496f9..61717bbd8 100644 --- a/rsass/tests/spec/libsass/div.rs +++ b/rsass/tests/spec/libsass/div.rs @@ -8,7 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$x: 3/4;\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n$x: 3/4;\ \n$xs: hey 3/4 ho;\n\ \ndiv {\ \n /* $x: 3/4 */\ @@ -16,9 +18,9 @@ fn test() { \n b: hey $x ho;\ \n /* $xs: hey 3/4 ho */\ \n c: $xs;\ - \n d: nth($xs, 2);\ - \n e: nth($xs, 2) == 0.75;\ - \n f: type-of(nth($xs, 2));\ + \n d: list.nth($xs, 2);\ + \n e: list.nth($xs, 2) == 0.75;\ + \n f: meta.type-of(list.nth($xs, 2));\ \n}"), "div {\ \n /* $x: 3/4 */\ diff --git a/rsass/tests/spec/libsass/list_evaluation.rs b/rsass/tests/spec/libsass/list_evaluation.rs index 9bd90de72..1ba84fa1a 100644 --- a/rsass/tests/spec/libsass/list_evaluation.rs +++ b/rsass/tests/spec/libsass/list_evaluation.rs @@ -8,12 +8,14 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("div {\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \ndiv {\ \n $things: red 2/3 blue;\ \n content: $things;\ - \n content: nth($things, 2);\ - \n content: type-of(nth($things, 2));\ - \n content: type-of(nth($things, 3));\ + \n content: list.nth($things, 2);\ + \n content: meta.type-of(list.nth($things, 2));\ + \n content: meta.type-of(list.nth($things, 3));\ \n /**** #{2+2} ****/\ \n content: (1 / 2 3 / 4) + (5/6 7/8);\ \n content: (1/2 3/4), (5/6 7/8);\ diff --git a/rsass/tests/spec/libsass/lists.rs b/rsass/tests/spec/libsass/lists.rs index d57a163f5..4c5affe92 100644 --- a/rsass/tests/spec/libsass/lists.rs +++ b/rsass/tests/spec/libsass/lists.rs @@ -8,29 +8,31 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("div {\ - \n $list: append(1/2 3, 4);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \ndiv {\ + \n $list: list.append(1/2 3, 4);\ \n content: (1 2 3) == (1, 2, 3);\ \n content: (1 2 3) == (1 2 3);\ \n content: var $list;\ \n content: lit (1/2 3 4);\ \n content: (1/2 3 4) == $list;\ - \n a: length((1/2 3 4)), length($list);\ - \n b: nth((1/2 3 4), 1), nth($list, 1);\ + \n a: list.length((1/2 3 4)), list.length($list);\ + \n b: list.nth((1/2 3 4), 1), list.nth($list, 1);\ \n content: (1/2 3 4) == (1/2 3 4);\ \n /***/\ - \n content: length($list);\ - \n content: type-of(nth($list, 1));\ - \n content: nth($list, 1);\ - \n content: nth(1/2 3 4, 1);\ + \n content: list.length($list);\ + \n content: meta.type-of(list.nth($list, 1));\ + \n content: list.nth($list, 1);\ + \n content: list.nth(1/2 3 4, 1);\ \n $a: 1 2 3;\ \n $b: (1 2 3);\ \n content: $a == $b;\ \n content: 1 2 () 3;\ \n color: red == #ff0000;\ \n $color-list : fudge red blue;\ - \n color: nth($color-list, 2) == #ff0000;\ - \n color: nth($color-list, 2) == red;\ + \n color: list.nth($color-list, 2) == #ff0000;\ + \n color: list.nth($color-list, 2) == red;\ \n}"), "div {\ \n content: false;\ diff --git a/rsass/tests/spec/libsass/mixin.rs b/rsass/tests/spec/libsass/mixin.rs index 73db7d767..742a7153f 100644 --- a/rsass/tests/spec/libsass/mixin.rs +++ b/rsass/tests/spec/libsass/mixin.rs @@ -9,12 +9,15 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "// @charset \"UTF-8\";\n\ + "@use \"sass:list\";\ + \n@use \"sass:math\";\ + \n@use \"sass:string\";\ + \n// @charset \"UTF-8\";\n\ \n@mixin background-image-retina($file, $type, $width, $height) {\ - \n background-image: unquote(image-url(\"#{$file}.#{$type}\", true));\ - \n hey: length(a b c d);\ - \n ho: unquote(\"hello\");\ - \n hee: unquote(unit(10fudge));\n\ + \n background-image: string.unquote(image-url(\"#{$file}.#{$type}\", true));\ + \n hey: list.length(a b c d);\ + \n ho: string.unquote(\"hello\");\ + \n hee: string.unquote(math.unit(10fudge));\n\ \n @media (-webkit-min-device-pixel-ratio: 2), (-moz-min-device-pixel-ratio: 2) {\ \n & {\ \n background-image: image-url(\"#{$file}@2x.#{$type}\");\ @@ -49,7 +52,7 @@ fn test() { \n @include bar(1);\ \n @include bar($x: n1, $y: n2);\ \n @include bar($x: n1);\ - \n blah: unquote(\"hello\");\ + \n blah: string.unquote(\"hello\");\ \n}" ), "div {\ diff --git a/rsass/tests/spec/libsass/parent_selector/missing.rs b/rsass/tests/spec/libsass/parent_selector/missing.rs index cf8c2fda6..5636bfab1 100644 --- a/rsass/tests/spec/libsass/parent_selector/missing.rs +++ b/rsass/tests/spec/libsass/parent_selector/missing.rs @@ -10,7 +10,8 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "$tablet-portrait: 768px;\ + "@use \"sass:map\";\ + \n$tablet-portrait: 768px;\ \n$tablet-landscape: 980px;\ \n$desk-normal: 1120px;\ \n$desk-big: 1280px;\ @@ -33,7 +34,7 @@ fn test() { \n }\ \n }\ \n}\n\ - \n@each $name in map-keys($grid-breakpoints-immobile) {\ + \n@each $name in map.keys($grid-breakpoints-immobile) {\ \n @include grid-media-query($name, $grid-breakpoints-immobile) {\ \n body.immobile & {\ \n margin-bottom: 0;\ @@ -43,11 +44,11 @@ fn test() { ), "Error: Top-level selectors may not contain the parent selector \"&\".\ \n ,\ - \n30 | body.immobile & {\ + \n31 | body.immobile & {\ \n | ^\ \n \'\ - \n input.scss 30:19 @content\ - \n input.scss 22:9 grid-media-query()\ - \n input.scss 29:3 root stylesheet", + \n input.scss 31:19 @content\ + \n input.scss 23:9 grid-media-query()\ + \n input.scss 30:3 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass/precision/default.rs b/rsass/tests/spec/libsass/precision/default.rs index 69908bca1..51b57ba13 100644 --- a/rsass/tests/spec/libsass/precision/default.rs +++ b/rsass/tests/spec/libsass/precision/default.rs @@ -8,11 +8,12 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("test {\r\ - \n foo: 0.4999 round(0.4999);\r\ - \n bar: 0.49999 round(0.49999);\r\ - \n baz: 0.499999 round(0.499999);\r\ - \n baz: 0.49999999999 round(0.49999999999);\r\ + runner().ok("@use \"sass:math\";\ + \ntest {\r\ + \n foo: 0.4999 math.round(0.4999);\r\ + \n bar: 0.49999 math.round(0.49999);\r\ + \n baz: 0.499999 math.round(0.499999);\r\ + \n baz: 0.49999999999 math.round(0.49999999999);\r\ \n}\r\n"), "test {\ \n foo: 0.4999 0;\ diff --git a/rsass/tests/spec/libsass/precision/higher.rs b/rsass/tests/spec/libsass/precision/higher.rs index 2c94364c6..fb859e5bb 100644 --- a/rsass/tests/spec/libsass/precision/higher.rs +++ b/rsass/tests/spec/libsass/precision/higher.rs @@ -9,10 +9,11 @@ fn runner() -> crate::TestRunner { fn test() { let runner = runner().set_precision(6); assert_eq!( - runner.ok("test {\r\ - \n foo: 0.4999 round(0.4999);\r\ - \n bar: 0.49999 round(0.49999);\r\ - \n baz: 0.499999 round(0.499999);\r\ + runner.ok("@use \"sass:math\";\ + \ntest {\r\ + \n foo: 0.4999 math.round(0.4999);\r\ + \n bar: 0.49999 math.round(0.49999);\r\ + \n baz: 0.499999 math.round(0.499999);\r\ \n}"), "test {\ \n foo: 0.4999 0;\ diff --git a/rsass/tests/spec/libsass/precision/lower.rs b/rsass/tests/spec/libsass/precision/lower.rs index 7fd62607b..314cf6d69 100644 --- a/rsass/tests/spec/libsass/precision/lower.rs +++ b/rsass/tests/spec/libsass/precision/lower.rs @@ -10,10 +10,11 @@ fn runner() -> crate::TestRunner { fn test() { let runner = runner().set_precision(4); assert_eq!( - runner.ok("test {\r\ - \n foo: 0.4999 round(0.4999);\r\ - \n bar: 0.49999 round(0.49999);\r\ - \n baz: 0.499999 round(0.499999);\r\ + runner.ok("@use \"sass:math\";\ + \ntest {\r\ + \n foo: 0.4999 math.round(0.4999);\r\ + \n bar: 0.49999 math.round(0.49999);\r\ + \n baz: 0.499999 math.round(0.499999);\r\ \n}"), "test {\ \n foo: 0.4999 0;\ diff --git a/rsass/tests/spec/libsass/selector_functions/selector_length.rs b/rsass/tests/spec/libsass/selector_functions/selector_length.rs index cb56a1c9e..4684572a1 100644 --- a/rsass/tests/spec/libsass/selector_functions/selector_length.rs +++ b/rsass/tests/spec/libsass/selector_functions/selector_length.rs @@ -8,10 +8,11 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("foo.bar.baz asd.qwe xyz, second {\r\ - \n length: length(&);\r\ - \n length: length(nth(&, 1));\r\ - \n length: length(nth(nth(&, 1), 1));\r\ + runner().ok("@use \"sass:list\";\ + \nfoo.bar.baz asd.qwe xyz, second {\r\ + \n length: list.length(&);\r\ + \n length: list.length(list.nth(&, 1));\r\ + \n length: list.length(list.nth(list.nth(&, 1), 1));\r\ \n}"), "foo.bar.baz asd.qwe xyz, second {\ \n length: 2;\ diff --git a/rsass/tests/spec/libsass/selector_functions/simple_selector.rs b/rsass/tests/spec/libsass/selector_functions/simple_selector.rs index a94783b5e..74b756a8e 100644 --- a/rsass/tests/spec/libsass/selector_functions/simple_selector.rs +++ b/rsass/tests/spec/libsass/selector_functions/simple_selector.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("foo {\r\ - \n test-01: simple-selectors(\".foo.bar\");\r\ - \n test-02: simple-selectors(\".foo.bar.baz\");\r\ + runner().ok("@use \"sass:selector\";\ + \nfoo {\r\ + \n test-01: selector.simple-selectors(\".foo.bar\");\r\ + \n test-02: selector.simple-selectors(\".foo.bar.baz\");\r\ \n}"), "foo {\ \n test-01: .foo, .bar;\ diff --git a/rsass/tests/spec/libsass/selectors/function_argument.rs b/rsass/tests/spec/libsass/selectors/function_argument.rs index e197bf8e6..bc6aa0503 100644 --- a/rsass/tests/spec/libsass/selectors/function_argument.rs +++ b/rsass/tests/spec/libsass/selectors/function_argument.rs @@ -8,25 +8,26 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$Selectors: ();\n\ + runner().ok("@use \"sass:list\";\ + \n$Selectors: ();\n\ \n//////////////////////////////\ \n// Add selectors of various depths and makeups\ \n//////////////////////////////\ \n.foo {\ - \n $Selectors: append($Selectors, &) !global;\ + \n $Selectors: list.append($Selectors, &) !global;\ \n}\n\ \n.bar a {\ - \n $Selectors: append($Selectors, &) !global;\ + \n $Selectors: list.append($Selectors, &) !global;\ \n}\n\ \n.bar,\ \n.baz {\ - \n $Selectors: append($Selectors, &) !global;\ + \n $Selectors: list.append($Selectors, &) !global;\ \n}\n\ \n.qux {\ \n &.waldo {\ \n .where & {\ \n .final {\ - \n $Selectors: append($Selectors, &) !global;\ + \n $Selectors: list.append($Selectors, &) !global;\ \n }\ \n }\ \n }\ @@ -35,12 +36,12 @@ fn test() { \n// Display Results\ \n//////////////////////////////\ \n.result {\ - \n length: length($Selectors);\ + \n length: list.length($Selectors);\ \n content: $Selectors;\ - \n @for $i from 1 through length($Selectors) {\ + \n @for $i from 1 through list.length($Selectors) {\ \n index: $i;\ - \n length: length(nth($Selectors, $i));\ - \n content: nth($Selectors, $i);\ + \n length: list.length(list.nth($Selectors, $i));\ + \n content: list.nth($Selectors, $i);\ \n }\ \n}"), ".result {\ diff --git a/rsass/tests/spec/libsass/selectors/mixin_argument.rs b/rsass/tests/spec/libsass/selectors/mixin_argument.rs index 069325fd1..6f4ce5acf 100644 --- a/rsass/tests/spec/libsass/selectors/mixin_argument.rs +++ b/rsass/tests/spec/libsass/selectors/mixin_argument.rs @@ -9,15 +9,17 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("@mixin selector-info($selector) {\ - \n type: type-of($selector);\ - \n length: length($selector);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@mixin selector-info($selector) {\ + \n type: meta.type-of($selector);\ + \n length: list.length($selector);\ \n content: $selector;\ - \n @for $i from 1 through length($selector) {\ + \n @for $i from 1 through list.length($selector) {\ \n index: $i;\ - \n length: length(nth($selector, $i));\ - \n type: type-of(nth($selector, $i));\ - \n content: nth($selector, $i);\ + \n length: list.length(list.nth($selector, $i));\ + \n type: meta.type-of(list.nth($selector, $i));\ + \n content: list.nth($selector, $i);\ \n }\ \n}\n\ \n.foo {\ diff --git a/rsass/tests/spec/libsass/test.rs b/rsass/tests/spec/libsass/test.rs index 2913c9a96..04592bcb5 100644 --- a/rsass/tests/spec/libsass/test.rs +++ b/rsass/tests/spec/libsass/test.rs @@ -10,7 +10,10 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$x: 3;\n\ + "@use \"sass:color\";\ + \n@use \"sass:list\";\ + \n@use \"sass:math\";\ + \n$x: 3;\n\ \ndiv {\ \n\tnoo: not $x;\ \n\tpoo: not 3;\ @@ -29,13 +32,13 @@ fn test() { \n a: rgba(100, 20, 0, 1);\ \n b: rgba(#abc, 1);\ \n c: compact(hello, my, false, name, is, false, aaron, false, false);\ - \n d: join(1 2 3, 4 5 6, comma);\ - \n e: join(a b c, d e f);\ - \n f: change-color(#102030, $blue: 5);\ - \n g: change-color(#102030, $red: 120, $blue: 5);\ + \n d: list.join(1 2 3, 4 5 6, comma);\ + \n e: list.join(a b c, d e f);\ + \n f: color.change(#102030, $blue: 5);\ + \n g: color.change(#102030, $red: 120, $blue: 5);\ \n h: hsl(25, 100%, 80%);\ - \n h: change-color(#ffc499, $alpha: 0.8, $lightness: 40%);\ - \n h: change-color(hsl(25, 100%, 80%), $alpha: 0.8, $lightness: 40%);\ + \n h: color.change(#ffc499, $alpha: 0.8, $lightness: 40%);\ + \n h: color.change(hsl(25, 100%, 80%), $alpha: 0.8, $lightness: 40%);\ \n i: hsla(25, 100%, 40%, 0.8);\ \n foo: url(\"http://blah/flah/grah\");\ \n foo: url(http://foo/bar/buzz.css);\ @@ -50,11 +53,11 @@ fn test() { \n}\n\ \ndiv {\ \n flug: url(bug.mug);\ - \n krug: nth(1 2 3, 2px);\ - \n blug: nth(a b c d, 3);\ - \n flig: comparable(34, 22px) comparable(1%, 3) comparable(2, 1) comparable(4cm, 1in);\ - \n flug: comparable(1px, 2.3in) comparable(1%, 2pt);\ - \n flib: comparable(3ex, 2px) comparable(3em, 2cm);\ + \n krug: list.nth(1 2 3, 2px);\ + \n blug: list.nth(a b c d, 3);\ + \n flig: math.compatible(34, 22px) math.compatible(1%, 3) math.compatible(2, 1) math.compatible(4cm, 1in);\ + \n flug: math.compatible(1px, 2.3in) math.compatible(1%, 2pt);\ + \n flib: math.compatible(3ex, 2px) math.compatible(3em, 2cm);\ \n glib: not(fudge) not(false) not(0) not(red);\ \n trib: if(red, yellow, not taken);\ \n trub: if(not(fudge), not taken, here we are);\ @@ -106,7 +109,7 @@ fn test() { \n g: #782005;\ \n h: hsl(25, 100%, 80%);\ \n h: rgba(204, 86, 0, 0.8);\ - \n h: rgba(204, 85, 0, 0.8);\ + \n h: hsla(25, 100%, 40%, 0.8);\ \n i: hsla(25, 100%, 40%, 0.8);\ \n foo: url(\"http://blah/flah/grah\");\ \n foo: url(http://foo/bar/buzz.css);\ diff --git a/rsass/tests/spec/libsass/unary_ops.rs b/rsass/tests/spec/libsass/unary_ops.rs index 757311760..9979a960e 100644 --- a/rsass/tests/spec/libsass/unary_ops.rs +++ b/rsass/tests/spec/libsass/unary_ops.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$x: 20%;\n\ + runner().ok("@use \"sass:meta\";\ + \n$x: 20%;\n\ \ndiv {\ \n a: -10;\ \n b: -10px + 10px;\ @@ -19,7 +20,7 @@ fn test() { \n g: -hello;\ \n h: +hello;\ \n i: + hello;\ - \n j: type-of(+ hello);\ + \n j: meta.type-of(+ hello);\ \n}"), "div {\ \n a: -10;\ diff --git a/rsass/tests/spec/libsass/units/feature_test.rs b/rsass/tests/spec/libsass/units/feature_test.rs index b0622770b..a9cbda89f 100644 --- a/rsass/tests/spec/libsass/units/feature_test.rs +++ b/rsass/tests/spec/libsass/units/feature_test.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@if feature-exists(units-level-3) {\ + runner().ok("@use \"sass:meta\";\ + \n@if meta.feature-exists(units-level-3) {\ \n div {\ \n feature: true;\ \n }\ diff --git a/rsass/tests/spec/libsass/units/simple.rs b/rsass/tests/spec/libsass/units/simple.rs index 2e28ef71f..1f8b64ffd 100644 --- a/rsass/tests/spec/libsass/units/simple.rs +++ b/rsass/tests/spec/libsass/units/simple.rs @@ -9,11 +9,12 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("div {\ + runner().ok("@use \"sass:math\";\ + \ndiv {\ \n hey: ((5in + 3cm) * 10px * 100pt * 10fu / 2px / 2fu / 3pt);\ \n ho: (23in/2fu) > (23cm/2fu);\ - \n hoo: unit((23px/2fu/12emu/1.2gnu));\ - \n hee: unit((2in/3cm/4cm));\ + \n hoo: math.unit((23px/2fu/12emu/1.2gnu));\ + \n hee: math.unit((2in/3cm/4cm));\ \n}"), "div {\ \n hey: 370866.1417322835pt;\ diff --git a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/at_root.rs b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/at_root.rs index 2a0a4c368..5e84de1a9 100644 --- a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/at_root.rs +++ b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/at_root.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$root_default: initial;\r\ + runner().ok("@use \"sass:meta\";\ + \n$root_default: initial;\r\ \n$root_implicit: initial;\r\ \n$root_explicit: initial !global;\r\ \n\r\ @@ -33,13 +34,13 @@ fn test() { \n root_default: $root_default;\r\ \n root_implicit: $root_implicit;\r\ \n root_explicit: $root_explicit;\r\ - \n @if variable-exists(local_default) {\r\ + \n @if meta.variable-exists(local_default) {\r\ \n local_default: $local_default;\r\ \n }\r\ - \n @if variable-exists(local_implicit) {\r\ + \n @if meta.variable-exists(local_implicit) {\r\ \n local_implicit: $local_implicit;\r\ \n }\r\ - \n @if variable-exists(local_explicit) {\r\ + \n @if meta.variable-exists(local_explicit) {\r\ \n local_explicit: $local_explicit;\r\ \n }\r\ \n}\r\n"), diff --git a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/each.rs b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/each.rs index 3b6dd4785..232888137 100644 --- a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/each.rs +++ b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/each.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("$root_default: initial;\r\ + runner().ok("@use \"sass:meta\";\ + \n$root_default: initial;\r\ \n$root_implicit: initial;\r\ \n$root_explicit: initial !global;\r\ \n\r\ @@ -31,22 +32,22 @@ fn test() { \n}\r\ \n\r\ \nresult {\r\ - \n @if variable-exists(outer) {\r\ + \n @if meta.variable-exists(outer) {\r\ \n outer: $outer;\r\ \n }\r\ - \n @if variable-exists(inner) {\r\ + \n @if meta.variable-exists(inner) {\r\ \n inner: $inner;\r\ \n }\r\ \n root_default: $root_default;\r\ \n root_implicit: $root_implicit;\r\ \n root_explicit: $root_explicit;\r\ - \n @if variable-exists(local_default) {\r\ + \n @if meta.variable-exists(local_default) {\r\ \n local_default: $local_default;\r\ \n }\r\ - \n @if variable-exists(local_implicit) {\r\ + \n @if meta.variable-exists(local_implicit) {\r\ \n local_implicit: $local_implicit;\r\ \n }\r\ - \n @if variable-exists(local_explicit) {\r\ + \n @if meta.variable-exists(local_explicit) {\r\ \n local_explicit: $local_explicit;\r\ \n }\r\ \n}\r\n"), diff --git a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/elseif.rs b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/elseif.rs index 7d3c83c6e..3cbeb1de5 100644 --- a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/elseif.rs +++ b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/elseif.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("$root_default: initial;\r\ + runner().ok("@use \"sass:meta\";\ + \n$root_default: initial;\r\ \n$root_implicit: initial;\r\ \n$root_explicit: initial !global;\r\ \n\r\ @@ -40,13 +41,13 @@ fn test() { \n root_default: $root_default;\r\ \n root_implicit: $root_implicit;\r\ \n root_explicit: $root_explicit;\r\ - \n @if variable-exists(local_default) {\r\ + \n @if meta.variable-exists(local_default) {\r\ \n local_default: $local_default;\r\ \n }\r\ - \n @if variable-exists(local_implicit) {\r\ + \n @if meta.variable-exists(local_implicit) {\r\ \n local_implicit: $local_implicit;\r\ \n }\r\ - \n @if variable-exists(local_explicit) {\r\ + \n @if meta.variable-exists(local_explicit) {\r\ \n local_explicit: $local_explicit;\r\ \n }\r\ \n}\r\n"), diff --git a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/function.rs b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/function.rs index 16f5f7adb..0e11fd17e 100644 --- a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/function.rs +++ b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/function.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$continue_inner: true;\r\ + runner().ok("@use \"sass:meta\";\ + \n$continue_inner: true;\r\ \n$continue_outer: true;\r\ \n$root_default: initial;\r\ \n$root_implicit: initial;\r\ @@ -36,22 +37,22 @@ fn test() { \n\r\ \nresult {\r\ \n fn: fn();\r\ - \n @if variable-exists(continue_outer) {\r\ + \n @if meta.variable-exists(continue_outer) {\r\ \n continue_outer: $continue_outer;\r\ \n }\r\ - \n @if variable-exists(continue_inner) {\r\ + \n @if meta.variable-exists(continue_inner) {\r\ \n continue_inner: $continue_inner;\r\ \n }\r\ \n root_default: $root_default;\r\ \n root_implicit: $root_implicit;\r\ \n root_explicit: $root_explicit;\r\ - \n @if variable-exists(local_default) {\r\ + \n @if meta.variable-exists(local_default) {\r\ \n local_default: $local_default;\r\ \n }\r\ - \n @if variable-exists(local_implicit) {\r\ + \n @if meta.variable-exists(local_implicit) {\r\ \n local_implicit: $local_implicit;\r\ \n }\r\ - \n @if variable-exists(local_explicit) {\r\ + \n @if meta.variable-exists(local_explicit) {\r\ \n local_explicit: $local_explicit;\r\ \n }\r\ \n}\r\n"), diff --git a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/mixin.rs b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/mixin.rs index d3b392881..08ce77a4a 100644 --- a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/mixin.rs +++ b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/mixin.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$root_default: initial;\r\ + runner().ok("@use \"sass:meta\";\ + \n$root_default: initial;\r\ \n$root_implicit: initial;\r\ \n$root_explicit: initial !global;\r\ \n\r\ @@ -37,13 +38,13 @@ fn test() { \n root_default: $root_default;\r\ \n root_implicit: $root_implicit;\r\ \n root_explicit: $root_explicit;\r\ - \n @if variable-exists(local_default) {\r\ + \n @if meta.variable-exists(local_default) {\r\ \n local_default: $local_default;\r\ \n }\r\ - \n @if variable-exists(local_implicit) {\r\ + \n @if meta.variable-exists(local_implicit) {\r\ \n local_implicit: $local_implicit;\r\ \n }\r\ - \n @if variable-exists(local_explicit) {\r\ + \n @if meta.variable-exists(local_explicit) {\r\ \n local_explicit: $local_explicit;\r\ \n }\r\ \n}\r\n"), diff --git a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/ruleset.rs b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/ruleset.rs index 58f9799c0..067dbb1ad 100644 --- a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/ruleset.rs +++ b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/ruleset.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$root_default: initial;\r\ + runner().ok("@use \"sass:meta\";\ + \n$root_default: initial;\r\ \n$root_implicit: initial;\r\ \n$root_explicit: initial !global;\r\ \n\r\ @@ -33,13 +34,13 @@ fn test() { \n root_default: $root_default;\r\ \n root_implicit: $root_implicit;\r\ \n root_explicit: $root_explicit;\r\ - \n @if variable-exists(local_default) {\r\ + \n @if meta.variable-exists(local_default) {\r\ \n local_default: $local_default;\r\ \n }\r\ - \n @if variable-exists(local_implicit) {\r\ + \n @if meta.variable-exists(local_implicit) {\r\ \n local_implicit: $local_implicit;\r\ \n }\r\ - \n @if variable-exists(local_explicit) {\r\ + \n @if meta.variable-exists(local_explicit) {\r\ \n local_explicit: $local_explicit;\r\ \n }\r\ \n}\r\n"), diff --git a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/test_else.rs b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/test_else.rs index af71c22fc..a4b9c8da5 100644 --- a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/test_else.rs +++ b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/test_else.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("$root_default: initial;\r\ + runner().ok("@use \"sass:meta\";\ + \n$root_default: initial;\r\ \n$root_implicit: initial;\r\ \n$root_explicit: initial !global;\r\ \n\r\ @@ -40,13 +41,13 @@ fn test() { \n root_default: $root_default;\r\ \n root_implicit: $root_implicit;\r\ \n root_explicit: $root_explicit;\r\ - \n @if variable-exists(local_default) {\r\ + \n @if meta.variable-exists(local_default) {\r\ \n local_default: $local_default;\r\ \n }\r\ - \n @if variable-exists(local_implicit) {\r\ + \n @if meta.variable-exists(local_implicit) {\r\ \n local_implicit: $local_implicit;\r\ \n }\r\ - \n @if variable-exists(local_explicit) {\r\ + \n @if meta.variable-exists(local_explicit) {\r\ \n local_explicit: $local_explicit;\r\ \n }\r\ \n}\r\n"), diff --git a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/test_for.rs b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/test_for.rs index 0ae1e3486..94f8fcda6 100644 --- a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/test_for.rs +++ b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/test_for.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("$continue: true;\r\ + runner().ok("@use \"sass:meta\";\ + \n$continue: true;\r\ \n$root_default: initial;\r\ \n$root_implicit: initial;\r\ \n$root_explicit: initial !global;\r\ @@ -32,22 +33,22 @@ fn test() { \n}\r\ \n\r\ \nresult {\r\ - \n @if variable-exists(outer) {\r\ + \n @if meta.variable-exists(outer) {\r\ \n outer: $outer;\r\ \n }\r\ - \n @if variable-exists(inner) {\r\ + \n @if meta.variable-exists(inner) {\r\ \n inner: $inner;\r\ \n }\r\ \n root_default: $root_default;\r\ \n root_implicit: $root_implicit;\r\ \n root_explicit: $root_explicit;\r\ - \n @if variable-exists(local_default) {\r\ + \n @if meta.variable-exists(local_default) {\r\ \n local_default: $local_default;\r\ \n }\r\ - \n @if variable-exists(local_implicit) {\r\ + \n @if meta.variable-exists(local_implicit) {\r\ \n local_implicit: $local_implicit;\r\ \n }\r\ - \n @if variable-exists(local_explicit) {\r\ + \n @if meta.variable-exists(local_explicit) {\r\ \n local_explicit: $local_explicit;\r\ \n }\r\ \n}\r\n"), diff --git a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/test_if.rs b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/test_if.rs index 11f86ee90..7e933f3de 100644 --- a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/test_if.rs +++ b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/test_if.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("$root_default: initial;\r\ + runner().ok("@use \"sass:meta\";\ + \n$root_default: initial;\r\ \n$root_implicit: initial;\r\ \n$root_explicit: initial !global;\r\ \n\r\ @@ -34,13 +35,13 @@ fn test() { \n root_default: $root_default;\r\ \n root_implicit: $root_implicit;\r\ \n root_explicit: $root_explicit;\r\ - \n @if variable-exists(local_default) {\r\ + \n @if meta.variable-exists(local_default) {\r\ \n local_default: $local_default;\r\ \n }\r\ - \n @if variable-exists(local_implicit) {\r\ + \n @if meta.variable-exists(local_implicit) {\r\ \n local_implicit: $local_implicit;\r\ \n }\r\ - \n @if variable-exists(local_explicit) {\r\ + \n @if meta.variable-exists(local_explicit) {\r\ \n local_explicit: $local_explicit;\r\ \n }\r\ \n}\r\n"), diff --git a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/test_while.rs b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/test_while.rs index 5f035036f..af348f0a7 100644 --- a/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/test_while.rs +++ b/rsass/tests/spec/libsass/variable_scoping/blead_global/expanding/test_while.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("$continue_inner: true;\r\ + runner().ok("@use \"sass:meta\";\ + \n$continue_inner: true;\r\ \n$continue_outer: true;\r\ \n$root_default: initial;\r\ \n$root_implicit: initial;\r\ @@ -35,22 +36,22 @@ fn test() { \n}\r\ \n\r\ \nresult {\r\ - \n @if variable-exists(continue_outer) {\r\ + \n @if meta.variable-exists(continue_outer) {\r\ \n continue_outer: $continue_outer;\r\ \n }\r\ - \n @if variable-exists(continue_inner) {\r\ + \n @if meta.variable-exists(continue_inner) {\r\ \n continue_inner: $continue_inner;\r\ \n }\r\ \n root_default: $root_default;\r\ \n root_implicit: $root_implicit;\r\ \n root_explicit: $root_explicit;\r\ - \n @if variable-exists(local_default) {\r\ + \n @if meta.variable-exists(local_default) {\r\ \n local_default: $local_default;\r\ \n }\r\ - \n @if variable-exists(local_implicit) {\r\ + \n @if meta.variable-exists(local_implicit) {\r\ \n local_implicit: $local_implicit;\r\ \n }\r\ - \n @if variable-exists(local_explicit) {\r\ + \n @if meta.variable-exists(local_explicit) {\r\ \n local_explicit: $local_explicit;\r\ \n }\r\ \n}\r\n"), diff --git a/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/each.rs b/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/each.rs index 2dd0a5484..76a17adf1 100644 --- a/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/each.rs +++ b/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/each.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("$root_default: initial;\r\ + runner().ok("@use \"sass:meta\";\ + \n$root_default: initial;\r\ \n$root_implicit: initial;\r\ \n$root_explicit: initial !global;\r\ \n\r\ @@ -38,31 +39,31 @@ fn test() { \n\r\ \nresult {\r\ \n fn: fn();\r\ - \n @if variable-exists(outer) {\r\ + \n @if meta.variable-exists(outer) {\r\ \n outer: $outer;\r\ \n }\r\ - \n @if variable-exists(inner) {\r\ + \n @if meta.variable-exists(inner) {\r\ \n inner: $inner;\r\ \n }\r\ - \n @if variable-exists(check_implicit) {\r\ + \n @if meta.variable-exists(check_implicit) {\r\ \n check_implicit: $check_implicit;\r\ \n }\r\ - \n @if variable-exists(check_explicit) {\r\ + \n @if meta.variable-exists(check_explicit) {\r\ \n check_explicit: $check_explicit;\r\ \n }\r\ - \n @if variable-exists(check_default) {\r\ + \n @if meta.variable-exists(check_default) {\r\ \n check_default: $check_default;\r\ \n }\r\ \n root_default: $root_default;\r\ \n root_implicit: $root_implicit;\r\ \n root_explicit: $root_explicit;\r\ - \n @if variable-exists(local_default) {\r\ + \n @if meta.variable-exists(local_default) {\r\ \n local_default: $local_default;\r\ \n }\r\ - \n @if variable-exists(local_implicit) {\r\ + \n @if meta.variable-exists(local_implicit) {\r\ \n local_implicit: $local_implicit;\r\ \n }\r\ - \n @if variable-exists(local_explicit) {\r\ + \n @if meta.variable-exists(local_explicit) {\r\ \n local_explicit: $local_explicit;\r\ \n }\r\ \n}\r\n"), diff --git a/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/elseif.rs b/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/elseif.rs index f9bee49bd..c20b503d1 100644 --- a/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/elseif.rs +++ b/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/elseif.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("$root_default: initial;\r\ + runner().ok("@use \"sass:meta\";\ + \n$root_default: initial;\r\ \n$root_implicit: initial;\r\ \n$root_explicit: initial !global;\r\ \n\r\ @@ -44,31 +45,31 @@ fn test() { \n\r\ \nresult {\r\ \n fn: fn();\r\ - \n @if variable-exists(outer) {\r\ + \n @if meta.variable-exists(outer) {\r\ \n outer: $outer;\r\ \n }\r\ - \n @if variable-exists(inner) {\r\ + \n @if meta.variable-exists(inner) {\r\ \n inner: $inner;\r\ \n }\r\ - \n @if variable-exists(check_implicit) {\r\ + \n @if meta.variable-exists(check_implicit) {\r\ \n check_implicit: $check_implicit;\r\ \n }\r\ - \n @if variable-exists(check_explicit) {\r\ + \n @if meta.variable-exists(check_explicit) {\r\ \n check_explicit: $check_explicit;\r\ \n }\r\ - \n @if variable-exists(check_default) {\r\ + \n @if meta.variable-exists(check_default) {\r\ \n check_default: $check_default;\r\ \n }\r\ \n root_default: $root_default;\r\ \n root_implicit: $root_implicit;\r\ \n root_explicit: $root_explicit;\r\ - \n @if variable-exists(local_default) {\r\ + \n @if meta.variable-exists(local_default) {\r\ \n local_default: $local_default;\r\ \n }\r\ - \n @if variable-exists(local_implicit) {\r\ + \n @if meta.variable-exists(local_implicit) {\r\ \n local_implicit: $local_implicit;\r\ \n }\r\ - \n @if variable-exists(local_explicit) {\r\ + \n @if meta.variable-exists(local_explicit) {\r\ \n local_explicit: $local_explicit;\r\ \n }\r\ \n}\r\n"), diff --git a/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/test_else.rs b/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/test_else.rs index 71ebffcbc..f267cf6f5 100644 --- a/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/test_else.rs +++ b/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/test_else.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("$root_default: initial;\r\ + runner().ok("@use \"sass:meta\";\ + \n$root_default: initial;\r\ \n$root_implicit: initial;\r\ \n$root_explicit: initial !global;\r\ \n\r\ @@ -44,31 +45,31 @@ fn test() { \n\r\ \nresult {\r\ \n fn: fn();\r\ - \n @if variable-exists(outer) {\r\ + \n @if meta.variable-exists(outer) {\r\ \n outer: $outer;\r\ \n }\r\ - \n @if variable-exists(inner) {\r\ + \n @if meta.variable-exists(inner) {\r\ \n inner: $inner;\r\ \n }\r\ - \n @if variable-exists(check_implicit) {\r\ + \n @if meta.variable-exists(check_implicit) {\r\ \n check_implicit: $check_implicit;\r\ \n }\r\ - \n @if variable-exists(check_explicit) {\r\ + \n @if meta.variable-exists(check_explicit) {\r\ \n check_explicit: $check_explicit;\r\ \n }\r\ - \n @if variable-exists(check_default) {\r\ + \n @if meta.variable-exists(check_default) {\r\ \n check_default: $check_default;\r\ \n }\r\ \n root_default: $root_default;\r\ \n root_implicit: $root_implicit;\r\ \n root_explicit: $root_explicit;\r\ - \n @if variable-exists(local_default) {\r\ + \n @if meta.variable-exists(local_default) {\r\ \n local_default: $local_default;\r\ \n }\r\ - \n @if variable-exists(local_implicit) {\r\ + \n @if meta.variable-exists(local_implicit) {\r\ \n local_implicit: $local_implicit;\r\ \n }\r\ - \n @if variable-exists(local_explicit) {\r\ + \n @if meta.variable-exists(local_explicit) {\r\ \n local_explicit: $local_explicit;\r\ \n }\r\ \n}\r\n"), diff --git a/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/test_for.rs b/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/test_for.rs index efd22e2f5..3e7543bd3 100644 --- a/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/test_for.rs +++ b/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/test_for.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("$root_default: initial;\r\ + runner().ok("@use \"sass:meta\";\ + \n$root_default: initial;\r\ \n$root_implicit: initial;\r\ \n$root_explicit: initial !global;\r\ \n\r\ @@ -38,31 +39,31 @@ fn test() { \n\r\ \nresult {\r\ \n fn: fn();\r\ - \n @if variable-exists(outer) {\r\ + \n @if meta.variable-exists(outer) {\r\ \n outer: $outer;\r\ \n }\r\ - \n @if variable-exists(inner) {\r\ + \n @if meta.variable-exists(inner) {\r\ \n inner: $inner;\r\ \n }\r\ - \n @if variable-exists(check_implicit) {\r\ + \n @if meta.variable-exists(check_implicit) {\r\ \n check_implicit: $check_implicit;\r\ \n }\r\ - \n @if variable-exists(check_explicit) {\r\ + \n @if meta.variable-exists(check_explicit) {\r\ \n check_explicit: $check_explicit;\r\ \n }\r\ - \n @if variable-exists(check_default) {\r\ + \n @if meta.variable-exists(check_default) {\r\ \n check_default: $check_default;\r\ \n }\r\ \n root_default: $root_default;\r\ \n root_implicit: $root_implicit;\r\ \n root_explicit: $root_explicit;\r\ - \n @if variable-exists(local_default) {\r\ + \n @if meta.variable-exists(local_default) {\r\ \n local_default: $local_default;\r\ \n }\r\ - \n @if variable-exists(local_implicit) {\r\ + \n @if meta.variable-exists(local_implicit) {\r\ \n local_implicit: $local_implicit;\r\ \n }\r\ - \n @if variable-exists(local_explicit) {\r\ + \n @if meta.variable-exists(local_explicit) {\r\ \n local_explicit: $local_explicit;\r\ \n }\r\ \n}\r\n"), diff --git a/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/test_if.rs b/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/test_if.rs index 85e587439..604a77a9b 100644 --- a/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/test_if.rs +++ b/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/test_if.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("$root_default: initial;\r\ + runner().ok("@use \"sass:meta\";\ + \n$root_default: initial;\r\ \n$root_implicit: initial;\r\ \n$root_explicit: initial !global;\r\ \n\r\ @@ -38,31 +39,31 @@ fn test() { \n\r\ \nresult {\r\ \n fn: fn();\r\ - \n @if variable-exists(outer) {\r\ + \n @if meta.variable-exists(outer) {\r\ \n outer: $outer;\r\ \n }\r\ - \n @if variable-exists(inner) {\r\ + \n @if meta.variable-exists(inner) {\r\ \n inner: $inner;\r\ \n }\r\ - \n @if variable-exists(check_implicit) {\r\ + \n @if meta.variable-exists(check_implicit) {\r\ \n check_implicit: $check_implicit;\r\ \n }\r\ - \n @if variable-exists(check_explicit) {\r\ + \n @if meta.variable-exists(check_explicit) {\r\ \n check_explicit: $check_explicit;\r\ \n }\r\ - \n @if variable-exists(check_default) {\r\ + \n @if meta.variable-exists(check_default) {\r\ \n check_default: $check_default;\r\ \n }\r\ \n root_default: $root_default;\r\ \n root_implicit: $root_implicit;\r\ \n root_explicit: $root_explicit;\r\ - \n @if variable-exists(local_default) {\r\ + \n @if meta.variable-exists(local_default) {\r\ \n local_default: $local_default;\r\ \n }\r\ - \n @if variable-exists(local_implicit) {\r\ + \n @if meta.variable-exists(local_implicit) {\r\ \n local_implicit: $local_implicit;\r\ \n }\r\ - \n @if variable-exists(local_explicit) {\r\ + \n @if meta.variable-exists(local_explicit) {\r\ \n local_explicit: $local_explicit;\r\ \n }\r\ \n}\r\n"), diff --git a/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/test_while.rs b/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/test_while.rs index 430379dbd..2b208b1a3 100644 --- a/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/test_while.rs +++ b/rsass/tests/spec/libsass/variable_scoping/blead_global/functional/test_while.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$continue_inner: true;\r\ + runner().ok("@use \"sass:meta\";\ + \n$continue_inner: true;\r\ \n$continue_outer: true;\r\ \n$root_default: initial;\r\ \n$root_implicit: initial;\r\ @@ -41,31 +42,31 @@ fn test() { \n\r\ \nresult {\r\ \n fn: fn();\r\ - \n @if variable-exists(continue_outer) {\r\ + \n @if meta.variable-exists(continue_outer) {\r\ \n continue_outer: $continue_outer;\r\ \n }\r\ - \n @if variable-exists(continue_inner) {\r\ + \n @if meta.variable-exists(continue_inner) {\r\ \n continue_inner: $continue_inner;\r\ \n }\r\ - \n @if variable-exists(check_implicit) {\r\ + \n @if meta.variable-exists(check_implicit) {\r\ \n check_implicit: $check_implicit;\r\ \n }\r\ - \n @if variable-exists(check_explicit) {\r\ + \n @if meta.variable-exists(check_explicit) {\r\ \n check_explicit: $check_explicit;\r\ \n }\r\ - \n @if variable-exists(check_default) {\r\ + \n @if meta.variable-exists(check_default) {\r\ \n check_default: $check_default;\r\ \n }\r\ \n root_default: $root_default;\r\ \n root_implicit: $root_implicit;\r\ \n root_explicit: $root_explicit;\r\ - \n @if variable-exists(local_default) {\r\ + \n @if meta.variable-exists(local_default) {\r\ \n local_default: $local_default;\r\ \n }\r\ - \n @if variable-exists(local_implicit) {\r\ + \n @if meta.variable-exists(local_implicit) {\r\ \n local_implicit: $local_implicit;\r\ \n }\r\ - \n @if variable-exists(local_explicit) {\r\ + \n @if meta.variable-exists(local_explicit) {\r\ \n local_explicit: $local_explicit;\r\ \n }\r\ \n}\r\n"), diff --git a/rsass/tests/spec/libsass/variable_scoping/feature_test.rs b/rsass/tests/spec/libsass/variable_scoping/feature_test.rs index 360fea40f..80c2e9354 100644 --- a/rsass/tests/spec/libsass/variable_scoping/feature_test.rs +++ b/rsass/tests/spec/libsass/variable_scoping/feature_test.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@if feature-exists(global-variable-shadowing) {\ + runner().ok("@use \"sass:meta\";\ + \n@if meta.feature-exists(global-variable-shadowing) {\ \n div {\ \n feature: true;\ \n }\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_100.rs b/rsass/tests/spec/libsass_closed_issues/issue_100.rs index 3d65dfb69..c3f18d6bb 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_100.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_100.rs @@ -8,10 +8,13 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$endColor: red;\r\ + runner().ok( + "@use \"sass:color\";\ + \n$endColor: red;\r\ \ntest {\r\ - \n background-color: darken($endColor, 10%) \\9;\r\ - \n}"), + \n background-color: color.adjust($endColor, $lightness: -10%) \\9;\r\ + \n}" + ), "test {\ \n background-color: #cc0000 \\9 ;\ \n}\n" diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1075.rs b/rsass/tests/spec/libsass_closed_issues/issue_1075.rs index f6a053b36..02ae151a6 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1075.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1075.rs @@ -8,10 +8,11 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$name: \"lighten\";\ + runner().ok("@use \"sass:meta\";\ + \n$name: \"lighten\";\ \n$args: (\"color\": #ff0000, \"amount\": 10%);\ \nfoo {\ - \n bar: call($name, $args...);\ + \n bar: meta.call($name, $args...);\ \n}\n"), "foo {\ \n bar: #ff3333;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1101.rs b/rsass/tests/spec/libsass_closed_issues/issue_1101.rs index b298ffec0..72cf60212 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1101.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1101.rs @@ -6,16 +6,18 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok( - "$foo: white;\r\ + "@use \"sass:color\";\ + \n$foo: white;\r\ \nfoo {\r\ - \n bar: adjust-color($foo, $hue: -6deg, $lightness: -16%, $saturation: -7%);\r\ + \n bar: color.adjust($foo, $hue: -6deg, $lightness: -16%, $saturation: -7%);\r\ \n}" ), "foo {\ - \n bar: #d6d6d6;\ + \n bar: rgb(214.2, 214.2, 214.2);\ \n}\n" ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1106.rs b/rsass/tests/spec/libsass_closed_issues/issue_1106.rs index 7881af512..3ff7ad3ed 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1106.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1106.rs @@ -9,25 +9,26 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "@function foo() { @return null; }\ + "@use \"sass:string\";\ + \n@function foo() { @return null; }\ \n$foo: null;\ \na {\ \n foo: bar;\ \n variable: $foo;\ \n function: foo();\ - \n unquote: unquote($foo);\ + \n unquote: string.unquote($foo);\ \n}\n\ \nb {\ \n variable: $foo;\ \n function: foo();\ - \n unquote: unquote($foo);\ + \n unquote: string.unquote($foo);\ \n}\n" ), "Error: $string: null is not a string.\ \n ,\ - \n7 | unquote: unquote($foo);\ - \n | ^^^^^^^^^^^^^\ + \n8 | unquote: string.unquote($foo);\ + \n | ^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 7:14 root stylesheet", + \n input.scss 8:14 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1127.rs b/rsass/tests/spec/libsass_closed_issues/issue_1127.rs index 99529a47b..429622769 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1127.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1127.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$a: to-upper-case(\'abcd\');\ - \n$b: to-upper-case(\"abcd\");\ - \n$c: to-upper-case(abcd);\n\ + runner().ok("@use \"sass:string\";\ + \n$a: string.to-upper-case(\'abcd\');\ + \n$b: string.to-upper-case(\"abcd\");\ + \n$c: string.to-upper-case(abcd);\n\ \nfoo {\ \n content: #{$a};\ \n content: #{$b};\ @@ -21,33 +22,33 @@ fn test() { \n content: \"#{$a}\";\ \n content: \"#{$b}\";\ \n content: \"#{$c}\";\n\ - \n content: #{unquote($a)};\ - \n content: #{unquote($b)};\ - \n content: #{unquote($c)};\ - \n content: \'#{unquote($a)}\';\ - \n content: \'#{unquote($b)}\';\ - \n content: \'#{unquote($c)}\';\ - \n content: \"#{unquote($a)}\";\ - \n content: \"#{unquote($b)}\";\ - \n content: \"#{unquote($c)}\";\n\ - \n content: #{$a + unquote(\"efg\")};\ - \n content: #{$b + unquote(\"efg\")};\ - \n content: #{$c + unquote(\"efg\")};\ - \n content: \'#{$a + unquote(\"efg\")}\';\ - \n content: \'#{$b + unquote(\"efg\")}\';\ - \n content: \'#{$c + unquote(\"efg\")}\';\ - \n content: \"#{$a + unquote(\"efg\")}\";\ - \n content: \"#{$b + unquote(\"efg\")}\";\ - \n content: \"#{$c + unquote(\"efg\")}\";\n\ - \n content: #{$a + unquote(\"\")};\ - \n content: #{$b + unquote(\"\")};\ - \n content: #{$c + unquote(\"\")};\ - \n content: \'#{$a + unquote(\"\")}\';\ - \n content: \'#{$b + unquote(\"\")}\';\ - \n content: \'#{$c + unquote(\"\")}\';\ - \n content: \"#{$a + unquote(\"\")}\";\ - \n content: \"#{$b + unquote(\"\")}\";\ - \n content: \"#{$c + unquote(\"\")}\";\ + \n content: #{string.unquote($a)};\ + \n content: #{string.unquote($b)};\ + \n content: #{string.unquote($c)};\ + \n content: \'#{string.unquote($a)}\';\ + \n content: \'#{string.unquote($b)}\';\ + \n content: \'#{string.unquote($c)}\';\ + \n content: \"#{string.unquote($a)}\";\ + \n content: \"#{string.unquote($b)}\";\ + \n content: \"#{string.unquote($c)}\";\n\ + \n content: #{$a + string.unquote(\"efg\")};\ + \n content: #{$b + string.unquote(\"efg\")};\ + \n content: #{$c + string.unquote(\"efg\")};\ + \n content: \'#{$a + string.unquote(\"efg\")}\';\ + \n content: \'#{$b + string.unquote(\"efg\")}\';\ + \n content: \'#{$c + string.unquote(\"efg\")}\';\ + \n content: \"#{$a + string.unquote(\"efg\")}\";\ + \n content: \"#{$b + string.unquote(\"efg\")}\";\ + \n content: \"#{$c + string.unquote(\"efg\")}\";\n\ + \n content: #{$a + string.unquote(\"\")};\ + \n content: #{$b + string.unquote(\"\")};\ + \n content: #{$c + string.unquote(\"\")};\ + \n content: \'#{$a + string.unquote(\"\")}\';\ + \n content: \'#{$b + string.unquote(\"\")}\';\ + \n content: \'#{$c + string.unquote(\"\")}\';\ + \n content: \"#{$a + string.unquote(\"\")}\";\ + \n content: \"#{$b + string.unquote(\"\")}\";\ + \n content: \"#{$c + string.unquote(\"\")}\";\ \n}\n"), "foo {\ \n content: ABCD;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1132.rs b/rsass/tests/spec/libsass_closed_issues/issue_1132.rs index 754ef27d9..4142557c5 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1132.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1132.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("foo {\ + runner().ok("@use \"sass:color\";\ + \nfoo {\ \n @for $i from 0 through 360 {\ - \n i#{$i}: hue(hsl($i, 10%, 20%));\ + \n i#{$i}: color.hue(hsl($i, 10%, 20%));\ \n }\ \n}\n"), "foo {\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1133/normal.rs b/rsass/tests/spec/libsass_closed_issues/issue_1133/normal.rs index b9522527e..5d3ed5f6c 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1133/normal.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1133/normal.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function foo($map) {\ + runner().ok("@use \"sass:meta\";\ + \n@function foo($map) {\ \n @return $map;\ \n}\n\ \na {\ @@ -18,7 +19,7 @@ fn test() { \n }\ \n}\n\ \nb {\ - \n $map: call(\"foo\", (this: is, my: map));\ + \n $map: meta.call(\"foo\", (this: is, my: map));\ \n @each $k, $v in $map {\ \n #{$k}: $v;\ \n }\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1133/vararg.rs b/rsass/tests/spec/libsass_closed_issues/issue_1133/vararg.rs index 5a2157ce4..74a605d63 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1133/vararg.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1133/vararg.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function foo($this, $my) {\ + runner().ok("@use \"sass:meta\";\ + \n@function foo($this, $my) {\ \n @return (this: $this, my: $my);\ \n}\n\ \na {\ @@ -18,7 +19,7 @@ fn test() { \n }\ \n}\n\ \nb {\ - \n $map: call(\"foo\", (this: is, my: map)...);\ + \n $map: meta.call(\"foo\", (this: is, my: map)...);\ \n @each $k, $v in $map {\ \n #{$k}: $v;\ \n }\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1169/error/color.rs b/rsass/tests/spec/libsass_closed_issues/issue_1169/error/color.rs index 440cb67f1..261c75fcf 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1169/error/color.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1169/error/color.rs @@ -10,22 +10,22 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "$map: (\r\ - \n red: \'foo\',\r\ - \n red: \'bar\',\r\ - \n);\r\ - \n\r\ - \n.foo {\r\ - \n content: inspect($map);\r\ + "@use \"sass:meta\";\n\ + \n$map: (\ + \n red: \'foo\',\ + \n red: \'bar\',\ + \n);\n\ + \n.foo {\ + \n content: meta.inspect($map);\ \n}" ), "Error: Duplicate key.\ \n ,\ - \n2 | red: \'foo\',\ + \n4 | red: \'foo\',\ \n | === first key\ - \n3 | red: \'bar\',\ + \n5 | red: \'bar\',\ \n | ^^^ second key\ \n \'\ - \n input.scss 3:3 root stylesheet", + \n input.scss 5:3 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1169/error/functioncall.rs b/rsass/tests/spec/libsass_closed_issues/issue_1169/error/functioncall.rs index 50ed98637..1e060ac81 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1169/error/functioncall.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1169/error/functioncall.rs @@ -10,26 +10,25 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "@function fncall($void) {\r\ - \n @return \"key\";\r\ - \n}\r\ - \n\r\ - \n$map: (\r\ - \n fncall(1+2): \'foo\',\r\ - \n fncall(1+2): \'bar\',\r\ - \n);\r\ - \n\r\ - \n.foo {\r\ - \n content: inspect($map);\r\ + "@use \"sass:meta\";\n\ + \n@function fncall($void) {\ + \n @return \"key\";\ + \n}\n\ + \n$map: (\ + \n fncall(1+2): \'foo\',\ + \n fncall(1+2): \'bar\',\ + \n);\n\ + \n.foo {\ + \n content: meta.inspect($map);\ \n}" ), "Error: Duplicate key.\ \n ,\ - \n6 | fncall(1+2): \'foo\',\ + \n8 | fncall(1+2): \'foo\',\ \n | =========== first key\ - \n7 | fncall(1+2): \'bar\',\ + \n9 | fncall(1+2): \'bar\',\ \n | ^^^^^^^^^^^ second key\ \n \'\ - \n input.scss 7:3 root stylesheet", + \n input.scss 9:3 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1169/error/interpolate.rs b/rsass/tests/spec/libsass_closed_issues/issue_1169/error/interpolate.rs index 6b3a60912..8a7255b44 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1169/error/interpolate.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1169/error/interpolate.rs @@ -10,22 +10,22 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "$map: (\r\ - \n \'red\': \'bar\',\r\ - \n #{re}#{\'d\'}: \'baz\',\r\ - \n);\r\ - \n\r\ - \n.foo {\r\ - \n content: inspect($map);\r\ + "@use \"sass:meta\";\n\ + \n$map: (\ + \n \'red\': \'bar\',\ + \n #{re}#{\'d\'}: \'baz\',\ + \n);\n\ + \n.foo {\ + \n content: meta.inspect($map);\ \n}" ), "Error: Duplicate key.\ \n ,\ - \n2 | \'red\': \'bar\',\ + \n4 | \'red\': \'bar\',\ \n | ===== first key\ - \n3 | #{re}#{\'d\'}: \'baz\',\ + \n5 | #{re}#{\'d\'}: \'baz\',\ \n | ^^^^^^^^^^^ second key\ \n \'\ - \n input.scss 3:3 root stylesheet", + \n input.scss 5:3 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1169/error/simple.rs b/rsass/tests/spec/libsass_closed_issues/issue_1169/error/simple.rs index f9105226e..08f597d09 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1169/error/simple.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1169/error/simple.rs @@ -8,13 +8,13 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$map: (\r\ - \n red: \'bar\',\r\ - \n #{red}: \'baz\',\r\ - \n);\r\ - \n\r\ - \n.foo {\r\ - \n content: inspect($map);\r\ + runner().ok("@use \"sass:meta\";\n\ + \n$map: (\ + \n red: \'bar\',\ + \n #{red}: \'baz\',\ + \n);\n\ + \n.foo {\ + \n content: meta.inspect($map);\ \n}"), ".foo {\ \n content: (red: \"bar\", red: \"baz\");\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1169/functioncall.rs b/rsass/tests/spec/libsass_closed_issues/issue_1169/functioncall.rs index 080c36d63..9100a4091 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1169/functioncall.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1169/functioncall.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$count: 0;\n\ + runner().ok("@use \"sass:meta\";\n\ + \n$count: 0;\n\ \n@function counter() {\ \n $count: $count + 1 !global;\ \n @return $count;\ @@ -18,7 +19,7 @@ fn test() { \n counter(): \'foo\',\ \n);\n\ \n.foo {\ - \n content: inspect($map);\ + \n content: meta.inspect($map);\ \n}"), ".foo {\ \n content: (1: \"bar\", 2: \"foo\");\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1169/interpolated.rs b/rsass/tests/spec/libsass_closed_issues/issue_1169/interpolated.rs index c83ef54dd..4a94ab994 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1169/interpolated.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1169/interpolated.rs @@ -9,21 +9,23 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$map1: ( red: \'literal\', transparent: \'literal\' );\ + "@use \"sass:map\";\ + \n@use \"sass:meta\";\n\ + \n$map1: ( red: \'literal\', transparent: \'literal\' );\ \n$map2: ( \'red\': \'quoted\', transparent: \'quoted\' );\ \n$map3: ( #{re}#{d}: \'interpolated\', #{trans}#{parent}: \'quoted\' );\n\ \nfoo {\ - \n content: inspect($map1);\ - \n content: inspect($map2);\ - \n content: inspect($map3);\ + \n content: meta.inspect($map1);\ + \n content: meta.inspect($map2);\ + \n content: meta.inspect($map3);\ \n}\n\ - \n$merge1: map-merge($map1, $map2);\ - \n$merge2: map-merge($map1, $map3);\ - \n$merge3: map-merge($map2, $map3);\n\ + \n$merge1: map.merge($map1, $map2);\ + \n$merge2: map.merge($map1, $map3);\ + \n$merge3: map.merge($map2, $map3);\n\ \nbar {\ - \n content: inspect($merge1);\ - \n content: inspect($merge2);\ - \n content: inspect($merge3);\ + \n content: meta.inspect($merge1);\ + \n content: meta.inspect($merge2);\ + \n content: meta.inspect($merge3);\ \n}" ), "foo {\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1169/simple.rs b/rsass/tests/spec/libsass_closed_issues/issue_1169/simple.rs index d6f726778..888df5dc1 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1169/simple.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1169/simple.rs @@ -8,19 +8,18 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$map1: (\r\ - \n red: \'bar\',\r\ - \n \'red\': \'foo\',\r\ - \n);\r\ - \n\r\ - \n$map2: (\r\ - \n red: \'bar\',\r\ - \n \'red\': #{red},\r\ - \n);\r\ - \n\r\ - \n.foo {\r\ - \n content: inspect($map1);\r\ - \n content: inspect($map2);\r\ + runner().ok("@use \"sass:meta\";\n\ + \n$map1: (\ + \n red: \'bar\',\ + \n \'red\': \'foo\',\ + \n);\n\ + \n$map2: (\ + \n red: \'bar\',\ + \n \'red\': #{red},\ + \n);\n\ + \n.foo {\ + \n content: meta.inspect($map1);\ + \n content: meta.inspect($map2);\ \n}"), ".foo {\ \n content: (red: \"bar\", \"red\": \"foo\");\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1171.rs b/rsass/tests/spec/libsass_closed_issues/issue_1171.rs index e6733777c..3a5285e04 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1171.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1171.rs @@ -8,16 +8,17 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function foo($initial, $args...) {\ - \n $args: append($args, 3);\n\ + runner().ok("@use \"sass:list\";\ + \n@function foo($initial, $args...) {\ + \n $args: list.append($args, 3);\n\ \n @return bar($initial, $args...);\ \n}\n\ \n@function bar($args...) {\ - \n @return length($args);\ + \n @return list.length($args);\ \n}\n\ \n@function baz($initial, $args...) {\ - \n $args: append($args, 3);\n\ - \n @return nth($args, 1);\ + \n $args: list.append($args, 3);\n\ + \n @return list.nth($args, 1);\ \n}\n\ \n.test {\ \n foo: foo(1, 2);\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1178.rs b/rsass/tests/spec/libsass_closed_issues/issue_1178.rs index d1d25f8fd..392e2a575 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1178.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1178.rs @@ -8,12 +8,13 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$foo: ((4, 5), 6, (7 8) 9);\n\ + runner().ok("@use \"sass:meta\";\n\ + \n$foo: ((4, 5), 6, (7 8) 9);\n\ \nbar {\ \n a: $foo;\ \n f: 1 2 3 + $foo;\ \n b: 1, 2, 3 + (2 ($foo));\ - \n x: inspect($foo);\ + \n x: meta.inspect($foo);\ \n}\n"), "bar {\ \n a: 4, 5, 6, 7 8 9;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1187.rs b/rsass/tests/spec/libsass_closed_issues/issue_1187.rs index 36380c012..01e59074e 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1187.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1187.rs @@ -10,7 +10,8 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "$a: \'foo\';\ + "@use \"sass:meta\";\n\ + \n$a: \'foo\';\ \n$b: \'foo\';\ \n$map: (\ \n $a: 1,\ @@ -18,16 +19,16 @@ fn test() { \n);\n\ \n.foo {\ \n content: $a == $b;\ - \n content: inspect($map);\ + \n content: meta.inspect($map);\ \n}" ), "Error: Duplicate key.\ \n ,\ - \n4 | $a: 1,\ + \n6 | $a: 1,\ \n | == first key\ - \n5 | $b: 2\ + \n7 | $b: 2\ \n | ^^ second key\ \n \'\ - \n input.scss 5:3 root stylesheet", + \n input.scss 7:3 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1192.rs b/rsass/tests/spec/libsass_closed_issues/issue_1192.rs index bca71edb5..34c7f9a37 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1192.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1192.rs @@ -9,11 +9,12 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$keyword: foobar;\n\ + "@use \"sass:meta\";\n\ + \n$keyword: foobar;\n\ \n@mixin test($arglist...){\ - \n $map: keywords($arglist);\ - \n /*#{inspect($map)}*/\ - \n /*#{inspect($arglist)}*/\ + \n $map: meta.keywords($arglist);\ + \n /*#{meta.inspect($map)}*/\ + \n /*#{meta.inspect($arglist)}*/\ \n}\n\ \n// Works\ \n@include test(foo, bar, baz);\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1207.rs b/rsass/tests/spec/libsass_closed_issues/issue_1207.rs index 1f3a34dba..f3e91ea0b 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1207.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1207.rs @@ -8,12 +8,13 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function test($pos) {\ + runner().ok("@use \"sass:string\";\ + \n@function test($pos) {\ \n @return test-#{$pos};\ \n}\n\ \n.foo {\ - \n content: test(str-slice(\'scale-0\', 7)); // Nope\ - \n content: test-#{str-slice(\'scale-0\', 7)}; // Yep\ + \n content: test(string.slice(\'scale-0\', 7)); // Nope\ + \n content: test-#{string.slice(\'scale-0\', 7)}; // Yep\ \n}"), ".foo {\ \n content: test-0;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1240.rs b/rsass/tests/spec/libsass_closed_issues/issue_1240.rs index 78bf2f6b2..35f96b32b 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1240.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1240.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$var: 1;\ + runner().ok("@use \"sass:list\";\ + \n$var: 1;\ \n$list: 2, 3;\ - \n$new-list: append($var, $list);\ + \n$new-list: list.append($var, $list);\ \n$nested-list: $var $list;\ \n@debug($var);\ \n@debug($list);\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1255.rs b/rsass/tests/spec/libsass_closed_issues/issue_1255.rs index 0a3c8de6a..d233430dd 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1255.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1255.rs @@ -9,18 +9,21 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("@function double($value) {\ + runner().ok( + "@use \"sass:list\";\ + \n@function double($value) {\ \n @return $value * 2;\ \n}\n\ \n@mixin dummy-bug($args...) {\ - \n @for $i from 1 through length($args) {\ - \n $args: set-nth($args, $i, double(nth($args, $i)));\ + \n @for $i from 1 through list.length($args) {\ + \n $args: list.set-nth($args, $i, double(list.nth($args, $i)));\ \n }\n\ \n content: $args;\ \n}\n\ \n.foo {\ \n @include dummy-bug(1, 2, 3, 4);\ - \n}"), + \n}" + ), ".foo {\ \n content: 2, 4, 6, 8;\ \n}\n" diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1257.rs b/rsass/tests/spec/libsass_closed_issues/issue_1257.rs index 75973588a..916bd6560 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1257.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1257.rs @@ -9,8 +9,9 @@ fn runner() -> crate::TestRunner { #[ignore] // unexepected error fn test() { assert_eq!( - runner().ok(".foo {\ - \n color: invert(red...);\ + runner().ok("@use \"sass:color\";\ + \n.foo {\ + \n color: color.invert(red...);\ \n}"), ".foo {\ \n color: aqua;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1258.rs b/rsass/tests/spec/libsass_closed_issues/issue_1258.rs deleted file mode 100644 index f1de18d0c..000000000 --- a/rsass/tests/spec/libsass_closed_issues/issue_1258.rs +++ /dev/null @@ -1,26 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_1258.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("issue_1258") -} - -#[test] -#[ignore] // unexepected error -fn test() { - assert_eq!( - runner().ok( - "$list: \'(-webkit-min-device-pixel-ratio: 2)\', \'(min-resolution: 192dpi)\';\ - \n$string: \'(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)\';\n\ - \n.foo {\ - \n // I should not unquote a list, I know. But still.\ - \n content: unquote($list);\ - \n content: unquote($string);\ - \n}" - ), - ".foo {\ - \n content: \"(-webkit-min-device-pixel-ratio: 2)\", \"(min-resolution: 192dpi)\";\ - \n content: (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi);\ - \n}\n" - ); -} diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1260.rs b/rsass/tests/spec/libsass_closed_issues/issue_1260.rs index 8e6e22b31..cb4a10841 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1260.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1260.rs @@ -9,9 +9,10 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$EQ-Selectors: ();\n\ + "@use \"sass:list\";\ + \n$EQ-Selectors: ();\n\ \n.el {\ - \n $EQ-Selectors: append($EQ-Selectors, &, \'comma\') !global;\ + \n $EQ-Selectors: list.append($EQ-Selectors, &, \'comma\') !global;\ \n}\n\ \nhtml:before {\ \n content: \"#{$EQ-Selectors}\";\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1263.rs b/rsass/tests/spec/libsass_closed_issues/issue_1263.rs index e69b7a8b6..b5b6f221c 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1263.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1263.rs @@ -6,6 +6,7 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("foo {\ @@ -17,8 +18,8 @@ fn test() { "foo {\ \n @apply;\ \n @apply (--bar);\ - \n @apply ( --bar );\ - \n @apply ( --bar , --foo );\ + \n @apply ( --bar );\ + \n @apply ( --bar , --foo );\ \n}\n" ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1266/max.rs b/rsass/tests/spec/libsass_closed_issues/issue_1266/max.rs index 135725a06..b4bc1195f 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1266/max.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1266/max.rs @@ -10,23 +10,24 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "$foo: 1 2 3 blah 4;\ + "@use \"sass:meta\";\ + \n$foo: 1 2 3 blah 4;\ \nfoo {\ - \n bar: call(max, $foo...);\ + \n bar: meta.call(max, $foo...);\ \n}\n" ), "DEPRECATION WARNING: Passing a string to call() is deprecated and will be illegal in Dart Sass 2.0.0.\n\ \nRecommendation: call(get-function(max))\n\ \n ,\ - \n3 | bar: call(max, $foo...);\ - \n | ^^^^^^^^^^^^^^^^^^\ + \n4 | bar: meta.call(max, $foo...);\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 3:8 root stylesheet\n\ + \n input.scss 4:8 root stylesheet\n\ \nError: blah is not a number.\ \n ,\ - \n3 | bar: call(max, $foo...);\ - \n | ^^^^^^^^^^^^^^^^^^\ + \n4 | bar: meta.call(max, $foo...);\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 3:8 root stylesheet", + \n input.scss 4:8 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1266/min.rs b/rsass/tests/spec/libsass_closed_issues/issue_1266/min.rs index e960bc9e8..6e757eda5 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1266/min.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1266/min.rs @@ -10,23 +10,24 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "$foo: 1 2 3 blah 4;\ + "@use \"sass:meta\";\ + \n$foo: 1 2 3 blah 4;\ \nfoo {\ - \n bar: call(min, $foo...);\ + \n bar: meta.call(min, $foo...);\ \n}\n" ), "DEPRECATION WARNING: Passing a string to call() is deprecated and will be illegal in Dart Sass 2.0.0.\n\ \nRecommendation: call(get-function(min))\n\ \n ,\ - \n3 | bar: call(min, $foo...);\ - \n | ^^^^^^^^^^^^^^^^^^\ + \n4 | bar: meta.call(min, $foo...);\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 3:8 root stylesheet\n\ + \n input.scss 4:8 root stylesheet\n\ \nError: blah is not a number.\ \n ,\ - \n3 | bar: call(min, $foo...);\ - \n | ^^^^^^^^^^^^^^^^^^\ + \n4 | bar: meta.call(min, $foo...);\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 3:8 root stylesheet", + \n input.scss 4:8 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1269.rs b/rsass/tests/spec/libsass_closed_issues/issue_1269.rs index 01893d277..9259ad173 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1269.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1269.rs @@ -8,13 +8,15 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function push($list, $items...) {\ - \n @return join($list, $items, $separator: auto);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\n\ + \n@function push($list, $items...) {\ + \n @return list.join($list, $items, $separator: auto);\ \n}\n\ \n.test {\ \n $list: push(1 2 3, 4, 5);\ - \n list: inspect($list);\ - \n value: nth($list, 4);\ + \n list: meta.inspect($list);\ + \n value: list.nth($list, 4);\ \n}"), ".test {\ \n list: 1 2 3 4 5;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1271.rs b/rsass/tests/spec/libsass_closed_issues/issue_1271.rs index bdeb6a668..67da18342 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1271.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1271.rs @@ -8,14 +8,17 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$character-code: f102;\n\ + runner().ok( + "@use \"sass:string\";\ + \n$character-code: f102;\n\ \ntest {\n\ \n /* Expected: \"\\f102\" */\n\ \n /* Sass 3.4 */\ - \n content: unquote(\"\\\"\\\\#{$character-code}\\\"\");\n\ + \n content: string.unquote(\"\\\"\\\\#{$character-code}\\\"\");\n\ \n /* Sass 3.3 */\ - \n content: str-slice(\"\\x\", 1, 1) + $character-code;\n\ - \n}"), + \n content: string.slice(\"\\x\", 1, 1) + $character-code;\n\ + \n}" + ), "test {\ \n /* Expected: \"\\f102\" */\ \n /* Sass 3.4 */\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1279.rs b/rsass/tests/spec/libsass_closed_issues/issue_1279.rs index 834c8e40e..db45bee58 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1279.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1279.rs @@ -8,15 +8,18 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function noop($string) {\ + runner().ok( + "@use \"sass:string\";\ + \n@function noop($string) {\ \n @return $string;\ \n}\n\ \n.foo {\ - \n upper: to-upper-case(\'f\') + str-slice(\'foo\', 2);\ - \n lower: to-lower-case(\'f\') + str-slice(\'foo\', 2);\ - \n user-upper: to-upper-case(\'f\') + noop(\'oo\');\ - \n user-lower: to-lower-case(\'f\') + noop(\'oo\');\ - \n}\n"), + \n upper: string.to-upper-case(\'f\') + string.slice(\'foo\', 2);\ + \n lower: string.to-lower-case(\'f\') + string.slice(\'foo\', 2);\ + \n user-upper: string.to-upper-case(\'f\') + noop(\'oo\');\ + \n user-lower: string.to-lower-case(\'f\') + noop(\'oo\');\ + \n}\n" + ), ".foo {\ \n upper: \"Foo\";\ \n lower: \"foo\";\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1281.rs b/rsass/tests/spec/libsass_closed_issues/issue_1281.rs index 76e8f0b43..59ffd4c5e 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1281.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1281.rs @@ -8,13 +8,14 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$quoted: \"green\";\ + runner().ok("@use \"sass:meta\";\ + \n$quoted: \"green\";\ \n$unquoted: green;\n\ \n.test {\ - \n string: type-of($quoted);\ - \n color: type-of($unquoted);\ - \n string: type-of(\"green\");\ - \n color: type-of(green);\ + \n string: meta.type-of($quoted);\ + \n color: meta.type-of($unquoted);\ + \n string: meta.type-of(\"green\");\ + \n color: meta.type-of(green);\ \n}\n"), ".test {\ \n string: string;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1283.rs b/rsass/tests/spec/libsass_closed_issues/issue_1283.rs index c82382eb1..ef3df06ca 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1283.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1283.rs @@ -8,9 +8,11 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$map: map-merge((1 2: 3), (2 1: 3));\n\ + runner().ok("@use \"sass:map\";\ + \n@use \"sass:meta\";\n\ + \n$map: map.merge((1 2: 3), (2 1: 3));\n\ \n.test {\ - \n test: inspect($map);\ + \n test: meta.inspect($map);\ \n}\n"), ".test {\ \n test: (1 2: 3, 2 1: 3);\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1285.rs b/rsass/tests/spec/libsass_closed_issues/issue_1285.rs index d8df20191..e2533c31e 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1285.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1285.rs @@ -6,12 +6,14 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( - runner().ok(".container {\ + runner().ok("@use \"sass:color\";\ + \n.container {\ \n @for $i from 1 through 3 {\ \n @at-root .box-#{$i} {\ - \n color: darken(red,($i * 5));\ + \n color: color.adjust(red,$lightness: -($i * 5%));\ \n }\ \n }\n\ \n // Control\ @@ -20,13 +22,13 @@ fn test() { \n }\ \n}\n"), ".box-1 {\ - \n color: #e60000;\ + \n color: rgb(229.5, 0, 0);\ \n}\ \n.box-2 {\ \n color: #cc0000;\ \n}\ \n.box-3 {\ - \n color: #b30000;\ + \n color: rgb(178.5, 0, 0);\ \n}\ \n.outside-child {\ \n background-color: blue;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1291.rs b/rsass/tests/spec/libsass_closed_issues/issue_1291.rs deleted file mode 100644 index 401ba8d31..000000000 --- a/rsass/tests/spec/libsass_closed_issues/issue_1291.rs +++ /dev/null @@ -1,40 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_1291.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("issue_1291") -} - -#[test] -#[ignore] // unexepected error -fn test() { - assert_eq!( - runner().ok("@mixin spec1($decimal) {\ - \n $decimal: unquote($decimal) * -1;\ - \n value: $decimal;\ - \n}\n\ - \n@mixin spec2($decimal) {\ - \n $decimal: -1 * unquote($decimal);\ - \n value: $decimal;\ - \n}\n\ - \n@mixin spec3($decimal) {\ - \n value: #{$decimal * -1};\ - \n}\n\ - \n.my-element {\ - \n @include spec1(3);\ - \n @include spec1(-3);\ - \n @include spec2(5);\ - \n @include spec2(-5);\ - \n @include spec3(7);\ - \n @include spec3(-7);\ - \n}"), - ".my-element {\ - \n value: -3;\ - \n value: 3;\ - \n value: -5;\ - \n value: 5;\ - \n value: -7;\ - \n value: 7;\ - \n}\n" - ); -} diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1303.rs b/rsass/tests/spec/libsass_closed_issues/issue_1303.rs index 003fc20c6..6940615b4 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1303.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1303.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok(".simple {\ - \n a: selector-replace(\'foo.bar\', \'foo\', \'foo[baz]\');\ + runner().ok("@use \"sass:selector\";\ + \n.simple {\ + \n a: selector.replace(\'foo.bar\', \'foo\', \'foo[baz]\');\ \n}\n"), ".simple {\ \n a: foo.bar[baz];\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1305.rs b/rsass/tests/spec/libsass_closed_issues/issue_1305.rs index e6c3bf262..55b8571d9 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1305.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1305.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok(".foo {\ - \n content: call(\'unquote\', \'foo\', ()...);\ + runner().ok("@use \"sass:meta\";\ + \n.foo {\ + \n content: meta.call(\'unquote\', \'foo\', ()...);\ \n}\n"), ".foo {\ \n content: foo;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1331.rs b/rsass/tests/spec/libsass_closed_issues/issue_1331.rs index 1af014ed4..a6ba6392d 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1331.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1331.rs @@ -8,12 +8,13 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$m: (foo: 1px, null: 2px, false: 3px, true: 4px);\n\ + runner().ok("@use \"sass:map\";\ + \n$m: (foo: 1px, null: 2px, false: 3px, true: 4px);\n\ \n@debug $m;\ - \n@debug map-get($m, foo);\ - \n@debug map-get($m, null);\ - \n@debug map-get($m, false);\ - \n@debug map-get($m, true);\n"), + \n@debug map.get($m, foo);\ + \n@debug map.get($m, null);\ + \n@debug map.get($m, false);\ + \n@debug map.get($m, true);\n"), "" ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1404.rs b/rsass/tests/spec/libsass_closed_issues/issue_1404.rs index 00337fa95..cdf68f4a4 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1404.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1404.rs @@ -9,10 +9,11 @@ fn runner() -> crate::TestRunner { #[ignore] // unexepected error fn test() { assert_eq!( - runner().ok(".test {\r\ + runner().ok("@use \"sass:meta\";\ + \n.test {\r\ \n color: #aaabbb--1-2-a;\r\ - \n color: type-of(#aaabbb--1-2-a);\r\ - \n color: type-of(#aaabbb--1-2);\r\ + \n color: meta.type-of(#aaabbb--1-2-a);\r\ + \n color: meta.type-of(#aaabbb--1-2);\r\ \n}"), ".test {\ \n color: #aaabbb--1-2-a;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1405.rs b/rsass/tests/spec/libsass_closed_issues/issue_1405.rs index 767b35cb0..32cf47fe0 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1405.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1405.rs @@ -9,12 +9,15 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("div {\r\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:math\";\ + \n@use \"sass:meta\";\ + \ndiv {\r\ \n foo: (1a2b3c);\r\ \n\r\ - \n length-1: length(1a2b3c);\r\ + \n length-1: list.length(1a2b3c);\r\ \n\r\ - \n unit-1: unit(1a2b3c);\r\ + \n unit-1: math.unit(1a2b3c);\r\ \n\r\ \n result-1: 1em-.75em;\r\ \n result-2: 2em-1em;\r\ @@ -22,12 +25,12 @@ fn test() { \n result-4: 1.5em-1em;\r\ \n result-5: 2em-1.5em;\r\ \n\r\ - \n type-1: type-of(1em-.75em);\r\ - \n type-2: type-of(2em-1em);\r\ - \n type-3: type-of(2em-0.75em);\r\ - \n type-4: type-of(1.5em-1em);\r\ - \n type-5: type-of(2em-1.5em);\r\ - \n type-6: type-of(1a2b3c);\r\ + \n type-1: meta.type-of(1em-.75em);\r\ + \n type-2: meta.type-of(2em-1em);\r\ + \n type-3: meta.type-of(2em-0.75em);\r\ + \n type-4: meta.type-of(1.5em-1em);\r\ + \n type-5: meta.type-of(2em-1.5em);\r\ + \n type-6: meta.type-of(1a2b3c);\r\ \n\r\ \n test-1: (1-em-2-em);\r\ \n test-1: (1-em - 2-em);\r\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1413.rs b/rsass/tests/spec/libsass_closed_issues/issue_1413.rs index 8fd5acbd9..24ca40f65 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1413.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1413.rs @@ -8,7 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("div {\r\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \ndiv {\r\ \n foo: \'A\'#{B};\r\ \n foo: #{A}\'B\';\r\ \n foo: \'A\'#{B}\'C\';\r\ @@ -23,31 +25,31 @@ fn test() { \n}\r\ \n\r\ \ndiv {\r\ - \n foo: type-of(\'A\'#{B});\r\ - \n foo: type-of(#{A}\'B\');\r\ - \n foo: type-of(\'A\'#{B}\'C\');\r\ - \n foo: type-of(#{A}\'B\'#{C});\r\ - \n foo: type-of(A#{B}\'C\');\r\ - \n foo: type-of(\'A\'#{B}C);\r\ - \n foo: type-of(#{A}B\'C\');\r\ - \n foo: type-of(\'A\'#{B}C\'D\');\r\ - \n foo: type-of(\'A\'B#{C}D\'E\');\r\ - \n foo: type-of(A\'B\'#{C}D\'E\');\r\ - \n foo: type-of(#{A}\'B\'C\'D\'\'E\');\r\ + \n foo: meta.type-of(\'A\'#{B});\r\ + \n foo: meta.type-of(#{A}\'B\');\r\ + \n foo: meta.type-of(\'A\'#{B}\'C\');\r\ + \n foo: meta.type-of(#{A}\'B\'#{C});\r\ + \n foo: meta.type-of(A#{B}\'C\');\r\ + \n foo: meta.type-of(\'A\'#{B}C);\r\ + \n foo: meta.type-of(#{A}B\'C\');\r\ + \n foo: meta.type-of(\'A\'#{B}C\'D\');\r\ + \n foo: meta.type-of(\'A\'B#{C}D\'E\');\r\ + \n foo: meta.type-of(A\'B\'#{C}D\'E\');\r\ + \n foo: meta.type-of(#{A}\'B\'C\'D\'\'E\');\r\ \n}\r\ \n\r\ \ndiv {\r\ - \n foo: length(\'A\'#{B});\r\ - \n foo: length(#{A}\'B\');\r\ - \n foo: length(\'A\'#{B}\'C\');\r\ - \n foo: length(#{A}\'B\'#{C});\r\ - \n foo: length(A#{B}\'C\');\r\ - \n foo: length(\'A\'#{B}C);\r\ - \n foo: length(#{A}B\'C\');\r\ - \n foo: length(\'A\'#{B}C\'D\');\r\ - \n foo: length(\'A\'B#{C}D\'E\');\r\ - \n foo: length(A\'B\'#{C}D\'E\');\r\ - \n foo: length(#{A}\'B\'C\'D\'\'E\');\r\ + \n foo: list.length(\'A\'#{B});\r\ + \n foo: list.length(#{A}\'B\');\r\ + \n foo: list.length(\'A\'#{B}\'C\');\r\ + \n foo: list.length(#{A}\'B\'#{C});\r\ + \n foo: list.length(A#{B}\'C\');\r\ + \n foo: list.length(\'A\'#{B}C);\r\ + \n foo: list.length(#{A}B\'C\');\r\ + \n foo: list.length(\'A\'#{B}C\'D\');\r\ + \n foo: list.length(\'A\'B#{C}D\'E\');\r\ + \n foo: list.length(A\'B\'#{C}D\'E\');\r\ + \n foo: list.length(#{A}\'B\'C\'D\'\'E\');\r\ \n}"), "div {\ \n foo: \"A\" B;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1417.rs b/rsass/tests/spec/libsass_closed_issues/issue_1417.rs index 7e3c781ae..e401c6471 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1417.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1417.rs @@ -9,15 +9,17 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("@function foo($a, $b) {\ + runner().ok("@use \"sass:math\";\ + \n@use \"sass:meta\";\ + \n@function foo($a, $b) {\ \n @return ($a $b);\ \n}\n\ \nfoo {\ \n foo: 1px / 2px;\ - \n foo: 1px / round(1.5);\ - \n foo: foo(1px / 2px, 1px / round(1.5));\ - \n foo: missing(1px / 2px, 1px / round(1.5));\ - \n foo: call(missing, 1px / 2px, 1px / round(1.5));\ + \n foo: 1px / math.round(1.5);\ + \n foo: foo(1px / 2px, 1px / math.round(1.5));\ + \n foo: missing(1px / 2px, 1px / math.round(1.5));\ + \n foo: meta.call(missing, 1px / 2px, 1px / math.round(1.5));\ \n}\n"), "foo {\ \n foo: 1px/2px;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1418/dynamic.rs b/rsass/tests/spec/libsass_closed_issues/issue_1418/dynamic.rs index c89616931..ce91946cd 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1418/dynamic.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1418/dynamic.rs @@ -10,22 +10,23 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "foo {\ - \n color: call(missing, $a: b);\ + "@use \"sass:meta\";\ + \nfoo {\ + \n color: meta.call(missing, $a: b);\ \n}\n" ), "DEPRECATION WARNING: Passing a string to call() is deprecated and will be illegal in Dart Sass 2.0.0.\n\ \nRecommendation: call(get-function(missing))\n\ \n ,\ - \n2 | color: call(missing, $a: b);\ - \n | ^^^^^^^^^^^^^^^^^^^^\ + \n3 | color: meta.call(missing, $a: b);\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 2:12 root stylesheet\n\ + \n input.scss 3:12 root stylesheet\n\ \nError: Plain CSS functions don\'t support keyword arguments.\ \n ,\ - \n2 | color: call(missing, $a: b);\ - \n | ^^^^^^^^^^^^^^^^^^^^\ + \n3 | color: meta.call(missing, $a: b);\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 2:12 root stylesheet", + \n input.scss 3:12 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1419/quoted.rs b/rsass/tests/spec/libsass_closed_issues/issue_1419/quoted.rs index e3ccf74a0..e54205ad1 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1419/quoted.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1419/quoted.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("foo {\ - \n foo: to-upper-case(\"ab\\63 d\");\ + runner().ok("@use \"sass:string\";\ + \nfoo {\ + \n foo: string.to-upper-case(\"ab\\63 d\");\ \n}\n"), "foo {\ \n foo: \"ABCD\";\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1419/unquoted.rs b/rsass/tests/spec/libsass_closed_issues/issue_1419/unquoted.rs index ba17ca873..411e49b8f 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1419/unquoted.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1419/unquoted.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("foo {\ - \n foo: to-upper-case(ab\\63 d);\ + runner().ok("@use \"sass:string\";\ + \nfoo {\ + \n foo: string.to-upper-case(ab\\63 d);\ \n}\n"), "foo {\ \n foo: ABCD;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1432/selector_extend.rs b/rsass/tests/spec/libsass_closed_issues/issue_1432/selector_extend.rs index 0fa8101a2..cabe55579 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1432/selector_extend.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1432/selector_extend.rs @@ -9,14 +9,15 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "@debug(selector-extend(\".a .b\", \".b\", null));\n" + "@use \"sass:selector\";\ + \n@debug(selector.extend(\".a .b\", \".b\", null));\n" ), "Error: $extender: null is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | @debug(selector-extend(\".a .b\", \".b\", null));\ + \n2 | @debug(selector.extend(\".a .b\", \".b\", null));\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:8 root stylesheet", + \n input.scss 2:8 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1432/selector_nest.rs b/rsass/tests/spec/libsass_closed_issues/issue_1432/selector_nest.rs index 7b5eb84e4..6bad66825 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1432/selector_nest.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1432/selector_nest.rs @@ -8,13 +8,16 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().err("@debug(selector-nest(\"foo\", null));\n"), + runner().err( + "@use \"sass:selector\";\ + \n@debug(selector.nest(\"foo\", null));\n" + ), "Error: null is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | @debug(selector-nest(\"foo\", null));\ + \n2 | @debug(selector.nest(\"foo\", null));\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:8 root stylesheet", + \n input.scss 2:8 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1432/selector_replace.rs b/rsass/tests/spec/libsass_closed_issues/issue_1432/selector_replace.rs index baf620e50..284bf42cf 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1432/selector_replace.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1432/selector_replace.rs @@ -9,14 +9,15 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "@debug(selector-replace(\"foo\", \"bar\", null));\n" + "@use \"sass:selector\";\ + \n@debug(selector.replace(\"foo\", \"bar\", null));\n" ), "Error: $replacement: null is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | @debug(selector-replace(\"foo\", \"bar\", null));\ + \n2 | @debug(selector.replace(\"foo\", \"bar\", null));\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:8 root stylesheet", + \n input.scss 2:8 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1432/selector_unify.rs b/rsass/tests/spec/libsass_closed_issues/issue_1432/selector_unify.rs index 412f7e077..ca7cb6b00 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1432/selector_unify.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1432/selector_unify.rs @@ -9,14 +9,15 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "@debug(selector-unify(\"foo\", null));\n" + "@use \"sass:selector\";\ + \n@debug(selector.unify(\"foo\", null));\n" ), "Error: $selector2: null is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | @debug(selector-unify(\"foo\", null));\ + \n2 | @debug(selector.unify(\"foo\", null));\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:8 root stylesheet", + \n input.scss 2:8 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1432/simple_selectors.rs b/rsass/tests/spec/libsass_closed_issues/issue_1432/simple_selectors.rs index af0c1d230..64995a7d2 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1432/simple_selectors.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1432/simple_selectors.rs @@ -9,14 +9,15 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "@debug(simple-selectors(null));\n" + "@use \"sass:selector\";\ + \n@debug(selector.simple-selectors(null));\n" ), "Error: $selector: null is not a valid selector: it must be a string,\ \na list of strings, or a list of lists of strings.\ \n ,\ - \n1 | @debug(simple-selectors(null));\ - \n | ^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | @debug(selector.simple-selectors(null));\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:8 root stylesheet", + \n input.scss 2:8 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1434.rs b/rsass/tests/spec/libsass_closed_issues/issue_1434.rs index 02d6d480e..a9769b8ee 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1434.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1434.rs @@ -8,13 +8,14 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok(".foo {\ - \n a: selector-nest(\'.foo\', \'.bar > .baz\');\ - \n b: selector-nest(\'.foo\', \'.bar ~ .baz\');\ - \n c: selector-nest(\'.foo\', \'.bar + .baz\');\ - \n d: selector-nest(\'.foo > .bar\', \'.baz\');\ - \n e: selector-nest(\'.foo ~ .bar\', \'.baz\');\ - \n f: selector-nest(\'.foo + .bar\', \'.baz\');\ + runner().ok("@use \"sass:selector\";\ + \n.foo {\ + \n a: selector.nest(\'.foo\', \'.bar > .baz\');\ + \n b: selector.nest(\'.foo\', \'.bar ~ .baz\');\ + \n c: selector.nest(\'.foo\', \'.bar + .baz\');\ + \n d: selector.nest(\'.foo > .bar\', \'.baz\');\ + \n e: selector.nest(\'.foo ~ .bar\', \'.baz\');\ + \n f: selector.nest(\'.foo + .bar\', \'.baz\');\ \n}\n"), ".foo {\ \n a: .foo .bar > .baz;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1488.rs b/rsass/tests/spec/libsass_closed_issues/issue_1488.rs index 8c332fe6d..5625582d4 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1488.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1488.rs @@ -8,37 +8,38 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function foo($arg2) {\ - \n @return type-of($arg2);\ + runner().ok("@use \"sass:meta\";\ + \n@function foo($arg2) {\ + \n @return meta.type-of($arg2);\ \n}\n\ \n@function foo_($arg2...) {\ - \n @return type-of($arg2);\ + \n @return meta.type-of($arg2);\ \n}\n\ \n@function bar($arg1, $arg2) {\ - \n @return type-of($arg1) + \"::\" + type-of($arg2);\ + \n @return meta.type-of($arg1) + \"::\" + meta.type-of($arg2);\ \n}\n\ \n@function bar_($arg1, $arg2...) {\ - \n @return type-of($arg1) + \"::\" + type-of($arg2);\ + \n @return meta.type-of($arg1) + \"::\" + meta.type-of($arg2);\ \n}\n\ \nfoo {\ \n foo: foo(one);\ \n foo: foo(one...);\ \n bar: bar(one, two);\ \n bar: bar(one, two...);\ - \n foo: call(\'foo\', one);\ - \n foo: call(\'foo\', one...);\ - \n bar: call(\'bar\', one, two);\ - \n bar: call(\'bar\', one, two...);\ + \n foo: meta.call(\'foo\', one);\ + \n foo: meta.call(\'foo\', one...);\ + \n bar: meta.call(\'bar\', one, two);\ + \n bar: meta.call(\'bar\', one, two...);\ \n}\n\ \nbar {\ \n foo: foo_(one);\ \n foo: foo_(one...);\ \n bar: bar_(one, two);\ \n bar: bar_(one, two...);\ - \n foo: call(\'foo_\', one);\ - \n foo: call(\'foo_\', one...);\ - \n bar: call(\'bar_\', one, two);\ - \n bar: call(\'bar_\', one, two...);\ + \n foo: meta.call(\'foo_\', one);\ + \n foo: meta.call(\'foo_\', one...);\ + \n bar: meta.call(\'bar_\', one, two);\ + \n bar: meta.call(\'bar_\', one, two...);\ \n}"), "foo {\ \n foo: string;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_151.rs b/rsass/tests/spec/libsass_closed_issues/issue_151.rs index c2ca56c1f..458d36601 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_151.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_151.rs @@ -9,16 +9,17 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "div.colors {\ - \n background: grayscale(red);\ + "@use \"sass:color\";\ + \ndiv.colors {\ + \n background: color.grayscale(red);\ \n background: saturate(red);\ - \n background: invert(red);\ - \n background: alpha(red);\ - \n color: grayscale(#369);\ + \n background: color.invert(red);\ + \n background: color.alpha(red);\ + \n color: color.grayscale(#369);\ \n color: saturate(#369);\ - \n color: saturate(#369, 20%);\ - \n color: invert(#369);\ - \n color: alpha(#369);\ + \n color: color.adjust(#369, $saturation: 20%);\ + \n color: color.invert(#369);\ + \n color: color.alpha(#369);\ \n}\n\ \ndiv.numbers {\ \n filter: grayscale(30%);\ @@ -31,9 +32,9 @@ fn test() { ), "Error: $amount: red is not a number.\ \n ,\ - \n3 | background: saturate(red);\ + \n4 | background: saturate(red);\ \n | ^^^^^^^^^^^^^\ \n \'\ - \n input.scss 3:15 root stylesheet", + \n input.scss 4:15 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1535.rs b/rsass/tests/spec/libsass_closed_issues/issue_1535.rs index dc4dcd1f5..ebc67e43f 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1535.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1535.rs @@ -9,8 +9,9 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("foo {\ - \n test: type-of(1--em);\ + runner().ok("@use \"sass:meta\";\ + \nfoo {\ + \n test: meta.type-of(1--em);\ \n test: (1--em-2--em);\ \n test: (1--em- 2--em);\ \n test: (1--em -2--em);\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1566.rs b/rsass/tests/spec/libsass_closed_issues/issue_1566.rs index 9e69b0582..858546dda 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1566.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1566.rs @@ -8,11 +8,12 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function foo($predicate) {\ - \n @return call(\'bar\', $predicate);\ + runner().ok("@use \"sass:meta\";\ + \n@function foo($predicate) {\ + \n @return meta.call(\'bar\', $predicate);\ \n}\n\ \n@function bar($predicate) {\ - \n @return type-of($predicate);\ + \n @return meta.type-of($predicate);\ \n}\n\ \ntest {\ \n test: foo(1 2 3);\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1579.rs b/rsass/tests/spec/libsass_closed_issues/issue_1579.rs index f25c9c338..d3c223900 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1579.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1579.rs @@ -8,11 +8,12 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function foo($a, $b: null, $c: false) {\ + runner().ok("@use \"sass:meta\";\ + \n@function foo($a, $b: null, $c: false) {\ \n @return $c;\ \n}\n\ \n@function bar($args...) {\ - \n @return call(foo, $args...);\ + \n @return meta.call(foo, $args...);\ \n}\n\ \ntest {\ \n test: bar(3, $c: true);\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1583.rs b/rsass/tests/spec/libsass_closed_issues/issue_1583.rs index 15e03f3b8..7d6399294 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1583.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1583.rs @@ -8,26 +8,29 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$ls: ((foo,));\n\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@use \"sass:string\";\n\ + \n$ls: ((foo,));\n\ \nfoo {\ - \n baz: length($ls);\ - \n baz: type-of($ls);\ - \n baz: inspect($ls);\ + \n baz: list.length($ls);\ + \n baz: meta.type-of($ls);\ + \n baz: meta.inspect($ls);\ \n}\n\ \nbar {\ - \n baz: length(&);\ - \n baz: type-of(&);\ - \n baz: inspect(&);\ + \n baz: list.length(&);\ + \n baz: meta.type-of(&);\ + \n baz: meta.inspect(&);\ \n}\n\ \nfoo {\ - \n string: inspect(&);\ - \n str-length: str-length(inspect(&));\ - \n list-length: length(&);\ + \n string: meta.inspect(&);\ + \n str-length: string.length(meta.inspect(&));\ + \n list-length: list.length(&);\ \n}\n\ \nfoo, bar {\ - \n string: inspect(&);\ - \n str-length: str-length(inspect(&));\ - \n list-length: length(&);\ + \n string: meta.inspect(&);\ + \n str-length: string.length(meta.inspect(&));\ + \n list-length: list.length(&);\ \n}\n"), "foo {\ \n baz: 1;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1604.rs b/rsass/tests/spec/libsass_closed_issues/issue_1604.rs index 21d162b48..4f7f8221a 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1604.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1604.rs @@ -8,12 +8,14 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function test($args...) {\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\n\ + \n@function test($args...) {\ \n $all: ();\n\ \n @each $arg in $args {\ - \n $all: append($all, $arg);\ + \n $all: list.append($all, $arg);\ \n }\n\ - \n @return inspect($all);\ + \n @return meta.inspect($all);\ \n}\n\ \ntest {\ \n args-1: test(1 2 3);\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1622.rs b/rsass/tests/spec/libsass_closed_issues/issue_1622.rs index be5604df5..1b2c67072 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1622.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1622.rs @@ -8,11 +8,13 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function foo($list) {\ - \n @return call(bar, $list);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@function foo($list) {\ + \n @return meta.call(bar, $list);\ \n}\n\ \n@function bar($list, $args...) {\ - \n @return length($list);\ + \n @return list.length($list);\ \n}\n\ \ntest {\ \n test: foo(1 2 3);\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1634.rs b/rsass/tests/spec/libsass_closed_issues/issue_1634.rs index bb32f6e15..9d9cff7f6 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1634.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1634.rs @@ -8,12 +8,14 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$empty-list: ();\n\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n$empty-list: ();\n\ \n@function foo($args...) {\ - \n @return call(bar, $args...);\ + \n @return meta.call(bar, $args...);\ \n}\n\ \n@function bar($list) {\ - \n @return length($list);\ + \n @return list.length($list);\ \n}\n\ \ntest {\ \n test: foo($empty-list);\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1644/complex.rs b/rsass/tests/spec/libsass_closed_issues/issue_1644/complex.rs index a97d2ba49..673adc158 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1644/complex.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1644/complex.rs @@ -10,7 +10,8 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "$tablet-portrait: 768px;\ + "@use \"sass:map\";\ + \n$tablet-portrait: 768px;\ \n$tablet-landscape: 980px;\ \n$desk-normal: 1120px;\ \n$desk-big: 1280px;\ @@ -33,7 +34,7 @@ fn test() { \n }\ \n }\ \n}\n\ - \n@each $name in map-keys($grid-breakpoints-immobile) {\ + \n@each $name in map.keys($grid-breakpoints-immobile) {\ \n @include grid-media-query($name, $grid-breakpoints-immobile) {\ \n body.immobile & {\ \n margin-bottom: 0;\ @@ -43,11 +44,11 @@ fn test() { ), "Error: Top-level selectors may not contain the parent selector \"&\".\ \n ,\ - \n30 | body.immobile & {\ + \n31 | body.immobile & {\ \n | ^\ \n \'\ - \n input.scss 30:19 @content\ - \n input.scss 22:9 grid-media-query()\ - \n input.scss 29:3 root stylesheet", + \n input.scss 31:19 @content\ + \n input.scss 23:9 grid-media-query()\ + \n input.scss 30:3 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1645.rs b/rsass/tests/spec/libsass_closed_issues/issue_1645.rs index bb0c42388..8dc59984a 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1645.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1645.rs @@ -8,11 +8,13 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function foo($a, $should-be-empty...) {\ - \n @return length($should-be-empty);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@function foo($a, $should-be-empty...) {\ + \n @return list.length($should-be-empty);\ \n}\n\ \n@function bar($args...) {\ - \n @return call(foo, $args...);\ + \n @return meta.call(foo, $args...);\ \n}\n\ \n@function args($args...) {\ \n @return $args;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1647/selectors.rs b/rsass/tests/spec/libsass_closed_issues/issue_1647/selectors.rs index 58b7e8a73..0e96a3615 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1647/selectors.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1647/selectors.rs @@ -8,19 +8,21 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$map: (foo: \'b\', bar: c);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:map\";\ + \n$map: (foo: \'b\', bar: c);\ \n$list: (\'d\', e);\n\ \na {\ - \n #{map-get($map, foo)} & {\ + \n #{map.get($map, foo)} & {\ \n foo: bar;\ \n }\ - \n #{map-get($map, bar)} & {\ + \n #{map.get($map, bar)} & {\ \n foo: bar;\ \n }\n\ - \n #{nth($list, 1)} & {\ + \n #{list.nth($list, 1)} & {\ \n foo: bar;\ \n }\n\ - \n #{nth($list, 2)} & {\ + \n #{list.nth($list, 2)} & {\ \n foo: bar;\ \n }\ \n}\n"), diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1667.rs b/rsass/tests/spec/libsass_closed_issues/issue_1667.rs index 23a73b99c..83a167b96 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1667.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1667.rs @@ -8,14 +8,15 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$map: (\r\ + runner().ok("@use \"sass:map\";\ + \n$map: (\r\ \n 1: 1,\r\ \n 1px: 1px\r\ \n);\r\ \n\r\ \nfoo {\r\ - \n a: map-get($map, 1);\r\ - \n b: map-get($map, 1px);\r\ + \n a: map.get($map, 1);\r\ + \n b: map.get($map, 1px);\r\ \n}\r\ \n\r\ \n$type-scale: (\r\ @@ -50,8 +51,8 @@ fn test() { \n);\r\ \n\r\ \n@function get-size($size) {\r\ - \n\t@if map-has-key($type-scale, $size) {\r\ - \n\t\t@return map-get($type-scale, $size);\r\ + \n\t@if map.has-key($type-scale, $size) {\r\ + \n\t\t@return map.get($type-scale, $size);\r\ \n\t}\r\ \n\r\ \n\t@warn \"Not a valid size.\";\r\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1709.rs b/rsass/tests/spec/libsass_closed_issues/issue_1709.rs index b8cd81a95..ceb2fba0a 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1709.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1709.rs @@ -9,8 +9,10 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "@mixin transition( $prefix_properties, $transitions... ) {\n\ - \n @if not str-index( inspect( $transitions ), \',\') {\ + "@use \"sass:string\";\ + \n@use \"sass:meta\";\n\ + \n@mixin transition( $prefix_properties, $transitions... ) {\n\ + \n @if not string.index( meta.inspect( $transitions ), \',\') {\ \n $transitions: ( $transitions );\ \n }\n\ \n @each $prefix in -webkit-, -moz-, -ms-, -o-, \'\' {\n\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1722.rs b/rsass/tests/spec/libsass_closed_issues/issue_1722.rs index a92a1f41a..67009e0c4 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1722.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1722.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$score: (item-height: 1.12em);\ + runner().ok("@use \"sass:map\";\ + \n$score: (item-height: 1.12em);\ \n.test {\ - \n background-position: 0 -#{map-get($score, item-height)};\ + \n background-position: 0 -#{map.get($score, item-height)};\ \n}\n\n"), ".test {\ \n background-position: 0 -1.12em;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1723.rs b/rsass/tests/spec/libsass_closed_issues/issue_1723.rs index 255bfe6a9..aaf7ad893 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1723.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1723.rs @@ -9,27 +9,26 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("test-1 test-2 test-3 test-4 test-5,\r\ - \ntest-6 test-7 test-8 test-9 test-10 {\r\ - \n @each $set in & {\r\ - \n set: inspect($set);\r\ - \n\r\ - \n @each $selector in $set {\r\ - \n selector: inspect($selector);\r\ - \n }\r\ - \n }\r\ - \n}\r\ - \n\r\ - \ntest-1 test-2 test-3 test-4 test-5,\r\ - \ntest-6 test-7 test-8 test-9 test-10 {\r\ - \n @for $i from 1 through length(&) {\r\ - \n $set: nth(&, $i);\r\ - \n set: inspect($set);\r\ - \n\r\ - \n @each $selector in $set {\r\ - \n selector: inspect($selector);\r\ - \n }\r\ - \n }\r\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\n\ + \ntest-1 test-2 test-3 test-4 test-5,\ + \ntest-6 test-7 test-8 test-9 test-10 {\ + \n @each $set in & {\ + \n set: meta.inspect($set);\n\ + \n @each $selector in $set {\ + \n selector: meta.inspect($selector);\ + \n }\ + \n }\ + \n}\n\ + \ntest-1 test-2 test-3 test-4 test-5,\ + \ntest-6 test-7 test-8 test-9 test-10 {\ + \n @for $i from 1 through list.length(&) {\ + \n $set: list.nth(&, $i);\ + \n set: meta.inspect($set);\n\ + \n @each $selector in $set {\ + \n selector: meta.inspect($selector);\ + \n }\ + \n }\ \n}"), "test-1 test-2 test-3 test-4 test-5,\ \ntest-6 test-7 test-8 test-9 test-10 {\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1757/each.rs b/rsass/tests/spec/libsass_closed_issues/issue_1757/each.rs index 2ed635aaa..d3e376914 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1757/each.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1757/each.rs @@ -8,18 +8,19 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok(".test .nest {\ - \n length: length(&);\ + runner().ok("@use \"sass:list\";\ + \n.test .nest {\ + \n length: list.length(&);\ \n @each $list in & {\ \n list: $list;\ - \n length: length($list);\ + \n length: list.length($list);\ \n }\ \n}\n\ \n.test, .other {\ - \n length: length(&);\ + \n length: list.length(&);\ \n @each $list in & {\ \n list: $list;\ - \n length: length($list);\ + \n length: list.length($list);\ \n }\ \n}\n"), ".test .nest {\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1757/test_for.rs b/rsass/tests/spec/libsass_closed_issues/issue_1757/test_for.rs index 90639e3e1..ac92c2158 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1757/test_for.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1757/test_for.rs @@ -8,20 +8,21 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok(".test .nest {\ - \n length: length(&);\ - \n @for $i from 1 through length(&) {\ - \n $list: nth(&, $i);\ + runner().ok("@use \"sass:list\";\ + \n.test .nest {\ + \n length: list.length(&);\ + \n @for $i from 1 through list.length(&) {\ + \n $list: list.nth(&, $i);\ \n list: $list;\ - \n length: length($list);\ + \n length: list.length($list);\ \n }\ \n}\n\ \n.test, .other {\ - \n length: length(&);\ - \n @for $i from 1 through length(&) {\ - \n $list: nth(&, $i);\ + \n length: list.length(&);\ + \n @for $i from 1 through list.length(&) {\ + \n $list: list.nth(&, $i);\ \n list: $list;\ - \n length: length($list);\ + \n length: list.length($list);\ \n }\ \n}\n"), ".test .nest {\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1796.rs b/rsass/tests/spec/libsass_closed_issues/issue_1796.rs index 73c7bef71..8d9552864 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1796.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1796.rs @@ -9,14 +9,15 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - ".parent {\ + "@use \"sass:list\";\ + \n.parent {\ \n .brother, .sister, .cousin {\ \n color: green;\ \n sel: &;\n\ \n $new-sel: ();\ \n @each $s in & {\ - \n $last: nth($s, -1);\ - \n $new-sel: append($new-sel, $s #{\'+\'} $last, comma);\ + \n $last: list.nth($s, -1);\ + \n $new-sel: list.append($new-sel, $s #{\'+\'} $last, comma);\ \n x: $new-sel;\ \n }\ \n @at-root #{$new-sel} {\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1819.rs b/rsass/tests/spec/libsass_closed_issues/issue_1819.rs index 31b5c69aa..ef73f7454 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1819.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1819.rs @@ -8,8 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("foo {\ - \n bar: type-of(selector-unify(\'p\', \'a\'));\ + runner().ok("@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \nfoo {\ + \n bar: meta.type-of(selector.unify(\'p\', \'a\'));\ \n}"), "foo {\ \n bar: null;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_185/mixin.rs b/rsass/tests/spec/libsass_closed_issues/issue_185/mixin.rs index 8d39dc7fa..f992d6c57 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_185/mixin.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_185/mixin.rs @@ -10,19 +10,20 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "@function shift($list) {\ - \n @if length($list) == 1 { @return (); }\n\ + "@use \"sass:list\";\ + \n@function shift($list) {\ + \n @if list.length($list) == 1 { @return (); }\n\ \n $new: ();\ - \n @for $i from 2 through length($list) {\ - \n $new: append($new, nth($list, $i));\ + \n @for $i from 2 through list.length($list) {\ + \n $new: list.append($new, list.nth($list, $i));\ \n }\ \n @return $new;\ \n}\n\ \n@mixin media($medias...) {\ - \n @if length($medias) == 0 {\ + \n @if list.length($medias) == 0 {\ \n @content;\ \n } @else {\ - \n @media #{nth($medias, 1)} {\ + \n @media #{list.nth($medias, 1)} {\ \n @include media(shift($medias)...) {\ \n @content;\ \n }\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1940.rs b/rsass/tests/spec/libsass_closed_issues/issue_1940.rs index fa617e219..4b5b9d89b 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1940.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1940.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("// ----\r\ + runner().ok("@use \"sass:map\";\ + \n// ----\r\ \n// libsass (v3.3.2)\r\ \n// ----\r\ \n\r\ @@ -17,17 +18,17 @@ fn test() { \n\tbar: #bar\r\ \n);\r\ \n\r\ - \n#{map-get($prefix, foo)} {\r\ + \n#{map.get($prefix, foo)} {\r\ \n color: red;\r\ \n}\r\ - \n#{map-get($prefix, bar)} {\r\ + \n#{map.get($prefix, bar)} {\r\ \n color: red;\r\ \n}\r\ \n\r\ - \n#{map-get($prefix, foo)} .baz {\r\ + \n#{map.get($prefix, foo)} .baz {\r\ \n color: red;\r\ \n}\r\ - \n#{map-get($prefix, bar)} .baz {\r\ + \n#{map.get($prefix, bar)} .baz {\r\ \n color: red;\r\ \n}"), "foo {\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1947.rs b/rsass/tests/spec/libsass_closed_issues/issue_1947.rs index 288caf4ce..62e50e502 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1947.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1947.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok(".a-#{quote(\'\' + b)} {\ + runner().ok("@use \"sass:string\";\ + \n.a-#{string.quote(\'\' + b)} {\ \n c: d;\ \n}\n\ \n.a-#{\'\' + b} {\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_1969.rs b/rsass/tests/spec/libsass_closed_issues/issue_1969.rs index e73265016..c50da4962 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_1969.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_1969.rs @@ -8,14 +8,17 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$base-text-color: #666;\n\ + runner().ok( + "@use \"sass:color\";\ + \n$base-text-color: #666;\n\ \n@function calcNavbarTextColor ($base-text-color) {\ \n @return $base-text-color;\ \n}\n\ \n$header-text-color: calcNavbarTextColor($base-text-color);\n\ \n.test_class {\ - \n color: lighten($header-text-color, 20%);\ - \n}"), + \n color: color.adjust($header-text-color, $lightness: 20%);\ + \n}" + ), ".test_class {\ \n color: #999999;\ \n}\n" diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2020.rs b/rsass/tests/spec/libsass_closed_issues/issue_2020.rs index 9adb5d4ea..8f5debb58 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2020.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2020.rs @@ -8,12 +8,14 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("form {\r\ - \n $selector: nth(&, 1);\r\ - \n sel: inspect($selector);\r\ - \n $selector: nth($selector, 1);\r\ - \n sel: inspect($selector);\r\ - \n} "), + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\n\ + \nform {\ + \n $selector: list.nth(&, 1);\ + \n sel: meta.inspect($selector);\ + \n $selector: list.nth($selector, 1);\ + \n sel: meta.inspect($selector);\ + \n}"), "form {\ \n sel: form;\ \n sel: form;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2031/extended_not.rs b/rsass/tests/spec/libsass_closed_issues/issue_2031/extended_not.rs index 700c0d71f..921b3bc48 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2031/extended_not.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2031/extended_not.rs @@ -10,7 +10,8 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - ":not(.foo) {\r\ + "@use \"sass:selector\";\ + \n:not(.foo) {\r\ \n content: test;\r\ \n}\r\ \n.bar, .baz {\r\ @@ -18,7 +19,7 @@ fn test() { \n}\r\ \n\r\ \ntest {\r\ - \n content: selector-extend(\":not(.foo)\", \".foo\", \".bar\");\r\ + \n content: selector.extend(\":not(.foo)\", \".foo\", \".bar\");\r\ \n}" ), ":not(.foo):not(.bar):not(.baz) {\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2112.rs b/rsass/tests/spec/libsass_closed_issues/issue_2112.rs index d92ed2fee..130fd0605 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2112.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2112.rs @@ -8,12 +8,13 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$color: #1caf9a;\r\ + runner().ok("@use \"sass:color\";\ + \n$color: #1caf9a;\r\ \n\r\ \nbody {\r\ - \n test-01: change-color($color, $hue: -240);\r\ - \n test-03: change-color($color, $hue: 120);\r\ - \n test-02: change-color($color, $hue: 480);\r\ + \n test-01: color.change($color, $hue: -240);\r\ + \n test-03: color.change($color, $hue: 120);\r\ + \n test-02: color.change($color, $hue: 480);\r\ \n}"), "body {\ \n test-01: #1caf1c;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2156/debug.rs b/rsass/tests/spec/libsass_closed_issues/issue_2156/debug.rs index dfa0c9a5e..3c4f54821 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2156/debug.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2156/debug.rs @@ -8,11 +8,12 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@debug \"\\\"foo\\\"\" + \"\";\r\ + runner().ok("@use \"sass:string\";\ + \n@debug \"\\\"foo\\\"\" + \"\";\r\ \n@debug \"\" + \"\\\"foo\\\"\";\r\ \n@debug \"\" + \"\\\"foo\";\r\ \n@debug \"\\\"foo\\\"\" + \"bar\";\r\ - \n@debug unquote(\"\\\"foo\\\" and \\\"bar\\\"\");\r\n"), + \n@debug string.unquote(\"\\\"foo\\\" and \\\"bar\\\"\");\r\n"), "" ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2156/error.rs b/rsass/tests/spec/libsass_closed_issues/issue_2156/error.rs index 249eb92f1..98c0b5f38 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2156/error.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2156/error.rs @@ -8,12 +8,15 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().err("@error unquote(\"\\\"foo\\\" and \\\"bar\\\"\");\r\n"), + runner().err( + "@use \"sass:string\";\ + \n@error string.unquote(\"\\\"foo\\\" and \\\"bar\\\"\");\n" + ), "Error: \"foo\" and \"bar\"\ \n ,\ - \n1 | @error unquote(\"\\\"foo\\\" and \\\"bar\\\"\");\ - \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ + \n2 | @error string.unquote(\"\\\"foo\\\" and \\\"bar\\\"\");\ + \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:1 root stylesheet", + \n input.scss 2:1 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2156/warn.rs b/rsass/tests/spec/libsass_closed_issues/issue_2156/warn.rs index 5a52dd54e..ace555d39 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2156/warn.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2156/warn.rs @@ -8,11 +8,12 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@warn \"\\\"foo\\\"\" + \"\";\r\ + runner().ok("@use \"sass:string\";\ + \n@warn \"\\\"foo\\\"\" + \"\";\r\ \n@warn \"\" + \"\\\"foo\\\"\";\r\ \n@warn \"\" + \"\\\"foo\";\r\ \n@warn \"\\\"foo\\\"\" + \"bar\";\r\ - \n@warn unquote(\"\\\"foo\\\" and \\\"bar\\\"\");\r\n"), + \n@warn string.unquote(\"\\\"foo\\\" and \\\"bar\\\"\");\r\n"), "" ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_221255.rs b/rsass/tests/spec/libsass_closed_issues/issue_221255.rs index a81733a86..540b83f4b 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_221255.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_221255.rs @@ -9,11 +9,12 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong error fn test() { assert_eq!( - runner().err( - "\'#{)\'{" - ), - "Error: Invalid CSS after \"\'#{\": expected expression (e.g. 1px, bold), was \")\'{\"\ - \n on line 1 of input.scss\ - \n Use --trace for backtrace.", + runner().err("\'#{)\'{\n"), + "Error: Expected expression.\ + \n ,\ + \n1 | \'#{)\'{\ + \n | ^^\ + \n \'\ + \n input.scss 1:2 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_224.rs b/rsass/tests/spec/libsass_closed_issues/issue_224.rs index 1914d92da..0f2db9f3c 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_224.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_224.rs @@ -8,13 +8,16 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$list: (\"a\", \"b\", \"c\");\n\ + runner().ok( + "@use \"sass:list\";\ + \n$list: (\"a\", \"b\", \"c\");\n\ \ntest {\ - \n content: nth($list, -1);\ - \n content: nth($list, -2);\ - \n content: nth($list, -3);\ - \n content: nth($list, -1) == nth($list, length($list));\ - \n}\n"), + \n content: list.nth($list, -1);\ + \n content: list.nth($list, -2);\ + \n content: list.nth($list, -3);\ + \n content: list.nth($list, -1) == list.nth($list, list.length($list));\ + \n}\n" + ), "test {\ \n content: \"c\";\ \n content: \"b\";\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2246.rs b/rsass/tests/spec/libsass_closed_issues/issue_2246.rs index 562eea02e..d5e0d767f 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2246.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2246.rs @@ -9,9 +9,10 @@ fn runner() -> crate::TestRunner { #[ignore] // unexepected error fn test() { assert_eq!( - runner().ok("@mixin foo($option: \'foo\') {\ + runner().ok("@use \"sass:math\";\ + \n@mixin foo($option: \'foo\') {\ \n // Create a unique, random placeholder to store styles\ - \n $placeholder : $option + random(9999);\n\ + \n $placeholder : $option + math.random(9999);\n\ \n // Store the styles in the placeholder\ \n @at-root %#{$placeholder} {\ \n content: \'foo\';\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2309.rs b/rsass/tests/spec/libsass_closed_issues/issue_2309.rs index 1bc9954d9..89fd486ec 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2309.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2309.rs @@ -9,7 +9,9 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$button-sizes: (\r\ + "@use \"sass:list\";\ + \n@use \"sass:map\";\ + \n$button-sizes: (\r\ \n \'xs\': (\r\ \n \'line-height\': 16 / 12,\r\ \n ),\r\ @@ -25,10 +27,10 @@ fn test() { \n);\r\ \n\r\ \n@each $size in $button-sizes {\r\ - \n $size-metrics: nth($size, 2);\r\ + \n $size-metrics: list.nth($size, 2);\r\ \n\r\ \n .c-button__icon {\r\ - \n min-height: map-get($size-metrics, \'line-height\') * 1em;\r\ + \n min-height: map.get($size-metrics, \'line-height\') * 1em;\r\ \n }\r\ \n}" ), diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2330.rs b/rsass/tests/spec/libsass_closed_issues/issue_2330.rs index 96d58f371..2f72fe460 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2330.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2330.rs @@ -9,19 +9,19 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "@function test () {\r\ - \n $m: ();\r\ - \n $abc: (a b c d e f g h i j k);\r\ - \n\r\ - \n @for $index from 1 through length($abc) {;\r\ - \n $m: map-merge($m, (nth($abc, $index):$index) );\r\ - \n }\r\ - \n\r\ - \n @return $m;\r\ - \n}\r\ - \n\r\ - \ntest {\r\ - \n content: inspect(test());\r\ + "@use \"sass:list\";\ + \n@use \"sass:map\";\ + \n@use \"sass:meta\";\n\ + \n@function test () {\ + \n $m: ();\ + \n $abc: (a b c d e f g h i j k);\n\ + \n @for $index from 1 through list.length($abc) {;\ + \n $m: map.merge($m, (list.nth($abc, $index):$index) );\ + \n }\n\ + \n @return $m;\ + \n}\n\ + \ntest {\ + \n content: meta.inspect(test());\ \n}" ), "test {\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2333.rs b/rsass/tests/spec/libsass_closed_issues/issue_2333.rs index 84511e8dc..add53ae42 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2333.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2333.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("test { test: inspect((a:1,b:(foo,bar),c:3)); }"), + runner().ok("@use \"sass:meta\";\n\ + \ntest { test: meta.inspect((a:1,b:(foo,bar),c:3)); }"), "test {\ \n test: (a: 1, b: (foo, bar), c: 3);\ \n}\n" diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2374.rs b/rsass/tests/spec/libsass_closed_issues/issue_2374.rs index 7847e3836..a5365b768 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2374.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2374.rs @@ -10,61 +10,59 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$colors: (\r\ - \n yellow: #ffeb3b\r\ - \n);\r\ - \n@each $name, $color in $colors {\r\ - \n $amount: 40;\r\ - \n @for $i from 0 through 9 {\r\ - \n .#{$name}-#{($i*100)} { background-color: lighten($color, $amount) };\r\ - \n $amount: $amount - 2;\r\ - \n }\r\ - \n}\r\ - \n\r\ - \n$colors: (\r\ - \n yellow: yellow,\r\ - \n red: red,\r\ - \n blue: blue,\r\ - \n \r\ - \n);\r\ - \n@each $name, $color in $colors {\r\ - \n @for $i from 0 through 2 {\r\ - \n .#{$name}-#{($i*100)} { \r\ - \n background-color: lighten($color, 10) \r\ - \n };\r\ - \n }\r\ - \n}\r\ - \n\r\n" + "@use \"sass:color\";\ + \n$colors: (\ + \n yellow: #ffeb3b\ + \n);\ + \n@each $name, $color in $colors {\ + \n $amount: 40%;\ + \n @for $i from 0 through 9 {\ + \n .#{$name}-#{($i*100)} { background-color: color.adjust($color, $lightness: $amount) };\ + \n $amount: $amount - 2;\ + \n }\ + \n}\n\ + \n$colors: (\ + \n yellow: yellow,\ + \n red: red,\ + \n blue: blue,\n\ + \n);\ + \n@each $name, $color in $colors {\ + \n @for $i from 0 through 2 {\ + \n .#{$name}-#{($i*100)} {\ + \n background-color: color.adjust($color, $lightness: 10%)\ + \n };\ + \n }\ + \n}\n\n" ), ".yellow-0 {\ - \n background-color: white;\ + \n background-color: hsl(53.8775510204, 100%, 101.568627451%);\ \n}\ \n.yellow-100 {\ - \n background-color: #fffffd;\ + \n background-color: rgb(255, 254.7755102041, 252.8);\ \n}\ \n.yellow-200 {\ - \n background-color: #fffef3;\ + \n background-color: rgb(255, 253.7346938776, 242.6);\ \n}\ \n.yellow-300 {\ - \n background-color: #fffde8;\ + \n background-color: rgb(255, 252.693877551, 232.4);\ \n}\ \n.yellow-400 {\ - \n background-color: #fffcde;\ + \n background-color: rgb(255, 251.6530612245, 222.2);\ \n}\ \n.yellow-500 {\ - \n background-color: #fffbd4;\ + \n background-color: rgb(255, 250.612244898, 212);\ \n}\ \n.yellow-600 {\ - \n background-color: #fffaca;\ + \n background-color: rgb(255, 249.5714285714, 201.8);\ \n}\ \n.yellow-700 {\ - \n background-color: #fff9c0;\ + \n background-color: rgb(255, 248.5306122449, 191.6);\ \n}\ \n.yellow-800 {\ - \n background-color: #fff7b5;\ + \n background-color: rgb(255, 247.4897959184, 181.4);\ \n}\ \n.yellow-900 {\ - \n background-color: #fff6ab;\ + \n background-color: rgb(255, 246.4489795918, 171.2);\ \n}\ \n.yellow-0 {\ \n background-color: #ffff33;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_238760.rs b/rsass/tests/spec/libsass_closed_issues/issue_238760.rs index 7a509b87c..700b3febb 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_238760.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_238760.rs @@ -9,13 +9,16 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong error fn test() { assert_eq!( - runner().err("$id: inspect((a#b:c)...)"), + runner().err( + "@use \"sass:meta\";\n\ + \n$id: meta.inspect((a#b:c)...)" + ), "Error: Variable keyword argument map must have string keys.\ - \na #b is not a string in (a #b: c).\ + \n(a #b) is not a string in (a #b: c).\ \n ,\ - \n1 | $id: inspect((a#b:c)...)\ - \n | ^^^^^^^\ + \n3 | $id: meta.inspect((a#b:c)...)\ + \n | ^^^^^^^\ \n \'\ - \n input.scss 1:14 root stylesheet", + \n input.scss 3:19 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2394.rs b/rsass/tests/spec/libsass_closed_issues/issue_2394.rs index 7c67824d8..f9640ade4 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2394.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2394.rs @@ -9,8 +9,10 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "@mixin brokenTest($color: red, $variableArguments...) {\r\ - \n $width: map-get(keywords($variableArguments), width);\r\ + "@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \n@mixin brokenTest($color: red, $variableArguments...) {\r\ + \n $width: map.get(meta.keywords($variableArguments), width);\r\ \n a {\r\ \n width: $width;\r\ \n color: $color;\r\ @@ -18,8 +20,8 @@ fn test() { \n}\r\ \n\r\ \n@mixin workingTest($variableArguments...) {\r\ - \n $width: map-get(keywords($variableArguments), width);\r\ - \n $color: map-get(keywords($variableArguments), color);\r\ + \n $width: map.get(meta.keywords($variableArguments), width);\r\ + \n $color: map.get(meta.keywords($variableArguments), color);\r\ \n a {\r\ \n width: $width;\r\ \n color: $color;\r\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2462.rs b/rsass/tests/spec/libsass_closed_issues/issue_2462.rs index 8269bfaa4..3dcf02b5b 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2462.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2462.rs @@ -6,13 +6,15 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( - runner().ok("b {\ - \n color: lighten(Crimson, 10%);\ + runner().ok("@use \"sass:color\";\ + \nb {\ + \n color: color.adjust(Crimson, $lightness: 10%);\ \n}\n"), "b {\ - \n color: #ed365b;\ + \n color: rgb(236.75, 54.25, 90.75);\ \n}\n" ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2472.rs b/rsass/tests/spec/libsass_closed_issues/issue_2472.rs index 3e3bc3a12..d989537ab 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2472.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2472.rs @@ -6,6 +6,7 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok("@function dark(\r\ @@ -31,11 +32,11 @@ fn test() { \n function2: dark2(#102030, 5%);\r\ \n}"), ".single {\ - \n direct: #0a131d;\ - \n arg: #0a131d;\ - \n call: #0a131d;\ - \n function: #0a131d;\ - \n function2: #0a131d;\ + \n direct: rgb(9.625, 19.25, 28.875);\ + \n arg: rgb(9.625, 19.25, 28.875);\ + \n call: rgb(9.625, 19.25, 28.875);\ + \n function: rgb(9.625, 19.25, 28.875);\ + \n function2: rgb(9.625, 19.25, 28.875);\ \n}\n" ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2509.rs b/rsass/tests/spec/libsass_closed_issues/issue_2509.rs index 0503c773c..43b9db627 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2509.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2509.rs @@ -6,10 +6,11 @@ fn runner() -> crate::TestRunner { } #[test] -#[ignore] // unexepected error +#[ignore] // wrong error fn test() { assert_eq!( - runner().ok("[charset i] {\r\ + runner().err( + "[charset i] {\r\ \n\tdisplay: block;\r\ \n}\r\ \n\r\ @@ -23,18 +24,13 @@ fn test() { \n\r\ \n[charset=\"utf-8\" I] {\r\ \n\tdisplay: block;\r\ - \n}"), - "[charset i] {\ - \n display: block;\ - \n}\ - \n[charset I] {\ - \n display: block;\ - \n}\ - \n[charset=\"utf-8\" i] {\ - \n display: block;\ - \n}\ - \n[charset=\"utf-8\" I] {\ - \n display: block;\ - \n}\n" + \n}" + ), + "Error: Expected \"]\".\ + \n ,\ + \n1 | [charset i] {\ + \n | ^\ + \n \'\ + \n input.scss 1:10 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2520.rs b/rsass/tests/spec/libsass_closed_issues/issue_2520.rs index 4f42dbaa3..da83d9fcd 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2520.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2520.rs @@ -10,27 +10,32 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "// ----\r\ + "@use \"sass:list\";\ + \n@use \"sass:map\";\ + \n@use \"sass:meta\";\ + \n@use \"sass:selector\";\ + \n@use \"sass:string\";\ + \n// ----\r\ \n// Sass (v3.4.21)\r\ \n// Compass (v1.0.3)\r\ \n// ----\r\ \n\r\ \n@function remove-modifiers($selector) {\r\ \n // convert selector to a string\r\ - \n $selector: inspect(nth($selector, 1));\r\ + \n $selector: meta.inspect(list.nth($selector, 1));\r\ \n \r\ \n $modifier: \'\';\r\ \n \r\ \n // Find out where the first modifier starts\r\ - \n $modifier-index: str-index($selector, \'\"--\');\r\ + \n $modifier-index: string.index($selector, \'\"--\');\r\ \n \r\ \n @if $modifier-index {\r\ \n // Strip the first part of the selector up until the first modifier\r\ - \n $modifier: str-slice($selector, $modifier-index);\r\ + \n $modifier: string.slice($selector, $modifier-index);\r\ \n // Find out where the modifier ends\r\ - \n $modifier-end: str-index($modifier, \'\"]\');\r\ + \n $modifier-end: string.index($modifier, \'\"]\');\r\ \n // Isolate the modifier\r\ - \n $modifier: str-slice($modifier, 0, $modifier-end);\r\ + \n $modifier: string.slice($modifier, 0, $modifier-end);\r\ \n // Remove the modifier from the selector\r\ \n $selector: str-replace($selector, $modifier, \'\');\r\ \n // Remove junk characters\r\ @@ -46,12 +51,12 @@ fn test() { \n $result: ();\r\ \n \r\ \n @each $item in $list {\r\ - \n @if not index($result, $item) {\r\ - \n @if length($item) > 1 and $recursive {\r\ - \n $result: append($result, remove-duplicates($item, $recursive));\r\ + \n @if not list.index($result, $item) {\r\ + \n @if list.length($item) > 1 and $recursive {\r\ + \n $result: list.append($result, remove-duplicates($item, $recursive));\r\ \n }\r\ \n @else {\r\ - \n $result: append($result, $item);\r\ + \n $result: list.append($result, $item);\r\ \n }\r\ \n }\r\ \n }\r\ @@ -60,11 +65,11 @@ fn test() { \n }\r\ \n \r\ \n @function str-replace($string, $search, $replace) { \r\ - \n $index: str-index($string, $search);\r\ + \n $index: string.index($string, $search);\r\ \n \r\ \n @if $index {\r\ - \n @return str-slice($string, 1, $index - 1) + $replace + str-replace(\r\ - \n str-slice($string, $index + str-length($search)), $search, $replace\r\ + \n @return string.slice($string, 1, $index - 1) + $replace + str-replace(\r\ + \n string.slice($string, $index + string.length($search)), $search, $replace\r\ \n );\r\ \n }\r\ \n \r\ @@ -86,7 +91,7 @@ fn test() { \n \r\ \n // Spoof our modules into a list\r\ \n $selectors: str-replace($selectors, \' \', \', \');\r\ - \n $selectors: selector-parse($selectors);\r\ + \n $selectors: selector.parse($selectors);\r\ \n \r\ \n @return $selectors;\r\ \n }\r\ @@ -94,11 +99,11 @@ fn test() { \n @function list-remove($list, $value, $recursive: false) { \r\ \n $result: ();\r\ \n \r\ - \n @for $i from 1 through length($list) {\r\ - \n @if type-of(nth($list, $i)) == list and $recursive {\r\ - \n $result: append($result, list-remove(nth($list, $i), $value, $recursive), comma);\r\ - \n } @else if nth($list, $i) != $value {\r\ - \n $result: append($result, nth($list, $i), comma);\r\ + \n @for $i from 1 through list.length($list) {\r\ + \n @if meta.type-of(list.nth($list, $i)) == list and $recursive {\r\ + \n $result: list.append($result, list-remove(list.nth($list, $i), $value, $recursive), comma);\r\ + \n } @else if list.nth($list, $i) != $value {\r\ + \n $result: list.append($result, list.nth($list, $i), comma);\r\ \n }\r\ \n }\r\ \n \r\ @@ -106,13 +111,13 @@ fn test() { \n }\r\ \n \r\ \n @function this($options...) {\r\ - \n $value: map-get($config, $options...);\r\ + \n $value: map.get($config, $options...);\r\ \n $debug: true;\r\ \n \r\ \n $this: &;\r\ \n \r\ - \n @if length($this) > 0 {\r\ - \n @if str-index(inspect(nth($this, 1)), \'%\') == 1 {\r\ + \n @if list.length($this) > 0 {\r\ + \n @if string.index(meta.inspect(list.nth($this, 1)), \'%\') == 1 {\r\ \n $debug: false;\r\ \n }\r\ \n }\r\ @@ -126,7 +131,7 @@ fn test() { \n \r\ \n @function config($map-old, $map-new) {\r\ \n // Merge default and custom options\r\ - \n $map-merged: map-merge($map-old, $map-new);\r\ + \n $map-merged: map.merge($map-old, $map-new);\r\ \n \r\ \n // Store config in global variable\r\ \n $config: $map-merged !global;\r\ @@ -145,8 +150,8 @@ fn test() { \n $selectors: ();\r\ \n \r\ \n @each $item in $module {\r\ - \n $selectors: join($selectors, \'.#{$module}\', comma);\r\ - \n $selectors: join($selectors, \'[class*=\"#{$module}--\"]\', comma);\r\ + \n $selectors: list.join($selectors, \'.#{$module}\', comma);\r\ + \n $selectors: list.join($selectors, \'[class*=\"#{$module}--\"]\', comma);\r\ \n }\r\ \n \r\ \n #{$selectors} {\r\ @@ -158,13 +163,13 @@ fn test() { \n $selectors: \'[class*=\"#{$module}#{$glue}\"]\';\r\ \n $this: &;\r\ \n $tree: module-tree($this);\r\ - \n $namespace: nth($tree, length($tree));\r\ + \n $namespace: list.nth($tree, list.length($tree));\r\ \n \r\ \n @if $components {\r\ \n $selectors: ();\r\ \n \r\ \n @each $component in $components {\r\ - \n $selectors: join(\r\ + \n $selectors: list.join(\r\ \n $selectors, \r\ \n \'.#{$namespace}#{$glue}#{$component}, [class*=\"#{$namespace}#{$glue}#{$component}-\"]\', \r\ \n comma\r\ @@ -176,29 +181,29 @@ fn test() { \n \r\ \n @each $selector in & {\r\ \n // spoof the selector into a list\r\ - \n $selector: str-replace(inspect($selector), \' \', \', \');\r\ - \n $selector: selector-parse($selector);\r\ + \n $selector: str-replace(meta.inspect($selector), \' \', \', \');\r\ + \n $selector: selector.parse($selector);\r\ \n \r\ \n // if the last item isn\'t a modifier, remove it\r\ - \n @if not str-index(inspect(nth($selector, length($selector))), \'[class*=\"--\') {\r\ - \n $selector: list-remove($selector, nth($selector, length($selector)));\r\ + \n @if not string.index(meta.inspect(list.nth($selector, list.length($selector))), \'[class*=\"--\') {\r\ + \n $selector: list-remove($selector, list.nth($selector, list.length($selector)));\r\ \n }\r\ \n \r\ \n // convert the selector back into a string\r\ - \n @if length($selector) == 1 {\r\ - \n $selector: nth($selector, 1);\r\ + \n @if list.length($selector) == 1 {\r\ + \n $selector: list.nth($selector, 1);\r\ \n }\r\ - \n $selector: str-replace(inspect($selector), \', \', \' \');\r\ + \n $selector: str-replace(meta.inspect($selector), \', \', \' \');\r\ \n \r\ \n // Re-build the parent selector\r\ - \n $parents: append($parents, $selector, comma);\r\ + \n $parents: list.append($parents, $selector, comma);\r\ \n }\r\ \n \r\ \n // remove duplicate selectors\r\ \n $parents: remove-duplicates($parents);\r\ \n \r\ - \n @if length($parents) == 1 {\r\ - \n $parents: nth($parents, 1);\r\ + \n @if list.length($parents) == 1 {\r\ + \n $parents: list.nth($parents, 1);\r\ \n }\r\ \n \r\ \n @if ($parents == \'()\') {\r\ @@ -218,12 +223,12 @@ fn test() { \n @mixin modifier($modifier) {\r\ \n $selectors: &;\r\ \n \r\ - \n @if str-index(inspect(&), \'.#{$module}\') {\r\ + \n @if string.index(meta.inspect(&), \'.#{$module}\') {\r\ \n $selectors: ();\r\ \n \r\ - \n @for $i from 1 through length(&) {\r\ + \n @for $i from 1 through list.length(&) {\r\ \n @if $i % 2 == 0 {\r\ - \n $selectors: append($selectors, nth(&, $i), comma);\r\ + \n $selectors: list.append($selectors, list.nth(&, $i), comma);\r\ \n }\r\ \n }\r\ \n }\r\ @@ -232,7 +237,7 @@ fn test() { \n $modifier-selectors: ();\r\ \n \r\ \n @each $item in $modifier {\r\ - \n $modifier-selectors: join(\r\ + \n $modifier-selectors: list.join(\r\ \n $modifier-selectors, \'&[class*=\"--#{$modifier}\"]\', comma\r\ \n );\r\ \n }\r\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2633.rs b/rsass/tests/spec/libsass_closed_issues/issue_2633.rs index 10df87490..d64a45d08 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2633.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2633.rs @@ -9,16 +9,17 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$sel1: \'.something__child + .something__child--mod1\';\ + "@use \"sass:selector\";\ + \n$sel1: \'.something__child + .something__child--mod1\';\ \n$sel2: \'.something__child ~ .something__child--mod2\';\ - \n$result1: selector-unify($sel1, $sel2);\n\ + \n$result1: selector.unify($sel1, $sel2);\n\ \n#{$result1} {\ \n /* nothing */\ \n}\n\ \n.a {\ \n color: blue;\ \n & > * {\ - \n @at-root #{selector-unify(&, \'.b\')} {\ + \n @at-root #{selector.unify(&, \'.b\')} {\ \n color: red;\ \n }\ \n }\ @@ -26,7 +27,7 @@ fn test() { \n.a, .b {\ \n color: blue;\ \n & > * {\ - \n @at-root #{selector-unify(&, \'.c, .d\')} {\ + \n @at-root #{selector.unify(&, \'.c, .d\')} {\ \n color: red;\ \n }\ \n }\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2640.rs b/rsass/tests/spec/libsass_closed_issues/issue_2640.rs index 95d603eeb..39a02cff7 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2640.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2640.rs @@ -8,12 +8,13 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok(".theme1, .theme2 {\ + runner().ok("@use \"sass:selector\";\ + \n.theme1, .theme2 {\ \n .something {\ \n /* nothing */\ \n }\ \n}\n\ - \n$sel: selector-nest(\'.theme1, .theme2\', \'.something\');\ + \n$sel: selector.nest(\'.theme1, .theme2\', \'.something\');\ \n \ \n#{$sel} {\ \n /* nothing */\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2779.rs b/rsass/tests/spec/libsass_closed_issues/issue_2779.rs index 82be4f0e3..f93e644da 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2779.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2779.rs @@ -8,7 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().err("@debug(selector-extend(\".a .b\", \"&b\", ndll));\n"), + runner().err( + "@use \"sass:selector\";\ + \n@debug(selector.extend(\".a .b\", \"&b\", ndll));\n" + ), "Error: $extendee: Parent selectors aren\'t allowed here.\ \n ,\ \n1 | &b\ @@ -16,9 +19,9 @@ fn test() { \n \'\ \n - 1:1 root stylesheet\ \n ,\ - \n1 | @debug(selector-extend(\".a .b\", \"&b\", ndll));\ + \n2 | @debug(selector.extend(\".a .b\", \"&b\", ndll));\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 1:8 root stylesheet", + \n input.scss 2:8 root stylesheet", ); } diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2808.rs b/rsass/tests/spec/libsass_closed_issues/issue_2808.rs index e11c3a3dd..5991ca3ae 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2808.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2808.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("test {\ - \n content: str-slice(abcdef, -10, 2)\ + runner().ok("@use \"sass:string\";\ + \ntest {\ + \n content: string.slice(abcdef, -10, 2)\ \n}\n"), "test {\ \n content: ab;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2863.rs b/rsass/tests/spec/libsass_closed_issues/issue_2863.rs index 93c764884..dfdc32fb2 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2863.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2863.rs @@ -8,15 +8,16 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$squoted: \"\'dquoted\'\";\ + runner().ok("@use \"sass:string\";\ + \n$squoted: \"\'dquoted\'\";\ \n$dquoted: \"\\\"squoted\\\"\";\n\ \ntest {\ - \n str-slice-single: str-slice( $squoted, 1, 2 );\ - \n str-slice-double: str-slice( $dquoted, 1, 2 );\ - \n str-index-single: str-index( $squoted, \"q\" );\ - \n str-index-double: str-index( $dquoted, \"q\" );\ - \n str-insert-single: str-insert( $squoted, \"p\", 2 );\ - \n str-insert-double: str-insert( $dquoted, \"p\", 2 );\ + \n str-slice-single: string.slice( $squoted, 1, 2 );\ + \n str-slice-double: string.slice( $dquoted, 1, 2 );\ + \n str-index-single: string.index( $squoted, \"q\" );\ + \n str-index-double: string.index( $dquoted, \"q\" );\ + \n str-insert-single: string.insert( $squoted, \"p\", 2 );\ + \n str-insert-double: string.insert( $dquoted, \"p\", 2 );\ \n}\n"), "test {\ \n str-slice-single: \"\'d\";\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_2980.rs b/rsass/tests/spec/libsass_closed_issues/issue_2980.rs index d44aee418..489690339 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_2980.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_2980.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$config: (\ + "@use \"sass:map\";\ + \n$config: (\ \n phone: (\ \n break-point-width:0px,\ \n break-point-name: xs\ @@ -28,8 +29,8 @@ fn test() { \n ),\ \n);\n\ \n@each $key, $map in $config {\ - \n $break-point-width: map_get($map, break-point-width);\ - \n $break-point-name: map_get($map, break-point-name);\ + \n $break-point-width: map.get($map, break-point-width);\ + \n $break-point-name: map.get($map, break-point-name);\ \n $infix: if($break-point-width == 0px, null, -$break-point-name);\ \n .foo#{$infix} {\ \n content: \'#{$break-point-name}\';\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_338.rs b/rsass/tests/spec/libsass_closed_issues/issue_338.rs index 3b3a45af8..16ec3c4f3 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_338.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_338.rs @@ -9,9 +9,10 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$list: (\"a\", \"b\");\n\ + "@use \"sass:list\";\ + \n$list: (\"a\", \"b\");\n\ \ntest {\ - \n content: if( length($list) > 2, nth($list, 3), nth($list, 1) );\ + \n content: if( list.length($list) > 2, list.nth($list, 3), list.nth($list, 1) );\ \n}\n" ), "test {\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_394.rs b/rsass/tests/spec/libsass_closed_issues/issue_394.rs index 834bce5a3..9bde28f98 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_394.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_394.rs @@ -8,11 +8,12 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$list1: alpha beta gamma;\ + runner().ok("@use \"sass:list\";\ + \n$list1: alpha beta gamma;\ \n$list2: one two three;\n\ \n$map: (alpha: one, beta: two, gamma: three);\n\ \n.ma-list {\ - \n @each $item1, $item2 in zip($list1, $list2) {\ + \n @each $item1, $item2 in list.zip($list1, $list2) {\ \n #{$item1}: $item2;\ \n }\ \n}\n\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_435.rs b/rsass/tests/spec/libsass_closed_issues/issue_435.rs index b157929ea..e952843a5 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_435.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_435.rs @@ -9,13 +9,14 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$skin-name: \"CMS_Black\";\r\ + "@use \"sass:string\";\ + \n$skin-name: \"CMS_Black\";\r\ \n\r\ - \n$QUOTE: unquote(\'\"\');\r\ - \n$EMPTY_STRING: unquote( \"\" );\r\ - \n$SLASH: unquote(\"/\");\r\ + \n$QUOTE: string.unquote(\'\"\');\r\ + \n$EMPTY_STRING: string.unquote( \"\" );\r\ + \n$SLASH: string.unquote(\"/\");\r\ \n\r\ - \n$SKINS_PATH: unquote(\"/CMS/Skins\");\r\ + \n$SKINS_PATH: string.unquote(\"/CMS/Skins\");\r\ \n$URL_SEPARATOR: $SLASH;\r\ \n$URL_PREFIX: $EMPTY_STRING;\r\ \n$URL_SUFFIX: $EMPTY_STRING;\r\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_439.rs b/rsass/tests/spec/libsass_closed_issues/issue_439.rs index a690be8cb..a626a976a 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_439.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_439.rs @@ -9,9 +9,10 @@ fn runner() -> crate::TestRunner { #[ignore] // unexepected error fn test() { assert_eq!( - runner().ok("@mixin odd( $selector, $n) {\ + runner().ok("@use \"sass:string\";\ + \n@mixin odd( $selector, $n) {\ \n $selector: \"& + \" + $selector + \" + \" + $selector;\ - \n $placeholder: unique_id();\ + \n $placeholder: string.unique_id();\ \n %#{$placeholder} { @content; }\ \n #{$selector}:first-child {\ \n #{$selector} { @extend %#{$placeholder}; }\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_506.rs b/rsass/tests/spec/libsass_closed_issues/issue_506.rs index ce6b48bdb..9f367e43a 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_506.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_506.rs @@ -8,13 +8,14 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$list: foo bar baz;\ + runner().ok("@use \"sass:list\";\ + \n$list: foo bar baz;\ \n$list--comma: foo, bar, baz;\ \n$single: foo;\n\ \ndiv {\ - \n _list-space: list-separator($list);\ - \n _list-comma: list-separator($list--comma);\ - \n _single-item: list-separator($single);\ + \n _list-space: list.separator($list);\ + \n _list-comma: list.separator($list--comma);\ + \n _single-item: list.separator($single);\ \n}"), "div {\ \n _list-space: space;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_509.rs b/rsass/tests/spec/libsass_closed_issues/issue_509.rs index d3dbf55ca..2cfae7eb3 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_509.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_509.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$foo: (\ + "@use \"sass:map\";\ + \n$foo: (\ \n (key1): (value-1-0),\ \n key2: value-2-0,\ \n (key6): (value-6-0),\ @@ -20,13 +21,13 @@ fn test() { \n (key-8-0, key-8-1, key-8-2): (value-8-0, value-8-1, value-8-2),\ \n);\n\ \ndiv {\ - \n foo: map-get((foo: 1, bar: 2), foo);\ - \n foo: map-get((foo: 1, bar: 2), bar);\ - \n foo: map-get((foo: 1, bar: 2), baz);\ - \n foo: map-get((), foo);\ - \n foo: map-get($foo, (key-5-0: value-5-1));\ - \n foo: map-get($foo, (key2));\ - \n foo: map-get($foo, (key-3-0 key-3-1 key-3-2));\ + \n foo: map.get((foo: 1, bar: 2), foo);\ + \n foo: map.get((foo: 1, bar: 2), bar);\ + \n foo: map.get((foo: 1, bar: 2), baz);\ + \n foo: map.get((), foo);\ + \n foo: map.get($foo, (key-5-0: value-5-1));\ + \n foo: map.get($foo, (key2));\ + \n foo: map.get($foo, (key-3-0 key-3-1 key-3-2));\ \n}\n" ), "div {\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_510.rs b/rsass/tests/spec/libsass_closed_issues/issue_510.rs index a7bc37e92..49cbf28a2 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_510.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_510.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$before: map-remove((foo: 1, bar: 2, baz: 3, burp: 4), bar, baz);\ + "@use \"sass:map\";\ + \n$before: map.remove((foo: 1, bar: 2, baz: 3, burp: 4), bar, baz);\ \n$after: (foo: 1, burp: 4);\n\ \ndiv {\ \n foo: $before == $after;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_512.rs b/rsass/tests/spec/libsass_closed_issues/issue_512.rs index 168f51399..17681bbd6 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_512.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_512.rs @@ -8,10 +8,12 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$list: a b c;\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n$list: a b c;\ \n.css {\ - \n debug: index($list, a);\n\ - \n @if type-of(index($list, 2)) == \"null\" {\ + \n debug: list.index($list, a);\n\ + \n @if meta.type-of(list.index($list, 2)) == \"null\" {\ \n debug: foo;\ \n }\ \n}\n"), diff --git a/rsass/tests/spec/libsass_closed_issues/issue_534.rs b/rsass/tests/spec/libsass_closed_issues/issue_534.rs index 1000cb7aa..a6047f82d 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_534.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_534.rs @@ -8,15 +8,16 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$foo: (\ + runner().ok("@use \"sass:map\";\ + \n$foo: (\ \n 1: foo1 bar1,\ \n 10: foo2 bar2,\ \n 100: foo3 bar3,\ \n);\n\ \ndiv {\ - \n foo: map-get($foo, 1);\ - \n foo: map-get($foo, 10);\ - \n foo: map-get($foo, 100);\ + \n foo: map.get($foo, 1);\ + \n foo: map.get($foo, 10);\ + \n foo: map.get($foo, 100);\ \n}\n"), "div {\ \n foo: foo1 bar1;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_54.rs b/rsass/tests/spec/libsass_closed_issues/issue_54.rs deleted file mode 100644 index 60814fe2a..000000000 --- a/rsass/tests/spec/libsass_closed_issues/issue_54.rs +++ /dev/null @@ -1,56 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_54.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("issue_54") -} - -#[test] -#[ignore] // wrong result -fn test() { - assert_eq!( - runner().ok("@mixin opacity($percent) {\r\ - \n foo { test: opacity($percent); }\r\ - \n}\r\ - \n\r\ - \n@-webkit-keyframes uiDelayedFadeIn {\r\ - \n 0% { @include opacity(0.01); }\r\ - \n 50% { @include opacity(0.01); }\r\ - \n 100% { @include opacity(1); }\r\ - \n}\r\ - \n\r\ - \n@-webkit-keyframes bounce {\r\ - \n from {\r\ - \n left: 0px;\r\ - \n }\r\ - \n to {\r\ - \n left: 200px;\r\ - \n }\r\ - \n}\r\n"), - "@-webkit-keyframes uiDelayedFadeIn {\ - \n 0% {\ - \n foo {\ - \n test: opacity(0.01);\ - \n }\ - \n }\ - \n 50% {\ - \n foo {\ - \n test: opacity(0.01);\ - \n }\ - \n }\ - \n 100% {\ - \n foo {\ - \n test: opacity(1);\ - \n }\ - \n }\ - \n}\ - \n@-webkit-keyframes bounce {\ - \n from {\ - \n left: 0px;\ - \n }\ - \n to {\ - \n left: 200px;\ - \n }\ - \n}\n" - ); -} diff --git a/rsass/tests/spec/libsass_closed_issues/issue_555.rs b/rsass/tests/spec/libsass_closed_issues/issue_555.rs index 196ff2718..e06b91b17 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_555.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_555.rs @@ -9,7 +9,7 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("\ + runner().ok("@use \"sass:map\";\n\ \n@function hello($name) {\ \n @return $name;\ \n}\n\ @@ -19,10 +19,10 @@ fn test() { \n hello(\"bob\") : bam,\ \n);\n\ \na {\ - \n foo: map-get($foo, \"bar()\");\ - \n foo: map-get($foo, \"bar(\\\"foo\\\")\");\ - \n foo: map-get($foo, \'bar(\"foo\")\');\ - \n foo: map-get($foo, \"bob\");\ + \n foo: map.get($foo, \"bar()\");\ + \n foo: map.get($foo, \"bar(\\\"foo\\\")\");\ + \n foo: map.get($foo, \'bar(\"foo\")\');\ + \n foo: map.get($foo, \"bob\");\ \n}\n"), "a {\ \n foo: baz;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_557.rs b/rsass/tests/spec/libsass_closed_issues/issue_557.rs index b0f9f6ecb..fac5c196e 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_557.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_557.rs @@ -8,9 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("\ + runner().ok("@use \"sass:map\";\n\ \na {\ - \n foo: map-get((foo: 1, bar: 2), \"bar\");\ + \n foo: map.get((foo: 1, bar: 2), \"bar\");\ \n}\n"), "a {\ \n foo: 2;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_574.rs b/rsass/tests/spec/libsass_closed_issues/issue_574.rs index a3a898556..ddc424d70 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_574.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_574.rs @@ -8,13 +8,14 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$flow: left;\n\ + runner().ok("@use \"sass:map\";\ + \n$flow: left;\n\ \n$map: (\ \n margin-#{$flow}: 3em,\ \n foo: bar,\ \n);\n\ \n.test {\ - \n margin-left: map-get($map, margin-left);\ + \n margin-left: map.get($map, margin-left);\ \n}\n"), ".test {\ \n margin-left: 3em;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_577.rs b/rsass/tests/spec/libsass_closed_issues/issue_577.rs index da4a8674c..287cd98b5 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_577.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_577.rs @@ -8,10 +8,11 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function map-each($map) {\ + runner().ok("@use \"sass:list\";\ + \n@function map-each($map) {\ \n $values: ();\n\ \n @each $key, $value in $map {\ - \n $values: append($values, $value);\ + \n $values: list.append($values, $value);\ \n }\n\ \n @return $values;\ \n}\n\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_578.rs b/rsass/tests/spec/libsass_closed_issues/issue_578.rs index e0404f3ca..97c47b063 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_578.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_578.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$list: one foo three bar six seven;\ - \n$pos: set-nth($list, 2, two);\ - \n$neg: set-nth($pos, -3, four five);\n\ + runner().ok("@use \"sass:list\";\ + \n$list: one foo three bar six seven;\ + \n$pos: list.set-nth($list, 2, two);\ + \n$neg: list.set-nth($pos, -3, four five);\n\ \n.test {\ \n -positive: $pos;\ \n -negative: $neg;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_643.rs b/rsass/tests/spec/libsass_closed_issues/issue_643.rs index e362dea9c..5e7c16fe8 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_643.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_643.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$map: (foo: bar, bar: baz);\n\ + runner().ok("@use \"sass:list\";\ + \n$map: (foo: bar, bar: baz);\n\ \nfoo {\ - \n a: nth($map, 2);\ + \n a: list.nth($map, 2);\ \n}\n"), "foo {\ \n a: bar baz;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_652.rs b/rsass/tests/spec/libsass_closed_issues/issue_652.rs index 280612917..f0b1d10c4 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_652.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_652.rs @@ -8,15 +8,16 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$map: (\ + runner().ok("@use \"sass:map\";\ + \n$map: (\ \n purple: foo,\ \n rgba(1,2,3,1): bar,\ \n #ffffff: baz,\ \n);\n\ \na {\ - \n name: map-get($map, purple) == foo;\ - \n func: map-get($map, rgba(1,2,3,1)) == bar;\ - \n hex: map-get($map, #ffffff) == baz;\ + \n name: map.get($map, purple) == foo;\ + \n func: map.get($map, rgba(1,2,3,1)) == bar;\ + \n hex: map.get($map, #ffffff) == baz;\ \n}\n"), "a {\ \n name: true;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_672.rs b/rsass/tests/spec/libsass_closed_issues/issue_672.rs index c60182f57..b88721808 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_672.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_672.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@mixin test($arglist...) {\ - \n $map: keywords($arglist);\ + runner().ok("@use \"sass:meta\";\ + \n@mixin test($arglist...) {\ + \n $map: meta.keywords($arglist);\ \n answer: if($map, \"Yep\", \"Nope\");\ \n}\n\ \nwith-keyword-args{\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_698.rs b/rsass/tests/spec/libsass_closed_issues/issue_698.rs deleted file mode 100644 index 2ba328b3a..000000000 --- a/rsass/tests/spec/libsass_closed_issues/issue_698.rs +++ /dev/null @@ -1,21 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_698.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("issue_698") -} - -#[test] -#[ignore] // missing error -fn test() { - assert_eq!( - runner().err( - "test {\ - \n test: foo + null;\ - \n}\n" - ), - "Error: Invalid null operation: \"\"foo\" plus null\".\ - \n on line 2 of input.scss\ - \n Use --trace for backtrace.", - ); -} diff --git a/rsass/tests/spec/libsass_closed_issues/issue_699.rs b/rsass/tests/spec/libsass_closed_issues/issue_699.rs index d7f6f4d40..a1f243004 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_699.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_699.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok(".selector {\ - \n color: invert(rebeccapurple);\ + runner().ok("@use \"sass:color\";\ + \n.selector {\ + \n color: color.invert(rebeccapurple);\ \n}"), ".selector {\ \n color: #99cc66;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_700.rs b/rsass/tests/spec/libsass_closed_issues/issue_700.rs index e4a881e78..811769fc8 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_700.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_700.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok(".selector {\ - \n color: invert(transparent);\ + runner().ok("@use \"sass:color\";\ + \n.selector {\ + \n color: color.invert(transparent);\ \n}"), ".selector {\ \n color: rgba(255, 255, 255, 0);\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_701.rs b/rsass/tests/spec/libsass_closed_issues/issue_701.rs index 6a279f408..29c9f53a0 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_701.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_701.rs @@ -8,19 +8,20 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok(".test-1 {\ + runner().ok("@use \"sass:meta\";\n\ + \n.test-1 {\ \n content: null;\ - \n content: inspect(null);\ - \n content: inspect(false);\ - \n content: inspect(true);\ - \n content: inspect(42);\ - \n content: inspect(42.3);\ - \n content: inspect(42px);\ - \n content: inspect(\"string\");\ + \n content: meta.inspect(null);\ + \n content: meta.inspect(false);\ + \n content: meta.inspect(true);\ + \n content: meta.inspect(42);\ + \n content: meta.inspect(42.3);\ + \n content: meta.inspect(42px);\ + \n content: meta.inspect(\"string\");\ \n $list: 1, 2, 3;\ - \n content: inspect($list);\ + \n content: meta.inspect($list);\ \n $map: ( a: 1, b: 2, c: 3 );\ - \n content: inspect($map);\ + \n content: meta.inspect($map);\ \n}\n"), ".test-1 {\ \n content: null;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_702.rs b/rsass/tests/spec/libsass_closed_issues/issue_702.rs index 1a4ea91da..f4160bc06 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_702.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_702.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok(".foo {\ - \n content: function-exists(\"feature-exists\");\ - \n content: feature-exists(\"foo\");\ + runner().ok("@use \"sass:meta\";\ + \n.foo {\ + \n content: meta.function-exists(\"feature-exists\");\ + \n content: meta.feature-exists(\"foo\");\ \n}\n"), ".foo {\ \n content: true;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_760.rs b/rsass/tests/spec/libsass_closed_issues/issue_760.rs index 08138966c..b3fe212e4 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_760.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_760.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("foo {\ - \n quoted: str-slice(\"abcd\", 1, 0);\ - \n unquoted: str-slice(abcd, 1, 0);\ + runner().ok("@use \"sass:string\";\ + \nfoo {\ + \n quoted: string.slice(\"abcd\", 1, 0);\ + \n unquoted: string.slice(abcd, 1, 0);\ \n}\n"), "foo {\ \n quoted: \"\";\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_763.rs b/rsass/tests/spec/libsass_closed_issues/issue_763.rs index ccf3a708d..e9267f3ac 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_763.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_763.rs @@ -8,14 +8,15 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("foo {\ - \n a: str-slice(\"abcd\", 1, 1);\ - \n b: str-slice(\'abcd\', 1, 1);\ - \n c: str-slice(abcd, 1, 1);\n\ - \n d: str-insert(\"abcd\", \"X\", 1);\ - \n e: str-insert(\"abcd\", \'X\', 1);\ - \n f: str-insert(\'abcd\', \"X\", 1);\ - \n g: str-insert(\'abcd\', \'X\', 1);\ + runner().ok("@use \"sass:string\";\ + \nfoo {\ + \n a: string.slice(\"abcd\", 1, 1);\ + \n b: string.slice(\'abcd\', 1, 1);\ + \n c: string.slice(abcd, 1, 1);\n\ + \n d: string.insert(\"abcd\", \"X\", 1);\ + \n e: string.insert(\"abcd\", \'X\', 1);\ + \n f: string.insert(\'abcd\', \"X\", 1);\ + \n g: string.insert(\'abcd\', \'X\', 1);\ \n}\n"), "foo {\ \n a: \"a\";\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_815.rs b/rsass/tests/spec/libsass_closed_issues/issue_815.rs index d1a7a183a..9c012b048 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_815.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_815.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("foo {\ - \n foo: str-slice(\"bar\", 1, 2);\ - \n bar: str-slice(\"bar\", 3);\ + runner().ok("@use \"sass:string\";\ + \nfoo {\ + \n foo: string.slice(\"bar\", 1, 2);\ + \n bar: string.slice(\"bar\", 3);\ \n}\n"), "foo {\ \n foo: \"ba\";\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_857.rs b/rsass/tests/spec/libsass_closed_issues/issue_857.rs index 4537526f6..1c28d5f3c 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_857.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_857.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$list: \"item-1\" \"item-2\" \"item-3\";\n\ + runner().ok("@use \"sass:list\";\ + \n$list: \"item-1\" \"item-2\" \"item-3\";\n\ \n#hello {\ - \n @if length($list) % 2 == 0 {\ + \n @if list.length($list) % 2 == 0 {\ \n color: blue;\ \n }\n\ \n @else {\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_86.rs b/rsass/tests/spec/libsass_closed_issues/issue_86.rs index bc5dcaec5..d875f0401 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_86.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_86.rs @@ -8,15 +8,20 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok(".color-functions {\r\ + runner().ok( + "@use \"sass:color\";\ + \n@use \"sass:math\";\ + \n@use \"sass:meta\";\ + \n.color-functions {\r\ \n $color: red;\r\ - \n hue: hue($color);\r\ - \n hue-type: type-of(hue($color));\r\ - \n hue-unit: unit(hue($color));\r\ - \n hue-comparable: comparable(hue($color), hue($color));\r\ - \n\ttest-1: comparable(lightness(red), 1%);\r\ - \n\ttest-2: comparable(saturation(red), 1%);\r\ - \n}"), + \n hue: color.hue($color);\r\ + \n hue-type: meta.type-of(color.hue($color));\r\ + \n hue-unit: math.unit(color.hue($color));\r\ + \n hue-comparable: math.compatible(color.hue($color), color.hue($color));\r\ + \n\ttest-1: math.compatible(color.lightness(red), 1%);\r\ + \n\ttest-2: math.compatible(color.saturation(red), 1%);\r\ + \n}" + ), ".color-functions {\ \n hue: 0deg;\ \n hue-type: number;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_864.rs b/rsass/tests/spec/libsass_closed_issues/issue_864.rs index 84da4329c..6e5878414 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_864.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_864.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("div { color: desaturate(#999, 50%); }"), + runner().ok("@use \"sass:color\";\ + \ndiv { color: color.adjust(#999, $saturation: -50%); }"), "div {\ \n color: #999999;\ \n}\n" diff --git a/rsass/tests/spec/libsass_closed_issues/issue_877.rs b/rsass/tests/spec/libsass_closed_issues/issue_877.rs index 4914a98d7..0ea979a82 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_877.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_877.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function _test1() {\ + runner().ok("@use \"sass:meta\";\ + \n@function _test1() {\ \n @return \'hello\';\ \n}\n\ \n@function -test2() {\ @@ -30,34 +31,34 @@ fn test() { \n$_test2: true;\ \n$test: true;\n\ \n.test {\ - \n function: function-exists(\'_test1\');\ - \n function: function-exists(\'-test1\');\ - \n function: function-exists(\'_test2\');\ - \n function: function-exists(\'-test2\');\ - \n function: function-exists(\'test1\');\ - \n function: function-exists(\'test2\');\ - \n function: function-exists(\'test\');\ - \n mixin: mixin-exists(\'_test1\');\ - \n mixin: mixin-exists(\'-test1\');\ - \n mixin: mixin-exists(\'_test2\');\ - \n mixin: mixin-exists(\'-test2\');\ - \n mixin: mixin-exists(\'test1\');\ - \n mixin: mixin-exists(\'test2\');\ - \n mixin: mixin-exists(\'test\');\ - \n variable: variable-exists(\'_test1\');\ - \n variable: variable-exists(\'-test1\');\ - \n variable: variable-exists(\'_test2\');\ - \n variable: variable-exists(\'-test2\');\ - \n variable: variable-exists(\'test1\');\ - \n variable: variable-exists(\'test2\');\ - \n variable: variable-exists(\'test\');\ - \n global-variable: global-variable-exists(\'_test1\');\ - \n global-variable: global-variable-exists(\'-test1\');\ - \n global-variable: global-variable-exists(\'_test2\');\ - \n global-variable: global-variable-exists(\'-test2\');\ - \n global-variable: global-variable-exists(\'test1\');\ - \n global-variable: global-variable-exists(\'test2\');\ - \n global-variable: global-variable-exists(\'test\');\ + \n function: meta.function-exists(\'_test1\');\ + \n function: meta.function-exists(\'-test1\');\ + \n function: meta.function-exists(\'_test2\');\ + \n function: meta.function-exists(\'-test2\');\ + \n function: meta.function-exists(\'test1\');\ + \n function: meta.function-exists(\'test2\');\ + \n function: meta.function-exists(\'test\');\ + \n mixin: meta.mixin-exists(\'_test1\');\ + \n mixin: meta.mixin-exists(\'-test1\');\ + \n mixin: meta.mixin-exists(\'_test2\');\ + \n mixin: meta.mixin-exists(\'-test2\');\ + \n mixin: meta.mixin-exists(\'test1\');\ + \n mixin: meta.mixin-exists(\'test2\');\ + \n mixin: meta.mixin-exists(\'test\');\ + \n variable: meta.variable-exists(\'_test1\');\ + \n variable: meta.variable-exists(\'-test1\');\ + \n variable: meta.variable-exists(\'_test2\');\ + \n variable: meta.variable-exists(\'-test2\');\ + \n variable: meta.variable-exists(\'test1\');\ + \n variable: meta.variable-exists(\'test2\');\ + \n variable: meta.variable-exists(\'test\');\ + \n global-variable: meta.global-variable-exists(\'_test1\');\ + \n global-variable: meta.global-variable-exists(\'-test1\');\ + \n global-variable: meta.global-variable-exists(\'_test2\');\ + \n global-variable: meta.global-variable-exists(\'-test2\');\ + \n global-variable: meta.global-variable-exists(\'test1\');\ + \n global-variable: meta.global-variable-exists(\'test2\');\ + \n global-variable: meta.global-variable-exists(\'test\');\ \n}\n"), ".test {\ \n function: true;\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_950.rs b/rsass/tests/spec/libsass_closed_issues/issue_950.rs deleted file mode 100644 index 873a2cd4d..000000000 --- a/rsass/tests/spec/libsass_closed_issues/issue_950.rs +++ /dev/null @@ -1,22 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_950.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("issue_950") -} - -#[test] -#[ignore] // unexepected error -fn test() { - assert_eq!( - runner().ok(".selector1{ foo: bar; }\ - \n.selector2{ zapf: dings; }\n\ - \n.selector3{ @extend .selector1, .selector2; }"), - ".selector1, .selector3 {\ - \n foo: bar;\ - \n}\ - \n.selector2, .selector3 {\ - \n zapf: dings;\ - \n}\n" - ); -} diff --git a/rsass/tests/spec/libsass_closed_issues/issue_980.rs b/rsass/tests/spec/libsass_closed_issues/issue_980.rs index cc043f282..32d8e9841 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_980.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_980.rs @@ -8,10 +8,11 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function foo($value, $default: 13, $args...) {\ + runner().ok("@use \"sass:list\";\ + \n@function foo($value, $default: 13, $args...) {\ \n $res: $value + $default;\ - \n @if length($args) != 0 {\ - \n $res: $res + nth($args, 1);\ + \n @if list.length($args) != 0 {\ + \n $res: $res + list.nth($args, 1);\ \n }\ \n @return $res;\ \n}\n\ diff --git a/rsass/tests/spec/libsass_closed_issues/issue_988.rs b/rsass/tests/spec/libsass_closed_issues/issue_988.rs index 62bea25f1..cfaaa0226 100644 --- a/rsass/tests/spec/libsass_closed_issues/issue_988.rs +++ b/rsass/tests/spec/libsass_closed_issues/issue_988.rs @@ -9,11 +9,12 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "@function str-replace($string, $search, $replace: \'\') {\ - \n $index: str-index($string, $search);\ + "@use \"sass:string\";\ + \n@function str-replace($string, $search, $replace: \'\') {\ + \n $index: string.index($string, $search);\ \n @if $index {\ - \n @return str-slice($string, 1, $index - 1) + $replace +\ - \n str-replace(str-slice($string, $index + str-length($search)), $search, $replace);\ + \n @return string.slice($string, 1, $index - 1) + $replace +\ + \n str-replace(string.slice($string, $index + string.length($search)), $search, $replace);\ \n }\ \n @return $string;\ \n}\n\ diff --git a/rsass/tests/spec/libsass_closed_issues/mod.rs b/rsass/tests/spec/libsass_closed_issues/mod.rs index 67dbfc3c8..90efa63d1 100644 --- a/rsass/tests/spec/libsass_closed_issues/mod.rs +++ b/rsass/tests/spec/libsass_closed_issues/mod.rs @@ -141,8 +141,6 @@ mod issue_1255; mod issue_1257; -mod issue_1258; - mod issue_1259; mod issue_1260; @@ -167,8 +165,6 @@ mod issue_1283; mod issue_1285; -mod issue_1291; - mod issue_1294; mod issue_1295; @@ -785,8 +781,6 @@ mod issue_534; mod issue_535; -mod issue_54; - mod issue_548; mod issue_549; @@ -883,8 +877,6 @@ mod issue_690; mod issue_694; -mod issue_698; - mod issue_699; mod issue_700; @@ -991,8 +983,6 @@ mod issue_945; mod issue_948; -mod issue_950; - mod issue_976; mod issue_978; diff --git a/rsass/tests/spec/libsass_todo_issues/issue_2818.rs b/rsass/tests/spec/libsass_todo_issues/issue_2818.rs index abbf8c1b2..7e1ff404c 100644 --- a/rsass/tests/spec/libsass_todo_issues/issue_2818.rs +++ b/rsass/tests/spec/libsass_todo_issues/issue_2818.rs @@ -6,13 +6,18 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( - runner().ok("$map: (\"lightness\": 10%, \"saturation\": 10%);\ - \n$base: call(get-function(\'scale-color\'), #dedede, $map...);\ - \ntest { color: $base; }\n"), + runner().ok( + "@use \"sass:color\";\ + \n@use \"sass:meta\";\ + \n$map: (\"lightness\": 10%, \"saturation\": 10%);\ + \n$base: meta.call(meta.get-function(\'scale\', $module: \'color\'), #dedede, $map...);\ + \ntest { color: $base; }\n" + ), "test {\ - \n color: #e4dede;\ + \n color: rgb(228.27, 222.33, 222.33);\ \n}\n" ); } diff --git a/rsass/tests/spec/main.rs b/rsass/tests/spec/main.rs index 3dee598e2..be3e85475 100644 --- a/rsass/tests/spec/main.rs +++ b/rsass/tests/spec/main.rs @@ -1,5 +1,5 @@ //! Tests auto-converted from "sass-spec/spec" -//! version dd934e0ec, 2024-05-16 15:04:08 -0700. +//! version 5d5758002, 2024-09-13 22:36:41 +0000. //! See for source material.\n //! The following tests are excluded from conversion: //! ["directives/extend", "libsass-todo-issues/issue_221260.hrx", "libsass-todo-issues/issue_221262.hrx", "libsass-todo-issues/issue_221264.hrx", "libsass-todo-issues/issue_221292.hrx", "libsass/unicode-bom/utf-16-big", "libsass/unicode-bom/utf-16-little", "non_conformant/scss/huge.hrx", "non_conformant/scss/multiline-var.hrx"] diff --git a/rsass/tests/spec/non_conformant/basic/t22_colors_with_alpha.rs b/rsass/tests/spec/non_conformant/basic/t22_colors_with_alpha.rs index 94988fcfe..b91589fa1 100644 --- a/rsass/tests/spec/non_conformant/basic/t22_colors_with_alpha.rs +++ b/rsass/tests/spec/non_conformant/basic/t22_colors_with_alpha.rs @@ -6,9 +6,11 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( - runner().ok("$x: rgb(0, 255, 255);\n\ + runner().ok("@use \"sass:color\";\ + \n$x: rgb(0, 255, 255);\n\ \ndiv {\ \n color: rgb(255, $blue: 0, $green: 255);\ \n background: rgb(123, 45, 6);\ @@ -21,13 +23,13 @@ fn test() { \n \ \n $x: rgb(123, 45, 6);\ \n \ - \n hoo: red($x);\ - \n moo: green($x);\ - \n poo: blue($x);\ + \n hoo: color.red($x);\ + \n moo: color.green($x);\ + \n poo: color.blue($x);\ \n \ - \n goo: mix(rgba(255, 0, 0, 0.5), #00f);\ + \n goo: color.mix(rgba(255, 0, 0, 0.5), #00f);\ \n \ - \n boo: invert(#123456);\ + \n boo: color.invert(#123456);\ \n}\n"), "div {\ \n color: rgb(255, 255, 0);\ @@ -40,7 +42,7 @@ fn test() { \n hoo: 123;\ \n moo: 45;\ \n poo: 6;\ - \n goo: rgba(64, 0, 191, 0.75);\ + \n goo: rgba(63.75, 0, 191.25, 0.75);\ \n boo: #edcba9;\ \n}\n" ); diff --git a/rsass/tests/spec/non_conformant/basic/t23_basic_value_interpolation.rs b/rsass/tests/spec/non_conformant/basic/t23_basic_value_interpolation.rs index 8eb8b7c2b..6e33e8553 100644 --- a/rsass/tests/spec/non_conformant/basic/t23_basic_value_interpolation.rs +++ b/rsass/tests/spec/non_conformant/basic/t23_basic_value_interpolation.rs @@ -8,13 +8,14 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("div {\ + runner().ok("@use \"sass:meta\";\ + \ndiv {\ \n a: hello#{world};\ \n a: hello #{world};\ \n b: 12#{3};\ - \n b: type-of(12#{3});\ + \n b: meta.type-of(12#{3});\ \n b: #{12 + 111};\ - \n b: type-of(#{12 + 111});\ + \n b: meta.type-of(#{12 + 111});\ \n}"), "div {\ \n a: helloworld;\ diff --git a/rsass/tests/spec/non_conformant/basic/t24_namespace_properties.rs b/rsass/tests/spec/non_conformant/basic/t24_namespace_properties.rs index afb44c8a3..1ab0bb54e 100644 --- a/rsass/tests/spec/non_conformant/basic/t24_namespace_properties.rs +++ b/rsass/tests/spec/non_conformant/basic/t24_namespace_properties.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("div {\ + runner().ok("@use \"sass:meta\";\ + \ndiv {\ \n a: {\ \n p1: q;\ \n b: {\ @@ -20,7 +21,7 @@ fn test() { \nfoo {\ \n bar: baz {\ \n bip: bop;\ - \n bing: type-of(\"hello\");\ + \n bing: meta.type-of(\"hello\");\ \n bang: 1 + 2;\ \n bung: bap;\ \n bong: bup {\ diff --git a/rsass/tests/spec/non_conformant/basic/t25_basic_string_interpolation.rs b/rsass/tests/spec/non_conformant/basic/t25_basic_string_interpolation.rs index cae4ca02a..aea71364a 100644 --- a/rsass/tests/spec/non_conformant/basic/t25_basic_string_interpolation.rs +++ b/rsass/tests/spec/non_conformant/basic/t25_basic_string_interpolation.rs @@ -9,8 +9,9 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "div {\ - \n blah: \"hello #{2+2} world #{unit(23px)} #{\'bloo\\n\'} blah\";\ + "@use \"sass:math\";\ + \ndiv {\ + \n blah: \"hello #{2+2} world #{math.unit(23px)} #{\'bloo\\n\'} blah\";\ \n}" ), "div {\ diff --git a/rsass/tests/spec/non_conformant/basic/t26_selector_interpolation.rs b/rsass/tests/spec/non_conformant/basic/t26_selector_interpolation.rs index 5f2dc564d..b51ad40a1 100644 --- a/rsass/tests/spec/non_conformant/basic/t26_selector_interpolation.rs +++ b/rsass/tests/spec/non_conformant/basic/t26_selector_interpolation.rs @@ -9,13 +9,14 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$x: oo, ba;\ + "@use \"sass:list\";\ + \n$x: oo, ba;\ \n$y: az, hu;\n\ \nf#{$x}r {\ \n p: 1;\ \n b#{$y}x {\ \n q: 2;\ - \n mumble#{length($x) + length($y)} {\ + \n mumble#{list.length($x) + list.length($y)} {\ \n r: 3;\ \n }\ \n }\ diff --git a/rsass/tests/spec/non_conformant/basic/t29_if.rs b/rsass/tests/spec/non_conformant/basic/t29_if.rs index 5c29aaf68..26c131e5c 100644 --- a/rsass/tests/spec/non_conformant/basic/t29_if.rs +++ b/rsass/tests/spec/non_conformant/basic/t29_if.rs @@ -8,28 +8,30 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$x: a, b, 1+2;\n\ - \n@if type-of(nth($x, 3)) == number {\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n$x: a, b, 1+2;\n\ + \n@if meta.type-of(list.nth($x, 3)) == number {\ \n div {\ \n background: gray;\ \n }\ \n}\n\ - \n@if type-of(nth($x, 2)) == number {\ + \n@if meta.type-of(list.nth($x, 2)) == number {\ \n div {\ \n background: gray;\ \n }\ \n}\ - \n@else if type-of(nth($x, 2)) == string {\ + \n@else if meta.type-of(list.nth($x, 2)) == string {\ \n div {\ \n background: blue;\ \n }\ \n}\n\ - \n@if type-of(nth($x, 2)) == number {\ + \n@if meta.type-of(list.nth($x, 2)) == number {\ \n div {\ \n background: gray;\ \n }\ \n}\ - \n@else if type-of(nth($x, 2)) == color {\ + \n@else if meta.type-of(list.nth($x, 2)) == color {\ \n div {\ \n background: blue;\ \n }\ diff --git a/rsass/tests/spec/non_conformant/basic/t33_ambiguous_imports.rs b/rsass/tests/spec/non_conformant/basic/t33_ambiguous_imports.rs index 8fedd023c..6e0d1e1c9 100644 --- a/rsass/tests/spec/non_conformant/basic/t33_ambiguous_imports.rs +++ b/rsass/tests/spec/non_conformant/basic/t33_ambiguous_imports.rs @@ -5,20 +5,18 @@ fn runner() -> crate::TestRunner { super::runner() .with_cwd("33_ambiguous_imports") .mock_file("blir/_fudge.scss", "fudge {\n color: brown;\n}") - .mock_file( - "dir.scss", - "dir {\n color: blue;\n}\n\n@import \"blir/fudge\";", - ) + .mock_file("dir.scss", "@use \"sass:meta\";\ndir {\n color: blue;\n}\n\n@include meta.load-css(\"blir/fudge\");") .mock_file("dir/whatever", "") } #[test] fn test() { assert_eq!( - runner().ok("main {\ + runner().ok("@use \"sass:meta\";\ + \nmain {\ \n color: red;\ \n}\n\ - \n@import \"dir\";"), + \n@include meta.load-css(\"dir\");"), "main {\ \n color: red;\ \n}\ diff --git a/rsass/tests/spec/non_conformant/basic/t51_trailing_commas_in_list.rs b/rsass/tests/spec/non_conformant/basic/t51_trailing_commas_in_list.rs index a08137192..3cef2877e 100644 --- a/rsass/tests/spec/non_conformant/basic/t51_trailing_commas_in_list.rs +++ b/rsass/tests/spec/non_conformant/basic/t51_trailing_commas_in_list.rs @@ -8,12 +8,14 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$mylist: (alpha, beta, gamma, );\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n$mylist: (alpha, beta, gamma, );\ \n$my-single-item-list: (alpha,);\ \n.test { \ - \n out1: length($mylist);\ - \n blah: type-of(nth($mylist,3));\ - \n out: length($my-single-item-list); \ + \n out1: list.length($mylist);\ + \n blah: meta.type-of(list.nth($mylist,3));\ + \n out: list.length($my-single-item-list); \ \n}"), ".test {\ \n out1: 3;\ diff --git a/rsass/tests/spec/non_conformant/basic/t55_variable_exists.rs b/rsass/tests/spec/non_conformant/basic/t55_variable_exists.rs index 6666c4efd..7f94478c2 100644 --- a/rsass/tests/spec/non_conformant/basic/t55_variable_exists.rs +++ b/rsass/tests/spec/non_conformant/basic/t55_variable_exists.rs @@ -8,34 +8,35 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function exists($name) {\ - \n @return variable-exists($name);\ + runner().ok("@use \"sass:meta\";\ + \n@function exists($name) {\ + \n @return meta.variable-exists($name);\ \n}\n\ \n@function f() {\ \n $foo: hi;\ \n @return g();\ \n}\n\ \n@function g() {\ - \n @return variable-exists(foo);\ + \n @return meta.variable-exists(foo);\ \n}\n\ \ndiv {\ - \n foo: variable-exists(x);\ - \n foo: variable-exists(\"x\");\n\ + \n foo: meta.variable-exists(x);\ + \n foo: meta.variable-exists(\"x\");\n\ \n span {\ \n $x: false;\n\ - \n foo: variable-exists(x);\ - \n foo: variable-exists(\"x\");\ - \n foo: variable-exists(y);\ - \n foo: variable-exists(\"y\");\ + \n foo: meta.variable-exists(x);\ + \n foo: meta.variable-exists(\"x\");\ + \n foo: meta.variable-exists(y);\ + \n foo: meta.variable-exists(\"y\");\ \n foo: exists(x);\ \n foo: exists(\"x\");\n\ \n p {\ - \n foo: variable-exists(x);\ - \n foo: variable-exists(\"x\");\ + \n foo: meta.variable-exists(x);\ + \n foo: meta.variable-exists(\"x\");\ \n foo: exists(x);\ \n foo: exists(\"x\");\ - \n foo: variable-exists(y);\ - \n foo: variable-exists(\"y\");\ + \n foo: meta.variable-exists(y);\ + \n foo: meta.variable-exists(\"y\");\ \n foo: f();\ \n $y: blah;\ \n }\ diff --git a/rsass/tests/spec/non_conformant/basic/t56_global_variable_exists.rs b/rsass/tests/spec/non_conformant/basic/t56_global_variable_exists.rs index ab341147f..834db0a82 100644 --- a/rsass/tests/spec/non_conformant/basic/t56_global_variable_exists.rs +++ b/rsass/tests/spec/non_conformant/basic/t56_global_variable_exists.rs @@ -8,39 +8,40 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function exists($name) {\ - \n @return global-variable-exists($name);\ + runner().ok("@use \"sass:meta\";\ + \n@function exists($name) {\ + \n @return meta.global-variable-exists($name);\ \n}\n\ \n@function f() {\ \n $foo: hi;\ \n @return g();\ \n}\n\ \n@function g() {\ - \n @return global-variable-exists(foo);\ + \n @return meta.global-variable-exists(foo);\ \n}\n\ \n$z: hi;\n\ \ndiv {\ - \n foo: global-variable-exists(x); \ - \n foo: global-variable-exists(\"x\"); \ - \n foo: global-variable-exists(z);\ - \n foo: global-variable-exists(\"z\"); \n\ + \n foo: meta.global-variable-exists(x); \ + \n foo: meta.global-variable-exists(\"x\"); \ + \n foo: meta.global-variable-exists(z);\ + \n foo: meta.global-variable-exists(\"z\"); \n\ \n span {\ \n $x: false;\n\ - \n foo: global-variable-exists(x);\ - \n foo: global-variable-exists(\"x\"); \ - \n foo: global-variable-exists(y);\ - \n foo: global-variable-exists(\"y\"); \n\ - \n foo: global-variable-exists(z);\ - \n foo: global-variable-exists(\"z\"); \n\ + \n foo: meta.global-variable-exists(x);\ + \n foo: meta.global-variable-exists(\"x\"); \ + \n foo: meta.global-variable-exists(y);\ + \n foo: meta.global-variable-exists(\"y\"); \n\ + \n foo: meta.global-variable-exists(z);\ + \n foo: meta.global-variable-exists(\"z\"); \n\ \n p {\ - \n foo: global-variable-exists(x);\ - \n foo: global-variable-exists(\"x\"); \ + \n foo: meta.global-variable-exists(x);\ + \n foo: meta.global-variable-exists(\"x\"); \ \n foo: exists(x);\ \n foo: exists(\"x\"); \ - \n foo: global-variable-exists(z);\ - \n foo: global-variable-exists(\"z\"); \ - \n foo: global-variable-exists(y);\ - \n foo: global-variable-exists(\"y\"); \ + \n foo: meta.global-variable-exists(z);\ + \n foo: meta.global-variable-exists(\"z\"); \ + \n foo: meta.global-variable-exists(y);\ + \n foo: meta.global-variable-exists(\"y\"); \ \n foo: f();\ \n $y: blah;\ \n //TODO: check for shadowing\ diff --git a/rsass/tests/spec/non_conformant/basic/t57_function_exists.rs b/rsass/tests/spec/non_conformant/basic/t57_function_exists.rs index 6530bc398..65f7352b3 100644 --- a/rsass/tests/spec/non_conformant/basic/t57_function_exists.rs +++ b/rsass/tests/spec/non_conformant/basic/t57_function_exists.rs @@ -8,58 +8,59 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function exists($name) {\ - \n @return function-exists($name);\ + runner().ok("@use \"sass:meta\";\ + \n@function exists($name) {\ + \n @return meta.function-exists($name);\ \n}\n\ \n@function f() {\ \n $foo: hi;\ \n @return g();\ \n}\n\ \n@function g() {\ - \n @return function-exists(foo);\ + \n @return meta.function-exists(foo);\ \n}\n\ \n@function h() {\ - \n @return function-exists(lighten);\ + \n @return meta.function-exists(lighten);\ \n}\n\ \ndiv {\ - \n foo: function-exists(lighten); \ - \n foo: function-exists(\"lighten\"); \ - \n foo: function-exists(exists);\ - \n foo: function-exists(\"exists\"); \ - \n foo: function-exists(f);\ - \n foo: function-exists(\"f\"); \ - \n foo: function-exists(g);\ - \n foo: function-exists(\"g\"); \ - \n foo: function-exists(nope);\ - \n foo: function-exists(\"nope\"); \ + \n foo: meta.function-exists(lighten); \ + \n foo: meta.function-exists(\"lighten\"); \ + \n foo: meta.function-exists(exists);\ + \n foo: meta.function-exists(\"exists\"); \ + \n foo: meta.function-exists(f);\ + \n foo: meta.function-exists(\"f\"); \ + \n foo: meta.function-exists(g);\ + \n foo: meta.function-exists(\"g\"); \ + \n foo: meta.function-exists(nope);\ + \n foo: meta.function-exists(\"nope\"); \ \n foo: g();\ \n foo: f();\ \n foo: h();\n\n\ \n span {\ - \n foo: function-exists(lighten); \ - \n foo: function-exists(\"lighten\"); \ - \n foo: function-exists(exists);\ - \n foo: function-exists(\"exists\"); \ - \n foo: function-exists(f);\ - \n foo: function-exists(\"f\"); \ - \n foo: function-exists(g);\ - \n foo: function-exists(\"g\"); \ - \n foo: function-exists(nope);\ - \n foo: function-exists(\"nope\"); \ + \n foo: meta.function-exists(lighten); \ + \n foo: meta.function-exists(\"lighten\"); \ + \n foo: meta.function-exists(exists);\ + \n foo: meta.function-exists(\"exists\"); \ + \n foo: meta.function-exists(f);\ + \n foo: meta.function-exists(\"f\"); \ + \n foo: meta.function-exists(g);\ + \n foo: meta.function-exists(\"g\"); \ + \n foo: meta.function-exists(nope);\ + \n foo: meta.function-exists(\"nope\"); \ \n foo: g();\ \n foo: f();\ \n foo: h();\ \n p {\ - \n foo: function-exists(lighten); \ - \n foo: function-exists(\"lighten\"); \ - \n foo: function-exists(exists);\ - \n foo: function-exists(\"exists\"); \ - \n foo: function-exists(f);\ - \n foo: function-exists(\"f\"); \ - \n foo: function-exists(g);\ - \n foo: function-exists(\"g\"); \ - \n foo: function-exists(nope);\ - \n foo: function-exists(\"nope\"); \ + \n foo: meta.function-exists(lighten); \ + \n foo: meta.function-exists(\"lighten\"); \ + \n foo: meta.function-exists(exists);\ + \n foo: meta.function-exists(\"exists\"); \ + \n foo: meta.function-exists(f);\ + \n foo: meta.function-exists(\"f\"); \ + \n foo: meta.function-exists(g);\ + \n foo: meta.function-exists(\"g\"); \ + \n foo: meta.function-exists(nope);\ + \n foo: meta.function-exists(\"nope\"); \ \n foo: g();\ \n foo: f();\ \n foo: h();\ diff --git a/rsass/tests/spec/non_conformant/basic/t58_mixin_exists.rs b/rsass/tests/spec/non_conformant/basic/t58_mixin_exists.rs index 40174c776..80cec1ea4 100644 --- a/rsass/tests/spec/non_conformant/basic/t58_mixin_exists.rs +++ b/rsass/tests/spec/non_conformant/basic/t58_mixin_exists.rs @@ -8,55 +8,56 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function exists($name) {\ - \n @return mixin-exists($name);\ + runner().ok("@use \"sass:meta\";\ + \n@function exists($name) {\ + \n @return meta.mixin-exists($name);\ \n}\n\ \n@function f() {\ \n $foo: hi;\ \n @return g();\ \n}\n\ \n@function g() {\ - \n @return mixin-exists(foo);\ + \n @return meta.mixin-exists(foo);\ \n}\n\ \n@function h() {\ - \n @return mixin-exists(lighten);\ + \n @return meta.mixin-exists(lighten);\ \n}\n\ \n@mixin red-text { color: red; }\ \n@mixin blue-text { color: red; }\ \n@mixin green-text { color: red; }\n\ \ndiv {\ - \n foo: mixin-exists(red-text); \ - \n foo: mixin-exists(\"red-text\"); \ - \n foo: mixin-exists(blue-text); \ - \n foo: mixin-exists(\"blue-text\"); \ - \n foo: mixin-exists(green-text); \ - \n foo: mixin-exists(\"green-text\"); \ - \n foo: mixin-exists(nope);\ - \n foo: mixin-exists(\"nope\");\ + \n foo: meta.mixin-exists(red-text); \ + \n foo: meta.mixin-exists(\"red-text\"); \ + \n foo: meta.mixin-exists(blue-text); \ + \n foo: meta.mixin-exists(\"blue-text\"); \ + \n foo: meta.mixin-exists(green-text); \ + \n foo: meta.mixin-exists(\"green-text\"); \ + \n foo: meta.mixin-exists(nope);\ + \n foo: meta.mixin-exists(\"nope\");\ \n foo: g();\ \n foo: f();\ \n foo: h();\n\n\ \n span {\ - \n foo: mixin-exists(red-text); \ - \n foo: mixin-exists(\"red-text\"); \ - \n foo: mixin-exists(blue-text); \ - \n foo: mixin-exists(\"blue-text\"); \ - \n foo: mixin-exists(green-text); \ - \n foo: mixin-exists(\"green-text\"); \ - \n foo: mixin-exists(nope);\ - \n foo: mixin-exists(\"nope\");\ + \n foo: meta.mixin-exists(red-text); \ + \n foo: meta.mixin-exists(\"red-text\"); \ + \n foo: meta.mixin-exists(blue-text); \ + \n foo: meta.mixin-exists(\"blue-text\"); \ + \n foo: meta.mixin-exists(green-text); \ + \n foo: meta.mixin-exists(\"green-text\"); \ + \n foo: meta.mixin-exists(nope);\ + \n foo: meta.mixin-exists(\"nope\");\ \n foo: g();\ \n foo: f();\ \n foo: h();\ \n p {\ - \n foo: mixin-exists(red-text); \ - \n foo: mixin-exists(\"red-text\"); \ - \n foo: mixin-exists(blue-text); \ - \n foo: mixin-exists(\"blue-text\"); \ - \n foo: mixin-exists(green-text); \ - \n foo: mixin-exists(\"green-text\"); \ - \n foo: mixin-exists(nope);\ - \n foo: mixin-exists(\"nope\");\ + \n foo: meta.mixin-exists(red-text); \ + \n foo: meta.mixin-exists(\"red-text\"); \ + \n foo: meta.mixin-exists(blue-text); \ + \n foo: meta.mixin-exists(\"blue-text\"); \ + \n foo: meta.mixin-exists(green-text); \ + \n foo: meta.mixin-exists(\"green-text\"); \ + \n foo: meta.mixin-exists(nope);\ + \n foo: meta.mixin-exists(\"nope\");\ \n foo: g();\ \n foo: f();\ \n foo: h();\ diff --git a/rsass/tests/spec/non_conformant/basic/t59_if_expression.rs b/rsass/tests/spec/non_conformant/basic/t59_if_expression.rs index 4eab04c94..f760e3bdb 100644 --- a/rsass/tests/spec/non_conformant/basic/t59_if_expression.rs +++ b/rsass/tests/spec/non_conformant/basic/t59_if_expression.rs @@ -9,12 +9,13 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$x: 0;\ + "@use \"sass:string\";\ + \n$x: 0;\ \n$if-false: whatever;\n\ \ndiv {\ \n foo: if($if-true: hey, $if-false: ho, $condition: true);\ \n foo: if($if-true: hey, $if-false: ho, $condition: false);\ - \n foo: if($x != 0, if($x, true, false), unquote(\"x is zero\"));\ + \n foo: if($x != 0, if($x, true, false), string.unquote(\"x is zero\"));\ \n foo: if(false, 1/0, $if-false: $if-false);\ \n}" ), diff --git a/rsass/tests/spec/non_conformant/colors/basic.rs b/rsass/tests/spec/non_conformant/colors/basic.rs index da05042a7..d1dd5a161 100644 --- a/rsass/tests/spec/non_conformant/colors/basic.rs +++ b/rsass/tests/spec/non_conformant/colors/basic.rs @@ -8,12 +8,13 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("p {\ + runner().ok("@use \"sass:string\";\ + \np {\ \n color: rgb(255, 128, 0);\ \n color: red green blue;\ \n color: (red) (green) (blue);\ \n color: red + hux;\ - \n color: unquote(\"red\") + green;\ + \n color: string.unquote(\"red\") + green;\ \n foo: rgb(200, 150%, 170%);\ \n}"), "p {\ diff --git a/rsass/tests/spec/non_conformant/colors/change_color.rs b/rsass/tests/spec/non_conformant/colors/change_color.rs index 9ce185b70..f9c04f42f 100644 --- a/rsass/tests/spec/non_conformant/colors/change_color.rs +++ b/rsass/tests/spec/non_conformant/colors/change_color.rs @@ -6,21 +6,23 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( runner().ok( - "p {\ - \n color: change-color(#102030, $blue: 5);\ - \n color: change-color(#102030, $alpha: .325);\ - \n color: change-color(#102030, $red: 120, $blue: 5);\ - \n color: change-color(hsl(25, 100%, 80%), $lightness: 40%, $alpha: 0.8);\ + "@use \"sass:color\";\ + \np {\ + \n color: color.change(#102030, $blue: 5);\ + \n color: color.change(#102030, $alpha: .325);\ + \n color: color.change(#102030, $red: 120, $blue: 5);\ + \n color: color.change(hsl(25, 100%, 80%), $lightness: 40%, $alpha: 0.8);\ \n}" ), "p {\ \n color: #102005;\ \n color: rgba(16, 32, 48, 0.325);\ \n color: #782005;\ - \n color: rgba(204, 85, 0, 0.8);\ + \n color: hsla(25, 100%, 40%, 0.8);\ \n}\n" ); } diff --git a/rsass/tests/spec/non_conformant/errors/fn_change_color_1.rs b/rsass/tests/spec/non_conformant/errors/fn_change_color_1.rs index 597170f76..a3bcc78ed 100644 --- a/rsass/tests/spec/non_conformant/errors/fn_change_color_1.rs +++ b/rsass/tests/spec/non_conformant/errors/fn_change_color_1.rs @@ -6,18 +6,20 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong error fn test() { assert_eq!( runner().err( - "foo {\r\ - \n test: change-color(red, $red: 0.5, $hue: 0.2);\r\ + "@use \"sass:color\";\ + \nfoo {\r\ + \n test: color.change(red, $red: 0.5, $hue: 0.2);\r\ \n}" ), - "Error: RGB parameters may not be passed along with HSL parameters.\ + "Error: $hue: Color space rgb doesn\'t have a channel with this name.\ \n ,\ - \n2 | test: change-color(red, $red: 0.5, $hue: 0.2);\ + \n3 | test: color.change(red, $red: 0.5, $hue: 0.2);\ \n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ \n \'\ - \n input.scss 2:9 root stylesheet", + \n input.scss 3:9 root stylesheet", ); } diff --git a/rsass/tests/spec/non_conformant/errors/import/file/mixin/simple/inside.rs b/rsass/tests/spec/non_conformant/errors/import/file/mixin/simple/inside.rs index 9ba5eb204..abc857d8e 100644 --- a/rsass/tests/spec/non_conformant/errors/import/file/mixin/simple/inside.rs +++ b/rsass/tests/spec/non_conformant/errors/import/file/mixin/simple/inside.rs @@ -12,20 +12,21 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "@mixin import-google-fonts() {\r\ + "@use \"sass:string\";\ + \n@mixin import-google-fonts() {\r\ \n @import url(\"http://fonts.googleapis.com/css?family=#{$family}\");\r\ \n}\r\ \nfoo {\r\ - \n $family: unquote(\"Droid+Sans\");\r\ + \n $family: string.unquote(\"Droid+Sans\");\r\ \n @include import-google-fonts();\r\ \n}" ), "Error: Undefined variable.\ \n ,\ - \n2 | @import url(\"http://fonts.googleapis.com/css?family=#{$family}\");\ + \n3 | @import url(\"http://fonts.googleapis.com/css?family=#{$family}\");\ \n | ^^^^^^^\ \n \'\ - \n input.scss 2:57 import-google-fonts()\ - \n input.scss 6:3 root stylesheet", + \n input.scss 3:57 import-google-fonts()\ + \n input.scss 7:3 root stylesheet", ); } diff --git a/rsass/tests/spec/non_conformant/errors/import/file/mixin/simple/outside.rs b/rsass/tests/spec/non_conformant/errors/import/file/mixin/simple/outside.rs index 4a2ed59ab..7471c05d1 100644 --- a/rsass/tests/spec/non_conformant/errors/import/file/mixin/simple/outside.rs +++ b/rsass/tests/spec/non_conformant/errors/import/file/mixin/simple/outside.rs @@ -11,10 +11,11 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "@mixin import-google-fonts() {\r\ + "@use \"sass:string\";\ + \n@mixin import-google-fonts() {\r\ \n @import url(\"http://fonts.googleapis.com/css?family=#{$family}\");\r\ \n}\r\ - \n$family: unquote(\"Droid+Sans\");\r\ + \n$family: string.unquote(\"Droid+Sans\");\r\ \n@include import-google-fonts();" ), "@import url(\"http://fonts.googleapis.com/css?family=Droid+Sans\");\n" diff --git a/rsass/tests/spec/non_conformant/errors/import/miss/mixin/simple/inside.rs b/rsass/tests/spec/non_conformant/errors/import/miss/mixin/simple/inside.rs index f0bedc800..e74f7c2a7 100644 --- a/rsass/tests/spec/non_conformant/errors/import/miss/mixin/simple/inside.rs +++ b/rsass/tests/spec/non_conformant/errors/import/miss/mixin/simple/inside.rs @@ -10,20 +10,21 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "@mixin import-google-fonts() {\r\ + "@use \"sass:string\";\ + \n@mixin import-google-fonts() {\r\ \n @import url(\"http://fonts.googleapis.com/css?family=#{$family}\");\r\ \n}\r\ \nfoo {\r\ - \n $family: unquote(\"Droid+Sans\");\r\ + \n $family: string.unquote(\"Droid+Sans\");\r\ \n @include import-google-fonts();\r\ \n}" ), "Error: Undefined variable.\ \n ,\ - \n2 | @import url(\"http://fonts.googleapis.com/css?family=#{$family}\");\ + \n3 | @import url(\"http://fonts.googleapis.com/css?family=#{$family}\");\ \n | ^^^^^^^\ \n \'\ - \n input.scss 2:57 import-google-fonts()\ - \n input.scss 6:3 root stylesheet", + \n input.scss 3:57 import-google-fonts()\ + \n input.scss 7:3 root stylesheet", ); } diff --git a/rsass/tests/spec/non_conformant/errors/import/miss/mixin/simple/outside.rs b/rsass/tests/spec/non_conformant/errors/import/miss/mixin/simple/outside.rs index 8a85f08c3..178367964 100644 --- a/rsass/tests/spec/non_conformant/errors/import/miss/mixin/simple/outside.rs +++ b/rsass/tests/spec/non_conformant/errors/import/miss/mixin/simple/outside.rs @@ -9,10 +9,11 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "@mixin import-google-fonts() {\r\ + "@use \"sass:string\";\ + \n@mixin import-google-fonts() {\r\ \n @import url(\"http://fonts.googleapis.com/css?family=#{$family}\");\r\ \n}\r\ - \n$family: unquote(\"Droid+Sans\");\r\ + \n$family: string.unquote(\"Droid+Sans\");\r\ \n@include import-google-fonts();" ), "@import url(\"http://fonts.googleapis.com/css?family=Droid+Sans\");\n" diff --git a/rsass/tests/spec/non_conformant/errors/import/url/mixin/simple/inside.rs b/rsass/tests/spec/non_conformant/errors/import/url/mixin/simple/inside.rs index 9c594086b..6a90a656e 100644 --- a/rsass/tests/spec/non_conformant/errors/import/url/mixin/simple/inside.rs +++ b/rsass/tests/spec/non_conformant/errors/import/url/mixin/simple/inside.rs @@ -10,20 +10,21 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().err( - "@mixin import-google-fonts() {\r\ + "@use \"sass:string\";\ + \n@mixin import-google-fonts() {\r\ \n @import url(\"http://fonts.googleapis.com/css?family=#{$family}\");\r\ \n}\r\ \nfoo {\r\ - \n $family: unquote(\"Droid+Sans\");\r\ + \n $family: string.unquote(\"Droid+Sans\");\r\ \n @include import-google-fonts();\r\ \n}" ), "Error: Undefined variable.\ \n ,\ - \n2 | @import url(\"http://fonts.googleapis.com/css?family=#{$family}\");\ + \n3 | @import url(\"http://fonts.googleapis.com/css?family=#{$family}\");\ \n | ^^^^^^^\ \n \'\ - \n input.scss 2:57 import-google-fonts()\ - \n input.scss 6:3 root stylesheet", + \n input.scss 3:57 import-google-fonts()\ + \n input.scss 7:3 root stylesheet", ); } diff --git a/rsass/tests/spec/non_conformant/errors/import/url/mixin/simple/outside.rs b/rsass/tests/spec/non_conformant/errors/import/url/mixin/simple/outside.rs index 2af72b946..dd274e208 100644 --- a/rsass/tests/spec/non_conformant/errors/import/url/mixin/simple/outside.rs +++ b/rsass/tests/spec/non_conformant/errors/import/url/mixin/simple/outside.rs @@ -9,10 +9,11 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "@mixin import-google-fonts() {\r\ + "@use \"sass:string\";\ + \n@mixin import-google-fonts() {\r\ \n @import url(\"http://fonts.googleapis.com/css?family=#{$family}\");\r\ \n}\r\ - \n$family: unquote(\"Droid+Sans\");\r\ + \n$family: string.unquote(\"Droid+Sans\");\r\ \n@include import-google-fonts();" ), "@import url(\"http://fonts.googleapis.com/css?family=Droid+Sans\");\n" diff --git a/rsass/tests/spec/non_conformant/extend_tests/mod.rs b/rsass/tests/spec/non_conformant/extend_tests/mod.rs index 7ad3490c8..23146075b 100644 --- a/rsass/tests/spec/non_conformant/extend_tests/mod.rs +++ b/rsass/tests/spec/non_conformant/extend_tests/mod.rs @@ -185,8 +185,6 @@ mod t088_test_negation_unification; mod t089_test_negation_unification; -mod t090_test_comma_extendee; - mod t091_test_redundant_selector_elimination; mod t094_test_long_extendee_runs_unification; @@ -427,8 +425,6 @@ mod t220_test_extend_in_double_nested_media_query; mod t221_test_partially_failed_extend; -mod t222_test_newline_near_combinator; - mod t223_test_duplicated_selector_with_newlines; mod t224_test_nested_selector_with_child_selector_hack_extendee; diff --git a/rsass/tests/spec/non_conformant/extend_tests/t090_test_comma_extendee.rs b/rsass/tests/spec/non_conformant/extend_tests/t090_test_comma_extendee.rs deleted file mode 100644 index f245e3af1..000000000 --- a/rsass/tests/spec/non_conformant/extend_tests/t090_test_comma_extendee.rs +++ /dev/null @@ -1,22 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/non_conformant/extend-tests/090_test_comma_extendee.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("090_test_comma_extendee") -} - -#[test] -#[ignore] // unexepected error -fn test() { - assert_eq!( - runner().ok(".foo {a: b}\ - \n.bar {c: d}\ - \n.baz {@extend .foo, .bar}\n"), - ".foo, .baz {\ - \n a: b;\ - \n}\ - \n.bar, .baz {\ - \n c: d;\ - \n}\n" - ); -} diff --git a/rsass/tests/spec/non_conformant/extend_tests/t222_test_newline_near_combinator.rs b/rsass/tests/spec/non_conformant/extend_tests/t222_test_newline_near_combinator.rs deleted file mode 100644 index cb9d31141..000000000 --- a/rsass/tests/spec/non_conformant/extend_tests/t222_test_newline_near_combinator.rs +++ /dev/null @@ -1,22 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/non_conformant/extend-tests/222_test_newline_near_combinator.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("222_test_newline_near_combinator") -} - -#[test] -#[ignore] // unexepected error -fn test() { - assert_eq!( - runner().ok(".a +\ - \n.b x {a: b}\ - \n.c y {@extend x}\n"), - ".a +\ - \n.b x, .a +\ - \n.b .c y, .c .a +\ - \n.b y {\ - \n a: b;\ - \n}\n" - ); -} diff --git a/rsass/tests/spec/non_conformant/misc/import_in_mixin.rs b/rsass/tests/spec/non_conformant/misc/import_in_mixin.rs index dd160bd99..38ec446d5 100644 --- a/rsass/tests/spec/non_conformant/misc/import_in_mixin.rs +++ b/rsass/tests/spec/non_conformant/misc/import_in_mixin.rs @@ -9,10 +9,11 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "@mixin import-google-fonts() {\ + "@use \"sass:string\";\ + \n@mixin import-google-fonts() {\ \n @import url(\"http://fonts.googleapis.com/css?family=#{$family}\");\ \n}\ - \n$family: unquote(\"Droid+Sans\");\ + \n$family: string.unquote(\"Droid+Sans\");\ \n@include import-google-fonts();\n" ), "@import url(\"http://fonts.googleapis.com/css?family=Droid+Sans\");\n" diff --git a/rsass/tests/spec/non_conformant/misc/import_with_interpolation.rs b/rsass/tests/spec/non_conformant/misc/import_with_interpolation.rs index d6ade1523..1617b088e 100644 --- a/rsass/tests/spec/non_conformant/misc/import_with_interpolation.rs +++ b/rsass/tests/spec/non_conformant/misc/import_with_interpolation.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$family: unquote(\"Droid+Sans\");\ + "@use \"sass:string\";\ + \n$family: string.unquote(\"Droid+Sans\");\ \n@import url(\"http://fonts.googleapis.com/css?family=#{$family}\");\n" ), "@import url(\"http://fonts.googleapis.com/css?family=Droid+Sans\");\n" diff --git a/rsass/tests/spec/non_conformant/mixin/content/arguments/receiving.rs b/rsass/tests/spec/non_conformant/mixin/content/arguments/receiving.rs index 65fba2576..d8933742e 100644 --- a/rsass/tests/spec/non_conformant/mixin/content/arguments/receiving.rs +++ b/rsass/tests/spec/non_conformant/mixin/content/arguments/receiving.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "// Content blocks\' argument lists can define arguments in in all the same ways\ + "@use \"sass:meta\";\ + \n// Content blocks\' argument lists can define arguments in in all the same ways\ \n// as they\'re defined in any other argument list.\n\ \nwith-defaults {\ \n nothing-passed {\ @@ -46,8 +47,8 @@ fn test() { \n @content;\ \n }\n\ \n @include mixin using ($args...) {\ - \n positional: inspect($args);\ - \n keywords: inspect(keywords($args));\ + \n positional: meta.inspect($args);\ + \n keywords: meta.inspect(meta.keywords($args));\ \n }\ \n }\n\ \n positional-passed {\ @@ -55,8 +56,8 @@ fn test() { \n @content(value1, value2, value3);\ \n }\n\ \n @include mixin using ($args...) {\ - \n positional: inspect($args);\ - \n keywords: inspect(keywords($args));\ + \n positional: meta.inspect($args);\ + \n keywords: meta.inspect(meta.keywords($args));\ \n }\ \n }\n\ \n named-passed {\ @@ -64,8 +65,8 @@ fn test() { \n @content($arg1: value1, $arg2: value2);\ \n }\n\ \n @include mixin using ($args...) {\ - \n positional: inspect($args);\ - \n keywords: inspect(keywords($args));\ + \n positional: meta.inspect($args);\ + \n keywords: meta.inspect(meta.keywords($args));\ \n }\ \n }\n\ \n both-passed {\ @@ -73,8 +74,8 @@ fn test() { \n @content(value1, $arg2: value2);\ \n }\n\ \n @include mixin using ($args...) {\ - \n positional: inspect($args);\ - \n keywords: inspect(keywords($args));\ + \n positional: meta.inspect($args);\ + \n keywords: meta.inspect(meta.keywords($args));\ \n }\ \n }\ \n}\n" diff --git a/rsass/tests/spec/non_conformant/sass/var_args/success.rs b/rsass/tests/spec/non_conformant/sass/var_args/success.rs index efca690fe..27e993c3e 100644 --- a/rsass/tests/spec/non_conformant/sass/var_args/success.rs +++ b/rsass/tests/spec/non_conformant/sass/var_args/success.rs @@ -9,25 +9,27 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong result fn test() { assert_eq!( - runner().ok("@mixin foo($x, $y, $zs...) {\ - \n grarh: type-of(false);\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n@mixin foo($x, $y, $zs...) {\ + \n grarh: meta.type-of(false);\ \n f: $zs;\ \n fa: $x, $y, $zs;\ \n fv: $zs;\ - \n ft: type-of($zs);\ - \n fj: join(1 2 3, $zs);\ - \n fjt: type-of(join(1 2 3, $zs));\ - \n fkt: type-of(join($zs, 1 2 3));\ - \n hoopla: length(a b c d e);\ - \n boopla: type-of(123+234);\ - \n koopla: type-of(length(a b c d));\ + \n ft: meta.type-of($zs);\ + \n fj: list.join(1 2 3, $zs);\ + \n fjt: meta.type-of(list.join(1 2 3, $zs));\ + \n fkt: meta.type-of(list.join($zs, 1 2 3));\ + \n hoopla: list.length(a b c d e);\ + \n boopla: meta.type-of(123+234);\ + \n koopla: meta.type-of(list.length(a b c d));\ \n}\n\ \n@mixin bar($x, $y, $z) {\ \n ba: $x, $y, $z;\ \n bv: $z;\ - \n bt: type-of($z);\ - \n bj: join(1 2 3, $z);\ - \n bjt: type-of(join(1 2 3, $z));\ + \n bt: meta.type-of($z);\ + \n bj: list.join(1 2 3, $z);\ + \n bjt: meta.type-of(list.join(1 2 3, $z));\ \n}\n\ \n$stuff: hey hoo ha;\n\ \n@mixin mudge($x, $y, $zs...) {\ @@ -41,7 +43,7 @@ fn test() { \n @include foo(a, b, c d e...);\ \n @include foo(a, c d e...);\ \n @include foo(a, $stuff...);\ - \n new: type-of(\"hello\");\ + \n new: meta.type-of(\"hello\");\ \n}\n\ \n@mixin bad($x, $y, $z) {\ \n first: $x;\ @@ -49,9 +51,9 @@ fn test() { \n rest: $z;\ \n}\n\ \n@mixin foo($x, $y, $z) {\ - \n a: type-of(join($x, $y));\ - \n b: type-of($z);\ - \n c: type-of(length($x));\ + \n a: meta.type-of(list.join($x, $y));\ + \n b: meta.type-of($z);\ + \n c: meta.type-of(list.length($x));\ \n}\n\ \ndiv {\ \n @include foo(a b c, d e, false);\ diff --git a/rsass/tests/spec/non_conformant/scss/alpha.rs b/rsass/tests/spec/non_conformant/scss/alpha.rs index 542b94235..829a6a1a0 100644 --- a/rsass/tests/spec/non_conformant/scss/alpha.rs +++ b/rsass/tests/spec/non_conformant/scss/alpha.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$x: rgb(0, 255, 255);\n\ + runner().ok("@use \"sass:color\";\ + \n$x: rgb(0, 255, 255);\n\ \ndiv {\ \n color: rgb(255, $blue: 0, $green: 255);\ \n background: rgb(123, 45, 6);\ @@ -22,13 +23,13 @@ fn test() { \n \ \n $x: rgb(123, 45, 6);\ \n \ - \n hoo: red($x);\ - \n moo: green($x);\ - \n poo: blue($x);\ + \n hoo: color.red($x);\ + \n moo: color.green($x);\ + \n poo: color.blue($x);\ \n \ \n// goo: mix(rgba(255, 0, 0, 0.5), #00f);\ \n \ - \n boo: invert(#123456);\ + \n boo: color.invert(#123456);\ \n}\n"), "div {\ \n color: rgb(255, 255, 0);\ diff --git a/rsass/tests/spec/non_conformant/scss/cons_up.rs b/rsass/tests/spec/non_conformant/scss/cons_up.rs index a1123db99..4907db2c2 100644 --- a/rsass/tests/spec/non_conformant/scss/cons_up.rs +++ b/rsass/tests/spec/non_conformant/scss/cons_up.rs @@ -9,7 +9,9 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$inputs-list: \'input[type=\"email\"]\',\ + "@use \"sass:string\";\ + \n@use \"sass:list\";\n\ + \n$inputs-list: \'input[type=\"email\"]\',\ \n \'input[type=\"number\"]\',\ \n \'input[type=\"password\"]\',\ \n \'input[type=\"search\"]\',\ @@ -26,12 +28,12 @@ fn test() { \n \'input[type=\"week\"]\';\n\ \n$unquoted-inputs-list: ();\n\ \n@each $input-type in $inputs-list {\ - \n $unquoted-inputs-list: append($unquoted-inputs-list, unquote($input-type), comma);\ + \n $unquoted-inputs-list: list.append($unquoted-inputs-list, string.unquote($input-type), comma);\ \n}\n\ \ndiv {\ \n content: $unquoted-inputs-list;\ - \n content: append((), hello);\ - \n content: length(());\ + \n content: list.append((), hello);\ + \n content: list.length(());\ \n}" ), "div {\ diff --git a/rsass/tests/spec/non_conformant/scss/directives_in_propsets.rs b/rsass/tests/spec/non_conformant/scss/directives_in_propsets.rs index 02bac0ace..8b5ca1dcb 100644 --- a/rsass/tests/spec/non_conformant/scss/directives_in_propsets.rs +++ b/rsass/tests/spec/non_conformant/scss/directives_in_propsets.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$color: red;\ + runner().ok("@use \"sass:meta\";\ + \n$color: red;\ \n$position: 50%;\ \n$x: 0;\n\ \n@mixin foo() {\ @@ -19,10 +20,10 @@ fn test() { \n something: {\ \n color: green;\ \n }\ - \n @if (type-of($color) == \"color\") {\ + \n @if (meta.type-of($color) == \"color\") {\ \n color: $color;\ \n }\ - \n @if (type-of($position) == \"number\") {\ + \n @if (meta.type-of($position) == \"number\") {\ \n position: $position;\ \n @include foo();\ \n }\ diff --git a/rsass/tests/spec/non_conformant/scss/each_in_functions.rs b/rsass/tests/spec/non_conformant/scss/each_in_functions.rs index 926ef7b16..43645c4b7 100644 --- a/rsass/tests/spec/non_conformant/scss/each_in_functions.rs +++ b/rsass/tests/spec/non_conformant/scss/each_in_functions.rs @@ -9,12 +9,14 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$GLOBAL: global;\n\ + "@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n$GLOBAL: global;\n\ \n@function foo($g1, $g2, $g3) {\ \n @each $value in $g1, $g2, $g3 {\ \n $GLOBAL: $GLOBAL each $value !global;\ - \n $GLOBAL: $GLOBAL type1 type-of(nth($value, 1)) !global;\ - \n $GLOBAL: $GLOBAL type2 type-of(nth($value, 2)) !global;\ + \n $GLOBAL: $GLOBAL type1 meta.type-of(list.nth($value, 1)) !global;\ + \n $GLOBAL: $GLOBAL type2 meta.type-of(list.nth($value, 2)) !global;\ \n }\ \n @each $value in (foo: foo, bar: bar) {\ \n $GLOBAL: $GLOBAL map $value !global;\ @@ -25,7 +27,7 @@ fn test() { \n a: foo(50% 50%, cover circle, red blue);\ \n b: $GLOBAL;\ \n $colors: red green blue;\ - \n c: a, b, type-of(nth($colors, 2)), d;\ + \n c: a, b, meta.type-of(list.nth($colors, 2)), d;\ \n}\n" ), "div {\ diff --git a/rsass/tests/spec/non_conformant/scss/ie_backslash.rs b/rsass/tests/spec/non_conformant/scss/ie_backslash.rs index 64468dc03..106fbbb1e 100644 --- a/rsass/tests/spec/non_conformant/scss/ie_backslash.rs +++ b/rsass/tests/spec/non_conformant/scss/ie_backslash.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("div {\ - \n background-color: darken(red, 10%) \\9;\ + runner().ok("@use \"sass:color\";\ + \ndiv {\ + \n background-color: color.adjust(red, $lightness: -10%) \\9;\ \n}"), "div {\ \n background-color: #cc0000 \\9 ;\ diff --git a/rsass/tests/spec/non_conformant/scss/ie_functions.rs b/rsass/tests/spec/non_conformant/scss/ie_functions.rs index a2ee52296..96e38af0a 100644 --- a/rsass/tests/spec/non_conformant/scss/ie_functions.rs +++ b/rsass/tests/spec/non_conformant/scss/ie_functions.rs @@ -10,11 +10,14 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "@mixin ie-opacity($opacity) {\ - \n opacity: $opacity / 100;\ + "@use \"sass:color\";\ + \n@use \"sass:math\";\ + \n@use \"sass:meta\";\n\ + \n@mixin ie-opacity($opacity) {\ + \n opacity: math.div($opacity, 100);\ \n filter: alpha(opacity=$opacity);\ \n bilter: alpha(opacity=$opacity);\ - \n kilter: type-of(opacity=$opacity);\ + \n kilter: meta.type-of(opacity=$opacity);\ \n left: expression(document.body.clientWidth/2-oDiv.offsetWidth/2);\ \n flop: expression(document.body.clientHeight/2-oDiv.offsetHeight/2);\ \n}\n\ @@ -25,10 +28,10 @@ fn test() { \n something: blah(hux = mumble);\ \n blah: progid:something.something(flip=foobar, bang=#abc);\ \n blah: progid:bar.hux();\ - \n blah: type-of(hux = mumble);\ + \n blah: meta.type-of(hux = mumble);\ \n @include ie-opacity(.5);\ \n left: expression(document.body.clientWidth/4);\ - \n filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#{ie-hex-str($startColor)}\', endColorstr=\'#{ie-hex-str($endColor)}\', GradientType=1);\ + \n filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#{color.ie-hex-str($startColor)}\', endColorstr=\'#{color.ie-hex-str($endColor)}\', GradientType=1);\ \n}\n\ \n.parser {\ \n filter: progid:DXImageTransform.Microsoft.Alpha(opacity=20);\ diff --git a/rsass/tests/spec/non_conformant/scss/media/script_features.rs b/rsass/tests/spec/non_conformant/scss/media/script_features.rs index 7dbb28fee..52b43bf0c 100644 --- a/rsass/tests/spec/non_conformant/scss/media/script_features.rs +++ b/rsass/tests/spec/non_conformant/scss/media/script_features.rs @@ -9,13 +9,14 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$foo: 3;\ + "@use \"sass:list\";\ + \n$foo: 3;\ \n$bar: 4;\ \n// Media features are special-cased to allow raw script without interpolation.\ \n@media only screen and (max-width: $foo) and (min-width: $bar) {x {y: z}}\n\ \n// Not just variables, but full script\ \n$vals: 1 2 3;\ - \n@media screen and (max-width: 1 + 2) and (min-width: 5 + 6 + nth($vals, 2)) {x {y: z}}\n\n" + \n@media screen and (max-width: 1 + 2) and (min-width: 5 + 6 + list.nth($vals, 2)) {x {y: z}}\n\n" ), "@media only screen and (max-width: 3) and (min-width: 4) {\ \n x {\ diff --git a/rsass/tests/spec/non_conformant/scss/mod.rs b/rsass/tests/spec/non_conformant/scss/mod.rs index 86b1ba7a5..8eee77ac9 100644 --- a/rsass/tests/spec/non_conformant/scss/mod.rs +++ b/rsass/tests/spec/non_conformant/scss/mod.rs @@ -175,8 +175,6 @@ mod nested_rules_with_declarations; mod nested_rules_with_fancy_selectors; -mod newlines_in_selectors; - mod no_namespace_properties_without_space; mod null; diff --git a/rsass/tests/spec/non_conformant/scss/newlines_in_selectors.rs b/rsass/tests/spec/non_conformant/scss/newlines_in_selectors.rs deleted file mode 100644 index 7de799970..000000000 --- a/rsass/tests/spec/non_conformant/scss/newlines_in_selectors.rs +++ /dev/null @@ -1,24 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/non_conformant/scss/newlines_in_selectors.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("newlines_in_selectors") -} - -#[test] -#[ignore] // wrong result -fn test() { - assert_eq!( - runner().ok("foo, bar\ - \nbaz {\ - \n bang, bip\ - \n bop {a: b}}\n"), - "foo bang, foo bip\ - \nbop, bar\ - \nbaz bang, bar\ - \nbaz bip\ - \nbop {\ - \n a: b;\ - \n}\n" - ); -} diff --git a/rsass/tests/spec/non_conformant/scss/null.rs b/rsass/tests/spec/non_conformant/scss/null.rs index 4e4cd6323..dc2218b5a 100644 --- a/rsass/tests/spec/non_conformant/scss/null.rs +++ b/rsass/tests/spec/non_conformant/scss/null.rs @@ -8,28 +8,29 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$x: 2;\n\ + runner().ok("@use \"sass:list\";\ + \n@use \"sass:meta\";\ + \n$x: 2;\n\ \ndiv {\ \n $x: null;\ - \n a: length(null null null);\ + \n a: list.length(null null null);\ \n b: #{null};\ - \n d: type-of($x);\ + \n d: meta.type-of($x);\ \n e: null == null;\ \n f: -null;\ \n g: -fudge;\ \n h: (null null null);\ \n i: froo(null, 4);\ \n j: (null), (null), 3, 4;\ - \n k: length(((null), (null), 3, 4));\ - \n \ - \n a2: length($x $x $x);\ + \n k: list.length(((null), (null), 3, 4));\n\ + \n a2: list.length($x $x $x);\ \n b2: #{$x};\ \n e2: $x == null;\ \n f2: -$x;\ \n h2: ($x $x $x);\ \n i2: froo($x, 4);\ \n j2: ($x), ($x), 3, 4;\ - \n k2: length((($x), ($x), 3, 4));\ + \n k2: list.length((($x), ($x), 3, 4));\ \n}"), "div {\ \n a: 3;\ diff --git a/rsass/tests/spec/non_conformant/scss/sass_script.rs b/rsass/tests/spec/non_conformant/scss/sass_script.rs index cc482c080..1c8163959 100644 --- a/rsass/tests/spec/non_conformant/scss/sass_script.rs +++ b/rsass/tests/spec/non_conformant/scss/sass_script.rs @@ -8,11 +8,12 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("foo {\ + runner().ok("@use \"sass:math\";\ + \nfoo {\ \n a: 1 + 2;\ \n b: 1 - 2;\ \n c: foo + bar;\ - \n d: floor(12.3px); }\n"), + \n d: math.floor(12.3px); }\n"), "foo {\ \n a: 3;\ \n b: -1;\ diff --git a/rsass/tests/spec/non_conformant/scss/simple_lists.rs b/rsass/tests/spec/non_conformant/scss/simple_lists.rs index a62cbe59a..1e921a09c 100644 --- a/rsass/tests/spec/non_conformant/scss/simple_lists.rs +++ b/rsass/tests/spec/non_conformant/scss/simple_lists.rs @@ -8,10 +8,11 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("div {\ + runner().ok("@use \"sass:string\";\ + \ndiv {\ \n hey: a, b, c, d;\ \n ho: a b c d;\ - \n ha: unquote(\"a, b, c, d\");\ + \n ha: string.unquote(\"a, b, c, d\");\ \n}"), "div {\ \n hey: a, b, c, d;\ diff --git a/rsass/tests/spec/non_conformant/scss/zero_compression.rs b/rsass/tests/spec/non_conformant/scss/zero_compression.rs index dbb408c13..5c1c40e8f 100644 --- a/rsass/tests/spec/non_conformant/scss/zero_compression.rs +++ b/rsass/tests/spec/non_conformant/scss/zero_compression.rs @@ -8,14 +8,15 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$orig: 0.12em;\r\ - \n$value: (0.12em);\r\ - \n$score: (item-height: 0.12em);\r\ - \nfoo {\r\ - \n tst-1: 0 -#{0.12em};\r\ - \n tst-2: 0 -#{$orig};\r\ - \n tst-3: 0 -#{$value};\r\ - \n tst-4: 0 -#{map-get($score, item-height)};\r\ + runner().ok("@use \"sass:map\";\n\ + \n$orig: 0.12em;\ + \n$value: (0.12em);\ + \n$score: (item-height: 0.12em);\ + \nfoo {\ + \n tst-1: 0 -#{0.12em};\ + \n tst-2: 0 -#{$orig};\ + \n tst-3: 0 -#{$value};\ + \n tst-4: 0 -#{map.get($score, item-height)};\ \n}"), "foo {\ \n tst-1: 0 -0.12em;\ diff --git a/rsass/tests/spec/non_conformant/scss_tests/mod.rs b/rsass/tests/spec/non_conformant/scss_tests/mod.rs index 780b2e775..c02a6001d 100644 --- a/rsass/tests/spec/non_conformant/scss_tests/mod.rs +++ b/rsass/tests/spec/non_conformant/scss_tests/mod.rs @@ -73,14 +73,10 @@ mod t038_test_nested_rules_with_fancy_selectors; mod t039_test_almost_ambiguous_nested_rules_and_declarations; -mod t040_test_newlines_in_selectors; - mod t041_test_newlines_in_selectors; mod t042_test_newlines_in_selectors; -mod t043_test_newlines_in_selectors; - mod t044_test_trailing_comma_in_selector; mod t045_test_parent_selectors; diff --git a/rsass/tests/spec/non_conformant/scss_tests/t008_test_sass_script.rs b/rsass/tests/spec/non_conformant/scss_tests/t008_test_sass_script.rs index 89c706eed..659711346 100644 --- a/rsass/tests/spec/non_conformant/scss_tests/t008_test_sass_script.rs +++ b/rsass/tests/spec/non_conformant/scss_tests/t008_test_sass_script.rs @@ -8,11 +8,12 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("foo {\ + runner().ok("@use \"sass:math\";\ + \nfoo {\ \n a: 1 + 2;\ \n b: 1 - 2;\ \n c: foo + bar;\ - \n d: floor(12.3px); }\n"), + \n d: math.floor(12.3px); }\n"), "foo {\ \n a: 3;\ \n b: -1;\ diff --git a/rsass/tests/spec/non_conformant/scss_tests/t028_test_import_with_interpolation.rs b/rsass/tests/spec/non_conformant/scss_tests/t028_test_import_with_interpolation.rs index 82a9f3fb9..f857a2015 100644 --- a/rsass/tests/spec/non_conformant/scss_tests/t028_test_import_with_interpolation.rs +++ b/rsass/tests/spec/non_conformant/scss_tests/t028_test_import_with_interpolation.rs @@ -9,7 +9,8 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "$family: unquote(\"Droid+Sans\");\ + "@use \"sass:string\";\ + \n$family: string.unquote(\"Droid+Sans\");\ \n@import url(\"http://fonts.googleapis.com/css?family=#{$family}\");\n" ), "@import url(\"http://fonts.googleapis.com/css?family=Droid+Sans\");\n" diff --git a/rsass/tests/spec/non_conformant/scss_tests/t040_test_newlines_in_selectors.rs b/rsass/tests/spec/non_conformant/scss_tests/t040_test_newlines_in_selectors.rs deleted file mode 100644 index 60d6a2ed5..000000000 --- a/rsass/tests/spec/non_conformant/scss_tests/t040_test_newlines_in_selectors.rs +++ /dev/null @@ -1,19 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/non_conformant/scss-tests/040_test_newlines_in_selectors.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("040_test_newlines_in_selectors") -} - -#[test] -#[ignore] // wrong result -fn test() { - assert_eq!( - runner().ok("foo\ - \nbar {a: b}\n"), - "foo\ - \nbar {\ - \n a: b;\ - \n}\n" - ); -} diff --git a/rsass/tests/spec/non_conformant/scss_tests/t043_test_newlines_in_selectors.rs b/rsass/tests/spec/non_conformant/scss_tests/t043_test_newlines_in_selectors.rs deleted file mode 100644 index fd05d08b1..000000000 --- a/rsass/tests/spec/non_conformant/scss_tests/t043_test_newlines_in_selectors.rs +++ /dev/null @@ -1,24 +0,0 @@ -//! Tests auto-converted from "sass-spec/spec/non_conformant/scss-tests/043_test_newlines_in_selectors.hrx" - -#[allow(unused)] -fn runner() -> crate::TestRunner { - super::runner().with_cwd("043_test_newlines_in_selectors") -} - -#[test] -#[ignore] // wrong result -fn test() { - assert_eq!( - runner().ok("foo, bar\ - \nbaz {\ - \n bang, bip\ - \n bop {a: b}}\n"), - "foo bang, foo bip\ - \nbop, bar\ - \nbaz bang, bar\ - \nbaz bip\ - \nbop {\ - \n a: b;\ - \n}\n" - ); -} diff --git a/rsass/tests/spec/non_conformant/scss_tests/t065_test_mixin_empty_var_args.rs b/rsass/tests/spec/non_conformant/scss_tests/t065_test_mixin_empty_var_args.rs index cc86139c6..ece36f511 100644 --- a/rsass/tests/spec/non_conformant/scss_tests/t065_test_mixin_empty_var_args.rs +++ b/rsass/tests/spec/non_conformant/scss_tests/t065_test_mixin_empty_var_args.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@mixin foo($a, $b...) {\ + runner().ok("@use \"sass:list\";\ + \n@mixin foo($a, $b...) {\ \n a: $a;\ - \n b: length($b);\ + \n b: list.length($b);\ \n}\n\ \n.foo {@include foo(1)}\n"), ".foo {\ diff --git a/rsass/tests/spec/non_conformant/scss_tests/t066_test_mixin_var_args_act_like_list.rs b/rsass/tests/spec/non_conformant/scss_tests/t066_test_mixin_var_args_act_like_list.rs index ab39765d0..b281b4499 100644 --- a/rsass/tests/spec/non_conformant/scss_tests/t066_test_mixin_var_args_act_like_list.rs +++ b/rsass/tests/spec/non_conformant/scss_tests/t066_test_mixin_var_args_act_like_list.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@mixin foo($a, $b...) {\ - \n a: length($b);\ - \n b: nth($b, 2);\ + runner().ok("@use \"sass:list\";\ + \n@mixin foo($a, $b...) {\ + \n a: list.length($b);\ + \n b: list.nth($b, 2);\ \n}\n\ \n.foo {@include foo(1, 2, 3, 4)}\n"), ".foo {\ diff --git a/rsass/tests/spec/non_conformant/scss_tests/t084_test_function_empty_var_args.rs b/rsass/tests/spec/non_conformant/scss_tests/t084_test_function_empty_var_args.rs index 116e45120..60982b58c 100644 --- a/rsass/tests/spec/non_conformant/scss_tests/t084_test_function_empty_var_args.rs +++ b/rsass/tests/spec/non_conformant/scss_tests/t084_test_function_empty_var_args.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function foo($a, $b...) {\ - \n @return \"a: #{$a}, b: #{length($b)}\";\ + runner().ok("@use \"sass:list\";\ + \n@function foo($a, $b...) {\ + \n @return \"a: #{$a}, b: #{list.length($b)}\";\ \n}\n\ \n.foo {val: foo(1)}\n"), ".foo {\ diff --git a/rsass/tests/spec/non_conformant/scss_tests/t085_test_function_var_args_act_like_list.rs b/rsass/tests/spec/non_conformant/scss_tests/t085_test_function_var_args_act_like_list.rs index 7aab5b990..c7909922f 100644 --- a/rsass/tests/spec/non_conformant/scss_tests/t085_test_function_var_args_act_like_list.rs +++ b/rsass/tests/spec/non_conformant/scss_tests/t085_test_function_var_args_act_like_list.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function foo($a, $b...) {\ - \n @return \"a: #{length($b)}, b: #{nth($b, 2)}\";\ + runner().ok("@use \"sass:list\";\ + \n@function foo($a, $b...) {\ + \n @return \"a: #{list.length($b)}, b: #{list.nth($b, 2)}\";\ \n}\n\ \n.foo {val: foo(1, 2, 3, 4)}\n"), ".foo {\ diff --git a/rsass/tests/spec/non_conformant/scss_tests/t103_test_function_var_args_passed_to_native.rs b/rsass/tests/spec/non_conformant/scss_tests/t103_test_function_var_args_passed_to_native.rs index 34a09421e..991227bbd 100644 --- a/rsass/tests/spec/non_conformant/scss_tests/t103_test_function_var_args_passed_to_native.rs +++ b/rsass/tests/spec/non_conformant/scss_tests/t103_test_function_var_args_passed_to_native.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("@function foo($args...) {\ - \n @return adjust-color($args...);\ + runner().ok("@use \"sass:color\";\ + \n@function foo($args...) {\ + \n @return color.adjust($args...);\ \n}\n\ \n.foo {val: foo(#102030, $blue: 5)}\n"), ".foo {\ diff --git a/rsass/tests/spec/non_conformant/scss_tests/t190_test_options_passed_to_script.rs b/rsass/tests/spec/non_conformant/scss_tests/t190_test_options_passed_to_script.rs index eb1073047..8fa11741f 100644 --- a/rsass/tests/spec/non_conformant/scss_tests/t190_test_options_passed_to_script.rs +++ b/rsass/tests/spec/non_conformant/scss_tests/t190_test_options_passed_to_script.rs @@ -6,11 +6,13 @@ fn runner() -> crate::TestRunner { } #[test] +#[ignore] // wrong result fn test() { assert_eq!( - runner().ok("foo {color: darken(black, 10%)}\n"), + runner().ok("@use \"sass:color\";\ + \nfoo {color: color.adjust(black, $lightness: -10%)}\n"), "foo {\ - \n color: black;\ + \n color: hsl(0, 0%, -10%);\ \n}\n" ); } diff --git a/rsass/tests/spec/values/calculation/calc/error/value.rs b/rsass/tests/spec/values/calculation/calc/error/value.rs index de49a5687..f33cda379 100644 --- a/rsass/tests/spec/values/calculation/calc/error/value.rs +++ b/rsass/tests/spec/values/calculation/calc/error/value.rs @@ -63,7 +63,7 @@ mod function { "@function a() {@return 1 2 3}\ \nb {c: calc(a())}\n" ), - "Error: Value 1 2 3 can\'t be used in a calculation.\ + "Error: Value (1 2 3) can\'t be used in a calculation.\ \n ,\ \n2 | b {c: calc(a())}\ \n | ^^^\ @@ -175,7 +175,7 @@ mod variable { "$a: 1 2 3;\ \nb {c: calc($a)}\n" ), - "Error: Value 1 2 3 can\'t be used in a calculation.\ + "Error: Value (1 2 3) can\'t be used in a calculation.\ \n ,\ \n2 | b {c: calc($a)}\ \n | ^^\ diff --git a/rsass/tests/spec/values/calculation/calc/parens.rs b/rsass/tests/spec/values/calculation/calc/parens.rs index 4eb050d26..2e92749e4 100644 --- a/rsass/tests/spec/values/calculation/calc/parens.rs +++ b/rsass/tests/spec/values/calculation/calc/parens.rs @@ -87,7 +87,8 @@ mod var { #[test] fn variable() { assert_eq!( - runner().ok("$c: unquote(\"1 + 2\");\ + runner().ok("@use \"sass:string\";\ + \n$c: string.unquote(\"1 + 2\");\ \na {b: calc(($c))}\n"), "a {\ \n b: calc((1 + 2));\ diff --git a/rsass/tests/spec/values/calculation/calc/space.rs b/rsass/tests/spec/values/calculation/calc/space.rs index 6486992d5..ff5a7a89f 100644 --- a/rsass/tests/spec/values/calculation/calc/space.rs +++ b/rsass/tests/spec/values/calculation/calc/space.rs @@ -76,7 +76,8 @@ mod variable { #[test] fn after() { assert_eq!( - runner().ok("$c: unquote(\"+ 2\");\ + runner().ok("@use \"sass:string\";\ + \n$c: string.unquote(\"+ 2\");\ \na {b: calc(1 $c)}\n"), "a {\ \n b: calc(1 + 2);\ @@ -86,7 +87,8 @@ mod variable { #[test] fn before() { assert_eq!( - runner().ok("$c: unquote(\"1 +\");\ + runner().ok("@use \"sass:string\";\ + \n$c: string.unquote(\"1 +\");\ \na {b: calc($c 2)}\n"), "a {\ \n b: calc(1 + 2);\ @@ -96,7 +98,8 @@ mod variable { #[test] fn between() { assert_eq!( - runner().ok("$c: unquote(\"+ 2 +\");\ + runner().ok("@use \"sass:string\";\ + \n$c: string.unquote(\"+ 2 +\");\ \na {b: calc(1 $c 3)}\n"), "a {\ \n b: calc(1 + 2 + 3);\ diff --git a/rsass/tests/spec/values/colors/alpha_hex/initial_digit.rs b/rsass/tests/spec/values/colors/alpha_hex/initial_digit.rs index 014a0ff09..e1be0c95e 100644 --- a/rsass/tests/spec/values/colors/alpha_hex/initial_digit.rs +++ b/rsass/tests/spec/values/colors/alpha_hex/initial_digit.rs @@ -9,18 +9,19 @@ fn runner() -> crate::TestRunner { fn test() { let runner = runner().set_precision(10); assert_eq!( - runner.ok("a {\ + runner.ok("@use \"sass:color\";\ + \na {\ \n four-digit: #0123;\ \n eight-digit: #98765432;\n\ \n // Verify that the color channels are set correctly.\ - \n four-digit-red: red(#0123);\ - \n four-digit-green: green(#0123);\ - \n four-digit-blue: blue(#0123);\ - \n four-digit-alpha: alpha(#0123);\n\ - \n eight-digit-red: red(#98765432);\ - \n eight-digit-green: green(#98765432);\ - \n eight-digit-blue: blue(#98765432);\ - \n eight-digit-alpha: alpha(#98765432);\ + \n four-digit-red: color.red(#0123);\ + \n four-digit-green: color.green(#0123);\ + \n four-digit-blue: color.blue(#0123);\ + \n four-digit-alpha: color.alpha(#0123);\n\ + \n eight-digit-red: color.red(#98765432);\ + \n eight-digit-green: color.green(#98765432);\ + \n eight-digit-blue: color.blue(#98765432);\ + \n eight-digit-alpha: color.alpha(#98765432);\ \n}\n"), "a {\ \n four-digit: rgba(0, 17, 34, 0.2);\ diff --git a/rsass/tests/spec/values/colors/alpha_hex/initial_letter.rs b/rsass/tests/spec/values/colors/alpha_hex/initial_letter.rs index c0b8c6a30..4a820601f 100644 --- a/rsass/tests/spec/values/colors/alpha_hex/initial_letter.rs +++ b/rsass/tests/spec/values/colors/alpha_hex/initial_letter.rs @@ -9,18 +9,19 @@ fn runner() -> crate::TestRunner { fn test() { let runner = runner().set_precision(10); assert_eq!( - runner.ok("a {\ + runner.ok("@use \"sass:color\";\ + \na {\ \n four-digit: #AbCd;\ \n eight-digit: #aBcDeF12;\n\ \n // Verify that the color channels are set correctly.\ - \n four-digit-red: red(#abcd);\ - \n four-digit-green: green(#abcd);\ - \n four-digit-blue: blue(#abcd);\ - \n four-digit-alpha: alpha(#abcd);\n\ - \n eight-digit-red: red(#ABCDEF12);\ - \n eight-digit-green: green(#ABCDEF12);\ - \n eight-digit-blue: blue(#ABCDEF12);\ - \n eight-digit-alpha: alpha(#ABCDEF12);\ + \n four-digit-red: color.red(#abcd);\ + \n four-digit-green: color.green(#abcd);\ + \n four-digit-blue: color.blue(#abcd);\ + \n four-digit-alpha: color.alpha(#abcd);\n\ + \n eight-digit-red: color.red(#ABCDEF12);\ + \n eight-digit-green: color.green(#ABCDEF12);\ + \n eight-digit-blue: color.blue(#ABCDEF12);\ + \n eight-digit-alpha: color.alpha(#ABCDEF12);\ \n}\n"), "a {\ \n four-digit: rgba(170, 187, 204, 0.8666666667);\ diff --git a/rsass/tests/spec/values/colors/equality.rs b/rsass/tests/spec/values/colors/equality.rs new file mode 100644 index 000000000..eff98f4ac --- /dev/null +++ b/rsass/tests/spec/values/colors/equality.rs @@ -0,0 +1,346 @@ +//! Tests auto-converted from "sass-spec/spec/values/colors/equality.hrx" + +#[allow(unused)] +fn runner() -> crate::TestRunner { + super::runner().with_cwd("equality") +} + +mod test_false { + #[allow(unused)] + use super::runner; + + #[test] + fn different_space() { + assert_eq!( + runner() + .ok("a {b: color(srgb 0 0 0) == color(srgb-linear 0 0 0)}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + fn different_type() { + assert_eq!( + runner().ok("a {b: red == unquote(\"red\")}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + mod legacy { + #[allow(unused)] + use super::runner; + + #[test] + fn different_space() { + assert_eq!( + runner().ok("a {b: red == hsl(0, 0%, 50%)}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + mod same_space { + #[allow(unused)] + use super::runner; + + mod hsl { + #[allow(unused)] + use super::runner; + + #[test] + fn no_none() { + assert_eq!( + runner().ok( + "a {b: hsl(50deg 50% 80%) == hsl(51deg 50% 80%)}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn one_none() { + assert_eq!( + runner() + .ok("a {b: hsl(0 0% 80%) == hsl(none 0% 80%)}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + } + mod hwb { + #[allow(unused)] + use super::runner; + + #[test] + fn no_none() { + assert_eq!( + runner().ok( + "a {b: hwb(50deg 20% 30%) == hwb(51deg 20% 30%)}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + fn one_none() { + assert_eq!( + runner() + .ok("a {b: hwb(0 0% 0%) == hwb(none 0% 0%)}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + } + mod rgb { + #[allow(unused)] + use super::runner; + + #[test] + fn no_none() { + assert_eq!( + runner().ok("a {b: red == blue}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn one_none() { + assert_eq!( + runner().ok( + "a {b: rgb(0 100 200) == rgb(none 100 200)}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); + } + } + } + } + mod same_space { + #[allow(unused)] + use super::runner; + + #[test] + fn different_alpha() { + assert_eq!( + runner().ok( + "a {b: lab(50% 100 -100) == lab(50% 100 -100 / 0.9)}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + fn no_none() { + assert_eq!( + runner().ok( + "a {b: color(prophoto-rgb 0.1 0.2 0.3) == color(prophoto-rgb 0.1 0.2 0.4)}\n" + ), + "a {\ + \n b: false;\ + \n}\n" + ); + } + #[test] + fn one_none() { + assert_eq!( + runner().ok("a {b: oklch(50% 0% none) == oklch(50% 0% 0)}\n"), + "a {\ + \n b: false;\ + \n}\n" + ); + } + } +} +mod test_true { + #[allow(unused)] + use super::runner; + + #[test] + fn alpha() { + assert_eq!( + runner().ok( + "a {b: color(prophoto-rgb 0.3 0.4 0.5 / 0.6) == color(prophoto-rgb 0.3 0.4 0.5 / 0.6)}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } + mod legacy { + #[allow(unused)] + use super::runner; + + mod different_space { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn no_none() { + assert_eq!( + runner().ok( + "a {b: purple == hsl(300, 100%, 25.098039215686%)}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner() + .ok("a {b: gray == hsl(none 0% 50.196078431373%)}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } + } + mod same_space { + #[allow(unused)] + use super::runner; + + mod hsl { + #[allow(unused)] + use super::runner; + + #[test] + fn no_none() { + assert_eq!( + runner().ok( + "a {b: hsl(250, 80%, 20%) == hsl(250deg, 80%, 20%)}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "a {b: hsl(none 80% 20%) == hsl(none 80% 20%)}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + fn wrapped_hue() { + assert_eq!( + runner().ok( + "a {b: hsl(180, 80%, 20%) == hsl(540, 80%, 20%)}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } + } + mod hwb { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // wrong result + fn no_none() { + assert_eq!( + runner().ok( + "a {b: hwb(250 30% 20%) == hwb(250deg 30% 20%)}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + fn none() { + assert_eq!( + runner().ok( + "a {b: hwb(none 30% 20%) == hwb(none 30% 20%)}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } + } + mod rgb { + #[allow(unused)] + use super::runner; + + #[test] + fn no_none() { + assert_eq!( + runner().ok("a {b: #abcdef == #abcdef}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // unexepected error + fn none() { + assert_eq!( + runner().ok( + "a {b: rgb(50 none 120) == rgb(50 none 120)}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } + } + } + } + #[test] + fn no_alpha_or_none() { + assert_eq!( + runner().ok("a {b: lab(66% 50 -100) == lab(66% 50 -100)}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + fn none() { + assert_eq!( + runner().ok("a {b: lch(100% 0% none) == lch(100% 0% none)}\n"), + "a {\ + \n b: true;\ + \n}\n" + ); + } + #[test] + #[ignore] // wrong result + fn within_epsilon() { + assert_eq!( + runner().ok( + "a {\ + \n b: oklab(\ + \n 50.0000000000001 29.9999999999999 -20.0000000000001 / 0.999999999999\ + \n ) == oklab(50 30 -20);\ + \n}\n" + ), + "a {\ + \n b: true;\ + \n}\n" + ); + } +} diff --git a/rsass/tests/spec/values/colors/mod.rs b/rsass/tests/spec/values/colors/mod.rs index 918f6144a..cb650b4fd 100644 --- a/rsass/tests/spec/values/colors/mod.rs +++ b/rsass/tests/spec/values/colors/mod.rs @@ -6,3 +6,5 @@ fn runner() -> crate::TestRunner { } mod alpha_hex; + +mod equality; diff --git a/rsass/tests/spec/values/identifiers/escape/normalize.rs b/rsass/tests/spec/values/identifiers/escape/normalize.rs index 7256baf6c..565b34390 100644 --- a/rsass/tests/spec/values/identifiers/escape/normalize.rs +++ b/rsass/tests/spec/values/identifiers/escape/normalize.rs @@ -2,9 +2,7 @@ #[allow(unused)] fn runner() -> crate::TestRunner { - super::runner() - .with_cwd("normalize") - .mock_file("output-ruby-sass.css", "@charset \"UTF-8\";\n.normalize {\n name-start-char: ax ax ax ax ax ax;\n name-start-char-non-hex: xx;\n name-start-char-non-ascii: ☃x ☃x ☃x;\n name-char-in-middle: a-x a-x;\n name-char-at-start: \\-x \\-x;\n digit-in-middle: a1x a1x;\n digit-at-start: \\31 x \\31 x;\n non-printable: \\0 x \\1 x \\2 x \\3 x \\4 x \\5 x \\6 x \\7 x \\8 x \\b x \\e x \\f x \\10 x \\11 x \\12 x \\13 x \\14 x \\15 x \\16 x \\17 x \\18 x \\19 x \\1a x \\1b x \\1c x \\1d x \\1e x \\1f x \\7f x;\n newline: \\a x \\c x \\d x;\n tab: \\9 x \\9 x;\n name-char-interpolation-beginning: \\-foo;\n name-char-interpolation-middle: foo-bar;\n name-char-interpolation-end: foo-;\n raw-escaped-tab: \\\t;\n}\n\n@media screen\\9 {\n x {\n y: z;\n }\n}\nselector\\9 {\n x: y;\n}\n") + super::runner().with_cwd("normalize") } #[test] diff --git a/rsass/tests/spec/values/identifiers/escape/script.rs b/rsass/tests/spec/values/identifiers/escape/script.rs index e79b9dd01..d02033d3e 100644 --- a/rsass/tests/spec/values/identifiers/escape/script.rs +++ b/rsass/tests/spec/values/identifiers/escape/script.rs @@ -9,14 +9,15 @@ fn runner() -> crate::TestRunner { fn test() { assert_eq!( runner().ok( - "// SassScript functions operate on the normalized form of the identifier.\ + "@use \"sass:string\";\ + \n// SassScript functions operate on the normalized form of the identifier.\ \n.script {\ - \n unescaped-str-length: str-length(ax) str-length(\\61x) str-length(\\00061 x);\ - \n escaped-str-length: str-length(\\1Ax) str-length(\\0001A x);\n\ - \n unescaped-slice: str-slice(xaz, 2, 2) str-slice(x\\61z, 2, 2) str-slice(x\\00061 z, 2, 2);\ - \n escaped-slice: str-slice(x\\1Az, 2, 5) str-slice(x\\0001A z, 2, 5);\n\ - \n unescaped-quote: quote(ax) quote(\\61x) quote(\\00061 x);\ - \n escaped-quote: quote(\\1Ax) quote(\\0001A x);\ + \n unescaped-str-length: string.length(ax) string.length(\\61x) string.length(\\00061 x);\ + \n escaped-str-length: string.length(\\1Ax) string.length(\\0001A x);\n\ + \n unescaped-slice: string.slice(xaz, 2, 2) string.slice(x\\61z, 2, 2) string.slice(x\\00061 z, 2, 2);\ + \n escaped-slice: string.slice(x\\1Az, 2, 5) string.slice(x\\0001A z, 2, 5);\n\ + \n unescaped-quote: string.quote(ax) string.quote(\\61x) string.quote(\\00061 x);\ + \n escaped-quote: string.quote(\\1Ax) string.quote(\\0001A x);\ \n}\n" ), ".script {\ diff --git a/rsass/tests/spec/values/lists/slash.rs b/rsass/tests/spec/values/lists/slash.rs index a4fca5ffe..ea1a768ed 100644 --- a/rsass/tests/spec/values/lists/slash.rs +++ b/rsass/tests/spec/values/lists/slash.rs @@ -13,7 +13,7 @@ mod functions { fn length() { assert_eq!( runner().ok("@use \"sass:list\";\ - \na {b: length(list.slash(c, d, e, f, g))}\n"), + \na {b: list.length(list.slash(c, d, e, f, g))}\n"), "a {\ \n b: 5;\ \n}\n" @@ -23,7 +23,7 @@ mod functions { fn nth() { assert_eq!( runner().ok("@use \"sass:list\";\ - \na {b: nth(list.slash(c, d, e, f, g), 3)}\n"), + \na {b: list.nth(list.slash(c, d, e, f, g), 3)}\n"), "a {\ \n b: e;\ \n}\n" @@ -41,7 +41,7 @@ mod output { "@use \"sass:list\";\ \n// CSS doesn\'t use slash-separated bracketed lists, but Sass supports them in\ \n// case one day that changes.\ - \na {b: join(c d, e f, $separator: slash, $bracketed: true)}\n" + \na {b: list.join(c d, e f, $separator: slash, $bracketed: true)}\n" ), "a {\ \n b: [c / d / e / f];\ diff --git a/rsass/tests/spec/values/maps/invalid_key.rs b/rsass/tests/spec/values/maps/invalid_key.rs index 1b50e57b7..6e7b6bf8d 100644 --- a/rsass/tests/spec/values/maps/invalid_key.rs +++ b/rsass/tests/spec/values/maps/invalid_key.rs @@ -9,12 +9,15 @@ fn runner() -> crate::TestRunner { #[ignore] // wrong error fn test() { assert_eq!( - runner().err("$id: inspect((a,b:c)...)\n"), + runner().err( + "@use \"sass:meta\";\n\ + \n$id: meta.inspect((a,b:c)...)\n" + ), "Error: expected \")\".\ \n ,\ - \n1 | $id: inspect((a,b:c)...)\ - \n | ^\ + \n3 | $id: meta.inspect((a,b:c)...)\ + \n | ^\ \n \'\ - \n input.scss 1:18 root stylesheet", + \n input.scss 3:23 root stylesheet", ); } diff --git a/rsass/tests/spec/values/maps/key_equality.rs b/rsass/tests/spec/values/maps/key_equality.rs index 08f0c2c4b..f37db432d 100644 --- a/rsass/tests/spec/values/maps/key_equality.rs +++ b/rsass/tests/spec/values/maps/key_equality.rs @@ -12,26 +12,41 @@ mod infinity { #[test] fn negative() { assert_eq!( - runner().ok("a {b: inspect(map-get(((-1/0): b), -1/0))}\n"), - "a {\ + runner().ok( + "@use \"sass:map\";\ + \n@use \"sass:math\";\ + \n@use \"sass:meta\";\n\ + \na {b: meta.inspect(map.get(((math.div(-1, 0)): b), math.div(-1, 0)))}\n" + ), + "a {\ \n b: b;\ \n}\n" - ); + ); } #[test] fn positive() { assert_eq!( - runner().ok("a {b: inspect(map-get(((1/0): b), 1/0))}\n"), - "a {\ + runner().ok( + "@use \"sass:map\";\ + \n@use \"sass:math\";\ + \n@use \"sass:meta\";\n\ + \na {b: meta.inspect(map.get(((math.div(1, 0)): b), math.div(1, 0)))}\n" + ), + "a {\ \n b: b;\ \n}\n" - ); + ); } } #[test] fn nan() { assert_eq!( - runner().ok("a {b: inspect(map-get(((0/0): b), 0/0))}\n"), + runner().ok( + "@use \"sass:map\";\ + \n@use \"sass:math\";\ + \n@use \"sass:meta\";\n\ + \na {b: meta.inspect(map.get((math.div(0, 0): b), math.div(0, 0)))}\n" + ), "a {\ \n b: null;\ \n}\n" diff --git a/rsass/tests/spec/values/maps/length.rs b/rsass/tests/spec/values/maps/length.rs index 07d1e1c42..854977f49 100644 --- a/rsass/tests/spec/values/maps/length.rs +++ b/rsass/tests/spec/values/maps/length.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$map: (aaa: 100, bbb: 200, ccc: 300);\n\ + runner().ok("@use \"sass:list\";\ + \n$map: (aaa: 100, bbb: 200, ccc: 300);\n\ \na {\ - \n b: length($map);\ + \n b: list.length($map);\ \n}\n"), "a {\ \n b: 3;\ diff --git a/rsass/tests/spec/values/maps/map_values.rs b/rsass/tests/spec/values/maps/map_values.rs index 6557ba6a4..028e15416 100644 --- a/rsass/tests/spec/values/maps/map_values.rs +++ b/rsass/tests/spec/values/maps/map_values.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("div {\ - \n foo: map-values((foo: 1, bar: 2));\ - \n foo: map-values((foo: 1, bar: 2, baz: 2));\ + runner().ok("@use \"sass:map\";\ + \ndiv {\ + \n foo: map.values((foo: 1, bar: 2));\ + \n foo: map.values((foo: 1, bar: 2, baz: 2));\ \n}\n"), "div {\ \n foo: 1, 2;\ diff --git a/rsass/tests/spec/values/numbers/divide/slash_free/argument.rs b/rsass/tests/spec/values/numbers/divide/slash_free/argument.rs index d6ab30415..71826943c 100644 --- a/rsass/tests/spec/values/numbers/divide/slash_free/argument.rs +++ b/rsass/tests/spec/values/numbers/divide/slash_free/argument.rs @@ -12,7 +12,8 @@ mod function { #[test] fn built_in() { assert_eq!( - runner().ok("c {d: join(1/2, 3/4)}\n"), + runner().ok("@use \"sass:list\";\ + \nc {d: list.join(1/2, 3/4)}\n"), "c {\ \n d: 0.5 0.75;\ \n}\n" @@ -21,7 +22,8 @@ mod function { #[test] fn named() { assert_eq!( - runner().ok("c {d: join($list1: 1/2, $list2: 3/4)}\n"), + runner().ok("@use \"sass:list\";\ + \nc {d: list.join($list1: 1/2, $list2: 3/4)}\n"), "c {\ \n d: 0.5 0.75;\ \n}\n" @@ -34,7 +36,8 @@ mod function { #[test] fn kwargs() { assert_eq!( - runner().ok("c {d: join(1/2..., (\"list2\": 3/4)...)}\n"), + runner().ok("@use \"sass:list\";\ + \nc {d: list.join(1/2..., (\"list2\": 3/4)...)}\n"), "c {\ \n d: 0.5 0.75;\ \n}\n" @@ -43,7 +46,8 @@ mod function { #[test] fn list() { assert_eq!( - runner().ok("c {d: join(1/2 3/4...)}\n"), + runner().ok("@use \"sass:list\";\ + \nc {d: list.join(1/2 3/4...)}\n"), "c {\ \n d: 0.5 0.75;\ \n}\n" @@ -52,8 +56,8 @@ mod function { #[test] fn map() { assert_eq!( - runner() - .ok("c {d: join((\"list1\": 1/2, \"list2\": 3/4)...)}\n"), + runner().ok("@use \"sass:list\";\ + \nc {d: list.join((\"list1\": 1/2, \"list2\": 3/4)...)}\n"), "c {\ \n d: 0.5 0.75;\ \n}\n" @@ -62,7 +66,8 @@ mod function { #[test] fn single() { assert_eq!( - runner().ok("c {d: join(1/2, 3/4...)}\n"), + runner().ok("@use \"sass:list\";\ + \nc {d: list.join(1/2, 3/4...)}\n"), "c {\ \n d: 0.5 0.75;\ \n}\n" diff --git a/rsass/tests/spec/values/numbers/divide/slash_free/test_return.rs b/rsass/tests/spec/values/numbers/divide/slash_free/test_return.rs index 76032a0fa..af155e0bf 100644 --- a/rsass/tests/spec/values/numbers/divide/slash_free/test_return.rs +++ b/rsass/tests/spec/values/numbers/divide/slash_free/test_return.rs @@ -8,7 +8,8 @@ fn runner() -> crate::TestRunner { #[test] fn built_in() { assert_eq!( - runner().ok("a {b: nth(3 1/2 4, 2)}\n"), + runner().ok("@use \"sass:list\";\ + \na {b: list.nth(3 1/2 4, 2)}\n"), "a {\ \n b: 0.5;\ \n}\n" diff --git a/rsass/tests/spec/values/numbers/divide/slash_separated.rs b/rsass/tests/spec/values/numbers/divide/slash_separated.rs index 8d67fdcaa..6f41f05eb 100644 --- a/rsass/tests/spec/values/numbers/divide/slash_separated.rs +++ b/rsass/tests/spec/values/numbers/divide/slash_separated.rs @@ -20,7 +20,8 @@ mod list { #[test] fn built_in() { assert_eq!( - runner().ok("c {d: join(1 2/3 4, ())}\n"), + runner().ok("@use \"sass:list\";\ + \nc {d: list.join(1 2/3 4, ())}\n"), "c {\ \n d: 1 2/3 4;\ \n}\n" diff --git a/rsass/tests/spec/values/numbers/modulo/zeros.rs b/rsass/tests/spec/values/numbers/modulo/zeros.rs index d3d828f98..32bbda854 100644 --- a/rsass/tests/spec/values/numbers/modulo/zeros.rs +++ b/rsass/tests/spec/values/numbers/modulo/zeros.rs @@ -52,8 +52,9 @@ fn positive_positive() { #[test] fn zero_divider() { assert_eq!( - runner().ok("a {\ - \n b: inspect(1 % 0);\ + runner().ok("@use \"sass:meta\";\n\ + \na {\ + \n b: meta.inspect(1 % 0);\ \n}\n"), "a {\ \n b: calc(NaN);\ diff --git a/rsass/tests/spec/values/numbers/units/multiple/divide_by_multiple_denominators.rs b/rsass/tests/spec/values/numbers/units/multiple/divide_by_multiple_denominators.rs index 0e24e77fa..a678b5215 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/divide_by_multiple_denominators.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/divide_by_multiple_denominators.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("a {\ - \n b: inspect(1 / (1 / 1px / 1rad));\ + runner().ok("@use \"sass:meta\";\ + \na {\ + \n b: meta.inspect(1 / (1 / 1px / 1rad));\ \n}\n"), "a {\ \n b: calc(1px * 1rad);\ diff --git a/rsass/tests/spec/values/numbers/units/multiple/divide_by_multiple_numerators.rs b/rsass/tests/spec/values/numbers/units/multiple/divide_by_multiple_numerators.rs index 21c2e6697..b1fb2b7f0 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/divide_by_multiple_numerators.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/divide_by_multiple_numerators.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("a {\ - \n b: inspect(1 / (1px * 1rad));\ + runner().ok("@use \"sass:meta\";\ + \na {\ + \n b: meta.inspect(1 / (1px * 1rad));\ \n}\n"), "a {\ \n b: calc(1 / 1px / 1rad);\ diff --git a/rsass/tests/spec/values/numbers/units/multiple/division_cancels_both.rs b/rsass/tests/spec/values/numbers/units/multiple/division_cancels_both.rs index 5e982167b..340e0fdb5 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/division_cancels_both.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/division_cancels_both.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$number: 1px * 1rad / 1ms / 1Hz;\ + runner().ok("@use \"sass:meta\";\ + \n$number: 1px * 1rad / 1ms / 1Hz;\ \na {\ - \n b: inspect($number / (1px / 1ms));\ + \n b: meta.inspect($number / (1px / 1ms));\ \n}\n"), "a {\ \n b: calc(1rad / 1Hz);\ diff --git a/rsass/tests/spec/values/numbers/units/multiple/division_cancels_compatible.rs b/rsass/tests/spec/values/numbers/units/multiple/division_cancels_compatible.rs index ea62aed66..7b4a9e9be 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/division_cancels_compatible.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/division_cancels_compatible.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$number: 1px * 1rad / 1ms / 1Hz;\ + runner().ok("@use \"sass:meta\";\ + \n$number: 1px * 1rad / 1ms / 1Hz;\ \na {\ - \n b: inspect($number / 1in);\ + \n b: meta.inspect($number / 1in);\ \n}\n"), "a {\ \n b: calc(0.0104166667rad / 1ms / 1Hz);\ diff --git a/rsass/tests/spec/values/numbers/units/multiple/division_cancels_denominator.rs b/rsass/tests/spec/values/numbers/units/multiple/division_cancels_denominator.rs index 4fda1a2f4..59ca4c087 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/division_cancels_denominator.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/division_cancels_denominator.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$number: 1px * 1rad / 1ms / 1Hz;\ + runner().ok("@use \"sass:meta\";\ + \n$number: 1px * 1rad / 1ms / 1Hz;\ \na {\ - \n b: inspect($number / (1 / 1ms));\ + \n b: meta.inspect($number / (1 / 1ms));\ \n}\n"), "a {\ \n b: calc(1px * 1rad / 1Hz);\ diff --git a/rsass/tests/spec/values/numbers/units/multiple/division_cancels_denominator_twice.rs b/rsass/tests/spec/values/numbers/units/multiple/division_cancels_denominator_twice.rs index 2a73d3589..534fdc28a 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/division_cancels_denominator_twice.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/division_cancels_denominator_twice.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$number: 1px * 1rad / 1ms / 1Hz;\ + runner().ok("@use \"sass:meta\";\ + \n$number: 1px * 1rad / 1ms / 1Hz;\ \na {\ - \n b: inspect($number / (1 / 1ms / 1Hz));\ + \n b: meta.inspect($number / (1 / 1ms / 1Hz));\ \n}\n"), "a {\ \n b: calc(1px * 1rad);\ diff --git a/rsass/tests/spec/values/numbers/units/multiple/division_cancels_numerator.rs b/rsass/tests/spec/values/numbers/units/multiple/division_cancels_numerator.rs index 915fa8295..5d9094136 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/division_cancels_numerator.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/division_cancels_numerator.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$number: 1px * 1rad / 1ms / 1Hz;\ + runner().ok("@use \"sass:meta\";\ + \n$number: 1px * 1rad / 1ms / 1Hz;\ \na {\ - \n b: inspect($number / 1px);\ + \n b: meta.inspect($number / 1px);\ \n}\n"), "a {\ \n b: calc(1rad / 1ms / 1Hz);\ diff --git a/rsass/tests/spec/values/numbers/units/multiple/division_cancels_numerator_twice.rs b/rsass/tests/spec/values/numbers/units/multiple/division_cancels_numerator_twice.rs index 7112ca259..10a43500c 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/division_cancels_numerator_twice.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/division_cancels_numerator_twice.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$number: 1px * 1rad / 1ms / 1Hz;\ + runner().ok("@use \"sass:meta\";\ + \n$number: 1px * 1rad / 1ms / 1Hz;\ \na {\ - \n b: inspect($number / (1px * 1rad));\ + \n b: meta.inspect($number / (1px * 1rad));\ \n}\n"), "a {\ \n b: calc(1 / 1ms / 1Hz);\ diff --git a/rsass/tests/spec/values/numbers/units/multiple/division_cancels_unknown.rs b/rsass/tests/spec/values/numbers/units/multiple/division_cancels_unknown.rs index a205ded9d..886cbf468 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/division_cancels_unknown.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/division_cancels_unknown.rs @@ -8,13 +8,12 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok( - "// Units cancel even if they\'re totally unknown to Sass.\ + runner().ok("@use \"sass:meta\";\ + \n// Units cancel even if they\'re totally unknown to Sass.\ \n$number: 1foo * 1bar / 1baz / 1qux;\ \na {\ - \n b: inspect($number / 1foo);\ - \n}\n" - ), + \n b: meta.inspect($number / 1foo);\ + \n}\n"), "a {\ \n b: calc(1bar / 1baz / 1qux);\ \n}\n" diff --git a/rsass/tests/spec/values/numbers/units/multiple/multiple_denominators.rs b/rsass/tests/spec/values/numbers/units/multiple/multiple_denominators.rs index e9b4a88a5..86bfa9fa9 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/multiple_denominators.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/multiple_denominators.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("a {\ - \n b: inspect((1 / 1px / 1rad));\ + runner().ok("@use \"sass:meta\";\ + \na {\ + \n b: meta.inspect((1 / 1px / 1rad));\ \n}\n"), "a {\ \n b: calc(1 / 1px / 1rad);\ diff --git a/rsass/tests/spec/values/numbers/units/multiple/multiple_numerators.rs b/rsass/tests/spec/values/numbers/units/multiple/multiple_numerators.rs index 4e9090e5d..8f8bbf1ee 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/multiple_numerators.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/multiple_numerators.rs @@ -8,8 +8,9 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("a {\ - \n b: inspect(1px * 1rad);\ + runner().ok("@use \"sass:meta\";\ + \na {\ + \n b: meta.inspect(1px * 1rad);\ \n}\n"), "a {\ \n b: calc(1px * 1rad);\ diff --git a/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_both.rs b/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_both.rs index c30f9ab4c..66c690f01 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_both.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_both.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$number: 1px * 1rad / 1ms / 1Hz;\ + runner().ok("@use \"sass:meta\";\ + \n$number: 1px * 1rad / 1ms / 1Hz;\ \na {\ - \n b: inspect($number * (1ms / 1px));\ + \n b: meta.inspect($number * (1ms / 1px));\ \n}\n"), "a {\ \n b: calc(1rad / 1Hz);\ diff --git a/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_compatible.rs b/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_compatible.rs index 668135d56..ea87e1d02 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_compatible.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_compatible.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$number: 1px * 1rad / 1ms / 1Hz;\ + runner().ok("@use \"sass:meta\";\ + \n$number: 1px * 1rad / 1ms / 1Hz;\ \na {\ - \n b: inspect($number * 1s);\ + \n b: meta.inspect($number * 1s);\ \n}\n"), "a {\ \n b: calc(1000px * 1rad / 1Hz);\ diff --git a/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_denominator.rs b/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_denominator.rs index 58b0197c9..6a3c4bde8 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_denominator.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_denominator.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$number: 1px * 1rad / 1ms / 1Hz;\ + runner().ok("@use \"sass:meta\";\ + \n$number: 1px * 1rad / 1ms / 1Hz;\ \na {\ - \n b: inspect($number * 1ms);\ + \n b: meta.inspect($number * 1ms);\ \n}\n"), "a {\ \n b: calc(1px * 1rad / 1Hz);\ diff --git a/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_denominator_twice.rs b/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_denominator_twice.rs index 55a11b996..401fe969d 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_denominator_twice.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_denominator_twice.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$number: 1px * 1rad / 1ms / 1Hz;\ + runner().ok("@use \"sass:meta\";\ + \n$number: 1px * 1rad / 1ms / 1Hz;\ \na {\ - \n b: inspect($number * (1ms * 1Hz));\ + \n b: meta.inspect($number * (1ms * 1Hz));\ \n}\n"), "a {\ \n b: calc(1px * 1rad);\ diff --git a/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_numerator.rs b/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_numerator.rs index b0c269631..3efd1d9c6 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_numerator.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_numerator.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$number: 1px * 1rad / 1ms / 1Hz;\ + runner().ok("@use \"sass:meta\";\ + \n$number: 1px * 1rad / 1ms / 1Hz;\ \na {\ - \n b: inspect($number * (1 / 1px));\ + \n b: meta.inspect($number * (1 / 1px));\ \n}\n"), "a {\ \n b: calc(1rad / 1ms / 1Hz);\ diff --git a/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_numerator_twice.rs b/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_numerator_twice.rs index 29e11d852..2dc420af5 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_numerator_twice.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_numerator_twice.rs @@ -8,9 +8,10 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok("$number: 1px * 1rad / 1ms / 1Hz;\ + runner().ok("@use \"sass:meta\";\ + \n$number: 1px * 1rad / 1ms / 1Hz;\ \na {\ - \n b: inspect($number * (1 / 1px / 1rad));\ + \n b: meta.inspect($number * (1 / 1px / 1rad));\ \n}\n"), "a {\ \n b: calc(1 / 1ms / 1Hz);\ diff --git a/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_unknown.rs b/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_unknown.rs index ae7b31b00..1a2759fff 100644 --- a/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_unknown.rs +++ b/rsass/tests/spec/values/numbers/units/multiple/multiplication_cancels_unknown.rs @@ -8,13 +8,12 @@ fn runner() -> crate::TestRunner { #[test] fn test() { assert_eq!( - runner().ok( - "// Units cancel even if they\'re totally unknown to Sass.\ + runner().ok("@use \"sass:meta\";\ + \n// Units cancel even if they\'re totally unknown to Sass.\ \n$number: 1foo * 1bar / 1baz / 1qux;\ \na {\ - \n b: inspect($number * 1baz);\ - \n}\n" - ), + \n b: meta.inspect($number * 1baz);\ + \n}\n"), "a {\ \n b: calc(1foo * 1bar / 1qux);\ \n}\n" diff --git a/rsass/tests/spec/variables.rs b/rsass/tests/spec/variables.rs index 055dced1e..9df51ca07 100644 --- a/rsass/tests/spec/variables.rs +++ b/rsass/tests/spec/variables.rs @@ -5,6 +5,59 @@ fn runner() -> crate::TestRunner { super::runner().with_cwd("variables") } +mod comment { + #[allow(unused)] + use super::runner; + + mod after_colon { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!(runner().ok("$a: /**/ b\n"), ""); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("$a: //\ + \n b\n"), + "" + ); + } + } + mod after_value { + #[allow(unused)] + use super::runner; + + #[test] + fn loud() { + assert_eq!(runner().ok("$a: b /**/\n"), ""); + } + #[test] + fn silent() { + assert_eq!(runner().ok("$a: b //\n"), ""); + } + } + mod before_colon { + #[allow(unused)] + use super::runner; + + #[test] + #[ignore] // unexepected error + fn loud() { + assert_eq!(runner().ok("$a /**/: b\n"), ""); + } + #[test] + fn silent() { + assert_eq!( + runner().ok("$a //\ + \n : b\n"), + "" + ); + } + } +} mod double_flag { #[allow(unused)] use super::runner;