MCPcopy Create free account
hub / github.com/buger/jsonparser / TestPropertyValueTypeStringer

Function TestPropertyValueTypeStringer

property_test.go:903–927  ·  view source on GitHub ↗

--------------------------------------------------------------------------- Property: ValueType.String round-trips for all enumerated tags --------------------------------------------------------------------------- reqproof:proptest String Verifies: SYS-REQ-001 [property]

(t *testing.T)

Source from the content-addressed store, hash-verified

901// reqproof:proptest String
902// Verifies: SYS-REQ-001 [property]
903func TestPropertyValueTypeStringer(t *testing.T) {
904 for _, tc := range []struct {
905 vt ValueType
906 want string
907 }{
908 {NotExist, "non-existent"},
909 {String, "string"},
910 {Number, "number"},
911 {Object, "object"},
912 {Array, "array"},
913 {Boolean, "boolean"},
914 {Null, "null"},
915 } {
916 got := tc.vt.String()
917 if got != tc.want {
918 t.Fatalf("ValueType(%d).String() = %q, want %q", tc.vt, got, tc.want)
919 }
920 }
921 // Determinism: same value → same string across many calls.
922 for i := 0; i < 100; i++ {
923 if String.String() != "string" {
924 t.Fatalf("ValueType.String non-deterministic")
925 }
926 }
927}
928
929// ---------------------------------------------------------------------------
930// Property: all fuzz harnesses from fuzz.go never panic on arbitrary bytes

Callers

nothing calls this directly

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected