aboutsummaryrefslogtreecommitdiff
path: root/stm_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'stm_test.go')
-rw-r--r--stm_test.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/stm_test.go b/stm_test.go
index fdf7af2..4103563 100644
--- a/stm_test.go
+++ b/stm_test.go
@@ -125,7 +125,7 @@ func TestVerify(t *testing.T) {
func TestSelect(t *testing.T) {
// empty Select should panic
- require.Panics(t, func() { Atomically(Select()) })
+ require.Panics(t, func() { Atomically(Select[struct{}]()) })
// with one arg, Select adds no effect
x := NewVar[int](2)
@@ -135,15 +135,16 @@ func TestSelect(t *testing.T) {
picked := Atomically(Select(
// always blocks; should never be selected
- VoidOperation(func(tx *Tx) {
+ func(tx *Tx)int {
tx.Retry()
- }),
+ panic("unreachable")
+ },
// always succeeds; should always be selected
- func(tx *Tx) interface{} {
+ func(tx *Tx) int {
return 2
},
// always succeeds; should never be selected
- func(tx *Tx) interface{} {
+ func(tx *Tx) int {
return 3
},
))
@@ -152,9 +153,9 @@ func TestSelect(t *testing.T) {
func TestCompose(t *testing.T) {
nums := make([]int, 100)
- fns := make([]Operation, 100)
+ fns := make([]Operation[struct{}], 100)
for i := range fns {
- fns[i] = func(x int) Operation {
+ fns[i] = func(x int) Operation[struct{}] {
return VoidOperation(func(*Tx) { nums[x] = x })
}(i) // capture loop var
}