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

Function test_xpath_eval

xpath_test.go:79–94  ·  view source on GitHub ↗
(t *testing.T, root *TNode, expr string, expected ...interface{})

Source from the content-addressed store, hash-verified

77}
78
79func test_xpath_eval(t *testing.T, root *TNode, expr string, expected ...interface{}) {
80 e, err := Compile(expr)
81 assertNoErr(t, err)
82
83 v := e.Evaluate(createNavigator(root))
84 // if is a node-set
85 if iter, ok := v.(*NodeIterator); ok {
86 got := iterateNavs(iter)
87 assertEqual(t, len(expected), len(got))
88 for i := 0; i < len(expected); i++ {
89 assertEqual(t, expected[i], got[i])
90 }
91 return
92 }
93 assertEqual(t, expected[0], v)
94}
95
96func Test_Predicates_MultiParent(t *testing.T) {
97 // https://github.com/antchfx/xpath/issues/75

Callers 15

Test_func_booleanFunction · 0.85
Test_func_nameFunction · 0.85
Test_func_ceiling_floorFunction · 0.85
Test_func_concatFunction · 0.85
Test_func_containsFunction · 0.85
Test_func_countFunction · 0.85
Test_func_ends_withFunction · 0.85
Test_func_local_nameFunction · 0.85
Test_func_starts_withFunction · 0.85
Test_func_stringFunction · 0.85
Test_func_string_joinFunction · 0.85
Test_func_string_lengthFunction · 0.85

Calls 6

CompileFunction · 0.85
assertNoErrFunction · 0.85
createNavigatorFunction · 0.85
iterateNavsFunction · 0.85
assertEqualFunction · 0.85
EvaluateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…