@@ -1004,92 +1004,94 @@ data Tag =
10041004 -- > Get ..
10051005 | TagPutTruncateGet
10061006
1007- -- Close a handle 2 times
1007+ -- | Close a handle 2 times
10081008 --
10091009 -- > h <- Open ..
10101010 -- > close h
10111011 -- > close h
10121012 | TagClosedTwice
10131013
1014- -- Open an existing file with ReadMode and then with WriteMode
1014+ -- | Open an existing file with ReadMode and then with WriteMode
10151015 --
10161016 -- > open fp ReadMode
10171017 -- > open fp Write
10181018 | TagOpenReadThenWrite
10191019
1020- -- Open 2 Readers of a file.
1020+ -- | Open 2 Readers of a file.
10211021 --
10221022 -- > open fp ReadMode
10231023 -- > open fp ReadMode
10241024 | TagOpenReadThenRead
10251025
1026- -- ListDir on a non empty dirextory.
1026+ -- | ListDir on a non empty dirextory.
10271027 --
10281028 -- > CreateDirIfMissing True a/b
10291029 -- > ListDirectory a
10301030 | TagCreateDirWithParentsThenListDirNotNull
10311031
1032- -- Read from an AppendMode file
1032+ -- | Read from an AppendMode file
10331033 --
10341034 -- > h <- Open fp AppendMode
10351035 -- > Read h ..
10361036 | TagReadInvalid
10371037
1038- -- Write to a read only file
1038+ -- | Write to a read only file
10391039 --
10401040 -- > h <- Open fp ReadMode
10411041 -- > Put h ..
10421042 | TagWriteInvalid
10431043
1044- -- Put Seek and Get
1044+ -- | Put Seek and Get
10451045 --
10461046 -- > Put ..
10471047 -- > Seek ..
10481048 -- > Get ..
10491049 | TagPutSeekGet
10501050
1051- -- Put Seek (negative) and Get
1051+ -- | Put Seek (negative) and Get
10521052 --
10531053 -- > Put ..
10541054 -- > Seek .. (negative)
10551055 -- > Get ..
10561056 | TagPutSeekNegGet
10571057
1058-
1059- -- Open with MustBeNew (O_EXCL flag), but the file already existed.
1058+ -- | Open with MustBeNew (O_EXCL flag), but the file already existed.
10601059 --
10611060 -- > h <- Open fp (AppendMode _)
10621061 -- > Close h
10631062 -- > Open fp (AppendMode MustBeNew)
10641063 | TagExclusiveFail
10651064
1066-
1067- -- Open with MustExist, but the file does not exist.
1065+ -- | Open with MustExist, but the file does not exist.
10681066 --
10691067 -- > DoesFileExist fp
10701068 -- > h <- Open fp (AppendMode _)
10711069 | TagAssumeExists
10721070
1071+ -- | Open in ReadMode, but the file does not exist.
1072+ --
1073+ -- > DoesFileExist fp
1074+ -- > h <- Open fp ReadMode
1075+ | TagReadMustExist
10731076
1074- -- Reading returns an empty bytestring when EOF
1077+ -- | Reading returns an empty bytestring when EOF
10751078 --
10761079 -- > h <- open fp ReadMode
10771080 -- > Get h 1 == ""
10781081 | TagReadEOF
10791082
1080-
1081- -- GetAt
1083+ -- | GetAt
10821084 --
10831085 -- > GetAt ...
10841086 | TagPread
10851087
1086- -- Roundtrip for I/O with user-supplied buffers
1088+ -- | Roundtrip for I/O with user-supplied buffers
10871089 --
10881090 -- > PutBuf h bs c
10891091 -- > GetBuf h c (==bs)
10901092 | TagPutGetBuf
10911093
1092- -- Roundtrip for I/O with user-supplied buffers
1094+ -- | Roundtrip for I/O with user-supplied buffers
10931095 --
10941096 -- > PutBufAt h bs c o
10951097 -- > GetBufAt h c o (==bs)
@@ -1144,7 +1146,8 @@ tag = C.classify [
11441146 , tagPutSeekGet Set. empty Set. empty
11451147 , tagPutSeekNegGet Set. empty Set. empty
11461148 , tagExclusiveFail
1147- -- , tagAssumeExistsFail -- Set.empty
1149+ , tagAssumeExistsFail
1150+ , tagReadMustExistFail
11481151 , tagReadEOF
11491152 , tagPread
11501153 , tagPutGetBuf Set. empty
@@ -1492,21 +1495,21 @@ tag = C.classify [
14921495
14931496 tagAssumeExistsFail :: EventPred
14941497 tagAssumeExistsFail = C. predicate $ \ ev ->
1495- {-
1496- tagClosedTwice closed = successful $ \ev _suc ->
1497- case eventMockCmd ev of
1498- Close (Handle h _) | Set.member h closed -> Left TagClosedTwice
1499- Close (Handle h _) -> Right $ tagClosedTwice $ Set.insert h closed
1500- _otherwise -> Right $ tagClosedTwice closed
1501- (DoesFileExist _, Bool False) -> Left TagDoesFileExistKO
1502- -}
15031498 case (eventMockCmd ev, eventMockResp ev) of
15041499 (Open _ mode, Resp (Left fsError))
15051500 | MustExist <- allowExisting mode
15061501 , fsErrorType fsError == FsResourceDoesNotExist ->
15071502 Left TagAssumeExists
15081503 _otherwise -> Right tagAssumeExistsFail
15091504
1505+ tagReadMustExistFail :: EventPred
1506+ tagReadMustExistFail = C. predicate $ \ ev ->
1507+ case (eventMockCmd ev, eventMockResp ev) of
1508+ (Open _ ReadMode , Resp (Left fsError))
1509+ | fsErrorType fsError == FsResourceDoesNotExist ->
1510+ Left TagReadMustExist
1511+ _otherwise -> Right tagReadMustExistFail
1512+
15101513 tagReadEOF :: EventPred
15111514 tagReadEOF = successful $ \ ev suc ->
15121515 case (eventMockCmd ev, suc) of
0 commit comments