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:
125
spec/tests/nix/basic_values.txt
Normal file
125
spec/tests/nix/basic_values.txt
Normal file
@ -0,0 +1,125 @@
|
||||
---input---
|
||||
"hello world"
|
||||
|
||||
"hello ${ { a = "world"; }.a }"
|
||||
|
||||
"1 2 ${toString 3}"
|
||||
|
||||
"${pkgs.bash}/bin/sh"
|
||||
|
||||
true, false, null, 123, 3.141
|
||||
|
||||
-1
|
||||
|
||||
/etc
|
||||
./foo.png
|
||||
~/.config
|
||||
|
||||
<nixpkgs>
|
||||
|
||||
''
|
||||
multi
|
||||
line
|
||||
string
|
||||
''
|
||||
|
||||
''
|
||||
multi
|
||||
${value}
|
||||
string
|
||||
''
|
||||
|
||||
---tokens---
|
||||
'"' Literal.String.Double
|
||||
'hello world' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n\n' Text
|
||||
|
||||
'"' Literal.String.Double
|
||||
'hello ' Literal.String.Double
|
||||
'${' Literal.String.Interpol
|
||||
' ' Text
|
||||
'{' Punctuation
|
||||
' ' Text
|
||||
'a' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'world' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'}' Punctuation
|
||||
'.' Operator
|
||||
'a' Text
|
||||
' ' Text
|
||||
'}' Literal.String.Interpol
|
||||
'"' Literal.String.Double
|
||||
'\n\n' Text
|
||||
|
||||
'"' Literal.String.Double
|
||||
'1 2 ' Literal.String.Double
|
||||
'${' Literal.String.Interpol
|
||||
'toString' Name.Builtin
|
||||
' ' Text
|
||||
'3' Literal.Number.Integer
|
||||
'}' Literal.String.Interpol
|
||||
'"' Literal.String.Double
|
||||
'\n\n' Text
|
||||
|
||||
'"' Literal.String.Double
|
||||
'${' Literal.String.Interpol
|
||||
'pkgs' Text
|
||||
'.' Operator
|
||||
'bash' Text
|
||||
'}' Literal.String.Interpol
|
||||
'/bin/sh' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n\n' Text
|
||||
|
||||
'true' Name.Constant
|
||||
',' Punctuation
|
||||
' ' Text
|
||||
'false' Name.Constant
|
||||
',' Punctuation
|
||||
' ' Text
|
||||
'null' Name.Constant
|
||||
',' Punctuation
|
||||
' ' Text
|
||||
'123' Literal.Number.Integer
|
||||
',' Punctuation
|
||||
' ' Text
|
||||
'3.141' Literal.Number.Float
|
||||
'\n\n' Text
|
||||
|
||||
'-1' Literal.Number.Integer
|
||||
'\n\n' Text
|
||||
|
||||
'/etc' Literal
|
||||
'\n' Text
|
||||
|
||||
'./foo.png' Literal
|
||||
'\n' Text
|
||||
|
||||
'~/.config' Literal
|
||||
'\n\n' Text
|
||||
|
||||
'<nixpkgs>' Literal
|
||||
'\n\n' Text
|
||||
|
||||
"''" Literal.String.Multiline
|
||||
'\n multi\n line\n string\n' Literal.String.Multiline
|
||||
|
||||
"''" Literal.String.Multiline
|
||||
'\n\n' Text
|
||||
|
||||
"''" Literal.String.Multiline
|
||||
'\n multi\n ' Literal.String.Multiline
|
||||
'${' Literal.String.Interpol
|
||||
'value' Text
|
||||
'}' Literal.String.Interpol
|
||||
'\n string\n' Literal.String.Multiline
|
||||
|
||||
"''" Literal.String.Multiline
|
||||
'\n' Text
|
34
spec/tests/nix/built_in.txt
Normal file
34
spec/tests/nix/built_in.txt
Normal file
@ -0,0 +1,34 @@
|
||||
---input---
|
||||
import ./foo.nix
|
||||
|
||||
map (x: x + x) [ 1 2 3 ]
|
||||
|
||||
---tokens---
|
||||
'import' Name.Builtin
|
||||
' ' Text
|
||||
'./foo.nix' Literal
|
||||
'\n\n' Text
|
||||
|
||||
'map' Name.Builtin
|
||||
' ' Text
|
||||
'(' Punctuation
|
||||
'x' Text
|
||||
':' Punctuation
|
||||
' ' Text
|
||||
'x' Text
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'x' Text
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
'[' Punctuation
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
' ' Text
|
||||
'2' Literal.Number.Integer
|
||||
' ' Text
|
||||
'3' Literal.Number.Integer
|
||||
' ' Text
|
||||
']' Punctuation
|
||||
'\n' Text
|
16
spec/tests/nix/comments.txt
Normal file
16
spec/tests/nix/comments.txt
Normal file
@ -0,0 +1,16 @@
|
||||
---input---
|
||||
# single line comment
|
||||
|
||||
/* multi
|
||||
line
|
||||
comment */
|
||||
|
||||
|
||||
---tokens---
|
||||
'# single line comment' Comment.Single
|
||||
'\n\n' Text
|
||||
|
||||
'/*' Comment.Multiline
|
||||
' multi\nline\ncomment ' Comment.Multiline
|
||||
'*/' Comment.Multiline
|
||||
'\n' Text
|
140
spec/tests/nix/compound_values.txt
Normal file
140
spec/tests/nix/compound_values.txt
Normal file
@ -0,0 +1,140 @@
|
||||
---input---
|
||||
{ x = 1; y = 2; }
|
||||
|
||||
{ foo.bar = 1; }
|
||||
|
||||
rec { x = "foo"; y = x + "bar"; }
|
||||
|
||||
[ "foo" "bar" "baz" ]
|
||||
|
||||
[ 1 2 3 ]
|
||||
|
||||
[ (f 1) { a = 1; b = 2; } [ "c" ] ]
|
||||
|
||||
---tokens---
|
||||
'{' Punctuation
|
||||
' ' Text
|
||||
'x' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'y' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'2' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'}' Punctuation
|
||||
'\n\n' Text
|
||||
|
||||
'{' Punctuation
|
||||
' ' Text
|
||||
'foo' Text
|
||||
'.' Operator
|
||||
'bar' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'}' Punctuation
|
||||
'\n\n' Text
|
||||
|
||||
'rec' Keyword
|
||||
' ' Text
|
||||
'{' Punctuation
|
||||
' ' Text
|
||||
'x' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'foo' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'y' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'x' Text
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'bar' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'}' Punctuation
|
||||
'\n\n' Text
|
||||
|
||||
'[' Punctuation
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'foo' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'bar' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'baz' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
' ' Text
|
||||
']' Punctuation
|
||||
'\n\n' Text
|
||||
|
||||
'[' Punctuation
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
' ' Text
|
||||
'2' Literal.Number.Integer
|
||||
' ' Text
|
||||
'3' Literal.Number.Integer
|
||||
' ' Text
|
||||
']' Punctuation
|
||||
'\n\n' Text
|
||||
|
||||
'[' Punctuation
|
||||
' ' Text
|
||||
'(' Punctuation
|
||||
'f' Text
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
'{' Punctuation
|
||||
' ' Text
|
||||
'a' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'b' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'2' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'}' Punctuation
|
||||
' ' Text
|
||||
'[' Punctuation
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'c' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
' ' Text
|
||||
']' Punctuation
|
||||
' ' Text
|
||||
']' Punctuation
|
||||
'\n' Text
|
56
spec/tests/nix/computed_property_names.txt
Normal file
56
spec/tests/nix/computed_property_names.txt
Normal file
@ -0,0 +1,56 @@
|
||||
---input---
|
||||
let
|
||||
bar = "bar";
|
||||
in {
|
||||
foo.${bar} = 3;
|
||||
foo.${bar + "bar"} = 3;
|
||||
}
|
||||
|
||||
---tokens---
|
||||
'let' Keyword
|
||||
'\n ' Text
|
||||
'bar' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'bar' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
';' Punctuation
|
||||
'\n' Text
|
||||
|
||||
'in' Keyword
|
||||
' ' Text
|
||||
'{' Punctuation
|
||||
'\n ' Text
|
||||
'foo' Text
|
||||
'.' Operator
|
||||
'${' Literal.String.Interpol
|
||||
'bar' Text
|
||||
'}' Literal.String.Interpol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'3' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
'\n ' Text
|
||||
'foo' Text
|
||||
'.' Operator
|
||||
'${' Literal.String.Interpol
|
||||
'bar' Text
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'bar' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'}' Literal.String.Interpol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'3' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
'\n' Text
|
||||
|
||||
'}' Punctuation
|
||||
'\n' Text
|
99
spec/tests/nix/control_structures.txt
Normal file
99
spec/tests/nix/control_structures.txt
Normal file
@ -0,0 +1,99 @@
|
||||
---input---
|
||||
if 1 + 1 == 2 then "yes!" else "no!"
|
||||
|
||||
assert 1 + 1 == 2; "yes!"
|
||||
|
||||
let x = "foo"; y = "bar"; in x + y
|
||||
|
||||
with builtins; head [ 1 2 3 ]
|
||||
|
||||
---tokens---
|
||||
'if' Keyword
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
' ' Text
|
||||
'==' Operator
|
||||
' ' Text
|
||||
'2' Literal.Number.Integer
|
||||
' ' Text
|
||||
'then' Keyword
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'yes!' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
' ' Text
|
||||
'else' Keyword
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'no!' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n\n' Text
|
||||
|
||||
'assert' Keyword
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
' ' Text
|
||||
'==' Operator
|
||||
' ' Text
|
||||
'2' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'yes!' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n\n' Text
|
||||
|
||||
'let' Keyword
|
||||
' ' Text
|
||||
'x' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'foo' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'y' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'bar' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'in' Keyword
|
||||
' ' Text
|
||||
'x' Text
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'y' Text
|
||||
'\n\n' Text
|
||||
|
||||
'with' Keyword
|
||||
' ' Text
|
||||
'builtins' Name.Builtin
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'head' Text
|
||||
' ' Text
|
||||
'[' Punctuation
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
' ' Text
|
||||
'2' Literal.Number.Integer
|
||||
' ' Text
|
||||
'3' Literal.Number.Integer
|
||||
' ' Text
|
||||
']' Punctuation
|
||||
'\n' Text
|
26
spec/tests/nix/floats.txt
Normal file
26
spec/tests/nix/floats.txt
Normal file
@ -0,0 +1,26 @@
|
||||
---input---
|
||||
0.3
|
||||
.1
|
||||
0.1e4
|
||||
-3.0
|
||||
0.1E-4
|
||||
0.2e+4
|
||||
|
||||
---tokens---
|
||||
'0.3' Literal.Number.Float
|
||||
'\n' Text
|
||||
|
||||
'.1' Literal.Number.Float
|
||||
'\n' Text
|
||||
|
||||
'0.1e4' Literal.Number.Float
|
||||
'\n' Text
|
||||
|
||||
'-3.0' Literal.Number.Float
|
||||
'\n' Text
|
||||
|
||||
'0.1E-4' Literal.Number.Float
|
||||
'\n' Text
|
||||
|
||||
'0.2e+4' Literal.Number.Float
|
||||
'\n' Text
|
219
spec/tests/nix/functions.txt
Normal file
219
spec/tests/nix/functions.txt
Normal file
@ -0,0 +1,219 @@
|
||||
---input---
|
||||
x: x + 1
|
||||
|
||||
|
||||
A function that expects an integer and returns it increased by 1
|
||||
|
||||
x: y: x + y
|
||||
|
||||
(x: x + 1) 100
|
||||
|
||||
let inc = x: x + 1; in inc (inc (inc 100))
|
||||
|
||||
{ x, y }: x + y
|
||||
|
||||
{ x, y ? "bar" }: x + y
|
||||
|
||||
{ x, y, ... }: x + y
|
||||
|
||||
{ x, y } @ args: x + y
|
||||
|
||||
args @ { x, y }: x + y
|
||||
|
||||
---tokens---
|
||||
'x' Text
|
||||
':' Punctuation
|
||||
' ' Text
|
||||
'x' Text
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
'\n\n\n' Text
|
||||
|
||||
'A' Text
|
||||
' ' Text
|
||||
'function' Text
|
||||
' ' Text
|
||||
'that' Text
|
||||
' ' Text
|
||||
'expects' Text
|
||||
' ' Text
|
||||
'an' Text
|
||||
' ' Text
|
||||
'integer' Text
|
||||
' ' Text
|
||||
'and' Operator.Word
|
||||
' ' Text
|
||||
'returns' Text
|
||||
' ' Text
|
||||
'it' Text
|
||||
' ' Text
|
||||
'increased' Text
|
||||
' ' Text
|
||||
'by' Text
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
'\n\n' Text
|
||||
|
||||
'x' Text
|
||||
':' Punctuation
|
||||
' ' Text
|
||||
'y' Text
|
||||
':' Punctuation
|
||||
' ' Text
|
||||
'x' Text
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'y' Text
|
||||
'\n\n' Text
|
||||
|
||||
'(' Punctuation
|
||||
'x' Text
|
||||
':' Punctuation
|
||||
' ' Text
|
||||
'x' Text
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
'100' Literal.Number.Integer
|
||||
'\n\n' Text
|
||||
|
||||
'let' Keyword
|
||||
' ' Text
|
||||
'inc' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'x' Text
|
||||
':' Punctuation
|
||||
' ' Text
|
||||
'x' Text
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'in' Keyword
|
||||
' ' Text
|
||||
'inc' Text
|
||||
' ' Text
|
||||
'(' Punctuation
|
||||
'inc' Text
|
||||
' ' Text
|
||||
'(' Punctuation
|
||||
'inc' Text
|
||||
' ' Text
|
||||
'100' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
')' Punctuation
|
||||
'\n\n' Text
|
||||
|
||||
'{' Punctuation
|
||||
' ' Text
|
||||
'x' Text
|
||||
',' Punctuation
|
||||
' ' Text
|
||||
'y' Text
|
||||
' ' Text
|
||||
'}' Punctuation
|
||||
':' Punctuation
|
||||
' ' Text
|
||||
'x' Text
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'y' Text
|
||||
'\n\n' Text
|
||||
|
||||
'{' Punctuation
|
||||
' ' Text
|
||||
'x' Text
|
||||
',' Punctuation
|
||||
' ' Text
|
||||
'y' Text
|
||||
' ' Text
|
||||
'?' Operator
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'bar' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
' ' Text
|
||||
'}' Punctuation
|
||||
':' Punctuation
|
||||
' ' Text
|
||||
'x' Text
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'y' Text
|
||||
'\n\n' Text
|
||||
|
||||
'{' Punctuation
|
||||
' ' Text
|
||||
'x' Text
|
||||
',' Punctuation
|
||||
' ' Text
|
||||
'y' Text
|
||||
',' Punctuation
|
||||
' ' Text
|
||||
'.' Operator
|
||||
'.' Operator
|
||||
'.' Operator
|
||||
' ' Text
|
||||
'}' Punctuation
|
||||
':' Punctuation
|
||||
' ' Text
|
||||
'x' Text
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'y' Text
|
||||
'\n\n' Text
|
||||
|
||||
'{' Punctuation
|
||||
' ' Text
|
||||
'x' Text
|
||||
',' Punctuation
|
||||
' ' Text
|
||||
'y' Text
|
||||
' ' Text
|
||||
'}' Punctuation
|
||||
' ' Text
|
||||
'@' Punctuation
|
||||
' ' Text
|
||||
'args' Text
|
||||
':' Punctuation
|
||||
' ' Text
|
||||
'x' Text
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'y' Text
|
||||
'\n\n' Text
|
||||
|
||||
'args' Text
|
||||
' ' Text
|
||||
'@' Punctuation
|
||||
' ' Text
|
||||
'{' Punctuation
|
||||
' ' Text
|
||||
'x' Text
|
||||
',' Punctuation
|
||||
' ' Text
|
||||
'y' Text
|
||||
' ' Text
|
||||
'}' Punctuation
|
||||
':' Punctuation
|
||||
' ' Text
|
||||
'x' Text
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'y' Text
|
||||
'\n' Text
|
186
spec/tests/nix/operators.txt
Normal file
186
spec/tests/nix/operators.txt
Normal file
@ -0,0 +1,186 @@
|
||||
---input---
|
||||
"foo" + "bar"
|
||||
|
||||
1 + 2
|
||||
|
||||
2 / 1
|
||||
|
||||
"foo" == "f" + "oo"
|
||||
|
||||
"foo" != "bar"
|
||||
|
||||
!true
|
||||
|
||||
2 * 2 < 5
|
||||
|
||||
5 > 1
|
||||
|
||||
2 - 1
|
||||
|
||||
{ x = 1; y = 2; }.x
|
||||
|
||||
{ x = 1; y = 2; }.z or 3
|
||||
|
||||
{ x = 1; y = 2; } // { z = 3; }
|
||||
|
||||
---tokens---
|
||||
'"' Literal.String.Double
|
||||
'foo' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'bar' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n\n' Text
|
||||
|
||||
'1' Literal.Number.Integer
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'2' Literal.Number.Integer
|
||||
'\n\n' Text
|
||||
|
||||
'2' Literal.Number.Integer
|
||||
' ' Text
|
||||
'/' Operator
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
'\n\n' Text
|
||||
|
||||
'"' Literal.String.Double
|
||||
'foo' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
' ' Text
|
||||
'==' Operator
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'f' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
' ' Text
|
||||
'+' Operator
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'oo' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n\n' Text
|
||||
|
||||
'"' Literal.String.Double
|
||||
'foo' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
' ' Text
|
||||
'!' Operator
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'"' Literal.String.Double
|
||||
'bar' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n\n' Text
|
||||
|
||||
'!' Operator
|
||||
'true' Name.Constant
|
||||
'\n\n' Text
|
||||
|
||||
'2' Literal.Number.Integer
|
||||
' ' Text
|
||||
'*' Operator
|
||||
' ' Text
|
||||
'2' Literal.Number.Integer
|
||||
' ' Text
|
||||
'<' Operator
|
||||
' ' Text
|
||||
'5' Literal.Number.Integer
|
||||
'\n\n' Text
|
||||
|
||||
'5' Literal.Number.Integer
|
||||
' ' Text
|
||||
'>' Operator
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
'\n\n' Text
|
||||
|
||||
'2' Literal.Number.Integer
|
||||
' ' Text
|
||||
'-' Operator
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
'\n\n' Text
|
||||
|
||||
'{' Punctuation
|
||||
' ' Text
|
||||
'x' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'y' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'2' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'}' Punctuation
|
||||
'.' Operator
|
||||
'x' Text
|
||||
'\n\n' Text
|
||||
|
||||
'{' Punctuation
|
||||
' ' Text
|
||||
'x' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'y' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'2' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'}' Punctuation
|
||||
'.' Operator
|
||||
'z' Text
|
||||
' ' Text
|
||||
'or' Operator.Word
|
||||
' ' Text
|
||||
'3' Literal.Number.Integer
|
||||
'\n\n' Text
|
||||
|
||||
'{' Punctuation
|
||||
' ' Text
|
||||
'x' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'1' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'y' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'2' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'}' Punctuation
|
||||
' ' Text
|
||||
'//' Operator
|
||||
' ' Text
|
||||
'{' Punctuation
|
||||
' ' Text
|
||||
'z' Literal.String.Symbol
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'3' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'}' Punctuation
|
||||
'\n' Text
|
101
spec/tests/nix/string_escape.txt
Normal file
101
spec/tests/nix/string_escape.txt
Normal file
@ -0,0 +1,101 @@
|
||||
---input---
|
||||
''
|
||||
''\t ''\n ''\r ''' ''$ '
|
||||
''
|
||||
|
||||
"\"\$${builtins.toString maxArgIndex}\""
|
||||
|
||||
"\n"
|
||||
|
||||
"cp \"$(nix-build -A ${attr})\" \"$0\" > /dev/null"
|
||||
|
||||
"$" #
|
||||
|
||||
''$'' #
|
||||
|
||||
" \ "
|
||||
|
||||
'' ''\ ''
|
||||
|
||||
---tokens---
|
||||
"''" Literal.String.Multiline
|
||||
'\n ' Literal.String.Multiline
|
||||
"''\\t" Literal.String.Escape
|
||||
' ' Literal.String.Multiline
|
||||
"''\\n" Literal.String.Escape
|
||||
' ' Literal.String.Multiline
|
||||
"''\\r" Literal.String.Escape
|
||||
' ' Literal.String.Multiline
|
||||
"'''" Literal.String.Escape
|
||||
' ' Literal.String.Multiline
|
||||
"''$" Literal.String.Escape
|
||||
' ' Literal.String.Multiline
|
||||
"'\n" Literal.String.Multiline
|
||||
|
||||
"''" Literal.String.Multiline
|
||||
'\n\n' Text
|
||||
|
||||
'"' Literal.String.Double
|
||||
'\\"' Literal.String.Escape
|
||||
'\\$' Literal.String.Escape
|
||||
'${' Literal.String.Interpol
|
||||
'builtins' Name.Builtin
|
||||
'.' Operator
|
||||
'toString' Name.Builtin
|
||||
' ' Text
|
||||
'maxArgIndex' Text
|
||||
'}' Literal.String.Interpol
|
||||
'\\"' Literal.String.Escape
|
||||
'"' Literal.String.Double
|
||||
'\n\n' Text
|
||||
|
||||
'"' Literal.String.Double
|
||||
'\\n' Literal.String.Escape
|
||||
'"' Literal.String.Double
|
||||
'\n\n' Text
|
||||
|
||||
'"' Literal.String.Double
|
||||
'cp ' Literal.String.Double
|
||||
'\\"' Literal.String.Escape
|
||||
'$(' Literal.String.Double
|
||||
'nix-build -A ' Literal.String.Double
|
||||
'${' Literal.String.Interpol
|
||||
'attr' Text
|
||||
'}' Literal.String.Interpol
|
||||
')' Literal.String.Double
|
||||
'\\"' Literal.String.Escape
|
||||
' ' Literal.String.Double
|
||||
'\\"' Literal.String.Escape
|
||||
'$0' Literal.String.Double
|
||||
'\\"' Literal.String.Escape
|
||||
' > /dev/null' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n\n' Text
|
||||
|
||||
'"' Literal.String.Double
|
||||
'$' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
' ' Text
|
||||
'#' Comment.Single
|
||||
'\n\n' Text
|
||||
|
||||
"''" Literal.String.Multiline
|
||||
'$' Literal.String.Multiline
|
||||
"''" Literal.String.Multiline
|
||||
' ' Text
|
||||
'#' Comment.Single
|
||||
'\n\n' Text
|
||||
|
||||
'"' Literal.String.Double
|
||||
' ' Literal.String.Double
|
||||
'\\' Literal.String.Double
|
||||
' ' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n\n' Text
|
||||
|
||||
"''" Literal.String.Multiline
|
||||
' ' Literal.String.Multiline
|
||||
"''\\" Literal.String.Escape
|
||||
' ' Literal.String.Multiline
|
||||
"''" Literal.String.Multiline
|
||||
'\n' Text
|
Reference in New Issue
Block a user