Skip to content

Commit

Permalink
test: add invalid chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
GreasySlug committed Dec 26, 2022
1 parent 45b49db commit 9d616fc
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 0 deletions.
100 changes: 100 additions & 0 deletions tests/should_err/invalid_chunk.er
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
a = 1 b = 1
d = True {1}
e = False {"a": 2}
f = 0.1 (1)
g = {x = 1} Class {name = Str; age = Nat}

[1, 2, 3] {1}
[1, 2, 3] {"c": 3}
[1, 2, 3] (1)
[1, 2, 3] {x = 1}

{1, 2, 3} {1}
{1, 2, 3} {"c": 3}
{1, 2, 3} (1)
{1, 2, 3} {x = 1}

{x = 1} {1}
{x = 1} {"c": 3}
{x = 1} (1)
{x = 1} {x = 1}

{"a": 1, "b": 2} {1}
{"a": 1, "b": 2} {"c": 3}
{"a": 1, "b": 2} (1)
{"a": 1, "b": 2} {x = 1; y = 1}

{1, 2, 3} g = 1
(1, 2, 3) {1}
(1, 2, 3) {"c": 3}
(1, 2, 3) {x = 1}

Class {name = Str; age = Nat} z = 1

# different error
[1, 2, 3] e = 1
{"a": 1, "b": 2} h = 1
{x = 1} i = 1
(1, 2, 3) j = 1

h = 1 [0, 1]
[1, 2, 3] [0, 1]
{"a": 1, "b": 2} [0, 1]
{x = 1} [0, 1]
(1, 2, 3) [0, 1]

# passed: index access
"Hello, world" [0]
[1, 2, 3] [1]
{"a": 1, "b": 2} [0]
{x = 1} [0]
(1, 2, 3) [0]
Class {name = Str; age = Nat} [0]

# passed: as args
[2, 2, 3] Class {name = Str; age = Nat}
{1, 2, 3} Class {name = Str; age = Nat}
{"a": 1, "b": 2} Class {name = Str; age = Nat}
(1, 2, 3) Class {name = Str; age = Nat}

Class {name = Str; age = Nat} [1, 2, 2]
Class {name = Str; age = Nat} {1, 2, 3}
Class {name = Str; age = Nat} {"c": 3, "d": 4}
Class {name = Str; age = Nat} (1, 2, 3)
Class {name = Str; age = Nat} Class {x = Int; y = Int}

block =
a = 1 b = 1
c = "Hello, world" [0] # is it possible to parse?
d = True {1}
e = False {"a": 2}
f = 0.1 (1)
g = {x = 1} Class {name = Str; age = Nat}

[1, 2, 3] {1}
[1, 2, 3] {"c": 3}
[1, 2, 3] (1)
[1, 2, 3] {x = 1}

{1, 2, 3} [1]
{1, 2, 3} {1}
{1, 2, 3} {"c": 3}
{1, 2, 3} (1)
{1, 2, 3} {x = 1}

{x = 1} {1}
{x = 1} {"c": 3}
{x = 1} (1)
{x = 1} {x = 1}

{"a": 1, "b": 2} {1}
{"a": 1, "b": 2} {"c": 3}
{"a": 1, "b": 2} (1)
{"a": 1, "b": 2} {x = 1; y = 1}

{1, 2, 3} g = 1
(1, 2, 3) {1}
(1, 2, 3) {"c": 3}
(1, 2, 3) {x = 1}

Class {name = Str; age = Nat} z = 1
5 changes: 5 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ fn exec_infer_union_array() -> Result<(), ()> {
expect_failure("tests/should_err/infer_union_array.er", 1)
}

#[test]
fn exec_invalid_chunk_prs_err() -> Result<(), ()> {
expect_failure("tests/should_err/invalid_chunk.er", 62)
}

#[test]
fn exec_invalid_interpol() -> Result<(), ()> {
expect_failure("tests/should_err/invalid_interpol.er", 2)
Expand Down

0 comments on commit 9d616fc

Please sign in to comment.