Import Anubis v1.28.2
Replace the tree with upstream TecharoHQ/anubis v1.28.2 (a1384fbf42e3). Masyunis customizations are re-applied in the following commits.
This commit is contained in:
1 parent
eb3e46d8d0
commit
e07de898cd
573 files changed
+35846
-6807
No files matched your search
@@ -0,0 +1,39 @@
|
||||
package bundler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBundler(t *testing.T) {
|
||||
input := []int{1, 2, 3, 4}
|
||||
done := false
|
||||
b := New[int](func(_ context.Context, data []int) {
|
||||
if len(data) != 4 {
|
||||
t.Errorf("Wanted len(data) == %d, got: %d", len(input), len(data))
|
||||
}
|
||||
|
||||
sum := 0
|
||||
const wantSum = 10
|
||||
for _, i := range data {
|
||||
sum += i
|
||||
}
|
||||
|
||||
if sum != wantSum {
|
||||
t.Errorf("wanted sum of inputs to be %d, got: %d", wantSum, sum)
|
||||
}
|
||||
done = true
|
||||
})
|
||||
|
||||
for _, i := range input {
|
||||
if err := b.Add(i, 1); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
b.Flush()
|
||||
|
||||
if !done {
|
||||
t.Fatal("function wasn't called")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user