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:
12
spec/tests/rust/test_attribute.txt
Normal file
12
spec/tests/rust/test_attribute.txt
Normal file
@ -0,0 +1,12 @@
|
||||
---input---
|
||||
#[foo(bar = [baz, qux])]
|
||||
|
||||
---tokens---
|
||||
'#[' Comment.Preproc
|
||||
'foo(bar = ' Comment.Preproc
|
||||
'[' Comment.Preproc
|
||||
'baz, qux' Comment.Preproc
|
||||
']' Comment.Preproc
|
||||
')' Comment.Preproc
|
||||
']' Comment.Preproc
|
||||
'\n' Text.Whitespace
|
39
spec/tests/rust/test_break.txt
Normal file
39
spec/tests/rust/test_break.txt
Normal file
@ -0,0 +1,39 @@
|
||||
---input---
|
||||
loop {
|
||||
break;
|
||||
break 'foo;
|
||||
break'foo;
|
||||
break_it;
|
||||
}
|
||||
|
||||
---tokens---
|
||||
'loop' Keyword
|
||||
' ' Text.Whitespace
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'break' Keyword
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'break' Keyword
|
||||
' ' Text.Whitespace
|
||||
"'foo" Name.Label
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'break' Keyword
|
||||
"'foo" Name.Label
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'break_it' Name
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
21
spec/tests/rust/test_func.txt
Normal file
21
spec/tests/rust/test_func.txt
Normal file
@ -0,0 +1,21 @@
|
||||
---input---
|
||||
fn func(x: u32) -> None {}
|
||||
|
||||
---tokens---
|
||||
'fn' Keyword
|
||||
' ' Text.Whitespace
|
||||
'func' Name.Function
|
||||
'(' Punctuation
|
||||
'x' Name
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'u32' Keyword.Type
|
||||
')' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'->' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'None' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'{' Punctuation
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
117
spec/tests/rust/test_rawstrings.txt
Normal file
117
spec/tests/rust/test_rawstrings.txt
Normal file
@ -0,0 +1,117 @@
|
||||
---input---
|
||||
fn main() {
|
||||
let raw_str = r"Escapes don't work
|
||||
|
||||
here: \x3F \u{211D}";
|
||||
println!("{}", raw_str);
|
||||
|
||||
// If you need quotes in a raw string, add a pair of #s
|
||||
let quotes = r#"And then I said:
|
||||
|
||||
"There is no escape!""#;
|
||||
println!("{}", quotes);
|
||||
|
||||
// If you need "# in your string, just use more #s in the delimiter.
|
||||
// There is no limit for the number of #s you can use.
|
||||
let longer_delimiter = r###"A string
|
||||
with "# in it. And even "##!"###;
|
||||
println!("{}", longer_delimiter);
|
||||
}
|
||||
|
||||
---tokens---
|
||||
'fn' Keyword
|
||||
' ' Text.Whitespace
|
||||
'main' Name.Function
|
||||
'(' Punctuation
|
||||
')' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'let' Keyword.Declaration
|
||||
' ' Text.Whitespace
|
||||
'raw_str' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'r"Escapes don\'t work\n\n here: \\x3F \\u{211D}"' Literal.String
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'println!' Name.Function.Magic
|
||||
'(' Punctuation
|
||||
'"' Literal.String
|
||||
'{}' Literal.String
|
||||
'"' Literal.String
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'raw_str' Name
|
||||
')' Punctuation
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'// If you need quotes in a raw string, add a pair of #s\n' Comment.Single
|
||||
|
||||
' ' Text.Whitespace
|
||||
'let' Keyword.Declaration
|
||||
' ' Text.Whitespace
|
||||
'quotes' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'r#"And then I said:\n\n "There is no escape!""#' Literal.String
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'println!' Name.Function.Magic
|
||||
'(' Punctuation
|
||||
'"' Literal.String
|
||||
'{}' Literal.String
|
||||
'"' Literal.String
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'quotes' Name
|
||||
')' Punctuation
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'// If you need "# in your string, just use more #s in the delimiter.\n' Comment.Single
|
||||
|
||||
' ' Text.Whitespace
|
||||
'// There is no limit for the number of #s you can use.\n' Comment.Single
|
||||
|
||||
' ' Text.Whitespace
|
||||
'let' Keyword.Declaration
|
||||
' ' Text.Whitespace
|
||||
'longer_delimiter' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'r###"A string\n with "# in it. And even "##!"###' Literal.String
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'println!' Name.Function.Magic
|
||||
'(' Punctuation
|
||||
'"' Literal.String
|
||||
'{}' Literal.String
|
||||
'"' Literal.String
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'longer_delimiter' Name
|
||||
')' Punctuation
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
17
spec/tests/rust/test_struct.txt
Normal file
17
spec/tests/rust/test_struct.txt
Normal file
@ -0,0 +1,17 @@
|
||||
---input---
|
||||
struct X { x: u32 }
|
||||
|
||||
---tokens---
|
||||
'struct' Keyword
|
||||
' ' Text.Whitespace
|
||||
'X' Name.Class
|
||||
' ' Text.Whitespace
|
||||
'{' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'x' Name
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'u32' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
13
spec/tests/rust/test_use.txt
Normal file
13
spec/tests/rust/test_use.txt
Normal file
@ -0,0 +1,13 @@
|
||||
---input---
|
||||
use std::collections::BtreeMap;
|
||||
|
||||
---tokens---
|
||||
'use' Keyword
|
||||
' ' Text.Whitespace
|
||||
'std' Name
|
||||
'::' Punctuation
|
||||
'collections' Name
|
||||
'::' Punctuation
|
||||
'BtreeMap' Name
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
Reference in New Issue
Block a user