Skip to content

Commit ce7a8eb

Browse files
committed
Test that FS.Sync.stat exceptions can be caught
1 parent b482169 commit ce7a8eb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/Test.purs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Data.Maybe
55
import Data.Either
66
import Control.Apply ((*>))
77
import Control.Bind ((=<<))
8+
import Control.Monad (unless)
89
import Control.Monad.Eff
910
import Control.Monad.Eff.Exception
1011
import Control.Monad.Eff.Console (log)
@@ -125,3 +126,10 @@ main = do
125126
buf1 <- Buffer.create =<< Buffer.size buf0
126127
bytes1 <- S.fdNext fd1 buf1
127128
S.fdClose fd1
129+
130+
log "statSync on a non-existing file should be catchable"
131+
r <- catchException'
132+
(const (pure true))
133+
(S.stat "this-does-not-exist" *> pure false)
134+
unless r $
135+
throwException (error "FS.Sync.stat should have thrown")

0 commit comments

Comments
 (0)