Skip to content

Commit 46cfcd4

Browse files
Skip dotslash tests if not installed
1 parent fca8dc3 commit 46cfcd4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

test/KDL/ParserSpec.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
module KDL.ParserSpec (spec) where
55

66
import Control.Monad (forM_)
7+
import Data.Maybe (isJust)
78
import Data.Text.IO qualified as Text
89
import KDL qualified
910
import Skeletest
1011
import Skeletest.Predicate qualified as P
1112
import System.Directory (findExecutable, listDirectory)
1213
import System.FilePath (takeExtension, (</>))
1314
import System.IO.Temp (withSystemTempDirectory)
15+
import System.IO.Unsafe (unsafePerformIO)
1416
import System.Process (callProcess)
1517

1618
spec :: Spec
@@ -44,7 +46,7 @@ spec = do
4446
-- tested in `parse`
4547
actual `shouldBe` expected
4648

47-
describe "kdl-test examples" $ do
49+
(if dotSlashInstalled then id else skip "dotslash not installed") . describe "kdl-test examples" $ do
4850
it "decodes correctly" $ do
4951
decoder <- findExecutable "kdl-hs-test-decoder" >>= maybe (error "Could not find kdl-hs-test-decoder") pure
5052
callProcess "scripts/kdl-test" ["run", "--decoder", decoder]
@@ -58,3 +60,6 @@ spec = do
5860
context file $ do
5961
content <- Text.readFile (dir </> "valid" </> file)
6062
(fmap KDL.render . KDL.parse) content `shouldBe` Right content
63+
64+
dotSlashInstalled :: Bool
65+
dotSlashInstalled = unsafePerformIO $ isJust <$> findExecutable "dotslash"

0 commit comments

Comments
 (0)