structs_test.go
changeset 31 1dc47df5c99f
parent 26 4d0a369079ce
child 34 7b1f924c75e2
equal deleted inserted replaced
30:a77fc342e013 31:1dc47df5c99f
    67 	assertMarshal(t, exp, s)
    67 	assertMarshal(t, exp, s)
    68 }
    68 }
    69 
    69 
    70 func TestStreamErrorMarshal(t *testing.T) {
    70 func TestStreamErrorMarshal(t *testing.T) {
    71 	name := xml.Name{Space: nsStreams, Local: "ack"}
    71 	name := xml.Name{Space: nsStreams, Local: "ack"}
    72 	e := &StreamError{Any: Generic{XMLName: name}}
    72 	e := &streamError{Any: Generic{XMLName: name}}
    73 	exp := `<stream:error><ack xmlns="` + nsStreams +
    73 	exp := `<stream:error><ack xmlns="` + nsStreams +
    74 		`"></ack></stream:error>`;
    74 		`"></ack></stream:error>`;
    75 	assertMarshal(t, exp, e)
    75 	assertMarshal(t, exp, e)
    76 
    76 
    77 	txt := errText{Lang: "pt", Text: "things happen"}
    77 	txt := errText{Lang: "pt", Text: "things happen"}
    78 	e = &StreamError{Any: Generic{XMLName: name}, Text: &txt}
    78 	e = &streamError{Any: Generic{XMLName: name}, Text: &txt}
    79 	exp = `<stream:error><ack xmlns="` + nsStreams +
    79 	exp = `<stream:error><ack xmlns="` + nsStreams +
    80 		`"></ack><text xmlns="` + nsStreams +
    80 		`"></ack><text xmlns="` + nsStreams +
    81 		`" xml:lang="pt">things happen</text></stream:error>`
    81 		`" xml:lang="pt">things happen</text></stream:error>`
    82 	assertMarshal(t, exp, e)
    82 	assertMarshal(t, exp, e)
    83 }
    83 }