(t *testing.T)
| 2806 | } |
| 2807 | |
| 2808 | func TestCheckInvalidOptSelectMember(t *testing.T) { |
| 2809 | fac := ast.NewExprFactory() |
| 2810 | target := fac.NewStruct(1, "Foo", nil) |
| 2811 | arg1 := fac.NewStruct(2, "Foo", nil) |
| 2812 | arg2 := fac.NewLiteral(3, types.String("field")) |
| 2813 | call := fac.NewMemberCall(4, "_?._", target, arg1, arg2) |
| 2814 | |
| 2815 | // This is not valid syntax, just for illustration purposes. |
| 2816 | src := common.NewTextSource("Foo{}._?._(Foo{}, 'field')") |
| 2817 | parsed := ast.NewAST(call, ast.NewSourceInfo(src)) |
| 2818 | reg := newTestRegistry(t) |
| 2819 | env, err := NewEnv(containers.DefaultContainer, reg) |
| 2820 | if err != nil { |
| 2821 | t.Fatalf("NewEnv(cont, reg) failed: %v", err) |
| 2822 | } |
| 2823 | _, iss := Check(parsed, src, env) |
| 2824 | if !strings.Contains(iss.ToDisplayString(), "incorrect signature. member call") { |
| 2825 | t.Errorf("got %s, wanted 'incorrect signature. member call'", iss.ToDisplayString()) |
| 2826 | } |
| 2827 | } |
| 2828 | |
| 2829 | func TestCheckInvalidOptSelectMissingArg(t *testing.T) { |
| 2830 | fac := ast.NewExprFactory() |
nothing calls this directly
no test coverage detected