structs_test.go
changeset 7 4f0f66f9a441
parent 6 8e425e340ca1
child 12 122ab6208c3c
equal deleted inserted replaced
6:8e425e340ca1 7:4f0f66f9a441
    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: definedCondition{name}}
    72 	e := &StreamError{Any: definedCondition{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: definedCondition{name}, Text: &txt}
    78 	e = &StreamError{Any: definedCondition{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 }