Skip to content
Snippets Groups Projects
Commit c3c90379 authored by Jens Nolte's avatar Jens Nolte
Browse files

Add tests

parent 5c86ba46
No related branches found
No related tags found
No related merge requests found
...@@ -88,11 +88,18 @@ spec = parallel $ do ...@@ -88,11 +88,18 @@ spec = parallel $ do
attachDisposeAction_ resourceManager $ toAwaitable avar <$ putAsyncVar_ avar () attachDisposeAction_ resourceManager $ toAwaitable avar <$ putAsyncVar_ avar ()
pure () :: IO () pure () :: IO ()
it "re-throws an exception" $ do
shouldThrow
do
withResourceManager \_ ->
throwIO TestException
\TestException -> True
it "re-throws an exception from a dispose action" $ do it "re-throws an exception from a dispose action" $ do
shouldThrow shouldThrow
do do
withResourceManager \resourceManager -> withResourceManager \resourceManager ->
attachDisposeAction resourceManager $ throwIO $ TestException attachDisposeAction resourceManager $ throwIO TestException
\TestException -> True \TestException -> True
it "can attach an disposable that is disposed asynchronously" $ do it "can attach an disposable that is disposed asynchronously" $ do
......
module Quasar.ObservableSpec (spec) where module Quasar.ObservableSpec (spec) where
import Quasar.Observable
import Control.Monad (void)
import Data.IORef import Data.IORef
import Prelude import Quasar.Prelude
import Quasar.Disposable
import Quasar.Observable
import Test.Hspec import Test.Hspec
spec :: Spec spec :: Spec
spec = do spec = do
observableSpec
mergeObservableSpec mergeObservableSpec
observableSpec :: Spec
observableSpec = parallel do
describe "Observable" do
it "works" $ io do
shouldReturn
do
withOnResourceManager do
observeWhile (pure () :: Observable ()) toObservableUpdate
()
mergeObservableSpec :: Spec mergeObservableSpec :: Spec
mergeObservableSpec = do mergeObservableSpec = do
describe "mergeObservable" $ parallel $ do describe "mergeObservable" $ parallel $ do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment