diff --git a/CHANGELOG.md b/CHANGELOG.md index fe212a0..c1a0256 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Unreleased +### Breaking Changes + +* `--write adjacent` no longer forbids overwriting existing generated files + ### New Features * Added support for assignments within expressions (e.g., `x = ++y;`) diff --git a/src/sv2v.hs b/src/sv2v.hs index 1fb48d8..3b94edd 100644 --- a/src/sv2v.hs +++ b/src/sv2v.hs @@ -4,13 +4,11 @@ - conversion entry point -} -import System.Directory (doesFileExist) import System.IO (hPrint, hPutStrLn, stderr, stdout) import System.Exit (exitFailure, exitSuccess) -import Control.Monad (filterM, when, zipWithM_) +import Control.Monad (when, zipWithM_) import Control.Monad.Except (runExceptT) -import Data.List (intercalate) import Convert (convert) import Job (readJob, Job(..), Write(..)) @@ -63,11 +61,6 @@ writeOutput (File f) _ asts = writeFile f $ show $ concat asts writeOutput Adjacent inPaths asts = do outPaths <- mapM rewritePath inPaths - badPaths <- filterM doesFileExist outPaths - when (not $ null badPaths) $ do - hPutStrLn stderr $ "Refusing to write output because the following" - ++ " files would be overwritten: " ++ intercalate ", " badPaths - exitFailure let results = map (++ "\n") $ map show asts zipWithM_ writeFile outPaths results diff --git a/test/write/run.sh b/test/write/run.sh index 518b0b0..6b3045e 100755 --- a/test/write/run.sh +++ b/test/write/run.sh @@ -45,13 +45,13 @@ test_adjacent() { test_adjacent_exist() { createArtifacts runAndCapture --write=adjacent *.sv - clearArtifacts - - assertFalse "adjacent conversion should fail" $result + assertTrue "adjacent conversion should overwrite and succeed" $result assertNull "stdout should be empty" "$stdout" - assertEquals "stderr should list existing files" \ - "Refusing to write output because the following files would be overwritten: one.v, two.v" \ - "$stderr" + assertNull "stderr should be empty" "$stderr" + + actual=`cat one.v two.v` + assertEquals "adjacent output should match combined" "$expected" "$actual" + clearArtifacts } test_adjacent_extension() {