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:
15
spec/tests/json/test_arrays.txt
Normal file
15
spec/tests/json/test_arrays.txt
Normal file
@ -0,0 +1,15 @@
|
||||
---input---
|
||||
[]
|
||||
["a", "b"]
|
||||
|
||||
---tokens---
|
||||
'[]' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'[' Punctuation
|
||||
'"a"' Literal.String.Double
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'"b"' Literal.String.Double
|
||||
']' Punctuation
|
||||
'\n' Text.Whitespace
|
6
spec/tests/json/test_backtracking.txt
Normal file
6
spec/tests/json/test_backtracking.txt
Normal file
@ -0,0 +1,6 @@
|
||||
---input---
|
||||
{"\u00D0000\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\63CD
|
||||
|
||||
---tokens---
|
||||
'{' Punctuation
|
||||
'"\\u00D0000\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\63CD\n' Error
|
30
spec/tests/json/test_basic.txt
Normal file
30
spec/tests/json/test_basic.txt
Normal file
@ -0,0 +1,30 @@
|
||||
---input---
|
||||
{"foo": "bar", "foo2": [1, 2, 3], "\u0123": "\u0123"}
|
||||
|
||||
---tokens---
|
||||
'{' Punctuation
|
||||
'"foo"' Name.Tag
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'"bar"' Literal.String.Double
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'"foo2"' Name.Tag
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'[' Punctuation
|
||||
'1' Literal.Number.Integer
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'2' Literal.Number.Integer
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'3' Literal.Number.Integer
|
||||
'],' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'"\\u0123"' Name.Tag
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'"\\u0123"' Literal.String.Double
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
23
spec/tests/json/test_basic_bare.txt
Normal file
23
spec/tests/json/test_basic_bare.txt
Normal file
@ -0,0 +1,23 @@
|
||||
---input---
|
||||
"foo": "bar", "foo2": [1, 2, 3]
|
||||
|
||||
---tokens---
|
||||
'"foo"' Name.Tag
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'"bar"' Literal.String.Double
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'"foo2"' Name.Tag
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'[' Punctuation
|
||||
'1' Literal.Number.Integer
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'2' Literal.Number.Integer
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'3' Literal.Number.Integer
|
||||
']' Punctuation
|
||||
'\n' Text.Whitespace
|
65
spec/tests/json/test_comments.txt
Normal file
65
spec/tests/json/test_comments.txt
Normal file
@ -0,0 +1,65 @@
|
||||
---input---
|
||||
{"a//b"//C1
|
||||
:123/////C2
|
||||
}
|
||||
|
||||
/** / **/{"a /**/ b"/*
|
||||
*/: 123}
|
||||
|
||||
// Invalid comments
|
||||
/
|
||||
1/
|
||||
/1
|
||||
""/
|
||||
|
||||
// Unclosed
|
||||
|
||||
""/**
|
||||
|
||||
---tokens---
|
||||
'{' Punctuation
|
||||
'"a//b"' Name.Tag
|
||||
'//C1' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
':' Punctuation
|
||||
'123' Literal.Number.Integer
|
||||
'/////C2' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'/** / **/' Comment.Multiline
|
||||
'{' Punctuation
|
||||
'"a /**/ b"' Name.Tag
|
||||
'/*\n*/' Comment.Multiline
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'123' Literal.Number.Integer
|
||||
'}' Punctuation
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'// Invalid comments' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'/' Error
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'1' Literal.Number.Integer
|
||||
'/' Error
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'/' Error
|
||||
'1' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'""' Literal.String.Double
|
||||
'/' Error
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'// Unclosed' Comment.Single
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'""' Literal.String.Double
|
||||
'/**\n' Error
|
14
spec/tests/json/test_constants.txt
Normal file
14
spec/tests/json/test_constants.txt
Normal file
@ -0,0 +1,14 @@
|
||||
---input---
|
||||
true
|
||||
false
|
||||
null
|
||||
|
||||
---tokens---
|
||||
'true' Keyword.Constant
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'false' Keyword.Constant
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'null' Keyword.Constant
|
||||
'\n' Text.Whitespace
|
79
spec/tests/json/test_escape_sequences.txt
Normal file
79
spec/tests/json/test_escape_sequences.txt
Normal file
@ -0,0 +1,79 @@
|
||||
---input---
|
||||
"\""
|
||||
"\\"
|
||||
"\/"
|
||||
"\b"
|
||||
"\f"
|
||||
"\n"
|
||||
"\r"
|
||||
"\t"
|
||||
"\u0123"
|
||||
"\u4567"
|
||||
"\u89ab"
|
||||
"\ucdef"
|
||||
"\uABCD"
|
||||
"\uEF01"
|
||||
|
||||
// Incomplete sequences
|
||||
"\uz"
|
||||
"\u1z"
|
||||
"\u12z"
|
||||
"\u123z"
|
||||
|
||||
---tokens---
|
||||
'"\\""' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"\\\\"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"\\/"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"\\b"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"\\f"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"\\n"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"\\r"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"\\t"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"\\u0123"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"\\u4567"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"\\u89ab"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"\\ucdef"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"\\uABCD"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"\\uEF01"' Literal.String.Double
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'// Incomplete sequences' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"\\uz"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"\\u1z"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"\\u12z"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"\\u123z"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
42
spec/tests/json/test_floats.txt
Normal file
42
spec/tests/json/test_floats.txt
Normal file
@ -0,0 +1,42 @@
|
||||
---input---
|
||||
123456789.0123456789
|
||||
-123456789.0123456789
|
||||
1e10
|
||||
-1E10
|
||||
1e-10
|
||||
-1E+10
|
||||
1.0e10
|
||||
-1.0E10
|
||||
1.0e-10
|
||||
-1.0E+10
|
||||
|
||||
---tokens---
|
||||
'123456789.0123456789' Literal.Number.Float
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'-123456789.0123456789' Literal.Number.Float
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'1e10' Literal.Number.Float
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'-1E10' Literal.Number.Float
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'1e-10' Literal.Number.Float
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'-1E+10' Literal.Number.Float
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'1.0e10' Literal.Number.Float
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'-1.0E10' Literal.Number.Float
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'1.0e-10' Literal.Number.Float
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'-1.0E+10' Literal.Number.Float
|
||||
'\n' Text.Whitespace
|
18
spec/tests/json/test_integers.txt
Normal file
18
spec/tests/json/test_integers.txt
Normal file
@ -0,0 +1,18 @@
|
||||
---input---
|
||||
0
|
||||
-1
|
||||
1234567890
|
||||
-1234567890
|
||||
|
||||
---tokens---
|
||||
'0' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'-1' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'1234567890' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'-1234567890' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
15
spec/tests/json/test_objects.txt
Normal file
15
spec/tests/json/test_objects.txt
Normal file
@ -0,0 +1,15 @@
|
||||
---input---
|
||||
{}
|
||||
{"a": "b"}
|
||||
|
||||
---tokens---
|
||||
'{}' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'{' Punctuation
|
||||
'"a"' Name.Tag
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'"b"' Literal.String.Double
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
29
spec/tests/json/test_round_trip.txt
Normal file
29
spec/tests/json/test_round_trip.txt
Normal file
@ -0,0 +1,29 @@
|
||||
---input---
|
||||
+
|
||||
0
|
||||
""0
|
||||
a
|
||||
b
|
||||
""/-
|
||||
|
||||
---tokens---
|
||||
'+' Error
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'0' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'""' Literal.String.Double
|
||||
'0' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'a' Error
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'b' Error
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'""' Literal.String.Double
|
||||
'/' Error
|
||||
'-' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
42
spec/tests/json/test_strings.txt
Normal file
42
spec/tests/json/test_strings.txt
Normal file
@ -0,0 +1,42 @@
|
||||
---input---
|
||||
""
|
||||
"abc"
|
||||
"ひらがな"
|
||||
"123"
|
||||
"[]"
|
||||
"{}"
|
||||
"true"
|
||||
"false"
|
||||
"nul"
|
||||
":,"
|
||||
|
||||
---tokens---
|
||||
'""' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"abc"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"ひらがな"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"123"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"[]"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"{}"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"true"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"false"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"nul"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'":,"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
17
spec/tests/json/test_whitespace.txt
Normal file
17
spec/tests/json/test_whitespace.txt
Normal file
@ -0,0 +1,17 @@
|
||||
---input---
|
||||
{
|
||||
"tabs": "here",
|
||||
}
|
||||
|
||||
---tokens---
|
||||
'{' Punctuation
|
||||
'\n\t' Text.Whitespace
|
||||
'"tabs"' Name.Tag
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'"here"' Literal.String.Double
|
||||
',' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
Reference in New Issue
Block a user