MCPcopy
hub / github.com/google/mtail / TestInferCaprefType

Function TestInferCaprefType

internal/runtime/compiler/types/types_test.go:338–350  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

336}
337
338func TestInferCaprefType(t *testing.T) {
339 for _, tc := range inferCaprefTypeTests {
340 tc := tc
341 t.Run(tc.pattern, func(t *testing.T) {
342 re, err := ParseRegexp(`(` + tc.pattern + `)`)
343 testutil.FatalIfErr(t, err)
344 r := InferCaprefType(re, 1)
345 if !Equals(tc.typ, r) {
346 t.Errorf("Types don't match: %q inferred %v, not %v", tc.pattern, r, tc.typ)
347 }
348 })
349 }
350}
351
352func TestTypeEquals(t *testing.T) {
353 if Equals(NewVariable(), NewVariable()) {

Callers

nothing calls this directly

Calls 5

FatalIfErrFunction · 0.92
ParseRegexpFunction · 0.85
InferCaprefTypeFunction · 0.85
EqualsFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected