MCPcopy Create free account
hub / github.com/antchfx/xpath / TestAbsolutePaths

Function TestAbsolutePaths

xpath_expression_test.go:49–61  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

47}
48
49func TestAbsolutePaths(t *testing.T) {
50 test_xpath_elements(t, book_example, `bookstore`, 2)
51 test_xpath_elements(t, book_example, `bookstore/book`, 3, 9, 15, 25)
52 test_xpath_elements(t, book_example, `(bookstore/book)`, 3, 9, 15, 25)
53 test_xpath_elements(t, book_example, `bookstore/book[2]`, 9)
54 test_xpath_elements(t, book_example, `bookstore/book[last()]`, 25)
55 test_xpath_elements(t, book_example, `bookstore/book[last()]/title`, 26)
56 test_xpath_values(t, book_example, `/bookstore/book[last()]/title/text()`, "Learning XML")
57 test_xpath_values(t, book_example, `/bookstore/book[@category = "children"]/year`, "2005")
58 test_xpath_elements(t, book_example, `bookstore/book/..`, 2)
59 test_xpath_elements(t, book_example, `/bookstore/*`, 3, 9, 15, 25)
60 test_xpath_elements(t, book_example, `/bookstore/*/title`, 4, 10, 16, 26)
61}
62
63func TestAttributes(t *testing.T) {
64 test_xpath_tags(t, html_example.FirstChild, "@*", "lang")

Callers

nothing calls this directly

Calls 2

test_xpath_elementsFunction · 0.85
test_xpath_valuesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…