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:
105
spec/tests/matlab/test_classes_with_properties.txt
Normal file
105
spec/tests/matlab/test_classes_with_properties.txt
Normal file
@ -0,0 +1,105 @@
|
||||
---input---
|
||||
classdef Name < dynamicprops
|
||||
properties
|
||||
% i am a comment
|
||||
name1
|
||||
name2
|
||||
end
|
||||
properties (Constant = true, SetAccess = protected)
|
||||
% i too am a comment
|
||||
matrix = [0, 1, 2];
|
||||
string = 'i am a string'
|
||||
end
|
||||
methods
|
||||
% i am also a comment
|
||||
function self = Name()
|
||||
% i am a comment inside a constructor
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---tokens---
|
||||
'classdef' Keyword
|
||||
' ' Text.Whitespace
|
||||
'Name' Name
|
||||
' ' Text.Whitespace
|
||||
'<' Operator
|
||||
' ' Text.Whitespace
|
||||
'dynamicprops' Keyword
|
||||
'\n ' Text.Whitespace
|
||||
'properties' Keyword
|
||||
'\n ' Text.Whitespace
|
||||
'% i am a comment' Comment
|
||||
'\n ' Text.Whitespace
|
||||
'name1' Name
|
||||
'\n ' Text.Whitespace
|
||||
'name2' Name
|
||||
'\n ' Text.Whitespace
|
||||
'end' Keyword
|
||||
'\n ' Text.Whitespace
|
||||
'properties' Keyword
|
||||
' ' Text.Whitespace
|
||||
'(' Punctuation
|
||||
'Constant' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'=' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'true' Keyword
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'SetAccess' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'=' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'protected' Keyword
|
||||
')' Punctuation
|
||||
'\n ' Text.Whitespace
|
||||
'% i too am a comment' Comment
|
||||
'\n ' Text.Whitespace
|
||||
'matrix' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'[' Punctuation
|
||||
'0' Literal.Number.Integer
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'1' Literal.Number.Integer
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'2' Literal.Number.Integer
|
||||
']' Punctuation
|
||||
';' Punctuation
|
||||
'\n ' Text.Whitespace
|
||||
'string' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Punctuation
|
||||
' ' Text.Whitespace
|
||||
"'" Literal.String
|
||||
"i am a string'" Literal.String
|
||||
'\n ' Text.Whitespace
|
||||
'end' Keyword
|
||||
'\n ' Text.Whitespace
|
||||
'methods' Keyword
|
||||
'\n ' Text.Whitespace
|
||||
'% i am also a comment' Comment
|
||||
'\n ' Text.Whitespace
|
||||
'function' Keyword
|
||||
' ' Text.Whitespace
|
||||
'self' Text
|
||||
' ' Text.Whitespace
|
||||
'=' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'Name' Name.Function
|
||||
'(' Punctuation
|
||||
')' Punctuation
|
||||
'\n ' Text.Whitespace
|
||||
'% i am a comment inside a constructor' Comment
|
||||
'\n ' Text.Whitespace
|
||||
'end' Keyword
|
||||
'\n ' Text.Whitespace
|
||||
'end' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'end' Keyword
|
||||
'\n' Text.Whitespace
|
12
spec/tests/matlab/test_command_mode.txt
Normal file
12
spec/tests/matlab/test_command_mode.txt
Normal file
@ -0,0 +1,12 @@
|
||||
# MATLAB allows char function arguments to not be enclosed by parentheses
|
||||
# or contain quote characters, as long as they are space separated. Test
|
||||
# that one common such function is formatted appropriately.
|
||||
|
||||
---input---
|
||||
help sin
|
||||
|
||||
---tokens---
|
||||
'help' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'sin' Name.Builtin
|
||||
'\n' Text.Whitespace
|
25
spec/tests/matlab/test_comment_after_continuation.txt
Normal file
25
spec/tests/matlab/test_comment_after_continuation.txt
Normal file
@ -0,0 +1,25 @@
|
||||
# Test that text after the line continuation ellipses is marked as a comment.
|
||||
|
||||
---input---
|
||||
set('T',300,... a comment
|
||||
'P',101325);
|
||||
|
||||
---tokens---
|
||||
'set' Name.Builtin
|
||||
'(' Punctuation
|
||||
"'" Literal.String
|
||||
"T'" Literal.String
|
||||
',' Punctuation
|
||||
'300' Literal.Number.Integer
|
||||
',' Punctuation
|
||||
'...' Keyword
|
||||
' a comment' Comment
|
||||
'\n' Text.Whitespace
|
||||
|
||||
"'" Literal.String
|
||||
"P'" Literal.String
|
||||
',' Punctuation
|
||||
'101325' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
10
spec/tests/matlab/test_dot_operator.txt
Normal file
10
spec/tests/matlab/test_dot_operator.txt
Normal file
@ -0,0 +1,10 @@
|
||||
# 1./x is (1)(./)(x), not (1.)(/)(x)
|
||||
|
||||
---input---
|
||||
1./x
|
||||
|
||||
---tokens---
|
||||
'1' Literal.Number.Integer
|
||||
'./' Operator
|
||||
'x' Name
|
||||
'\n' Text.Whitespace
|
36
spec/tests/matlab/test_keywords_ended_by_newline.txt
Normal file
36
spec/tests/matlab/test_keywords_ended_by_newline.txt
Normal file
@ -0,0 +1,36 @@
|
||||
# Test that keywords on their own line are marked as keywords.
|
||||
|
||||
---input---
|
||||
if x > 100
|
||||
disp('x > 100')
|
||||
else
|
||||
disp('x < 100')
|
||||
end
|
||||
|
||||
---tokens---
|
||||
'if' Keyword
|
||||
' ' Text.Whitespace
|
||||
'x' Name
|
||||
' ' Text.Whitespace
|
||||
'>' Operator
|
||||
' ' Text.Whitespace
|
||||
'100' Literal.Number.Integer
|
||||
'\n ' Text.Whitespace
|
||||
'disp' Name.Builtin
|
||||
'(' Punctuation
|
||||
"'" Literal.String
|
||||
"x > 100'" Literal.String
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'else' Keyword
|
||||
'\n ' Text.Whitespace
|
||||
'disp' Name.Builtin
|
||||
'(' Punctuation
|
||||
"'" Literal.String
|
||||
"x < 100'" Literal.String
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'end' Keyword
|
||||
'\n' Text.Whitespace
|
25
spec/tests/matlab/test_line_continuation.txt
Normal file
25
spec/tests/matlab/test_line_continuation.txt
Normal file
@ -0,0 +1,25 @@
|
||||
# Test that line continuation by ellipses does not produce generic
|
||||
# output on the second line.
|
||||
|
||||
---input---
|
||||
set('T',300,...
|
||||
'P',101325);
|
||||
|
||||
---tokens---
|
||||
'set' Name.Builtin
|
||||
'(' Punctuation
|
||||
"'" Literal.String
|
||||
"T'" Literal.String
|
||||
',' Punctuation
|
||||
'300' Literal.Number.Integer
|
||||
',' Punctuation
|
||||
'...' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
"'" Literal.String
|
||||
"P'" Literal.String
|
||||
',' Punctuation
|
||||
'101325' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
@ -0,0 +1,13 @@
|
||||
# Test that multiple spaces with an equal sign doesn't get formatted to a string.
|
||||
|
||||
---input---
|
||||
x = 100;
|
||||
|
||||
---tokens---
|
||||
'x' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'100' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
13
spec/tests/matlab/test_one_space_assignment.txt
Normal file
13
spec/tests/matlab/test_one_space_assignment.txt
Normal file
@ -0,0 +1,13 @@
|
||||
# Test that one space before an equal sign is formatted correctly.
|
||||
|
||||
---input---
|
||||
x = 100;
|
||||
|
||||
---tokens---
|
||||
'x' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'100' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
13
spec/tests/matlab/test_operator_multiple_space.txt
Normal file
13
spec/tests/matlab/test_operator_multiple_space.txt
Normal file
@ -0,0 +1,13 @@
|
||||
# Test that multiple spaces with an operator doesn't get formatted to a string.
|
||||
|
||||
---input---
|
||||
x > 100;
|
||||
|
||||
---tokens---
|
||||
'x' Name
|
||||
' ' Text.Whitespace
|
||||
'>' Operator
|
||||
' ' Text.Whitespace
|
||||
'100' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
18
spec/tests/matlab/test_single_line.txt
Normal file
18
spec/tests/matlab/test_single_line.txt
Normal file
@ -0,0 +1,18 @@
|
||||
---input---
|
||||
set('T',300,'P',101325);
|
||||
|
||||
---tokens---
|
||||
'set' Name.Builtin
|
||||
'(' Punctuation
|
||||
"'" Literal.String
|
||||
"T'" Literal.String
|
||||
',' Punctuation
|
||||
'300' Literal.Number.Integer
|
||||
',' Punctuation
|
||||
"'" Literal.String
|
||||
"P'" Literal.String
|
||||
',' Punctuation
|
||||
'101325' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
Reference in New Issue
Block a user