From 3e8b2f443a44ba40d6ba3e370d8292eff2a81381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Sat, 21 Dec 2024 17:42:13 -0800 Subject: [PATCH] feat(compliance): pull in final extra tests and change VT to newline --- src/v2_parser.rs | 11 ++++++----- .../expected_kdl/vertical_tab_whitespace.kdl | 1 + tests/test_cases/input/vertical_tab_whitespace.kdl | 2 +- .../input/zero_space_before_first_arg_fail.kdl | 1 + .../test_cases/input/zero_space_before_prop_fail.kdl | 1 + .../input/zero_space_before_second_arg_fail.kdl | 1 + .../input/zero_space_before_slashdash_arg_fail.kdl | 1 + 7 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 tests/test_cases/input/zero_space_before_first_arg_fail.kdl create mode 100644 tests/test_cases/input/zero_space_before_prop_fail.kdl create mode 100644 tests/test_cases/input/zero_space_before_second_arg_fail.kdl create mode 100644 tests/test_cases/input/zero_space_before_slashdash_arg_fail.kdl diff --git a/src/v2_parser.rs b/src/v2_parser.rs index 73986c3..6467fcb 100644 --- a/src/v2_parser.rs +++ b/src/v2_parser.rs @@ -1578,11 +1578,12 @@ fn escline_test() { assert_eq!(node.entries().len(), 2); } -pub(crate) static NEWLINES: [&str; 7] = [ +pub(crate) static NEWLINES: [&str; 8] = [ "\u{000D}\u{000A}", "\u{000D}", "\u{000A}", "\u{0085}", + "\u{000B}", "\u{000C}", "\u{2028}", "\u{2029}", @@ -1609,10 +1610,10 @@ fn ws(input: &mut Input<'_>) -> PResult<()> { alt((unicode_space, multi_line_comment)).parse_next(input) } -static UNICODE_SPACES: [char; 19] = [ - '\u{0009}', '\u{000B}', '\u{0020}', '\u{00A0}', '\u{1680}', '\u{2000}', '\u{2001}', '\u{2002}', - '\u{2003}', '\u{2004}', '\u{2005}', '\u{2006}', '\u{2007}', '\u{2008}', '\u{2009}', '\u{200A}', - '\u{202F}', '\u{205F}', '\u{3000}', +static UNICODE_SPACES: [char; 18] = [ + '\u{0009}', '\u{0020}', '\u{00A0}', '\u{1680}', '\u{2000}', '\u{2001}', + '\u{2002}', '\u{2003}', '\u{2004}', '\u{2005}', '\u{2006}', '\u{2007}', + '\u{2008}', '\u{2009}', '\u{200A}', '\u{202F}', '\u{205F}', '\u{3000}', ]; /// `unicode-space := ` diff --git a/tests/test_cases/expected_kdl/vertical_tab_whitespace.kdl b/tests/test_cases/expected_kdl/vertical_tab_whitespace.kdl index 1b3db2c..42d333e 100644 --- a/tests/test_cases/expected_kdl/vertical_tab_whitespace.kdl +++ b/tests/test_cases/expected_kdl/vertical_tab_whitespace.kdl @@ -1 +1,2 @@ node arg +node2 arg2 diff --git a/tests/test_cases/input/vertical_tab_whitespace.kdl b/tests/test_cases/input/vertical_tab_whitespace.kdl index 507d3a0..7353324 100644 --- a/tests/test_cases/input/vertical_tab_whitespace.kdl +++ b/tests/test_cases/input/vertical_tab_whitespace.kdl @@ -1 +1 @@ -node arg +node arg node2 arg2 diff --git a/tests/test_cases/input/zero_space_before_first_arg_fail.kdl b/tests/test_cases/input/zero_space_before_first_arg_fail.kdl new file mode 100644 index 0000000..250d1f9 --- /dev/null +++ b/tests/test_cases/input/zero_space_before_first_arg_fail.kdl @@ -0,0 +1 @@ +node"string" diff --git a/tests/test_cases/input/zero_space_before_prop_fail.kdl b/tests/test_cases/input/zero_space_before_prop_fail.kdl new file mode 100644 index 0000000..4497205 --- /dev/null +++ b/tests/test_cases/input/zero_space_before_prop_fail.kdl @@ -0,0 +1 @@ +node foo="value"bar=5 diff --git a/tests/test_cases/input/zero_space_before_second_arg_fail.kdl b/tests/test_cases/input/zero_space_before_second_arg_fail.kdl new file mode 100644 index 0000000..604500e --- /dev/null +++ b/tests/test_cases/input/zero_space_before_second_arg_fail.kdl @@ -0,0 +1 @@ +node "string"1 diff --git a/tests/test_cases/input/zero_space_before_slashdash_arg_fail.kdl b/tests/test_cases/input/zero_space_before_slashdash_arg_fail.kdl new file mode 100644 index 0000000..5a2a6b3 --- /dev/null +++ b/tests/test_cases/input/zero_space_before_slashdash_arg_fail.kdl @@ -0,0 +1 @@ +node "string"/-1