Skip to content

Commit

Permalink
Fix core/gioutil tests
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondburned committed Jun 29, 2024
1 parent 30fbd28 commit 5109f19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/core/gioutil/listmodel_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ func ExampleListModel() {
list.Append(Person{"Bob", 30})
list.Append(Person{"Charlie", 40})

// AllItems() can be iterated over if rangefunc is supported.
all := list.AllItems()
// All() can be iterated over if rangefunc is supported.
all := list.All()
all(func(p Person) bool {
fmt.Println(p)
return true
Expand Down
8 changes: 4 additions & 4 deletions pkg/core/gioutil/listmodel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ func TestListModel(t *testing.T) {

fuckShitUp()

listItems := drainIterator(list.AllItems())
listItems := drainIterator(list.All())
assertEq(t, "ListModel length mismatch", list.NItems(), 3)
assertEq(t, "ListModel's items don't match expected list", listItems, expect)

list.Remove(0)

listItems = drainIterator(list.AllItems())
listItems = drainIterator(list.All())
assertEq(t, "ListModel length mismatch", list.NItems(), 2)
assertEq(t, "ListModel's items don't match expected list", listItems, expect[1:])

list.Splice(0, 2)

listItems = drainIterator(list.AllItems())
listItems = drainIterator(list.All())
assertEq(t, "ListModel length mismatch", list.NItems(), 0)
assertEq(t, "ListModel's items don't match expected list", listItems, []weirdType(nil))
}
Expand Down Expand Up @@ -85,7 +85,7 @@ func BenchmarkListModel(b *testing.B) {
b.ResetTimer()

for i := 0; i < b.N; i++ {
all := list.AllItems()
all := list.All()
all(func(*weirdType) bool { return true })
}
})
Expand Down

0 comments on commit 5109f19

Please sign in to comment.