(t *testing.T)
| 2848 | } |
| 2849 | |
| 2850 | func TestCheckInvalidOptSelectMember(t *testing.T) { |
| 2851 | fac := ast.NewExprFactory() |
| 2852 | target := fac.NewStruct(1, "Foo", nil) |
| 2853 | arg1 := fac.NewStruct(2, "Foo", nil) |
| 2854 | arg2 := fac.NewLiteral(3, types.String("field")) |
| 2855 | call := fac.NewMemberCall(4, "_?._", target, arg1, arg2) |
| 2856 | |
| 2857 | // This is not valid syntax, just for illustration purposes. |
| 2858 | src := common.NewTextSource("Foo{}._?._(Foo{}, 'field')") |
| 2859 | parsed := ast.NewAST(call, ast.NewSourceInfo(src)) |
| 2860 | reg := newTestRegistry(t) |
| 2861 | env, err := NewEnv(containers.DefaultContainer, reg) |
| 2862 | if err != nil { |
| 2863 | t.Fatalf("NewEnv(cont, reg) failed: %v", err) |
| 2864 | } |
| 2865 | _, iss := Check(parsed, src, env) |
| 2866 | if !strings.Contains(iss.ToDisplayString(), "incorrect signature. member call") { |
| 2867 | t.Errorf("got %s, wanted 'incorrect signature. member call'", iss.ToDisplayString()) |
| 2868 | } |
| 2869 | } |
| 2870 | |
| 2871 | func TestCheckInvalidOptSelectMissingArg(t *testing.T) { |
| 2872 | fac := ast.NewExprFactory() |
nothing calls this directly
no test coverage detected