-
-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moved tokenizer.rs and tree_construction.rs tests into crates for issue #445 #457
Changes from 4 commits
67c1ea7
9393b48
d290386
43fca24
665c762
2b042a2
ee44864
8fc2ccb
272c205
c0c543a
4a819c3
50af07b
c1ee0fa
693eced
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
use gosub_testing::testing::tokenizer::{self, FixtureFile}; | ||
use lazy_static::lazy_static; | ||
use std::collections::HashSet; | ||
use test_case::test_case; | ||
|
||
#[cfg(test)] | ||
mod tests{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think an extra |
||
const DISABLED_CASES: &[&str] = &[ | ||
// TODO: Handle UTF-16 high and low private surrogate characters | ||
// https://www.compart.com/en/unicode/U+DBC0 | ||
// https://www.compart.com/en/unicode/U+DC00 | ||
";\\uDBC0\\uDC00", | ||
"<!-- -\\uDBC0\\uDC00", | ||
"<!-- \\uDBC0\\uDC00", | ||
"<!----\\uDBC0\\uDC00", | ||
"<!---\\uDBC0\\uDC00", | ||
"<!--\\uDBC0\\uDC00", | ||
"<!DOCTYPE a PUBLIC\"\\uDBC0\\uDC00", | ||
"<!DOCTYPE a PUBLIC'\\uDBC0\\uDC00", | ||
"<!DOCTYPE a SYSTEM\"\\uDBC0\\uDC00", | ||
"<!DOCTYPE a SYSTEM'\\uDBC0\\uDC00", | ||
"<!DOCTYPE a\\uDBC0\\uDC00", | ||
"<!DOCTYPE \\uDBC0\\uDC00", | ||
"<!DOCTYPEa PUBLIC\"\\uDBC0\\uDC00", | ||
"<!DOCTYPEa PUBLIC'\\uDBC0\\uDC00", | ||
"<!DOCTYPEa SYSTEM\"\\uDBC0\\uDC00", | ||
"<!DOCTYPEa SYSTEM'\\uDBC0\\uDC00", | ||
"<!DOCTYPEa\\uDBC0\\uDC00", | ||
"<!DOCTYPE\\uDBC0\\uDC00", | ||
"\\uDBC0\\uDC00", | ||
]; | ||
|
||
lazy_static! { | ||
static ref DISABLED: HashSet<String> = DISABLED_CASES | ||
.iter() | ||
.map(|s| s.to_string()) | ||
.collect::<HashSet<_>>(); | ||
} | ||
|
||
#[test_case("contentModelFlags.test")] | ||
#[test_case("domjs.test")] | ||
#[test_case("entities.test")] | ||
#[test_case("escapeFlag.test")] | ||
#[test_case("namedEntities.test")] | ||
#[test_case("numericEntities.test")] | ||
#[test_case("pendingSpecChanges.test")] | ||
#[test_case("test1.test")] | ||
#[test_case("test2.test")] | ||
#[test_case("test3.test")] | ||
#[test_case("test4.test")] | ||
// #[test_case("unicodeCharsProblematic.test")] | ||
#[test_case("unicodeChars.test")] | ||
// #[test_case("xmlViolation.test")] | ||
fn tokenization(filename: &str) { | ||
let root = tokenizer::fixture_from_filename(filename).unwrap(); | ||
|
||
let tests = match root { | ||
FixtureFile::Tests { tests } => tests, | ||
FixtureFile::XmlTests { tests } => tests, | ||
}; | ||
|
||
for test in tests { | ||
if DISABLED.contains(&test.description) { | ||
// Check that we don't panic | ||
test.tokenize(); | ||
continue; | ||
} | ||
|
||
test.assert_valid(); | ||
} | ||
} | ||
} |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to not like these imports for some reason when i run
make test
locally. Where is thetest_case
macro being defined?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an external crate. Basically just run
cargo add test_case --dev -p gosub_html5
It also seems like fmt and clippy aren't happy, it can be fixed via
make format
I haven't looked really into what is wrong, again I'll do that tomorrow.