mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-19 06:33:06 -03:00
Reorganize tests into a real spec suite
This commit is contained in:
12
spec/tests/toml/bool-comment.txt
Normal file
12
spec/tests/toml/bool-comment.txt
Normal file
@ -0,0 +1,12 @@
|
||||
---input---
|
||||
foo = true # comment used to prevent bool from being recognized
|
||||
|
||||
---tokens---
|
||||
'foo' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'true' Keyword.Constant
|
||||
' ' Text.Whitespace
|
||||
'# comment used to prevent bool from being recognized' Comment.Single
|
||||
'\n' Text.Whitespace
|
20
spec/tests/toml/comment-section-header.txt
Normal file
20
spec/tests/toml/comment-section-header.txt
Normal file
@ -0,0 +1,20 @@
|
||||
---input---
|
||||
[example] # A comment can appear on the same line as a section header
|
||||
foo = "bar"
|
||||
|
||||
---tokens---
|
||||
'[' Keyword
|
||||
'example' Keyword
|
||||
']' Keyword
|
||||
' ' Text.Whitespace
|
||||
'# A comment can appear on the same line as a section header' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'foo' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'bar' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
15
spec/tests/toml/multiline-string-comment.txt
Normal file
15
spec/tests/toml/multiline-string-comment.txt
Normal file
@ -0,0 +1,15 @@
|
||||
---input---
|
||||
message = """multiline strings
|
||||
can be followed by""" # comments
|
||||
|
||||
---tokens---
|
||||
'message' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'"""' Literal.String.Double
|
||||
'multiline strings\n can be followed by' Literal.String.Double
|
||||
'"""' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'# comments' Comment.Single
|
||||
'\n' Text.Whitespace
|
64
spec/tests/toml/number-keys.txt
Normal file
64
spec/tests/toml/number-keys.txt
Normal file
@ -0,0 +1,64 @@
|
||||
---input---
|
||||
1234 = "foo" # 1234 is a name
|
||||
foo = 1234 # 1234 is a number
|
||||
foo2 = [
|
||||
1234, # number
|
||||
{ 1234 = "foo", foo = 1234 } # name then number
|
||||
]
|
||||
|
||||
---tokens---
|
||||
'1234' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'foo' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'# 1234 is a name' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'foo' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'1234' Literal.Number.Integer
|
||||
' ' Text.Whitespace
|
||||
'# 1234 is a number' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'foo2' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'[' Punctuation
|
||||
'\n ' Text.Whitespace
|
||||
'1234' Literal.Number.Integer
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'# number' Comment.Single
|
||||
'\n ' Text.Whitespace
|
||||
'{' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'1234' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'foo' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'foo' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'1234' Literal.Number.Integer
|
||||
' ' Text.Whitespace
|
||||
'}' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'# name then number' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
']' Punctuation
|
||||
'\n' Text.Whitespace
|
16
spec/tests/toml/section-header-whitespace.txt
Normal file
16
spec/tests/toml/section-header-whitespace.txt
Normal file
@ -0,0 +1,16 @@
|
||||
---input---
|
||||
[ foo . bar ] # whitespace allowed in table headers
|
||||
|
||||
---tokens---
|
||||
'[' Keyword
|
||||
' ' Text.Whitespace
|
||||
'foo' Keyword
|
||||
' ' Text.Whitespace
|
||||
'.' Keyword
|
||||
' ' Text.Whitespace
|
||||
'bar' Keyword
|
||||
' ' Text.Whitespace
|
||||
']' Keyword
|
||||
' ' Text.Whitespace
|
||||
'# whitespace allowed in table headers' Comment.Single
|
||||
'\n' Text.Whitespace
|
86
spec/tests/toml/string-escapes.txt
Normal file
86
spec/tests/toml/string-escapes.txt
Normal file
@ -0,0 +1,86 @@
|
||||
---input---
|
||||
[strings]
|
||||
basic-string = "I'm a basic string. I can contain 'single quotes', \u0055nicode escapes \U0001f61b \U0001F61B, \"escaped\" double quotes, \n and \t more."
|
||||
literal-string = 'I am literal string. Escapes like \this have no effect on me. I can contain "double quotes".'
|
||||
multiline-basic-string = """
|
||||
I'm a multiline basic string.
|
||||
I can span several lines and contain 'single' and "double" quotes
|
||||
as well as \u0055nicode escapes. Line continuations \
|
||||
work too.
|
||||
"""
|
||||
multiline-literal-string = '''
|
||||
I'm a "multiline" 'literal' string.
|
||||
Escapes like \this have no effect on me. Neither does this: \
|
||||
it is not a line continuation.'''
|
||||
|
||||
---tokens---
|
||||
'[' Keyword
|
||||
'strings' Keyword
|
||||
']' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'basic-string' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
"I'm a basic string. I can contain 'single quotes', " Literal.String.Double
|
||||
'\\u0055' Literal.String.Escape
|
||||
'nicode escapes ' Literal.String.Double
|
||||
'\\U0001f61b' Literal.String.Escape
|
||||
' ' Literal.String.Double
|
||||
'\\U0001F61B' Literal.String.Escape
|
||||
', ' Literal.String.Double
|
||||
'\\"' Literal.String.Escape
|
||||
'escaped' Literal.String.Double
|
||||
'\\"' Literal.String.Escape
|
||||
' double quotes, ' Literal.String.Double
|
||||
'\\n' Literal.String.Escape
|
||||
' and ' Literal.String.Double
|
||||
'\\t' Literal.String.Escape
|
||||
' more.' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'literal-string' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
"'" Literal.String.Single
|
||||
'I am literal string. Escapes like \\this have no effect on me. I can contain "double quotes".\'' Literal.String.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'multiline-basic-string' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'"""' Literal.String.Double
|
||||
"\nI'm a multiline basic string.\nI can span several lines and contain 'single' and " Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'double' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
' quotes\nas well as ' Literal.String.Double
|
||||
'\\u0055' Literal.String.Escape
|
||||
'nicode escapes. Line continuations ' Literal.String.Double
|
||||
'\\' Literal.String.Escape
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' work too.\n' Literal.String.Double
|
||||
|
||||
'"""' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'multiline-literal-string' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
"'''" Literal.String.Single
|
||||
'\nI' Literal.String.Single
|
||||
"'" Literal.String.Single
|
||||
'm a "multiline" ' Literal.String.Single
|
||||
"'" Literal.String.Single
|
||||
'literal' Literal.String.Single
|
||||
"'" Literal.String.Single
|
||||
' string.\nEscapes like \\this have no effect on me. Neither does this: \\\n it is not a line continuation.' Literal.String.Single
|
||||
"'''" Literal.String.Single
|
||||
'\n' Text.Whitespace
|
49
spec/tests/toml/strings-eager.txt
Normal file
49
spec/tests/toml/strings-eager.txt
Normal file
@ -0,0 +1,49 @@
|
||||
---input---
|
||||
foo = "this string should" # not extend into the comment that contains "quotes"
|
||||
bar = 'same with a' # basic 'string'
|
||||
baz = """same with a""" # multiline """basic string"""
|
||||
spam = '''same with a''' # multiline '''literal string'''
|
||||
|
||||
---tokens---
|
||||
'foo' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'this string should' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'# not extend into the comment that contains "quotes"' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'bar' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
"'" Literal.String.Single
|
||||
"same with a'" Literal.String.Single
|
||||
' ' Text.Whitespace
|
||||
"# basic 'string'" Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'baz' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'"""' Literal.String.Double
|
||||
'same with a' Literal.String.Double
|
||||
'"""' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'# multiline """basic string"""' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'spam' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
"'''" Literal.String.Single
|
||||
'same with a' Literal.String.Single
|
||||
"'''" Literal.String.Single
|
||||
' ' Text.Whitespace
|
||||
"# multiline '''literal string'''" Comment.Single
|
||||
'\n' Text.Whitespace
|
27
spec/tests/toml/table-header-string.txt
Normal file
27
spec/tests/toml/table-header-string.txt
Normal file
@ -0,0 +1,27 @@
|
||||
---input---
|
||||
[table.header.with.some."strings".and."escape\nsequences\u263a"]
|
||||
|
||||
---tokens---
|
||||
'[' Keyword
|
||||
'table' Keyword
|
||||
'.' Keyword
|
||||
'header' Keyword
|
||||
'.' Keyword
|
||||
'with' Keyword
|
||||
'.' Keyword
|
||||
'some' Keyword
|
||||
'.' Keyword
|
||||
'"' Literal.String.Double
|
||||
'strings' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'.' Keyword
|
||||
'and' Keyword
|
||||
'.' Keyword
|
||||
'"' Literal.String.Double
|
||||
'escape' Literal.String.Double
|
||||
'\\n' Literal.String.Escape
|
||||
'sequences' Literal.String.Double
|
||||
'\\u263a' Literal.String.Escape
|
||||
'"' Literal.String.Double
|
||||
']' Keyword
|
||||
'\n' Text.Whitespace
|
Reference in New Issue
Block a user