Skip to content

Commit 1ce0d6c

Browse files
committed
fix timestamp resolution dependent tests
1 parent 28786c4 commit 1ce0d6c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ghcide/test/exe/Main.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ import Data.IORef.Extra (atomicModifyIORef_)
102102
import qualified Development.IDE.Plugin.HLS.GhcIde as Ghcide
103103
import Text.Regex.TDFA ((=~))
104104
import Development.IDE.Core.FileStore (getModTime)
105+
import Control.Concurrent (threadDelay)
105106

106107
waitForProgressBegin :: Session ()
107108
waitForProgressBegin = skipManyTill anyMessage $ satisfyMaybe $ \case
@@ -4982,6 +4983,8 @@ sessionDepsArePickedUp = testSession'
49824983
doc <- createDoc "Foo.hs" "haskell" fooContent
49834984
expectDiagnostics
49844985
[("Foo.hs", [(DsError, (3, 6), "Couldn't match expected type")])]
4986+
-- sleep to ensure hie.yaml timestamps are different
4987+
liftIO $ threadDelay 1000
49854988
-- Update hie.yaml to enable OverloadedStrings.
49864989
liftIO $
49874990
writeFileUTF8
@@ -5469,6 +5472,7 @@ unitTests = do
54695472
let f = "/tmp/ghcide-timestamp-test"
54705473
writeFile f ""
54715474
t <- getModTime f
5475+
threadDelay 1000 -- 1ms
54725476
writeFile f ""
54735477
t' <- getModTime f
54745478
assertBool "Timestamps do not have subsecond resolution" (t /= t')

0 commit comments

Comments
 (0)