Verifies: SYS-REQ-060 [malformed] Truncated escape sequences in ParseString shall return MalformedValueError.
(t *testing.T)
| 596 | // Verifies: SYS-REQ-060 [malformed] |
| 597 | // Truncated escape sequences in ParseString shall return MalformedValueError. |
| 598 | func TestTruncatedEscapeSequences(t *testing.T) { |
| 599 | cases := []struct { |
| 600 | name string |
| 601 | input string |
| 602 | }{ |
| 603 | {name: "truncated unicode 2 hex", input: `\u00`}, |
| 604 | {name: "truncated unicode 1 hex", input: `\u0`}, |
| 605 | {name: "truncated unicode no hex", input: `\u`}, |
| 606 | } |
| 607 | for _, tc := range cases { |
| 608 | t.Run(tc.name, func(t *testing.T) { |
| 609 | _, err := ParseString([]byte(tc.input)) |
| 610 | if !errors.Is(err, MalformedValueError) { |
| 611 | t.Fatalf("ParseString(%q) error = %v, want %v", tc.input, err, MalformedValueError) |
| 612 | } |
| 613 | }) |
| 614 | } |
| 615 | } |
| 616 | |
| 617 | // Verifies: SYS-REQ-061 [malformed] |
| 618 | // High surrogate without low surrogate shall return MalformedValueError. |
nothing calls this directly
no test coverage detected
searching dependent graphs…