MCPcopy Create free account
hub / github.com/arcjet/gravity / TestClassify_UnitCase

Function TestClassify_UnitCase

examples/variants/variants_test.go:10–17  ·  view source on GitHub ↗

TestClassify_UnitCase exercises lifting a unit-case variant returned from the guest. The wrapper struct must be zero-sized and the type switch on the Go side must accept it as the variant interface.

(t *testing.T)

Source from the content-addressed store, hash-verified

8// from the guest. The wrapper struct must be zero-sized and the type
9// switch on the Go side must accept it as the variant interface.
10func TestClassify_UnitCase(t *testing.T) {
11 ins := newInstance(t)
12
13 got := ins.Classify(t.Context(), "email")
14 if _, ok := got.(EntityEmail); !ok {
15 t.Fatalf("Classify(\"email\") = %T, want EntityEmail", got)
16 }
17}
18
19// TestClassify_PayloadCase exercises lifting a payload-bearing case
20// where the payload is a primitive — the wrapper carries it in `Value`.

Callers

nothing calls this directly

Calls 1

newInstanceFunction · 0.70

Tested by

no test coverage detected