Skip to content
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

update sublimehq/Packages and update tests accordingly #535

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified assets/default.themedump
Binary file not shown.
Binary file modified assets/default_metadata.packdump
Binary file not shown.
Binary file modified assets/default_newlines.packdump
Binary file not shown.
Binary file modified assets/default_nonewlines.packdump
Binary file not shown.
4 changes: 2 additions & 2 deletions src/parsing/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
55 changes: 33 additions & 22 deletions src/parsing/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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)),
]
);
}
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/parsing/syntax_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion testdata/Packages
Submodule Packages updated 382 files
12 changes: 11 additions & 1 deletion testdata/known_syntest_failures.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
loading syntax definitions from testdata/Packages
FAILED testdata/Packages/C#/tests/syntax_test_Strings.cs: 38
FAILED testdata/Packages/Clojure/tests/syntax_test_clojure.clj: 1
FAILED testdata/Packages/Erlang/syntax_test_erlang.erl: 783
FAILED testdata/Packages/Git Formats/syntax_test_git_config: 17
FAILED testdata/Packages/Git Formats/syntax_test_git_rebase: 3
FAILED testdata/Packages/JSON/syntax_test_json.json: 4
FAILED testdata/Packages/Java/syntax_test_java.java: 817
FAILED testdata/Packages/JavaScript/tests/syntax_test_js.js: 47
FAILED testdata/Packages/LaTeX/syntax_test_latex.tex: 1
FAILED testdata/Packages/Makefile/syntax_test_makefile.mak: 6
FAILED testdata/Packages/Markdown/syntax_test_markdown.md: 3920
FAILED testdata/Packages/PHP/syntax_test_php.php: 22
FAILED testdata/Packages/Ruby/syntax_test_ruby.rb: 1
FAILED testdata/Packages/ShellScript/test/syntax_test_bash.sh: 14
exiting with code 1
13 changes: 11 additions & 2 deletions testdata/known_syntest_failures_fancy.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
loading syntax definitions from testdata/Packages
FAILED testdata/Packages/C#/tests/syntax_test_Strings.cs: 38
FAILED testdata/Packages/Clojure/tests/syntax_test_clojure.clj: 1
FAILED testdata/Packages/Erlang/syntax_test_erlang.erl: 783
FAILED testdata/Packages/Git Formats/syntax_test_git_config: 17
FAILED testdata/Packages/Git Formats/syntax_test_git_rebase: 3
FAILED testdata/Packages/JSON/syntax_test_json.json: 4
FAILED testdata/Packages/Java/syntax_test_java.java: 817
FAILED testdata/Packages/JavaScript/tests/syntax_test_js.js: 47
FAILED testdata/Packages/LaTeX/syntax_test_latex.tex: 1
FAILED testdata/Packages/Markdown/syntax_test_markdown.md: 11
FAILED testdata/Packages/Markdown/syntax_test_markdown.md: 3920
FAILED testdata/Packages/PHP/syntax_test_php.php: 22
FAILED testdata/Packages/Ruby/syntax_test_ruby.rb: 1
FAILED testdata/Packages/ShellScript/test/syntax_test_bash.sh: 14
exiting with code 1
Loading