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

Function Test_func_string_length

xpath_function_test.go:122–128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

120}
121
122func Test_func_string_length(t *testing.T) {
123 test_xpath_eval(t, empty_example, `string-length("Harp not on that string, madam; that is past.")`, float64(45))
124 test_xpath_eval(t, empty_example, `string-length(normalize-space(' abc '))`, float64(3))
125 test_xpath_eval(t, html_example, `string-length(//title/text())`, float64(len("My page")))
126 test_xpath_eval(t, html_example, `string-length(//html/@lang)`, float64(len("en")))
127 test_xpath_count(t, employee_example, `//employee[string-length(@id) > 0]`, 3) // = //employee[@id]
128}
129
130func Test_func_substring(t *testing.T) {
131 test_xpath_eval(t, empty_example, `substring("motor car", 6)`, " car")

Callers

nothing calls this directly

Calls 2

test_xpath_evalFunction · 0.85
test_xpath_countFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…