Skip to content

Commit

Permalink
Add tests that force imut for
Browse files Browse the repository at this point in the history
Signed-off-by: Heinz N. Gies <[email protected]>
  • Loading branch information
Licenser committed Sep 22, 2023
1 parent 9155e74 commit 6515244
Show file tree
Hide file tree
Showing 26 changed files with 55 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ test_cases!(
fold_array_initial_op,
fold_array_initial,
fold_array,
fold_number_op_imut,
fold_number_imut,
fold_record_imut,
fold_array_initial_op_imut,
fold_array_initial_imut,
fold_array_imut,
record_add,
nested_use_with_path,
multi_use,
Expand Down
1 change: 1 addition & 0 deletions tests/script_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ test_cases!(
pp_nest_cyclic,
// INSERT
bad_fold,
bad_fold_imut,
strnig_as_ident,
sub_overflow,
mul_overflow,
Expand Down
5 changes: 5 additions & 0 deletions tests/script_errors/bad_fold_imut/error.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Error:
1 | (for event of
2 | case (k, v) => v
3 | into [] use merge end)
| ^^^^^ Found the token `merge` but expected one of `*`, `+`, `-`, `/`
3 changes: 3 additions & 0 deletions tests/script_errors/bad_fold_imut/script.tremor
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(for event of
case (k, v) => v
into [] use merge end)
1 change: 1 addition & 0 deletions tests/script_runtime_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ test_cases!(
subslice_out_of_bounds,
// INSERT
bad_fold_type,
bad_fold_type_imut,
bad_merge2,
bad_merge,
meta_and_use,
Expand Down
5 changes: 5 additions & 0 deletions tests/script_runtime_errors/bad_fold_type_imut/error.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Error:
1 | (for event of
2 | case (k,v) => [k, v]
| ^^^^^^ Type error: Expected object, found array
3 | into {} end)
1 change: 1 addition & 0 deletions tests/script_runtime_errors/bad_fold_type_imut/in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[1,2]
3 changes: 3 additions & 0 deletions tests/script_runtime_errors/bad_fold_type_imut/script.tremor
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(for event of
case (k,v) => [k, v]
into {} end)
1 change: 1 addition & 0 deletions tests/scripts/fold_array_imut/in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[1,2,3,4]
1 change: 1 addition & 0 deletions tests/scripts/fold_array_imut/out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[2,3,4,5]
3 changes: 3 additions & 0 deletions tests/scripts/fold_array_imut/script.tremor
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(for event of
case (k, v) => v + 1
end)
1 change: 1 addition & 0 deletions tests/scripts/fold_array_initial_imut/in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[1,2,3,4]
1 change: 1 addition & 0 deletions tests/scripts/fold_array_initial_imut/out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[2,3,4,5]
3 changes: 3 additions & 0 deletions tests/scripts/fold_array_initial_imut/script.tremor
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(for event of
case (k, v) => v + 1
into [] end)
1 change: 1 addition & 0 deletions tests/scripts/fold_array_initial_op_imut/in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[1,2,3,4]
1 change: 1 addition & 0 deletions tests/scripts/fold_array_initial_op_imut/out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[1,2,3,4,5]
3 changes: 3 additions & 0 deletions tests/scripts/fold_array_initial_op_imut/script.tremor
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(for event of
case (k, v) => v + 1
into [1] use + end)
1 change: 1 addition & 0 deletions tests/scripts/fold_number_imut/in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[1,2,3,4]
1 change: 1 addition & 0 deletions tests/scripts/fold_number_imut/out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
3 changes: 3 additions & 0 deletions tests/scripts/fold_number_imut/script.tremor
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(for event of
case (k, v) => v
into 0 end)
1 change: 1 addition & 0 deletions tests/scripts/fold_number_op_imut/in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[1,2,3,4]
1 change: 1 addition & 0 deletions tests/scripts/fold_number_op_imut/out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24
3 changes: 3 additions & 0 deletions tests/scripts/fold_number_op_imut/script.tremor
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(for event of
case (k, v) => v
into 1 use * end)
1 change: 1 addition & 0 deletions tests/scripts/fold_record_imut/in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[1,2,3,4]
1 change: 1 addition & 0 deletions tests/scripts/fold_record_imut/out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"0":2,"1":3,"2":4,"3":5}
3 changes: 3 additions & 0 deletions tests/scripts/fold_record_imut/script.tremor
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(for event of
case (k, v) => {"#{k}": v + 1}
into {} end)

0 comments on commit 6515244

Please sign in to comment.