Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
* Pre-apply sass/sass-spec#1431
* Improve error handling in spectest itself.
  • Loading branch information
kaj committed Jul 15, 2019
1 parent 44488f1 commit 6a215b9
Show file tree
Hide file tree
Showing 16 changed files with 2,482 additions and 789 deletions.
9 changes: 7 additions & 2 deletions src/spectest/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,8 @@ fn fn_name(name: &str) -> String {
.replace('.', "_");
if t.chars().next().unwrap_or('0').is_numeric() {
format!("t{}", t)
} else if t == "else"
} else if t == "as"
|| t == "else"
|| t == "false"
|| t == "for"
|| t == "if"
Expand Down Expand Up @@ -436,8 +437,12 @@ fn load_test_fixture_hrx(
));
}
}
return Err(Error(format!(
"No expected CSS / error found for {:?}",
prefix,
)));
}
Err(Error("No expected CSS / error found".into()))
Err(Error(format!("No input found for {:?}", prefix)))
}

/// Load options from options.yml.
Expand Down
14 changes: 1 addition & 13 deletions tests/basic/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Tests auto-converted from "sass-spec/spec/basic"
//! version d8dc38cd, 2019-07-03 17:55:12 -0700.
//! version a62d3300, 2019-07-12 01:55:28 +0100.
//! See <https://github.com/sass/sass-spec> for source material.\n
//! The following tests are excluded from conversion:
//! ["14_imports.hrx", "33_ambiguous_imports.hrx"]
Expand Down Expand Up @@ -598,18 +598,6 @@ fn t59_if_expression() {
);
}

// From "sass-spec/spec/basic/60_call.hrx"
#[test]
fn t60_call() {
assert_eq!(
rsass(
"@function foobar() {\n @return foobar;\n}\n\n@function fudge($str) {\n @return \"assets/fudge/\" + $str;\n}\n\n\nbody {\n display: call(foobar); \n display: call(min, 1,3,5,7);\n display: call(min, 5);\n display: call(max, 10,3,5,7);\n color: fudge(\"blah\");\n}"
)
.unwrap(),
"body {\n display: foobar;\n display: 1;\n display: 5;\n display: 10;\n color: \"assets/fudge/blah\";\n}\n"
);
}

fn rsass(input: &str) -> Result<String, String> {
compile_scss(input.as_bytes(), OutputStyle::Expanded)
.map_err(|e| format!("rsass failed: {}", e))
Expand Down
2 changes: 1 addition & 1 deletion tests/colors/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Tests auto-converted from "sass-spec/spec/colors"
//! version d8dc38cd, 2019-07-03 17:55:12 -0700.
//! version a62d3300, 2019-07-12 01:55:28 +0100.
//! See <https://github.com/sass/sass-spec> for source material.\n
use rsass::{compile_scss, OutputStyle};

Expand Down
Loading

0 comments on commit 6a215b9

Please sign in to comment.