Skip to content

Commit 28786c4

Browse files
committed
add a test
1 parent 24d9ad4 commit 28786c4

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

ghcide/src/Development/IDE/Core/FileStore.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ module Development.IDE.Core.FileStore(
1919
resetInterfaceStore,
2020
getModificationTimeImpl,
2121
addIdeGlobal,
22-
getFileContentsImpl
22+
getFileContentsImpl,
23+
getModTime
2324
) where
2425

2526
import Control.Concurrent.STM (atomically)
@@ -31,7 +32,6 @@ import Control.Monad.IO.Class
3132
import qualified Data.ByteString as BS
3233
import Data.Either.Extra
3334
import qualified Data.HashMap.Strict as HM
34-
import Data.Int (Int64)
3535
import qualified Data.Map.Strict as Map
3636
import Data.Maybe
3737
import qualified Data.Rope.UTF16 as Rope

ghcide/test/exe/Main.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ import qualified Language.LSP.Types as LSP
101101
import Data.IORef.Extra (atomicModifyIORef_)
102102
import qualified Development.IDE.Plugin.HLS.GhcIde as Ghcide
103103
import Text.Regex.TDFA ((=~))
104+
import Development.IDE.Core.FileStore (getModTime)
104105

105106
waitForProgressBegin :: Session ()
106107
waitForProgressBegin = skipManyTill anyMessage $ satisfyMaybe $ \case
@@ -5464,6 +5465,13 @@ unitTests = do
54645465
actualOrder <- liftIO $ readIORef orderRef
54655466

54665467
liftIO $ actualOrder @?= reverse [(1::Int)..20]
5468+
, testCase "timestamps have subsecond resolution" $ do
5469+
let f = "/tmp/ghcide-timestamp-test"
5470+
writeFile f ""
5471+
t <- getModTime f
5472+
writeFile f ""
5473+
t' <- getModTime f
5474+
assertBool "Timestamps do not have subsecond resolution" (t /= t')
54675475
]
54685476

54695477
testIde :: IDE.Arguments -> Session () -> IO ()

0 commit comments

Comments
 (0)