Skip to content

Commit

Permalink
update test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvoth committed May 9, 2022
1 parent 755b4e9 commit c70184b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion crates/analyzer/tests/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ test_stmt! { type_constructor_arg_count, "let x: u8 = u8(1, 10)" }
test_stmt! { unary_minus_on_bool, "let x: bool = true\n-x" }
test_stmt! { unary_not_on_int, "let x: u256 = 10\nnot x" }
test_stmt! { undefined_generic_type, "let x: foobar<u256> = 10" }
test_stmt! { undefined_name, "let x: u16 = y\nlet z: u16 = y" }
test_stmt! { undefined_name, "let x: u16 = y\nlet z: u16 = y\nlet v: u16 = _42" }
test_stmt! { undefined_type, "let x: foobar = 10" }
test_stmt! { unexpected_return, "return 1" }
test_stmt! { unit_type_constructor, "()()" }
Expand Down
6 changes: 6 additions & 0 deletions crates/analyzer/tests/snapshots/errors__undefined_name.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@ error: cannot find value `y` in this scope
4let z: u16 = y
^ undefined

error: cannot find value `_42` in this scope
┌─ [snippet]:5:16
5let v: u16 = _42
^^^ undefined


3 changes: 1 addition & 2 deletions crates/parser/tests/cases/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ test_parse_err! { expr_bad_prefix, expressions::parse_expr, "*x + 1" }
test_parse_err! { expr_path_left, expressions::parse_expr, "(1 + 2)::foo::bar" }
test_parse_err! { expr_path_right, expressions::parse_expr, "foo::10::bar" }
test_parse_err! { expr_dotted_number, expressions::parse_expr, "3.14" }
test_parse_err! { expr_number_end_with_underscore, expressions::parse_expr, "42_42_" }
test_parse_err! { expr_number_start_with_underscore, expressions::parse_expr, "_42_42" }
test_parse_err! { expr_call_eq_label, expressions::parse_expr, "foo(bar=1, baz = 2)" }
test_parse_err! { expr_assignment, expressions::parse_expr, "1 + (x = y)" }
test_parse_err! { for_no_in, functions::parse_stmt, "for x:\n pass" }
Expand All @@ -104,6 +102,7 @@ test_parse_err! { stmt_vardecl_missing_type_annotation_2, functions::parse_stmt,
test_parse_err! { stmt_vardecl_missing_type_annotation_3, functions::parse_stmt, "let x:" }
test_parse_err! { stmt_vardecl_invalid_type_annotation, functions::parse_stmt, "let x: y + z" }
test_parse_err! { stmt_vardecl_invalid_name, functions::parse_stmt, "let x + y: u8" }
test_parse_err! { number_end_with_underscore, functions::parse_stmt, "42_42_"}
test_parse_err! { array_old_syntax, functions::parse_stmt, "let x: u8[10]" }
test_parse_err! { array_old_syntax_invalid, functions::parse_stmt, "let x: u8[10" }
test_parse_err! { self_const, module::parse_module, "const self: u8 = 10" }
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
source: crates/parser/tests/cases/errors.rs
expression: "err_string(stringify!(number_end_with_underscore), functions::parse_stmt,\n \"42_42_\")"

---
error: invalid syntax in function body
┌─ number_end_with_underscore:1:6
1 │ 42_42_
│ ^ unexpected token


0 comments on commit c70184b

Please sign in to comment.