MCPcopy Create free account
hub / github.com/antchfx/xmlquery / TestStreamParser_InvalidXPath

Function TestStreamParser_InvalidXPath

parse_test.go:424–440  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

422}
423
424func TestStreamParser_InvalidXPath(t *testing.T) {
425 sp, err := CreateStreamParser(strings.NewReader(""), "[invalid")
426 if err == nil || err.Error() != "invalid streamElementXPath '[invalid', err: expression must evaluate to a node-set" {
427 t.Fatalf("got non-expected error: %v", err)
428 }
429 if sp != nil {
430 t.Fatal("expected nil for sp, but got none-nil value")
431 }
432
433 sp, err = CreateStreamParser(strings.NewReader(""), ".", "[invalid")
434 if err == nil || err.Error() != "invalid streamElementFilter '[invalid', err: expression must evaluate to a node-set" {
435 t.Fatalf("got non-expected error: %v", err)
436 }
437 if sp != nil {
438 t.Fatal("expected nil for sp, but got none-nil value")
439 }
440}
441
442func testOutputXML(t *testing.T, msg string, expectedXML string, n *Node) {
443 if n.OutputXMLWithOptions(WithOutputSelf(), WithoutPreserveSpace()) != expectedXML {

Callers

nothing calls this directly

Calls 1

CreateStreamParserFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…