// TestNoFlagDueToStop tests the waiting for a signal while // a scene is stopped. func TestNoFlagDueToStop(t *testing.T) { assert := audit.NewTestingAssertion(t, false) scn := scene.Start() go func() { err := scn.WaitFlag("foo") assert.True(scene.IsSceneEndedError(err)) }() go func() { err := scn.WaitFlag("foo") assert.True(scene.IsSceneEndedError(err)) }() time.Sleep(100 * time.Millisecond) err := scn.Stop() assert.Nil(err) }
// TestAccessAfterStopping tests an access after the // scene already has been stopped. func TestAccessAfterStopping(t *testing.T) { assert := audit.NewTestingAssertion(t, false) scn := scene.Start() err := scn.Store("foo", 4711) assert.Nil(err) foo, err := scn.Fetch("foo") assert.Nil(err) assert.Equal(foo, 4711) err = scn.Stop() assert.Nil(err) foo, err = scn.Fetch("foo") assert.True(scene.IsSceneEndedError(err)) assert.Nil(foo) }