Commit 9936cf9d authored by Kirill Smelkov's avatar Kirill Smelkov Committed by Kamil Kisiel

pyquote: Add tests

I initially added pyquote only as debugging tool (in b429839d "tests:
Show pickles in a way that can be copy-pasted into Python"), and later
it started to be used in the Encoder (see 18004fbd "Move pyquote into
main codebase"). However there is no explicit tests for pyquote.

Add some pyquote tests.
parent a15630df
...@@ -26,6 +26,16 @@ func testCodec(t *testing.T, transform func(in string)(string, error), testv []C ...@@ -26,6 +26,16 @@ func testCodec(t *testing.T, transform func(in string)(string, error), testv []C
} }
} }
func TestPyQuote(t *testing.T) {
testCodec(t, func(in string) (string, error) {
return pyquote(in), nil
}, []CodecTestCase{
{`\"'`, `"\\\"'"`},
{"\x80hello мир", `"\x80hello мир"`},
{"\n\r\x01", `"\n\r\x01"`},
})
}
func TestPyDecodeStringEscape(t *testing.T) { func TestPyDecodeStringEscape(t *testing.T) {
testCodec(t, pydecodeStringEscape, []CodecTestCase{ testCodec(t, pydecodeStringEscape, []CodecTestCase{
{`hello`, "hello"}, {`hello`, "hello"},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment