Skip to content

Commit

Permalink
fix: ui tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mladedav committed Mar 16, 2024
1 parent c0644db commit c2c7a0f
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 108 deletions.
29 changes: 0 additions & 29 deletions lib/tests/tests/diagnostics/return_in_closure.vrl

This file was deleted.

34 changes: 0 additions & 34 deletions lib/tests/tests/diagnostics/return_in_closure_after_closure.vrl

This file was deleted.

29 changes: 0 additions & 29 deletions lib/tests/tests/diagnostics/return_in_closure_argument.vrl

This file was deleted.

34 changes: 26 additions & 8 deletions lib/tests/tests/expressions/abort/abort_typedef.vrl
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
# result: {
# "a": {"never": true},
# "b": {"bytes": true},
# "b2": {"bytes": true},
# "c": {"never": true},
# "d": {"object": {}},
# "e": {"null": true},
# "f": {"bytes": true, "integer": true},
# "g": {"never": true}
# "a": {
# "never": true
# },
# "b": {
# "bytes": true
# },
# "b2": {
# "bytes": true
# },
# "c": {
# "never": true
# },
# "d": {
# "object": {}
# },
# "e": {
# "null": true
# },
# "f": {
# "bytes": true,
# "integer": true
# },
# "g": {
# "bytes": true
# }
# }


x = "string"

Expand Down
24 changes: 24 additions & 0 deletions lib/tests/tests/expressions/return/return_bad_type_in_closure.vrl
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
}
10 changes: 10 additions & 0 deletions lib/tests/tests/expressions/return/return_in_closure.vrl
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
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 lib/tests/tests/expressions/return/return_in_closure_argument.vrl
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]
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
}
33 changes: 25 additions & 8 deletions lib/tests/tests/expressions/return/return_typedef.vrl
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
# result: {
# "a": {"never": true},
# "b": {"bytes": true},
# "b2": {"bytes": true},
# "c": {"never": true},
# "d": {"object": {}},
# "e": {"null": true},
# "f": {"bytes": true, "integer": true},
# "g": {"never": true}
# "a": {
# "never": true
# },
# "b": {
# "bytes": true
# },
# "b2": {
# "bytes": true
# },
# "c": {
# "never": true
# },
# "d": {
# "object": {}
# },
# "e": {
# "null": true
# },
# "f": {
# "bytes": true,
# "integer": true
# },
# "g": {
# "bytes": true
# }
# }

x = "string"

Expand Down

0 comments on commit c2c7a0f

Please sign in to comment.