44module KDL.ParserSpec (spec ) where
55
66import Control.Monad (forM_ )
7+ import Data.Maybe (isJust )
78import Data.Text.IO qualified as Text
89import KDL qualified
910import Skeletest
1011import Skeletest.Predicate qualified as P
1112import System.Directory (findExecutable , listDirectory )
1213import System.FilePath (takeExtension , (</>) )
1314import System.IO.Temp (withSystemTempDirectory )
15+ import System.IO.Unsafe (unsafePerformIO )
1416import System.Process (callProcess )
1517
1618spec :: 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