MCPcopy
hub / github.com/expr-lang/expr / TestIssue461

Function TestIssue461

test/issues/461/issue_test.go:10–93  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestIssue461(t *testing.T) {
11 type EnvStr string
12 type EnvField struct {
13 S EnvStr
14 Str string
15 }
16 type Env struct {
17 S EnvStr
18 Str string
19 EnvField EnvField
20 }
21 var tests = []struct {
22 input string
23 env Env
24 want bool
25 err string
26 }{
27 {
28 input: "Str == S",
29 env: Env{S: "string", Str: "string"},
30 err: "invalid operation: == (mismatched types string and issue_test.EnvStr)",
31 },
32 {
33 input: "Str == Str",
34 env: Env{Str: "string"},
35 want: true,
36 },
37 {
38 input: "S == S",
39 env: Env{Str: "string"},
40 want: true,
41 },
42 {
43 input: `Str == "string"`,
44 env: Env{Str: "string"},
45 want: true,
46 },
47 {
48 input: `S == "string"`,
49 env: Env{Str: "string"},
50 err: "invalid operation: == (mismatched types issue_test.EnvStr and string)",
51 },
52 {
53 input: "EnvField.Str == EnvField.S",
54 env: Env{EnvField: EnvField{S: "string", Str: "string"}},
55 err: "invalid operation: == (mismatched types string and issue_test.EnvStr)",
56 },
57 {
58 input: "EnvField.Str == EnvField.Str",
59 env: Env{EnvField: EnvField{Str: "string"}},
60 want: true,
61 },
62 {
63 input: "EnvField.S == EnvField.S",
64 env: Env{EnvField: EnvField{Str: "string"}},
65 want: true,
66 },
67 {

Callers

nothing calls this directly

Calls 10

CompileFunction · 0.92
EnvStruct · 0.92
AsBoolFunction · 0.92
ErrorFunction · 0.92
ContainsFunction · 0.92
RunFunction · 0.92
NoErrorFunction · 0.92
EqualFunction · 0.92
RunMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…