func TestSearchXMLParseSearchQuit(t *testing.T) { noEnd := strings.Split(standardXML, "Commercial")[0] body := ioutil.NopCloser(strings.NewReader(noEnd)) cr, err := NewStandardXMLSearchResult(body) testutils.Ok(t, err) var listings [][]byte count, maxRows, err := cr.ForEach(minidom.ByName("PropertyListing"), func(elem io.ReadCloser, err error) error { tmp, _ := ioutil.ReadAll(elem) listings = append(listings, tmp) return err }) testutils.NotOk(t, err) testutils.Equals(t, false, maxRows) testutils.Equals(t, 10, count) testutils.Equals(t, 1, len(listings)) }
func TestSearchXMLEof(t *testing.T) { body := ioutil.NopCloser(strings.NewReader("")) _, err := NewCompactSearchResult(body) testutils.NotOk(t, err) }