(t *testing.T)
| 1612 | } |
| 1613 | |
| 1614 | func Test_App_quoteRawString(t *testing.T) { |
| 1615 | t.Parallel() |
| 1616 | |
| 1617 | cases := []struct { |
| 1618 | name string |
| 1619 | in string |
| 1620 | out string |
| 1621 | }{ |
| 1622 | {"empty", "", ""}, |
| 1623 | {"simple", "simple", "simple"}, |
| 1624 | {"backslash", "A\\B", "A\\\\B"}, |
| 1625 | {"quote", `He said "Yo"`, `He said \"Yo\"`}, |
| 1626 | {"newline", "Hello\n", "Hello\\n"}, |
| 1627 | {"carriage", "Hello\r", "Hello\\r"}, |
| 1628 | {"controls", string([]byte{0, 31, 127}), "%00%1F%7F"}, |
| 1629 | {"mixed", "test \"A\n\r" + string([]byte{1}) + "\\", `test \"A\n\r%01\\`}, |
| 1630 | } |
| 1631 | |
| 1632 | for _, tc := range cases { |
| 1633 | t.Run(tc.name, func(t *testing.T) { |
| 1634 | t.Parallel() |
| 1635 | app := New() |
| 1636 | require.Equal(t, tc.out, app.quoteRawString(tc.in)) |
| 1637 | }) |
| 1638 | } |
| 1639 | } |
| 1640 | |
| 1641 | func Test_App_quoteString_DetachesFromPooledBuffer(t *testing.T) { |
| 1642 | t.Parallel() |
nothing calls this directly
no test coverage detected