structs_test.go
changeset 61 16513974d273
parent 42 f6bb47ca12f2
child 71 578c2a83dc18
--- a/structs_test.go	Sat Jan 07 21:20:23 2012 -0700
+++ b/structs_test.go	Sat Jan 07 22:22:18 2012 -0700
@@ -83,8 +83,9 @@
 }
 
 func TestIqMarshal(t *testing.T) {
-	iq := &Iq{Type: "set", Id: "3", Any: &Generic{XMLName:
-			xml.Name{Space: NsBind, Local: "bind"}}}
+	iq := &Iq{Type: "set", Id: "3", Nested:
+		[]interface{}{Generic{XMLName: xml.Name{Space: NsBind,
+				Local: "bind"}}}}
 	exp := `<iq id="3" type="set"><bind xmlns="` + NsBind +
 		`"></bind></iq>`
 	assertMarshal(t, exp, iq)
@@ -106,11 +107,10 @@
 	if st.GetError() != nil {
 		t.Errorf("iq: error %v", st.GetError())
 	}
-	if st.generic() == nil {
-		t.Errorf("iq: nil child")
+	if st.innerxml() == "" {
+		t.Errorf("iq: empty child")
 	}
-	assertEquals(t, "foo", st.generic().XMLName.Local)
-	assertEquals(t, "text", st.generic().Chardata)
+	assertEquals(t, "<foo>text</foo>", st.innerxml())
 
 	str = `<message to="alice" from="bob"/>`
 	st, err = ParseStanza(str)
@@ -125,8 +125,8 @@
 	if st.GetError() != nil {
 		t.Errorf("message: error %v", st.GetError())
 	}
-	if st.generic() != nil {
-		t.Errorf("message: child %v", st.generic())
+	if st.innerxml() != "" {
+		t.Errorf("message: child %v", st.innerxml())
 	}
 
 	str = `<presence/>`