package mxj import ( "fmt" "io" "testing" ) func TestXmlSeqHeader(t *testing.T) { fmt.Println("\n---------------- xmlseq_test.go ...") } func TestNewMapXmlSeq(t *testing.T) { x := []byte(` William T. Gaddis Gaddis is one of the most influential but little know authors in America. The Recognitions One of the great seminal American novels of the 20th century. Without it Thomas Pynchon probably wouldn't have written Gravity's Rainbow. Austin Tappan Wright Islandia An example of earlier 20th century American utopian fiction. John Hawkes The Beetle Leg A lyrical novel about the construction of Ft. Peck Dam in Montana. T.E. Porter King's Day A magical novella. `) msv, err := NewMapXmlSeq(x) if err != nil && err != io.EOF { t.Fatal("err:", err.Error()) } fmt.Println("NewMapXmlSeq, x:\n", string(x)) fmt.Println("NewMapXmlSeq, s:\n", msv.StringIndent()) b, err := msv.XmlIndent("", " ") if err != nil { t.Fatal("err:", err) } fmt.Println("NewMapXmlSeq, msv.XmlIndent():\n", string(b)) } func TestXmlSeqDecodeError(t *testing.T) { fmt.Println("------------ TestXmlSeqDecodeError ...") x := []byte(` William T. Gaddis Gaddis is one of the most influential but little know authors in America. The Recognitions One of the great seminal American novels of the 20th century. Without it Thomas Pynchon probably wouldn't have written Gravity's Rainbow. `) _, err := NewMapXmlSeq(x) if err == nil { t.Fatal("didn't catch EndElement error") } fmt.Println("err ok:", err) }