Skip to content

Commit

Permalink
test/cases: disregard ordering in "strings/concat: set" test
Browse files Browse the repository at this point in the history
Since anything can happen, we now list the possibilities (3! = 6),
and check that any of them was the result.

Fixes #2924.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
  • Loading branch information
srenatus authored and tsandall committed Dec 14, 2020
1 parent ef10c5f commit 9e52194
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 88 deletions.
1 change: 0 additions & 1 deletion internal/wasm/sdk/test/e2e/exceptions.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Exception Format is <test name>: <reason>
"baseandvirtualdocs/base/virtual: conflicts": "document merge conflict - https://github.com/open-policy-agent/opa/issues/2926"
"strings/concat: set": "test result order is not consistent - https://github.com/open-policy-agent/opa/issues/2924"
"strings/format_int": "rounding error - https://github.com/open-policy-agent/opa/issues/2923"
"strings/format_int: ref dest": "rounding error - https://github.com/open-policy-agent/opa/issues/2923"
"strings/format_int: ref dest (2)": "rounding error - https://github.com/open-policy-agent/opa/issues/2923"
Expand Down
104 changes: 17 additions & 87 deletions test/cases/testdata/strings/test-strings-0883.yaml
Original file line number Diff line number Diff line change
@@ -1,95 +1,25 @@
cases:
- data:
a:
- 1
- 2
- 3
- 4
b:
v1: hello
v2: goodbye
c:
- x:
- true
- false
- foo
"y":
- null
- 3.14159
z:
p: true
q: false
d:
e:
- bar
- baz
f:
- xs:
- 1
ys:
- 2
- xs:
- 2
ys:
- 3
g:
a:
- 1
- 0
- 0
- 0
b:
- 0
- 2
- 0
- 0
c:
- 0
- 0
- 0
- 4
h:
- - 1
- 2
- 3
- - 2
- 3
- 4
l:
- a: bob
b: -1
c:
- 1
- 2
- 3
- 4
- a: alice
b: 1
c:
- 2
- 3
- 4
- 5
d: null
m: []
numbers:
- "1"
- "2"
- "3"
- "4"
strings:
bar: 2
baz: 3
foo: 1
three: 3
modules:
- |
package generated
package test
p = x {
concat(",", {"1", "2", "3"}, x)
# Sets are unordered, so the output is not guaranteed.
# These are theoretically possible:
possibilities = {
"1,2,3",
"2,3,1",
"3,1,2",
"3,2,1",
"2,1,3",
"1,3,2"
}
p {
x := concat(",", {"1", "2", "3"})
possibilities[x]
}
note: 'strings/concat: set'
query: data.generated.p = x
query: data.test.p = x
want_result:
- x: 1,2,3
- x: true

0 comments on commit 9e52194

Please sign in to comment.