diff options
Diffstat (limited to 'tests/snippets/crystal')
-rw-r--r-- | tests/snippets/crystal/test_annotation.txt | 16 | ||||
-rw-r--r-- | tests/snippets/crystal/test_array_access.txt | 11 | ||||
-rw-r--r-- | tests/snippets/crystal/test_chars.txt | 25 | ||||
-rw-r--r-- | tests/snippets/crystal/test_constant_and_module.txt | 14 | ||||
-rw-r--r-- | tests/snippets/crystal/test_escaped_bracestring.txt | 19 | ||||
-rw-r--r-- | tests/snippets/crystal/test_escaped_interpolation.txt | 9 | ||||
-rw-r--r-- | tests/snippets/crystal/test_interpolation_nested_curly.txt | 56 | ||||
-rw-r--r-- | tests/snippets/crystal/test_lib.txt | 58 | ||||
-rw-r--r-- | tests/snippets/crystal/test_macro.txt | 76 | ||||
-rw-r--r-- | tests/snippets/crystal/test_operator_methods.txt | 18 | ||||
-rw-r--r-- | tests/snippets/crystal/test_percent_strings.txt | 41 | ||||
-rw-r--r-- | tests/snippets/crystal/test_percent_strings_special.txt | 31 | ||||
-rw-r--r-- | tests/snippets/crystal/test_pseudo_builtins.txt | 20 | ||||
-rw-r--r-- | tests/snippets/crystal/test_pseudo_keywords.txt | 50 | ||||
-rw-r--r-- | tests/snippets/crystal/test_range_syntax1.txt | 8 | ||||
-rw-r--r-- | tests/snippets/crystal/test_range_syntax2.txt | 10 |
16 files changed, 462 insertions, 0 deletions
diff --git a/tests/snippets/crystal/test_annotation.txt b/tests/snippets/crystal/test_annotation.txt new file mode 100644 index 0000000..b585fa1 --- /dev/null +++ b/tests/snippets/crystal/test_annotation.txt @@ -0,0 +1,16 @@ +---input--- +@[FOO::Bar::Baz(opt: "xx")] + +---tokens--- +'@[' Operator +'FOO::Bar::Baz' Name.Decorator +'(' Punctuation +'opt' Literal.String.Symbol +':' Punctuation +' ' Text.Whitespace +'"' Literal.String.Double +'xx' Literal.String.Double +'"' Literal.String.Double +')' Punctuation +']' Operator +'\n' Text.Whitespace diff --git a/tests/snippets/crystal/test_array_access.txt b/tests/snippets/crystal/test_array_access.txt new file mode 100644 index 0000000..6b36c51 --- /dev/null +++ b/tests/snippets/crystal/test_array_access.txt @@ -0,0 +1,11 @@ +---input--- +[5][5]? + +---tokens--- +'[' Operator +'5' Literal.Number.Integer +']' Operator +'[' Operator +'5' Literal.Number.Integer +']?' Operator +'\n' Text.Whitespace diff --git a/tests/snippets/crystal/test_chars.txt b/tests/snippets/crystal/test_chars.txt new file mode 100644 index 0000000..c254bfb --- /dev/null +++ b/tests/snippets/crystal/test_chars.txt @@ -0,0 +1,25 @@ +---input--- +'a' +'я' +'\u{1234}' +' +' +'abc' + +---tokens--- +"'a'" Literal.String.Char +'\n' Text.Whitespace + +"'я'" Literal.String.Char +'\n' Text.Whitespace + +"'\\u{1234}'" Literal.String.Char +'\n' Text.Whitespace + +"'\n'" Literal.String.Char +'\n' Text.Whitespace + +"'" Error +'abc' Name +"'" Error +'\n' Text.Whitespace diff --git a/tests/snippets/crystal/test_constant_and_module.txt b/tests/snippets/crystal/test_constant_and_module.txt new file mode 100644 index 0000000..f8d33ff --- /dev/null +++ b/tests/snippets/crystal/test_constant_and_module.txt @@ -0,0 +1,14 @@ +---input--- +HTTP +HTTP::Server.new + +---tokens--- +'HTTP' Name.Constant +'\n' Text.Whitespace + +'HTTP' Name +'::' Operator +'Server' Name +'.' Operator +'new' Name +'\n' Text.Whitespace diff --git a/tests/snippets/crystal/test_escaped_bracestring.txt b/tests/snippets/crystal/test_escaped_bracestring.txt new file mode 100644 index 0000000..14718b9 --- /dev/null +++ b/tests/snippets/crystal/test_escaped_bracestring.txt @@ -0,0 +1,19 @@ +---input--- +str.gsub(%r{\\\\}, "/") + +---tokens--- +'str' Name +'.' Operator +'gsub' Name +'(' Punctuation +'%r{' Literal.String.Regex +'\\\\' Literal.String.Regex +'\\\\' Literal.String.Regex +'}' Literal.String.Regex +',' Punctuation +' ' Text.Whitespace +'"' Literal.String.Double +'/' Literal.String.Double +'"' Literal.String.Double +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/crystal/test_escaped_interpolation.txt b/tests/snippets/crystal/test_escaped_interpolation.txt new file mode 100644 index 0000000..c623464 --- /dev/null +++ b/tests/snippets/crystal/test_escaped_interpolation.txt @@ -0,0 +1,9 @@ +---input--- +"\#{a + b}" + +---tokens--- +'"' Literal.String.Double +'\\#' Literal.String.Escape +'{a + b}' Literal.String.Double +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/crystal/test_interpolation_nested_curly.txt b/tests/snippets/crystal/test_interpolation_nested_curly.txt new file mode 100644 index 0000000..f4a69f7 --- /dev/null +++ b/tests/snippets/crystal/test_interpolation_nested_curly.txt @@ -0,0 +1,56 @@ +---input--- +"A#{ (3..5).group_by { |x| x/2}.map do |k,v| "#{k}" end.join }" + "Z" + +---tokens--- +'"' Literal.String.Double +'A' Literal.String.Double +'#{' Literal.String.Interpol +' ' Text.Whitespace +'(' Punctuation +'3' Literal.Number.Integer +'..' Operator +'5' Literal.Number.Integer +')' Punctuation +'.' Operator +'group_by' Name +' ' Text.Whitespace +'{' Literal.String.Interpol +' ' Text.Whitespace +'|' Operator +'x' Name +'|' Operator +' ' Text.Whitespace +'x' Name +'/' Operator +'2' Literal.Number.Integer +'}' Literal.String.Interpol +'.' Operator +'map' Name +' ' Text.Whitespace +'do' Keyword +' ' Text.Whitespace +'|' Operator +'k' Name +',' Punctuation +'v' Name +'|' Operator +' ' Text.Whitespace +'"' Literal.String.Double +'#{' Literal.String.Interpol +'k' Name +'}' Literal.String.Interpol +'"' Literal.String.Double +' ' Text.Whitespace +'end' Keyword +'.' Operator +'join' Name +' ' Text.Whitespace +'}' Literal.String.Interpol +'"' Literal.String.Double +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'"' Literal.String.Double +'Z' Literal.String.Double +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/crystal/test_lib.txt b/tests/snippets/crystal/test_lib.txt new file mode 100644 index 0000000..6f6f107 --- /dev/null +++ b/tests/snippets/crystal/test_lib.txt @@ -0,0 +1,58 @@ +---input--- +@[Link("some")] +lib LibSome +@[CallConvention("X86_StdCall")] +fun foo="some.foo"(thing : Void*) : LibC::Int +end + +---tokens--- +'@[' Operator +'Link' Name.Decorator +'(' Punctuation +'"' Literal.String.Double +'some' Literal.String.Double +'"' Literal.String.Double +')' Punctuation +']' Operator +'\n' Text.Whitespace + +'lib' Keyword +' ' Text.Whitespace +'LibSome' Name.Namespace +'\n' Text.Whitespace + +'@[' Operator +'CallConvention' Name.Decorator +'(' Punctuation +'"' Literal.String.Double +'X86_StdCall' Literal.String.Double +'"' Literal.String.Double +')' Punctuation +']' Operator +'\n' Text.Whitespace + +'fun' Keyword +' ' Text.Whitespace +'foo' Name.Function +'=' Operator +'"' Literal.String.Double +'some.foo' Literal.String.Double +'"' Literal.String.Double +'(' Punctuation +'thing' Name +' ' Text.Whitespace +':' Punctuation +' ' Text.Whitespace +'Void' Name +'*' Operator +')' Punctuation +' ' Text.Whitespace +':' Punctuation +' ' Text.Whitespace +'LibC' Name +'::' Operator +'Int' Name +'\n' Text.Whitespace + +'end' Keyword +'\n' Text.Whitespace diff --git a/tests/snippets/crystal/test_macro.txt b/tests/snippets/crystal/test_macro.txt new file mode 100644 index 0000000..765caa2 --- /dev/null +++ b/tests/snippets/crystal/test_macro.txt @@ -0,0 +1,76 @@ +---input--- +def<=>(other : self) : Int +{%for field in %w(first_name middle_name last_name)%} +cmp={{field.id}}<=>other.{{field.id}} +return cmp if cmp!=0 +{%end%} +0 +end + +---tokens--- +'def' Keyword +'<=>' Name.Function +'(' Punctuation +'other' Name +' ' Text.Whitespace +':' Punctuation +' ' Text.Whitespace +'self' Keyword +')' Punctuation +' ' Text.Whitespace +':' Punctuation +' ' Text.Whitespace +'Int' Name +'\n' Text.Whitespace + +'{%' Literal.String.Interpol +'for' Keyword +' ' Text.Whitespace +'field' Name +' ' Text.Whitespace +'in' Keyword +' ' Text.Whitespace +'%w(' Literal.String.Other +'first_name middle_name last_name' Literal.String.Other +')' Literal.String.Other +'%}' Literal.String.Interpol +'\n' Text.Whitespace + +'cmp' Name +'=' Operator +'{{' Literal.String.Interpol +'field' Name +'.' Operator +'id' Name +'}}' Literal.String.Interpol +'<=>' Operator +'other' Name +'.' Operator +'{{' Literal.String.Interpol +'field' Name +'.' Operator +'id' Name +'}}' Literal.String.Interpol +'\n' Text.Whitespace + +'return' Keyword +' ' Text.Whitespace +'cmp' Name +' ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'cmp' Name +'!=' Operator +'0' Literal.Number.Integer +'\n' Text.Whitespace + +'{%' Literal.String.Interpol +'end' Keyword +'%}' Literal.String.Interpol +'\n' Text.Whitespace + +'0' Literal.Number.Integer +'\n' Text.Whitespace + +'end' Keyword +'\n' Text.Whitespace diff --git a/tests/snippets/crystal/test_operator_methods.txt b/tests/snippets/crystal/test_operator_methods.txt new file mode 100644 index 0000000..084771f --- /dev/null +++ b/tests/snippets/crystal/test_operator_methods.txt @@ -0,0 +1,18 @@ +---input--- +([] of Int32).[]?(5) + +---tokens--- +'(' Punctuation +'[' Operator +']' Operator +' ' Text.Whitespace +'of' Keyword +' ' Text.Whitespace +'Int32' Name +')' Punctuation +'.' Operator +'[]?' Name.Operator +'(' Punctuation +'5' Literal.Number.Integer +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/crystal/test_percent_strings.txt b/tests/snippets/crystal/test_percent_strings.txt new file mode 100644 index 0000000..80f247c --- /dev/null +++ b/tests/snippets/crystal/test_percent_strings.txt @@ -0,0 +1,41 @@ +---input--- +%(hello ("world")) +%[hello ["world"]] +%{hello "world"} +%<hello <"world">> +%|hello "world"| + +---tokens--- +'%(' Literal.String.Other +'hello ' Literal.String.Other +'(' Literal.String.Other +'"world"' Literal.String.Other +')' Literal.String.Other +')' Literal.String.Other +'\n' Text.Whitespace + +'%[' Literal.String.Other +'hello ' Literal.String.Other +'[' Literal.String.Other +'"world"' Literal.String.Other +']' Literal.String.Other +']' Literal.String.Other +'\n' Text.Whitespace + +'%{' Literal.String.Other +'hello "world"' Literal.String.Other +'}' Literal.String.Other +'\n' Text.Whitespace + +'%<' Literal.String.Other +'hello ' Literal.String.Other +'<' Literal.String.Other +'"world"' Literal.String.Other +'>' Literal.String.Other +'>' Literal.String.Other +'\n' Text.Whitespace + +'%|' Literal.String.Other +'hello "world"' Literal.String.Other +'|' Literal.String.Other +'\n' Text.Whitespace diff --git a/tests/snippets/crystal/test_percent_strings_special.txt b/tests/snippets/crystal/test_percent_strings_special.txt new file mode 100644 index 0000000..4ca1c0b --- /dev/null +++ b/tests/snippets/crystal/test_percent_strings_special.txt @@ -0,0 +1,31 @@ +---input--- +%Q(hello \n #{name}) +%q(hello \n #{name}) +%w(foo\nbar baz) + +---tokens--- +'%Q(' Literal.String.Other +'hello ' Literal.String.Other +'\\n' Literal.String.Escape +' ' Literal.String.Other +'#{' Literal.String.Interpol +'name' Name +'}' Literal.String.Interpol +')' Literal.String.Other +'\n' Text.Whitespace + +'%q(' Literal.String.Other +'hello ' Literal.String.Other +'\\' Literal.String.Other +'n ' Literal.String.Other +'#' Literal.String.Other +'{name}' Literal.String.Other +')' Literal.String.Other +'\n' Text.Whitespace + +'%w(' Literal.String.Other +'foo' Literal.String.Other +'\\' Literal.String.Other +'nbar baz' Literal.String.Other +')' Literal.String.Other +'\n' Text.Whitespace diff --git a/tests/snippets/crystal/test_pseudo_builtins.txt b/tests/snippets/crystal/test_pseudo_builtins.txt new file mode 100644 index 0000000..9c8c917 --- /dev/null +++ b/tests/snippets/crystal/test_pseudo_builtins.txt @@ -0,0 +1,20 @@ +---input--- +record Cls do +def_equals s +end + +---tokens--- +'record' Name.Builtin.Pseudo +' ' Text.Whitespace +'Cls' Name +' ' Text.Whitespace +'do' Keyword +'\n' Text.Whitespace + +'def_equals' Name.Builtin.Pseudo +' ' Text.Whitespace +'s' Name +'\n' Text.Whitespace + +'end' Keyword +'\n' Text.Whitespace diff --git a/tests/snippets/crystal/test_pseudo_keywords.txt b/tests/snippets/crystal/test_pseudo_keywords.txt new file mode 100644 index 0000000..18827ad --- /dev/null +++ b/tests/snippets/crystal/test_pseudo_keywords.txt @@ -0,0 +1,50 @@ +---input--- +def f(x : T, line = __LINE__) forall T +if x.is_a?(String) +pp! x +end +end + +---tokens--- +'def' Keyword +' ' Text.Whitespace +'f' Name.Function +'(' Punctuation +'x' Name +' ' Text.Whitespace +':' Punctuation +' ' Text.Whitespace +'T' Name +',' Punctuation +' ' Text.Whitespace +'line' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'__LINE__' Keyword.Pseudo +')' Punctuation +' ' Text.Whitespace +'forall' Keyword.Pseudo +' ' Text.Whitespace +'T' Name +'\n' Text.Whitespace + +'if' Keyword +' ' Text.Whitespace +'x' Name +'.is_a?' Keyword.Pseudo +'(' Punctuation +'String' Name +')' Punctuation +'\n' Text.Whitespace + +'pp!' Name.Builtin.Pseudo +' ' Text.Whitespace +'x' Name +'\n' Text.Whitespace + +'end' Keyword +'\n' Text.Whitespace + +'end' Keyword +'\n' Text.Whitespace diff --git a/tests/snippets/crystal/test_range_syntax1.txt b/tests/snippets/crystal/test_range_syntax1.txt new file mode 100644 index 0000000..a3ba24a --- /dev/null +++ b/tests/snippets/crystal/test_range_syntax1.txt @@ -0,0 +1,8 @@ +---input--- +1...3 + +---tokens--- +'1' Literal.Number.Integer +'...' Operator +'3' Literal.Number.Integer +'\n' Text.Whitespace diff --git a/tests/snippets/crystal/test_range_syntax2.txt b/tests/snippets/crystal/test_range_syntax2.txt new file mode 100644 index 0000000..08bf4b1 --- /dev/null +++ b/tests/snippets/crystal/test_range_syntax2.txt @@ -0,0 +1,10 @@ +---input--- +1 .. 3 + +---tokens--- +'1' Literal.Number.Integer +' ' Text.Whitespace +'..' Operator +' ' Text.Whitespace +'3' Literal.Number.Integer +'\n' Text.Whitespace |