• Kirill Smelkov's avatar
    tests: Fix Xloosy · 85183af0
    Kirill Smelkov authored
    In b28613c2 (Add StrictUnicode mode) I modified TestEntry to have
    .strictUnicodeN and .strictUnicodeY fields and adjusted X to set them
    both to true by default. However I missed to adjust Xloosy, which
    started to return TestEntry with both .strictUnicodeN=.strictUnicodeY=false
    which effectively disabled running test entries defined via Xloosy.
    
    -> Fix that by reusing X in Xloosy implementation.
    
    This brings in unnoticed test failures with structs and strings:
    
        --- FAIL: TestDecode (0.03s)
            --- FAIL: TestDecode/[]ogórek.foo{"Qux",_4}/StrictUnicode=y/"((S\"Foo\"\nS\"Qux\"\nS\"Bar\"\nI4\ndl." (0.00s)
                ogorek_test.go:594: decode:
                    have: []interface {}{map[interface {}]interface {}{ogórek.ByteString("Bar"):4, ogórek.ByteString("Foo"):ogórek.ByteString("Qux")}}
                    want: []interface {}{map[interface {}]interface {}{"Bar":4, "Foo":"Qux"}}
            --- FAIL: TestDecode/[]ogórek.foo{"Qux",_4}/StrictUnicode=y/"((U\x03FooU\x03QuxU\x03BarK\x04dl." (0.00s)
                ogorek_test.go:594: decode:
                    have: []interface {}{map[interface {}]interface {}{ogórek.ByteString("Bar"):4, ogórek.ByteString("Foo"):ogórek.ByteString("Qux")}}
                    want: []interface {}{map[interface {}]interface {}{"Bar":4, "Foo":"Qux"}}
        --- FAIL: TestEncode (0.11s)
            --- FAIL: TestEncode/[]ogórek.foo{"Qux",_4}/StrictUnicode=y/proto=0 (0.00s)
                ogorek_test.go:670: encode:
                    have: "((VFoo\nVQux\nVBar\nI4\ndl."
                    want: "((S\"Foo\"\nS\"Qux\"\nS\"Bar\"\nI4\ndl."
            --- FAIL: TestEncode/[]ogórek.foo{"Qux",_4}/StrictUnicode=y/proto=1 (0.00s)
                ogorek_test.go:670: encode:
                    have: "((X\x03\x00\x00\x00FooX\x03\x00\x00\x00QuxX\x03\x00\x00\x00BarK\x04dl."
                    want: "((U\x03FooU\x03QuxU\x03BarK\x04dl."
            --- FAIL: TestEncode/[]ogórek.foo{"Qux",_4}/StrictUnicode=y/proto=2 (0.00s)
                ogorek_test.go:670: encode:
                    have: "\x80\x02((X\x03\x00\x00\x00FooX\x03\x00\x00\x00QuxX\x03\x00\x00\x00BarK\x04dl."
                    want: "\x80\x02((U\x03FooU\x03QuxU\x03BarK\x04dl."
    
    because in that test data are prepared to auto strings mode and started
    to fail with StrictUnicode=y. Fix that by adjusting that test to run in
    StrictUnicode=n mode only.
    85183af0
ogorek_test.go 39.3 KB