(t *testing.T)
| 144 | } |
| 145 | |
| 146 | func TestXPath(t *testing.T) { |
| 147 | node := FindOne(testDoc, "//html") |
| 148 | if SelectAttr(node, "lang") != "en-US" { |
| 149 | t.Fatal("//html[@lang] != en-Us") |
| 150 | } |
| 151 | |
| 152 | node = FindOne(testDoc, "//header") |
| 153 | if strings.Index(InnerText(node), "Logo") > 0 { |
| 154 | t.Fatal("InnerText() have comment node text") |
| 155 | } |
| 156 | if !strings.Contains(OutputHTML(node, true), "Logo") { |
| 157 | t.Fatal("OutputHTML() shoud have comment node text") |
| 158 | } |
| 159 | link := FindOne(testDoc, "//a[1]/@href") |
| 160 | if link == nil { |
| 161 | t.Fatal("link is nil") |
| 162 | } |
| 163 | if v := InnerText(link); v != "/London" { |
| 164 | t.Fatalf("expect value is /London, but got %s", v) |
| 165 | } |
| 166 | |
| 167 | } |
| 168 | |
| 169 | func TestXPathCdUp(t *testing.T) { |
| 170 | doc := loadHTML(`<html><b attr="1"></b></html>`) |
nothing calls this directly
no test coverage detected
searching dependent graphs…