From 2cfcf9eb5ff2f332dad0c6adead53ef0500001db Mon Sep 17 00:00:00 2001 From: xuri Date: Wed, 16 Jun 2021 15:03:50 +0000 Subject: encode the escaped string literal which not permitted in an XML 1.0 document --- lib_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib_test.go') diff --git a/lib_test.go b/lib_test.go index ad20946..315688f 100644 --- a/lib_test.go +++ b/lib_test.go @@ -258,3 +258,16 @@ func TestBstrUnmarshal(t *testing.T) { assert.Equal(t, expected, bstrUnmarshal(bstr)) } } + +func TestBstrMarshal(t *testing.T) { + bstrs := map[string]string{ + "*_xG05F_*": "*_xG05F_*", + "*_x0008_*": "*_x005F_x0008_*", + "*_x005F_*": "*_x005F_x005F_*", + "*_x005F_xG006_*": "*_x005F_x005F_xG006_*", + "*_x005F_x0006_*": "*_x005F_x005F_x005F_x0006_*", + } + for bstr, expected := range bstrs { + assert.Equal(t, expected, bstrMarshal(bstr)) + } +} -- cgit v1.2.1