Reorganize tests into a real spec suite

This commit is contained in:
2024-08-04 19:18:43 -03:00
parent 57c160173c
commit e7c2053222
693 changed files with 136 additions and 116 deletions

View File

@ -0,0 +1,20 @@
---input---
// C++ Style comment
/* C-style comment on one line */
/**
* C-style comments
* covering multiple lines
* are totally cool
*/
---tokens---
'// C++ Style comment' Comment.Single
'\n\n' Text.Whitespace
'/* C-style comment on one line */' Comment.Multiline
'\n\n' Text.Whitespace
'/**\n * C-style comments\n * covering multiple lines\n * are totally cool\n */' Comment.Multiline
'\n' Text.Whitespace

View File

@ -0,0 +1,122 @@
---input---
package {
default_applicable_licenses: ["example"],
}
module_name {
name: "foo",
// A comment inside a rule
shared_libs: ["libfoo"],
stl: "none",
srcs: my_srcs_var, // A comment following a property
level: 42,
arch: {
arm: {
srcs: ["arm.cpp"],
},
x86: {
srcs: ["x86.cpp"],
},
},
}
---tokens---
'package' Name.Function
' ' Text.Whitespace
'{' Punctuation
'\n ' Text.Whitespace
'default_applicable_licenses' Name
':' Punctuation
' ' Text.Whitespace
'[' Punctuation
'"example"' Literal.String
']' Punctuation
',' Punctuation
'\n' Text.Whitespace
'}' Punctuation
'\n\n' Text.Whitespace
'module_name' Name.Function
' ' Text.Whitespace
'{' Punctuation
'\n ' Text.Whitespace
'name' Name
':' Punctuation
' ' Text.Whitespace
'"foo"' Literal.String
',' Punctuation
'\n ' Text.Whitespace
'// A comment inside a rule' Comment.Single
'\n ' Text.Whitespace
'shared_libs' Name
':' Punctuation
' ' Text.Whitespace
'[' Punctuation
'"libfoo"' Literal.String
']' Punctuation
',' Punctuation
'\n ' Text.Whitespace
'stl' Name
':' Punctuation
' ' Text.Whitespace
'"none"' Literal.String
',' Punctuation
'\n ' Text.Whitespace
'srcs' Name
':' Punctuation
' ' Text.Whitespace
'my_srcs_var' Name
',' Punctuation
' ' Text.Whitespace
'// A comment following a property' Comment.Single
'\n ' Text.Whitespace
'level' Name
':' Punctuation
' ' Text.Whitespace
'42' Literal.Number.Integer
',' Punctuation
'\n ' Text.Whitespace
'arch' Name
':' Punctuation
' ' Text.Whitespace
'{' Punctuation
'\n ' Text.Whitespace
'arm' Name
':' Punctuation
' ' Text.Whitespace
'{' Punctuation
'\n ' Text.Whitespace
'srcs' Name
':' Punctuation
' ' Text.Whitespace
'[' Punctuation
'"arm.cpp"' Literal.String
']' Punctuation
',' Punctuation
'\n ' Text.Whitespace
'}' Punctuation
',' Punctuation
'\n ' Text.Whitespace
'x86' Name
':' Punctuation
' ' Text.Whitespace
'{' Punctuation
'\n ' Text.Whitespace
'srcs' Name
':' Punctuation
' ' Text.Whitespace
'[' Punctuation
'"x86.cpp"' Literal.String
']' Punctuation
',' Punctuation
'\n ' Text.Whitespace
'}' Punctuation
',' Punctuation
'\n ' Text.Whitespace
'}' Punctuation
',' Punctuation
'\n' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,51 @@
---input---
module_name {
name: "foo",
// A comment inside a rule
shared_libs: ["libfoo"],
stl: "none",
}
// Make sure this works
some_var = 42
---tokens---
'module_name' Name.Function
' ' Text.Whitespace
'{' Punctuation
'\n ' Text.Whitespace
'name' Name
':' Punctuation
' ' Text.Whitespace
'"foo"' Literal.String
',' Punctuation
'\n ' Text.Whitespace
'// A comment inside a rule' Comment.Single
'\n ' Text.Whitespace
'shared_libs' Name
':' Punctuation
' ' Text.Whitespace
'[' Punctuation
'"libfoo"' Literal.String
']' Punctuation
',' Punctuation
'\n ' Text.Whitespace
'stl' Name
':' Punctuation
' ' Text.Whitespace
'"none"' Literal.String
',' Punctuation
'\n' Text.Whitespace
'}' Punctuation
'\n\n' Text.Whitespace
'// Make sure this works' Comment.Single
'\n' Text.Whitespace
'some_var' Name.Variable
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'42' Literal.Number.Integer
'\n' Text.Whitespace

View File

@ -0,0 +1,136 @@
---input---
an_int = 42
a_hex_int = 0xC001
a_string = "cool"
a_list = ["put", "stuff", "here"]
a_map = {key1: "value1", key2: ["value2"]}
test_append = ["a", "b"]
test_append += ["c", "d"]
multiline_list = [
"snap",
// With comments
"crackle",
/* more comments */ "pop",
]
---tokens---
'an_int' Name.Variable
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'42' Literal.Number.Integer
'\n' Text.Whitespace
'\n' Text.Whitespace
'a_hex_int' Name.Variable
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'0xC001' Literal.Number.Hex
'\n' Text.Whitespace
'\n' Text.Whitespace
'a_string' Name.Variable
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'"cool"' Literal.String
'\n' Text.Whitespace
'\n' Text.Whitespace
'a_list' Name.Variable
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'[' Punctuation
'"put"' Literal.String
',' Punctuation
' ' Text.Whitespace
'"stuff"' Literal.String
',' Punctuation
' ' Text.Whitespace
'"here"' Literal.String
']' Punctuation
'\n' Text.Whitespace
'\n' Text.Whitespace
'a_map' Name.Variable
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'{' Punctuation
'key1' Name
':' Punctuation
' ' Text.Whitespace
'"value1"' Literal.String
',' Punctuation
' ' Text.Whitespace
'key2' Name
':' Punctuation
' ' Text.Whitespace
'[' Punctuation
'"value2"' Literal.String
']' Punctuation
'}' Punctuation
'\n' Text.Whitespace
'\n' Text.Whitespace
'test_append' Name.Variable
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'[' Punctuation
'"a"' Literal.String
',' Punctuation
' ' Text.Whitespace
'"b"' Literal.String
']' Punctuation
'\n' Text.Whitespace
'test_append' Name.Variable
' ' Text.Whitespace
'+=' Operator
' ' Text.Whitespace
'[' Punctuation
'"c"' Literal.String
',' Punctuation
' ' Text.Whitespace
'"d"' Literal.String
']' Punctuation
'\n' Text.Whitespace
'\n' Text.Whitespace
'multiline_list' Name.Variable
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'[' Punctuation
'\n ' Text.Whitespace
'"snap"' Literal.String
',' Punctuation
'\n ' Text.Whitespace
'// With comments' Comment.Single
'\n ' Text.Whitespace
'"crackle"' Literal.String
',' Punctuation
'\n ' Text.Whitespace
'/* more comments */' Comment.Multiline
' ' Text.Whitespace
'"pop"' Literal.String
',' Punctuation
'\n' Text.Whitespace
']' Punctuation
'\n' Text.Whitespace