MCPcopy Index your code
hub / github.com/buger/jsonparser / TestGetBooleanPartialLiteral

Function TestGetBooleanPartialLiteral

deep_spec_test.go:769–781  ·  view source on GitHub ↗

============================================================================= GetBoolean partial literal (SYS-REQ-079) ============================================================================= Verifies: SYS-REQ-079 [boundary] GetBoolean on partial boolean literal shall return error.

(t *testing.T)

Source from the content-addressed store, hash-verified

767// Verifies: SYS-REQ-079 [boundary]
768// GetBoolean on partial boolean literal shall return error.
769func TestGetBooleanPartialLiteral(t *testing.T) {
770 // When a value is something like "tru" (not a real boolean), Get classifies it
771 // differently (Number or Unknown) and GetBoolean returns a type error.
772 _, err := GetBoolean([]byte(`{"a":1}`), "a")
773 if err == nil {
774 t.Fatal("GetBoolean on numeric value should return error")
775 }
776
777 _, err = GetBoolean([]byte(`{"a":"true"}`), "a")
778 if err == nil {
779 t.Fatal("GetBoolean on string 'true' should return error")
780 }
781}
782
783// =============================================================================
784// GetUnsafeString edge cases (SYS-REQ-080, SYS-REQ-081, SYS-REQ-082)

Callers

nothing calls this directly

Calls 1

GetBooleanFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…