(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestAppendJSONString(t *testing.T) { |
| 10 | testAppendJSONString(t, ``) |
| 11 | testAppendJSONString(t, `f`) |
| 12 | testAppendJSONString(t, `"`) |
| 13 | testAppendJSONString(t, `<`) |
| 14 | testAppendJSONString(t, "\x00\n\r\t\b\f"+`"\`) |
| 15 | testAppendJSONString(t, `"foobar`) |
| 16 | testAppendJSONString(t, `foobar"`) |
| 17 | testAppendJSONString(t, `foo "bar" |
| 18 | baz`) |
| 19 | testAppendJSONString(t, `this is a "тест"`) |
| 20 | testAppendJSONString(t, `привет test ыва`) |
| 21 | |
| 22 | testAppendJSONString(t, `</script><script>alert('evil')</script>`) |
| 23 | testAppendJSONString(t, "\u001b") |
| 24 | } |
| 25 | |
| 26 | func testAppendJSONString(t *testing.T, s string) { |
| 27 | expectedResult, err := json.Marshal(s) |
nothing calls this directly
no test coverage detected
searching dependent graphs…