1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-03-17 20:58:08 +02:00

Add JSON test.

This commit is contained in:
Alec Thomas 2021-09-11 11:33:47 +10:00
parent f7c1454f13
commit d1f987668b
3 changed files with 639 additions and 572 deletions

File diff suppressed because it is too large Load Diff

11
lexers/testdata/json.actual vendored Normal file
View File

@ -0,0 +1,11 @@
{
"list": [1, 2, 3],
"map": {
"key": "value",
},
// A comment
"number": 1.23,
"string": "string",
"positive": true,
"negative": false
}

56
lexers/testdata/json.expected vendored Normal file
View File

@ -0,0 +1,56 @@
[
{"type":"Punctuation","value":"{"},
{"type":"Text","value":"\n\t"},
{"type":"NameTag","value":"\"list\""},
{"type":"Punctuation","value":":"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"["},
{"type":"LiteralNumberInteger","value":"1"},
{"type":"Punctuation","value":","},
{"type":"Text","value":" "},
{"type":"LiteralNumberInteger","value":"2"},
{"type":"Punctuation","value":","},
{"type":"Text","value":" "},
{"type":"LiteralNumberInteger","value":"3"},
{"type":"Punctuation","value":"],"},
{"type":"Text","value":"\n\t"},
{"type":"NameTag","value":"\"map\""},
{"type":"Punctuation","value":":"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"Text","value":"\n\t\t"},
{"type":"NameTag","value":"\"key\""},
{"type":"Punctuation","value":":"},
{"type":"Text","value":" "},
{"type":"LiteralStringDouble","value":"\"value\""},
{"type":"Punctuation","value":","},
{"type":"Text","value":"\n\t"},
{"type":"Punctuation","value":"},"},
{"type":"Text","value":"\n\t"},
{"type":"CommentSingle","value":"// A comment\n"},
{"type":"Text","value":"\t"},
{"type":"NameTag","value":"\"number\""},
{"type":"Punctuation","value":":"},
{"type":"Text","value":" "},
{"type":"LiteralNumberFloat","value":"1.23"},
{"type":"Punctuation","value":","},
{"type":"Text","value":"\n\t"},
{"type":"NameTag","value":"\"string\""},
{"type":"Punctuation","value":":"},
{"type":"Text","value":" "},
{"type":"LiteralStringDouble","value":"\"string\""},
{"type":"Punctuation","value":","},
{"type":"Text","value":"\n\t"},
{"type":"NameTag","value":"\"positive\""},
{"type":"Punctuation","value":":"},
{"type":"Text","value":" "},
{"type":"KeywordConstant","value":"true"},
{"type":"Punctuation","value":","},
{"type":"Text","value":"\n\t"},
{"type":"NameTag","value":"\"negative\""},
{"type":"Punctuation","value":":"},
{"type":"Text","value":" "},
{"type":"KeywordConstant","value":"false"},
{"type":"Text","value":"\n"},
{"type":"Punctuation","value":"}"}
]