Skip to content

Commit

Permalink
Ensure that golden test files have valid file extensions
Browse files Browse the repository at this point in the history
This is to make #80 easier to implement.
  • Loading branch information
jgrosso committed Oct 31, 2022
1 parent 921f00e commit 3cb21c0
Show file tree
Hide file tree
Showing 52 changed files with 40 additions and 42 deletions.
2 changes: 1 addition & 1 deletion scripts/onHsFiles.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
find app src test -iname "*.hs" ! -path "app/Main.hs" ! -path "src/Axel/Parse/Args.hs" ! -path "src/Axel.hs" ! -path "src/Axel/Haskell/Macros.hs" -print0 | xargs -0 "$@"
find app src test -iname "*.hs" ! -path "app/Main.hs" ! -path "src/Axel/Parse/Args.hs" ! -path "src/Axel.hs" ! -path "src/Axel/Haskell/Macros.hs" ! -name "golden_*.hs" -print0 | xargs -0 "$@"
12 changes: 5 additions & 7 deletions test/Axel/Test/Transpilation/TranspilationSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,19 @@ test_transpilation_golden :: IO TestTree
test_transpilation_golden = do
axelFiles <-
map (FilePath . T.pack) <$>
findByExtension [".axel_golden"] "test/Axel/Test/Transpilation"
findByExtension [".axel"] "test/Axel/Test/Transpilation"
pure $
testGroup "transpilation golden tests" $ do
axelFile <- axelFiles
let hsFile = replaceExtension axelFile "hs_golden"
let hsFile = replaceExtension axelFile "hs"
let transpiled = do
axelSource <- T.readFile $ T.unpack (op FilePath axelFile)
output <-
runApp $
Eff.evalState (M.empty :: ModuleInfo) $
Eff.evalState (M.empty :: SM.ModuleInfo) $
Ghci.withGhci $ transpileSource (takeBaseName axelFile) axelSource
let newSource = encodeUtf8Lazy $ SM.raw output
pure $ newSource <> "\n"
let testName = T.unpack . op FilePath $ takeBaseName axelFile
pure $
goldenVsString
(T.unpack . op FilePath $ takeBaseName axelFile)
(T.unpack . op FilePath $ hsFile)
transpiled
goldenVsString testName (T.unpack . op FilePath $ hsFile) transpiled

This file was deleted.

19 changes: 0 additions & 19 deletions test/Axel/Test/Transpilation/macros/Quasiquote.hs_golden

This file was deleted.

Loading

0 comments on commit 3cb21c0

Please sign in to comment.