mirror of
https://github.com/alecthomas/chroma.git
synced 2025-03-29 21:56:56 +02:00
add yaml test cases for more bool types and multi-line flow scalars.
This commit is contained in:
parent
2b9c82d89f
commit
2612dee604
26
lexers/testdata/yaml.actual
vendored
26
lexers/testdata/yaml.actual
vendored
@ -15,6 +15,8 @@ scientific_notation: 1e+12
|
||||
# The number 1 will be interpreted as a number, not a boolean. if you want
|
||||
# it to be interpreted as a boolean, use true
|
||||
boolean: true
|
||||
boolean_different_case: False
|
||||
boolean_yes: YES
|
||||
null_value: null
|
||||
key with spaces: value
|
||||
# Notice that strings don't need to be quoted. However, they can be.
|
||||
@ -25,6 +27,16 @@ double quotes: "have many: \", \0, \t, \u263A, \x0d\x0a == \r\n, and more."
|
||||
# UTF-8/16/32 characters need to be encoded
|
||||
Superscript two: \u00B2
|
||||
|
||||
# Multi-line flow scalars can be unquoted or quoted.
|
||||
unquoted_scalar: Multiline scalar
|
||||
with 'quotes' in the middle.
|
||||
This is the last line.
|
||||
single_quoted_scalar: 'Multiline single quoted scalar
|
||||
with "quotes" in the middle
|
||||
Last line'
|
||||
double_quoted_scalar: "Multiline double quoted scalar
|
||||
with 'quotes' in the middle
|
||||
end"
|
||||
# Multiple-line strings can be written either as a 'literal block' (using |),
|
||||
# or a 'folded block' (using '>').
|
||||
literal_block: |
|
||||
@ -44,7 +56,21 @@ folded_style: >
|
||||
|
||||
'More-indented' lines keep their newlines, too -
|
||||
this text will appear over two lines.
|
||||
literal_block_with_strip_chomping: |-
|
||||
This entire block of text will be the value of the 'literal_block' key,
|
||||
with line breaks being preserved and the strip chomping indicator.
|
||||
|
||||
The literal continues until de-dented, and the leading indentation is
|
||||
stripped.
|
||||
|
||||
Any lines that are 'more-indented' keep the rest of their indentation -
|
||||
these lines will be indented by 4 spaces.
|
||||
literal_block_with_keep_chomping: |+
|
||||
This entire block of text will be the value of the 'literal_block' key,
|
||||
with line breaks being preserved and the keep chomping indicator.
|
||||
|
||||
The literal continues until de-dented, and the leading indentation is
|
||||
stripped.
|
||||
####################
|
||||
# COLLECTION TYPES #
|
||||
####################
|
||||
|
45
lexers/testdata/yaml.expected
vendored
45
lexers/testdata/yaml.expected
vendored
@ -44,6 +44,16 @@
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordConstant","value":"true"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameTag","value":"boolean_different_case"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordConstant","value":"False"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameTag","value":"boolean_yes"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordConstant","value":"YES"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameTag","value":"null_value"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
@ -83,6 +93,27 @@
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Literal","value":"\\u00B2"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"Comment","value":"# Multi-line flow scalars can be unquoted or quoted."},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameTag","value":"unquoted_scalar"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Literal","value":"Multiline scalar"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Literal","value":"with 'quotes' in the middle."},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Literal","value":"This is the last line."},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameTag","value":"single_quoted_scalar"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringSingle","value":"'Multiline single quoted scalar\n with \"quotes\" in the middle\n Last line'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameTag","value":"double_quoted_scalar"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringDouble","value":"\"Multiline double quoted scalar\n with 'quotes' in the middle\n end\""},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Comment","value":"# Multiple-line strings can be written either as a 'literal block' (using |),"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Comment","value":"# or a 'folded block' (using '\u003e')."},
|
||||
@ -95,7 +126,19 @@
|
||||
{"type":"NameTag","value":"folded_style"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringDoc","value":"\u003e\n This entire block of text will be the value of 'folded_style', but this\n time, all newlines will be replaced with a single space.\n\n Blank lines, like above, are converted to a newline character.\n\n 'More-indented' lines keep their newlines, too -\n this text will appear over two lines.\n\n####################"},
|
||||
{"type":"LiteralStringDoc","value":"\u003e\n This entire block of text will be the value of 'folded_style', but this\n time, all newlines will be replaced with a single space.\n\n Blank lines, like above, are converted to a newline character.\n\n 'More-indented' lines keep their newlines, too -\n this text will appear over two lines."},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameTag","value":"literal_block_with_strip_chomping"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringDoc","value":"|-\n This entire block of text will be the value of the 'literal_block' key,\n with line breaks being preserved and the strip chomping indicator.\n\n The literal continues until de-dented, and the leading indentation is\n stripped.\n\n Any lines that are 'more-indented' keep the rest of their indentation -\n these lines will be indented by 4 spaces."},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameTag","value":"literal_block_with_keep_chomping"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringDoc","value":"|+\n This entire block of text will be the value of the 'literal_block' key,\n with line breaks being preserved and the keep chomping indicator.\n\n The literal continues until de-dented, and the leading indentation is\n stripped."},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Comment","value":"####################"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Comment","value":"# COLLECTION TYPES #"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
|
Loading…
x
Reference in New Issue
Block a user