From b62ffed3755248a39795b91cf22933b0835d2390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Sat, 27 Apr 2024 11:14:10 +0200 Subject: [PATCH] update sublimehq/Packages and update tests accordingly --- src/parsing/metadata.rs | 4 +-- src/parsing/parser.rs | 55 +++++++++++++++++++++++---------------- src/parsing/syntax_set.rs | 2 +- testdata/Packages | 2 +- 4 files changed, 37 insertions(+), 26 deletions(-) diff --git a/src/parsing/metadata.rs b/src/parsing/metadata.rs index 36466f3..98cfc15 100644 --- a/src/parsing/metadata.rs +++ b/src/parsing/metadata.rs @@ -493,13 +493,13 @@ mod tests { #[test] fn load_raw() { - let comments_file: &str = "testdata/Packages/Go/Comments.tmPreferences"; + let comments_file: &str = "testdata/Packages/Go/GoCommentRules.tmPreferences"; assert!(Path::new(comments_file).exists()); let r = RawMetadataEntry::load(comments_file); assert!(r.is_ok()); - let indent_file: &str = "testdata/Packages/Go/Indentation Rules.tmPreferences"; + let indent_file: &str = "testdata/Packages/Go/Indents/GoIndent.tmPreferences"; assert!(Path::new(indent_file).exists()); let r = RawMetadataEntry::load(indent_file).unwrap(); diff --git a/src/parsing/parser.rs b/src/parsing/parser.rs index 4b319e7..4625492 100644 --- a/src/parsing/parser.rs +++ b/src/parsing/parser.rs @@ -757,24 +757,35 @@ mod tests { let ops1 = ops(&mut state, "module Bob::Wow::Troll::Five; 5; end", &ss); let test_ops1 = vec![ (0, Push(Scope::new("source.ruby.rails").unwrap())), - (0, Push(Scope::new("meta.module.ruby").unwrap())), - (0, Push(Scope::new("keyword.control.module.ruby").unwrap())), + (0, Push(Scope::new("meta.namespace.ruby").unwrap())), + (0, Push(Scope::new("storage.type.namespace.ruby").unwrap())), + ( + 0, + Push(Scope::new("keyword.declaration.namespace.ruby").unwrap()), + ), (6, Pop(2)), - (6, Push(Scope::new("meta.module.ruby").unwrap())), (7, Pop(1)), - (7, Push(Scope::new("meta.module.ruby").unwrap())), - (7, Push(Scope::new("entity.name.module.ruby").unwrap())), + (7, Push(Scope::new("meta.namespace.ruby").unwrap())), + (7, Push(Scope::new("entity.name.namespace.ruby").unwrap())), (7, Push(Scope::new("support.other.namespace.ruby").unwrap())), (10, Pop(1)), - (10, Push(Scope::new("punctuation.accessor.ruby").unwrap())), + ( + 10, + Push(Scope::new("punctuation.accessor.double-colon.ruby").unwrap()), + ), + (12, Pop(1)), ]; assert_eq!(&ops1[0..test_ops1.len()], &test_ops1[..]); let ops2 = ops(&mut state, "def lol(wow = 5)", &ss); - let test_ops2 = vec![ + let test_ops2 = [ (0, Push(Scope::new("meta.function.ruby").unwrap())), - (0, Push(Scope::new("keyword.control.def.ruby").unwrap())), - (3, Pop(2)), + (0, Push(Scope::new("storage.type.function.ruby").unwrap())), + ( + 0, + Push(Scope::new("keyword.declaration.function.ruby").unwrap()), + ), + (3, Pop(3)), (3, Push(Scope::new("meta.function.ruby").unwrap())), (4, Push(Scope::new("entity.name.function.ruby").unwrap())), (7, Pop(1)), @@ -829,6 +840,7 @@ mod tests { test_stack.push(Scope::new("text.html.basic").unwrap()); test_stack.push(Scope::new("source.js.embedded.html").unwrap()); test_stack.push(Scope::new("source.js").unwrap()); + test_stack.push(Scope::new("meta.string.js").unwrap()); test_stack.push(Scope::new("string.quoted.single.js").unwrap()); test_stack.push(Scope::new("source.ruby.rails.embedded.html").unwrap()); test_stack.push(Scope::new("meta.function.parameters.ruby").unwrap()); @@ -860,40 +872,39 @@ mod tests { Push(Scope::new("keyword.operator.assignment.ruby").unwrap()) ), (5, Pop(1)), - ( - 6, - Push(Scope::new("string.unquoted.embedded.sql.ruby").unwrap()) - ), + (6, Push(Scope::new("meta.string.heredoc.ruby").unwrap())), + (6, Push(Scope::new("string.unquoted.heredoc.ruby").unwrap())), ( 6, Push(Scope::new("punctuation.definition.string.begin.ruby").unwrap()) ), + (12, Pop(2)), (12, Pop(1)), - (12, Pop(1)), + (12, Push(Scope::new("meta.string.heredoc.ruby").unwrap())), + (12, Push(Scope::new("source.sql.embedded.ruby").unwrap())), + (12, Clear(ClearAmount::TopN(2))), ( 12, - Push(Scope::new("string.unquoted.embedded.sql.ruby").unwrap()) + Push(Scope::new("punctuation.accessor.dot.ruby").unwrap()) ), - (12, Push(Scope::new("text.sql.embedded.ruby").unwrap())), - (12, Clear(ClearAmount::TopN(2))), - (12, Push(Scope::new("punctuation.accessor.ruby").unwrap())), (13, Pop(1)), - (18, Restore), ] ); - assert_eq!(ops(&mut state, "wow", &ss), vec![]); + assert_eq!(ops(&mut state, "wow", &ss), vec![(0, Restore)]); assert_eq!( ops(&mut state, "SQL", &ss), vec![ (0, Pop(1)), + (0, Push(Scope::new("string.unquoted.heredoc.ruby").unwrap())), ( 0, Push(Scope::new("punctuation.definition.string.end.ruby").unwrap()) ), (3, Pop(1)), (3, Pop(1)), + (3, Pop(1)), ] ); } @@ -998,8 +1009,8 @@ mod tests { let mut state1 = ParseState::new(syntax); let mut state2 = ParseState::new(syntax); - assert_eq!(ops(&mut state1, "class Foo {", &ss).len(), 11); - assert_eq!(ops(&mut state2, "class Fooo {", &ss).len(), 11); + assert_eq!(ops(&mut state1, "class Foo {", &ss).len(), 12); + assert_eq!(ops(&mut state2, "class Fooo {", &ss).len(), 12); assert_eq!(state1, state2); ops(&mut state1, "}", &ss); diff --git a/src/parsing/syntax_set.rs b/src/parsing/syntax_set.rs index 3833fed..496a493 100644 --- a/src/parsing/syntax_set.rs +++ b/src/parsing/syntax_set.rs @@ -1032,7 +1032,7 @@ mod tests { .get_context(&syntax.context_ids()["main"]) .expect("#[cfg(test)]"); let count = syntax_definition::context_iter(&ps, main_context).count(); - assert_eq!(count, 109); + assert_eq!(count, 168); } #[test] diff --git a/testdata/Packages b/testdata/Packages index fa6b862..483657a 160000 --- a/testdata/Packages +++ b/testdata/Packages @@ -1 +1 @@ -Subproject commit fa6b8629c95041bf262d4c1dab95c456a0530122 +Subproject commit 483657a3db466716505255c6380f57698354508b