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

Function TestGetUnsafeStringUnicodeEdgeCases

obligation_property_test.go:804–829  ·  view source on GitHub ↗

Verifies: SYS-REQ-105 MCDC SYS-REQ-105: getunsafestring_input_has_unicode_edge_cases=T, getunsafestring_handles_unicode_edges_safely=T => TRUE

(t *testing.T)

Source from the content-addressed store, hash-verified

802// Verifies: SYS-REQ-105
803// MCDC SYS-REQ-105: getunsafestring_input_has_unicode_edge_cases=T, getunsafestring_handles_unicode_edges_safely=T => TRUE
804func TestGetUnsafeStringUnicodeEdgeCases(t *testing.T) {
805 cases := []struct {
806 name string
807 data string
808 key string
809 }{
810 {name: "BOM in value", data: `{"s":"\uFEFF"}`, key: "s"},
811 {name: "raw multi-byte UTF-8", data: "{\"s\":\"\xc3\xa9\"}", key: "s"},
812 {name: "emoji in value", data: "{\"s\":\"\xf0\x9f\x98\x80\"}", key: "s"},
813 {name: "ZWJ sequence", data: "{\"s\":\"\xe2\x80\x8d\"}", key: "s"},
814 }
815 for _, tc := range cases {
816 t.Run(tc.name, func(t *testing.T) {
817 defer func() {
818 if r := recover(); r != nil {
819 t.Fatalf("GetUnsafeString panicked on %s: %v", tc.name, r)
820 }
821 }()
822
823 val, err := GetUnsafeString([]byte(tc.data), tc.key)
824 // GetUnsafeString returns raw bytes -- we just verify no panic
825 _ = val
826 _ = err
827 })
828 }
829}
830
831// Verifies: SYS-REQ-109
832// MCDC SYS-REQ-109: parseint_input_has_edge_case_number=T, parseint_handles_edge_numbers_safely=T => TRUE

Callers

nothing calls this directly

Calls 1

GetUnsafeStringFunction · 0.85

Tested by

no test coverage detected