Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sv2v
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
sv2v
Commits
f868f06e
Commit
f868f06e
authored
Mar 16, 2022
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
write adjacent overwrites existing files
parent
ed09fe88
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
14 deletions
+11
-14
CHANGELOG.md
+4
-0
src/sv2v.hs
+1
-8
test/write/run.sh
+6
-6
No files found.
CHANGELOG.md
View file @
f868f06e
## Unreleased
### Breaking Changes
*
`--write adjacent`
no longer forbids overwriting existing generated files
### New Features
*
Added support for assignments within expressions (e.g.,
`x = ++y;`
)
...
...
src/sv2v.hs
View file @
f868f06e
...
...
@@ -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
...
...
test/write/run.sh
View file @
f868f06e
...
...
@@ -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
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment