Просмотр исходного кода

Also adds compareAndSwap to the test.

Alliballibaba 3 месяцев назад
Родитель
Сommit
3672c60fa0
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      state_test.go

+ 1 - 1
state_test.go

@@ -34,7 +34,7 @@ func TestStateShouldHaveCorrectAmountOfSubscribers(t *testing.T) {
 	threadState.set(stateInactive)
 	assertNumberOfSubscribers(t, threadState, 1)
 
-	threadState.set(stateShuttingDown)
+	assert.True(t, threadState.compareAndSwap(stateInactive, stateShuttingDown))
 	assertNumberOfSubscribers(t, threadState, 0)
 }