Verifies: SYS-REQ-114 (JSONPath compiled paths) reqproof:proptest:skip targeted witness/regression test; not a property-test subject
(t *testing.T)
| 272 | // Verifies: SYS-REQ-114 (JSONPath compiled paths) |
| 273 | // reqproof:proptest:skip targeted witness/regression test; not a property-test subject |
| 274 | func TestCompiledPathPartsReturnsCopy(t *testing.T) { |
| 275 | path, err := CompilePath("person.name") |
| 276 | if err != nil { |
| 277 | t.Fatalf("CompilePath returned error: %v", err) |
| 278 | } |
| 279 | |
| 280 | parts := path.Parts() |
| 281 | parts[0] = "changed" |
| 282 | |
| 283 | got, err := path.GetString([]byte(`{"person":{"name":"Ada"},"changed":{"name":"Grace"}}`)) |
| 284 | if err != nil { |
| 285 | t.Fatalf("GetString returned error: %v", err) |
| 286 | } |
| 287 | if got != "Ada" { |
| 288 | t.Fatalf("mutating Parts changed compiled path: got %q, want Ada", got) |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | func BenchmarkParsePath(b *testing.B) { |
| 293 | for i := 0; i < b.N; i++ { |
nothing calls this directly
no test coverage detected