Skip to content

Commit a8ced8f

Browse files
committed
Merge PR #120
2 parents 3cbab97 + c92c3eb commit a8ced8f

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

build.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ func (b *builder) processFilter(root *filterNode, flags flag, props *builderProp
208208
switch qyFunc.Input.(type) {
209209
case *filterQuery:
210210
cond = &lastFuncQuery{Input: qyFunc.Input}
211+
case *groupQuery:
212+
cond = &lastFuncQuery{Input: qyFunc.Input}
211213
}
212214
}
213215
}
@@ -689,9 +691,7 @@ func (b *builder) processNode(root node, flags flag, props *builderProp) (q quer
689691
return
690692
}
691693
q = &groupQuery{Input: q}
692-
if b.firstInput == nil {
693-
b.firstInput = q
694-
}
694+
b.firstInput = q
695695
}
696696
b.parseDepth--
697697
return

xpath_predicate_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ func TestPositions(t *testing.T) {
2727
test_xpath_elements(t, employee_example, `//employee[last()]`, 13)
2828
test_xpath_elements(t, employee_example, `//employee[position() = last()]`, 13)
2929
test_xpath_elements(t, book_example, `//book[@category = "web"][2]`, 25)
30+
test_xpath_elements(t, book_example, `//book[@category = "web"][last()]`, 25)
3031
test_xpath_elements(t, book_example, `(//book[@category = "web"])[2]`, 25)
32+
test_xpath_elements(t, book_example, `(//book[@category = "web"])[last()]`, 25)
33+
test_xpath_elements(t, employee_example, `(//employee)[last()]`, 13)
34+
test_xpath_elements(t, book_example, `(//author)[last()]`, 27)
3135
}
3236

3337
func TestPredicates(t *testing.T) {

0 commit comments

Comments
 (0)