We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 775fc3a commit f493d7dCopy full SHA for f493d7d
1 file changed
test/issues/854/issue_test.go
@@ -0,0 +1,24 @@
1
+package main
2
+
3
+import (
4
+ "testing"
5
6
+ "github.com/expr-lang/expr"
7
+ "github.com/expr-lang/expr/internal/testify/require"
8
+ "github.com/expr-lang/expr/types"
9
+)
10
11
+func TestIssue854(t *testing.T) {
12
+ envType := types.Map{
13
+ "user": types.Map{
14
+ // If we do not specify `Profile` here,
15
+ // this is a correct behavior to throw
16
+ // on a missing property.
17
+ },
18
+ }
19
20
+ code := `user.Profile?.Address ?? "Unknown address"`
21
22
+ _, err := expr.Compile(code, expr.Env(envType))
23
+ require.Error(t, err)
24
+}
0 commit comments