Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/tests/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use crate::lexer::tokenize;

#[test]
fn test_lexer_all_kind() {
insta::assert_yaml_snapshot!(tokenize("foo != 123(]{.:").unwrap());
insta::assert_yaml_snapshot!(tokenize("foo != 123(]{.:"));
}

#[test]
fn test_lexer_negative_number() {
insta::assert_yaml_snapshot!(tokenize("-123.456").unwrap());
insta::assert_yaml_snapshot!(tokenize("-123.456"));
}

#[test]
Expand Down
22 changes: 11 additions & 11 deletions src/tests/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ use crate::parser::parse;
#[test]
fn test_parse_from_events_nested_data() {
let tokens = tokenize(include_str!("./resources/from_events_nested_data.eql")).unwrap();
insta::assert_yaml_snapshot!(parse(tokens.as_slice()).unwrap());
insta::assert_yaml_snapshot!(parse(tokens.as_slice()));
}

#[test]
fn test_parse_from_events_using_subquery() {
let tokens = tokenize(include_str!("./resources/from_events_using_subquery.eql")).unwrap();
insta::assert_yaml_snapshot!(parse(tokens.as_slice()).unwrap());
insta::assert_yaml_snapshot!(parse(tokens.as_slice()));
}

#[test]
Expand All @@ -19,7 +19,7 @@ fn test_parse_from_events_where_subject_project_record_with_count() {
"./resources/from_events_where_subject_project_record_with_count.eql"
))
.unwrap();
insta::assert_yaml_snapshot!(parse(tokens.as_slice()).unwrap());
insta::assert_yaml_snapshot!(parse(tokens.as_slice()));
}

#[test]
Expand All @@ -28,7 +28,7 @@ fn test_parse_from_events_with_top_identity_projection() {
"./resources/from_events_with_top_identity_projection.eql"
))
.unwrap();
insta::assert_yaml_snapshot!(parse(tokens.as_slice()).unwrap());
insta::assert_yaml_snapshot!(parse(tokens.as_slice()));
}

#[test]
Expand All @@ -37,19 +37,19 @@ fn test_parse_from_events_with_type_to_project_record() {
"./resources/from_events_with_type_to_project_record.eql"
))
.unwrap();
insta::assert_yaml_snapshot!(parse(tokens.as_slice()).unwrap());
insta::assert_yaml_snapshot!(parse(tokens.as_slice()));
}

#[test]
fn test_parse_binary_op() {
let tokens = tokenize(include_str!("./resources/parser_binary_op.eql")).unwrap();
insta::assert_yaml_snapshot!(parse(tokens.as_slice()).unwrap());
insta::assert_yaml_snapshot!(parse(tokens.as_slice()));
}

#[test]
fn test_parser_unhinged_unary_op() {
let tokens = tokenize(include_str!("./resources/parser_unhinged_unary_op.eql")).unwrap();
insta::assert_yaml_snapshot!(parse(tokens.as_slice()).unwrap());
insta::assert_yaml_snapshot!(parse(tokens.as_slice()));
}

#[test]
Expand All @@ -58,25 +58,25 @@ fn test_parser_from_events_with_group_by_and_having() {
"./resources/from_events_with_group_by_and_having.eql"
))
.unwrap();
insta::assert_yaml_snapshot!(parse(tokens.as_slice()).unwrap());
insta::assert_yaml_snapshot!(parse(tokens.as_slice()));
}

#[test]
fn test_parser_from_events_with_distinct() {
let tokens = tokenize(include_str!("./resources/from_events_with_distinct.eql")).unwrap();
insta::assert_yaml_snapshot!(parse(tokens.as_slice()).unwrap());
insta::assert_yaml_snapshot!(parse(tokens.as_slice()));
}

#[test]
fn test_parser_valid_contains() {
let tokens = tokenize(include_str!("./resources/valid_contains.eql")).unwrap();
insta::assert_yaml_snapshot!(parse(tokens.as_slice()).unwrap());
insta::assert_yaml_snapshot!(parse(tokens.as_slice()));
}

#[test]
fn test_parser_valid_type_conversion() {
let tokens = tokenize(include_str!("./resources/valid_type_conversion.eql")).unwrap();
insta::assert_yaml_snapshot!(parse(tokens.as_slice()).unwrap());
insta::assert_yaml_snapshot!(parse(tokens.as_slice()));
}

#[test]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
---
source: src/tests/lexer.rs
expression: "tokenize(\"foo != 123(]{.:\").unwrap()"
expression: "tokenize(\"foo != 123(]{.:\")"
---
- sym:
Id: foo
line: 1
col: 1
- sym:
Operator: Neq
line: 1
col: 5
- sym:
Number: 123
line: 1
col: 8
- sym:
Symbol: OpenParen
line: 1
col: 11
- sym:
Symbol: CloseBracket
line: 1
col: 12
- sym:
Symbol: OpenBrace
line: 1
col: 13
- sym:
Symbol: Dot
line: 1
col: 14
- sym:
Symbol: Colon
line: 1
col: 15
- sym: Eof
line: 1
col: 16
Ok:
- sym:
Id: foo
line: 1
col: 1
- sym:
Operator: Neq
line: 1
col: 5
- sym:
Number: 123
line: 1
col: 8
- sym:
Symbol: OpenParen
line: 1
col: 11
- sym:
Symbol: CloseBracket
line: 1
col: 12
- sym:
Symbol: OpenBrace
line: 1
col: 13
- sym:
Symbol: Dot
line: 1
col: 14
- sym:
Symbol: Colon
line: 1
col: 15
- sym: Eof
line: 1
col: 16
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
---
source: src/tests/lexer.rs
expression: "tokenize(\"-123.456\").unwrap()"
expression: "tokenize(\"-123.456\")"
---
- sym:
Operator: Sub
line: 1
col: 1
- sym:
Number: 123.456
line: 1
col: 2
- sym: Eof
line: 1
col: 9
Ok:
- sym:
Operator: Sub
line: 1
col: 1
- sym:
Number: 123.456
line: 1
col: 2
- sym: Eof
line: 1
col: 9
Loading