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

Function TestNegativeSliceEnd

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

Source from the content-addressed store, hash-verified

138}
139
140func TestNegativeSliceEnd(t *testing.T) {
141 sel := Doc().Find(".container-fluid").Slice(1, -1)
142 assertLength(t, sel.Nodes, 2)
143 assertSelectionIs(t, sel.Eq(0), "#cf2")
144 assertSelectionIs(t, sel.Eq(1), "#cf3")
145}
146
147func TestNegativeSliceBoth(t *testing.T) {
148 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