Skip to content

Commit

Permalink
Update sass-spec to 2024-10-18.
Browse files Browse the repository at this point in the history
Lots of deprecation stuff that I don't yet have the infrastructure to
support properly.
  • Loading branch information
kaj committed Oct 27, 2024
1 parent 3a683c4 commit c445195
Show file tree
Hide file tree
Showing 72 changed files with 1,900 additions and 647 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ project adheres to
* Improved parse error handling (Issue #141, PR #201, PR #205).
Many parse errors now match the dart sass error message.
Also allow "loud" comments in more places.
* Updated sass-spec test suite to 2024-10-10.
* Updated sass-spec test suite to 2024-10-18.


## Release 0.28.10
Expand Down
201 changes: 0 additions & 201 deletions rsass/tests/spec/core_functions/color/adjust_hue.rs

This file was deleted.

16 changes: 16 additions & 0 deletions rsass/tests/spec/core_functions/color/adjust_hue/above_max.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust_hue/above_max.hrx"
#[allow(unused)]
fn runner() -> crate::TestRunner {
super::runner().with_cwd("above_max")
}

#[test]
fn test() {
assert_eq!(
runner().ok("a {b: adjust-hue(red, 540)}\n"),
"a {\
\n b: aqua;\
\n}\n"
);
}
16 changes: 16 additions & 0 deletions rsass/tests/spec/core_functions/color/adjust_hue/alpha.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust_hue/alpha.hrx"
#[allow(unused)]
fn runner() -> crate::TestRunner {
super::runner().with_cwd("alpha")
}

#[test]
fn test() {
assert_eq!(
runner().ok("a {b: adjust-hue(rgba(red, 0.1), 359)}\n"),
"a {\
\n b: rgba(255, 0, 4.25, 0.1);\
\n}\n"
);
}
113 changes: 113 additions & 0 deletions rsass/tests/spec/core_functions/color/adjust_hue/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust_hue/error.hrx"
#[allow(unused)]
fn runner() -> crate::TestRunner {
super::runner().with_cwd("error")
}

#[test]
#[ignore] // wrong error
fn non_legacy() {
assert_eq!(
runner().err(
"a {b: adjust-hue(lch(0% 0 0deg), 10deg)}\n"
),
"DEPRECATION WARNING: Global built-in functions are deprecated and will be removed in Dart Sass 3.0.0.\
\nUse color.adjust instead.\n\
\nMore info and automated migrator: https://sass-lang.com/d/import\n\
\n ,\
\n1 | a {b: adjust-hue(lch(0% 0 0deg), 10deg)}\
\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\
\n \'\
\n input.scss 1:7 root stylesheet\n\
\nError: 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!(
runner().err("a {b: adjust-hue(red)}\n"),
"Error: Missing argument $degrees.\
\n ,--> input.scss\
\n1 | a {b: adjust-hue(red)}\
\n | ^^^^^^^^^^^^^^^ invocation\
\n \'\
\n ,--> sass:color\
\n1 | @function adjust-hue($color, $degrees) {\
\n | ============================ declaration\
\n \'\
\n input.scss 1:7 root stylesheet",
);
}
#[test]
fn too_many_args() {
assert_eq!(
runner().err("a {b: adjust-hue(red, 1, 2)}\n"),
"Error: Only 2 arguments allowed, but 3 were passed.\
\n ,--> input.scss\
\n1 | a {b: adjust-hue(red, 1, 2)}\
\n | ^^^^^^^^^^^^^^^^^^^^^ invocation\
\n \'\
\n ,--> sass:color\
\n1 | @function adjust-hue($color, $degrees) {\
\n | ============================ declaration\
\n \'\
\n input.scss 1:7 root stylesheet",
);
}
mod test_type {
#[allow(unused)]
use super::runner;

#[test]
#[ignore] // wrong error
fn color() {
assert_eq!(
runner().err(
"a {b: adjust-hue(1, 2)}\n"
),
"DEPRECATION WARNING: Global built-in functions are deprecated and will be removed in Dart Sass 3.0.0.\
\nUse color.adjust instead.\n\
\nMore info and automated migrator: https://sass-lang.com/d/import\n\
\n ,\
\n1 | a {b: adjust-hue(1, 2)}\
\n | ^^^^^^^^^^^^^^^^\
\n \'\
\n input.scss 1:7 root stylesheet\n\
\nError: $color: 1 is not a color.\
\n ,\
\n1 | a {b: adjust-hue(1, 2)}\
\n | ^^^^^^^^^^^^^^^^\
\n \'\
\n input.scss 1:7 root stylesheet",
);
}
#[test]
#[ignore] // wrong error
fn hue() {
assert_eq!(
runner().err(
"a {b: adjust-hue(red, blue)}\n"
),
"DEPRECATION WARNING: Global built-in functions are deprecated and will be removed in Dart Sass 3.0.0.\
\nUse color.adjust instead.\n\
\nMore info and automated migrator: https://sass-lang.com/d/import\n\
\n ,\
\n1 | a {b: adjust-hue(red, blue)}\
\n | ^^^^^^^^^^^^^^^^^^^^^\
\n \'\
\n input.scss 1:7 root stylesheet\n\
\nError: $degrees: blue is not a number.\
\n ,\
\n1 | a {b: adjust-hue(red, blue)}\
\n | ^^^^^^^^^^^^^^^^^^^^^\
\n \'\
\n input.scss 1:7 root stylesheet",
);
}
}
16 changes: 16 additions & 0 deletions rsass/tests/spec/core_functions/color/adjust_hue/fraction.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust_hue/fraction.hrx"
#[allow(unused)]
fn runner() -> crate::TestRunner {
super::runner().with_cwd("fraction")
}

#[test]
fn test() {
assert_eq!(
runner().ok("a {b: adjust-hue(red, 0.5)}\n"),
"a {\
\n b: rgb(255, 2.125, 0);\
\n}\n"
);
}
16 changes: 16 additions & 0 deletions rsass/tests/spec/core_functions/color/adjust_hue/max.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust_hue/max.hrx"
#[allow(unused)]
fn runner() -> crate::TestRunner {
super::runner().with_cwd("max")
}

#[test]
fn test() {
assert_eq!(
runner().ok("a {b: adjust-hue(red, 359)}\n"),
"a {\
\n b: rgb(255, 0, 4.25);\
\n}\n"
);
}
Loading

0 comments on commit c445195

Please sign in to comment.