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

Function TestDirective

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

Source from the content-addressed store, hash-verified

634}
635
636func TestDirective(t *testing.T) {
637 s := `<?xml version="1.0" encoding="UTF-8"?>
638 <!DOCTYPE Workspace>
639 <Workspace xmlns="http://www.qlcplus.org/Workspace" CurrentWindow="FixtureManager">
640 <Creator>
641 <Name>Q Light Controller Plus</Name>
642 <Version>4.12.3</Version>
643 </Creator>
644 </Workspace>`
645 doc, err := Parse(strings.NewReader(s))
646 if err != nil {
647 t.Fatal(err.Error())
648 }
649
650 top := doc.FirstChild
651 n := top.NextSibling.NextSibling
652 if n == nil {
653 t.Error("should be not nil, but got nil")
654 return
655 }
656 if v := n.Type; v != NotationNode {
657 t.Errorf("expected the node type is NotationNode, but got %d", v)
658 }
659 if expected, val := `<!DOCTYPE Workspace>`, n.OutputXML(true); expected != val {
660 t.Errorf("expected %s but got %s", expected, val)
661 }
662
663 list := Find(doc, `//*`)
664 if m := len(list); m != 4 {
665 t.Errorf("expected count is 4 but got %d", m)
666 }
667}
668
669func TestLineNumbers(t *testing.T) {
670 s := `<?xml version="1.0" encoding="UTF-8"?>

Callers

nothing calls this directly

Calls 3

ParseFunction · 0.85
FindFunction · 0.85
OutputXMLMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…