Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/parser/src/tests.rs')
| -rw-r--r-- | crates/parser/src/tests.rs | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/crates/parser/src/tests.rs b/crates/parser/src/tests.rs index f6f8742725..7a6230eaf8 100644 --- a/crates/parser/src/tests.rs +++ b/crates/parser/src/tests.rs @@ -1,3 +1,5 @@ +mod sourcegen_inline_tests; + use std::{ fmt::Write, fs, @@ -9,7 +11,7 @@ use expect_test::expect_file; use crate::LexedStr; #[test] -fn lex_valid() { +fn lex_ok() { for case in TestCase::list("lexer/ok") { let actual = lex(&case.text); expect_file![case.txt].assert_eq(&actual) @@ -17,7 +19,7 @@ fn lex_valid() { } #[test] -fn lex_invalid() { +fn lex_err() { for case in TestCase::list("lexer/err") { let actual = lex(&case.text); expect_file![case.txt].assert_eq(&actual) @@ -40,7 +42,7 @@ fn lex(text: &str) -> String { } #[test] -fn parse_valid() { +fn parse_ok() { for case in TestCase::list("parser/ok") { let (actual, errors) = parse(&case.text); assert!(!errors, "errors in an OK file {}:\n{}", case.rs.display(), actual); @@ -49,7 +51,16 @@ fn parse_valid() { } #[test] -fn parse_invalid() { +fn parse_inline_ok() { + for case in TestCase::list("parser/inline/ok") { + let (actual, errors) = parse(&case.text); + assert!(!errors, "errors in an OK file {}:\n{}", case.rs.display(), actual); + expect_file![case.txt].assert_eq(&actual); + } +} + +#[test] +fn parse_err() { for case in TestCase::list("parser/err") { let (actual, errors) = parse(&case.text); assert!(errors, "no errors in an ERR file {}:\n{}", case.rs.display(), actual); @@ -57,6 +68,15 @@ fn parse_invalid() { } } +#[test] +fn parse_inline_err() { + for case in TestCase::list("parser/inline/err") { + let (actual, errors) = parse(&case.text); + assert!(errors, "no errors in an ERR file {}:\n{}", case.rs.display(), actual); + expect_file![case.txt].assert_eq(&actual) + } +} + fn parse(text: &str) -> (String, bool) { let lexed = LexedStr::new(text); let input = lexed.to_input(); |