MCPcopy
hub / github.com/buger/jsonparser / TestMutationNilSafety

Function TestMutationNilSafety

obligation_property_test.go:398–422  ·  view source on GitHub ↗

Verifies: SYS-REQ-101 MCDC SYS-REQ-101: mutation_input_is_nil=T, mutation_returns_safe_result_for_nil=T => TRUE

(t *testing.T)

Source from the content-addressed store, hash-verified

396// Verifies: SYS-REQ-101
397// MCDC SYS-REQ-101: mutation_input_is_nil=T, mutation_returns_safe_result_for_nil=T => TRUE
398func TestMutationNilSafety(t *testing.T) {
399 t.Run("Set_nil", func(t *testing.T) {
400 defer func() {
401 if r := recover(); r != nil {
402 t.Fatalf("Set(nil) panicked: %v", r)
403 }
404 }()
405
406 _, err := Set(nil, []byte(`"value"`), "key")
407 // Set on nil should return an error or handle gracefully
408 _ = err
409 })
410
411 t.Run("Delete_nil", func(t *testing.T) {
412 defer func() {
413 if r := recover(); r != nil {
414 t.Fatalf("Delete(nil) panicked: %v", r)
415 }
416 }()
417
418 result := Delete(nil, "key")
419 // Delete on nil should return nil or empty without panic
420 _ = result
421 })
422}
423
424// Verifies: SYS-REQ-104
425// MCDC SYS-REQ-104: getunsafestring_input_is_nil=T, getunsafestring_returns_safe_result_for_nil=T => TRUE

Callers

nothing calls this directly

Calls 2

SetFunction · 0.85
DeleteFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…