@@ -916,6 +916,35 @@ func TestIssue5880(t *testing.T) {
916
916
}
917
917
}
918
918
919
+ func TestIssue8068 (t * testing.T ) {
920
+ emptyError := SyntaxError {}
921
+ noError := emptyError .Error ()
922
+ testCases := []struct {
923
+ s string
924
+ wantErr SyntaxError
925
+ }{
926
+ {`<foo xmlns:bar="a"></foo>` , SyntaxError {}},
927
+ {`<foo xmlns:bar=""></foo>` , SyntaxError {Msg : "empty namespace with prefix" , Line : 1 }},
928
+ {`<foo xmlns:="a"></foo>` , SyntaxError {}},
929
+ {`<foo xmlns:""></foo>` , SyntaxError {Msg : "attribute name without = in element" , Line : 1 }},
930
+ {`<foo xmlns:"a"></foo>` , SyntaxError {Msg : "attribute name without = in element" , Line : 1 }},
931
+ }
932
+ var dest string
933
+ for _ , tc := range testCases {
934
+ if got , want := Unmarshal ([]byte (tc .s ), & dest ), tc .wantErr .Error (); got == nil {
935
+ if want != noError {
936
+ t .Errorf ("%q: got nil, want %s" , tc .s , want )
937
+ }
938
+ } else {
939
+ if want == "" {
940
+ t .Errorf ("%q: got %s, want nil" , tc .s , got )
941
+ } else if got .Error () != want {
942
+ t .Errorf ("%q: got %s, want %s" , tc .s , got , want )
943
+ }
944
+ }
945
+ }
946
+ }
947
+
919
948
func TestIssue8535 (t * testing.T ) {
920
949
921
950
type ExampleConflict struct {
0 commit comments