-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
114 additions
and
108 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
lib/tests/tests/diagnostics/return_in_closure_after_closure.vrl
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
lib/tests/tests/diagnostics/return_in_closure_argument.vrl
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
lib/tests/tests/expressions/return/return_bad_type_in_closure.vrl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# DIAGNOSTICS | ||
# result: | ||
# | ||
# error[E122]: type mismatch in closure return type | ||
# ┌─ :2:37 | ||
# │ | ||
# 2 │ filter([1, 2, 3]) -> |_key, _value| { | ||
# │ ╭─────────────────────────────────────────^ | ||
# │ │ ╭───────────────────────────────────────' | ||
# │ │ │ ╭─────────────────────────────────────' | ||
# 3 │ │ │ │ return 0 | ||
# 4 │ │ │ │ true | ||
# 5 │ │ │ │ } | ||
# │ ╰─│─│─^ block returns invalid value type | ||
# │ ╰─│─' expected: boolean | ||
# │ ╰─' received: integer or boolean | ||
# │ | ||
# = see language documentation at https://vrl.dev | ||
# = try your code in the VRL REPL, learn more at https://vrl.dev/examples | ||
|
||
filter([1, 2, 3]) -> |_key, _value| { | ||
return 0 | ||
true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# result: 0 | ||
|
||
foo = 0 | ||
|
||
for_each({ "foo": "bar", "lorem": "ipsum" }) -> |_key, _value| { | ||
return 42 | ||
foo = 1 | ||
} | ||
|
||
foo |
10 changes: 10 additions & 0 deletions
10
lib/tests/tests/expressions/return/return_in_closure_after_closure.vrl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# result: null | ||
|
||
for_each({ "foo": "bar", "lorem": "ipsum" }) -> |_key, _value| { | ||
|
||
for_each({ "foo": "bar", "lorem": "ipsum" }) -> |_key, _value| { | ||
true | ||
} | ||
|
||
return 42 | ||
} |
10 changes: 10 additions & 0 deletions
10
lib/tests/tests/expressions/return/return_in_closure_argument.vrl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# result: [0, 1] | ||
|
||
foo = 0 | ||
bar = 0 | ||
|
||
for_each({ "foo": for_each({}) -> |_key, _value| { foo = 1; return true } }) -> |_key, _value| { | ||
bar = 1 | ||
} | ||
|
||
[foo, bar] |
9 changes: 9 additions & 0 deletions
9
lib/tests/tests/expressions/return/return_in_closure_in_closure.vrl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# result: {} | ||
|
||
filter({ "bar": null }) -> |_key, _value| { | ||
for_each({ "foo": null }) -> |_key, _value| { | ||
return 0 | ||
} | ||
|
||
false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters