MCPcopy Create free account
hub / github.com/PuerkitoBio/goquery / TestNegativeSliceEnd

Function TestNegativeSliceEnd

array_test.go:151–156  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

149}
150
151func TestNegativeSliceEnd(t *testing.T) {
152 sel := Doc().Find(".container-fluid").Slice(1, -1)
153 assertLength(t, sel.Nodes, 2)
154 assertSelectionIs(t, sel.Eq(0), "#cf2")
155 assertSelectionIs(t, sel.Eq(1), "#cf3")
156}
157
158func TestNegativeSliceBoth(t *testing.T) {
159 sel := Doc().Find(".container-fluid").Slice(-3, -1)

Callers

nothing calls this directly

Calls 6

DocFunction · 0.85
assertLengthFunction · 0.85
assertSelectionIsFunction · 0.85
SliceMethod · 0.80
FindMethod · 0.80
EqMethod · 0.80

Tested by

no test coverage detected