mirror of https://github.com/zachjs/sv2v.git
remove long deprecated flags
- remove -o/--oneunit, has been the default behavior - revise test coverage for default vs. siloed behavior - add test to ensure README usage matches CLI help text - remove -V alias for --version - remove -? alias for --help
This commit is contained in:
parent
9ae29853d5
commit
c048ce5b36
19
src/Job.hs
19
src/Job.hs
|
|
@ -75,21 +75,6 @@ defaultJob = Job
|
|||
|
||||
type DeprecationPhase = [String] -> IO [String]
|
||||
|
||||
oneunit :: DeprecationPhase
|
||||
oneunit strs = do
|
||||
let strs' = filter (not . isOneunitArg) strs
|
||||
if strs == strs'
|
||||
then return strs
|
||||
else do
|
||||
hPutStr stderr $ "Deprecation warning: --oneunit has been removed, "
|
||||
++ "and is now on by default\n"
|
||||
return strs'
|
||||
where
|
||||
isOneunitArg :: String -> Bool
|
||||
isOneunitArg "-o" = True
|
||||
isOneunitArg "--oneunit" = True
|
||||
isOneunitArg _ = False
|
||||
|
||||
flagRename :: String -> String -> DeprecationPhase
|
||||
flagRename before after strs = do
|
||||
let strs' = map rename strs
|
||||
|
|
@ -109,12 +94,10 @@ flagRename before after strs = do
|
|||
readJob :: IO Job
|
||||
readJob = do
|
||||
strs <- getArgs
|
||||
strs' <- oneunit strs
|
||||
strs' <- return strs
|
||||
>>= flagRename "-i" "-I"
|
||||
>>= flagRename "-d" "-D"
|
||||
>>= flagRename "-e" "-E"
|
||||
>>= flagRename "-V" "--version"
|
||||
>>= flagRename "-?" "--help"
|
||||
job <- withArgs (strs') $ cmdArgs defaultJob
|
||||
return $ if verbose job
|
||||
then job { exclude = Succinct : exclude job }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
test_help() {
|
||||
runAndCapture --help
|
||||
assertTrue "getting help should succeed" $result
|
||||
assertNotNull "stdout should not be empty" "$stdout"
|
||||
assertNull "stderr should be empty" "$stderr"
|
||||
lines=`echo "$stdout" | wc -l`
|
||||
usage=`echo "$stdout" | tail -n +3 | head -n $(expr $lines - 5)`
|
||||
usage="\`\`\`
|
||||
$usage
|
||||
\`\`\`"
|
||||
if [[ ! $(<../../README.md) = *"$usage"* ]]; then
|
||||
fail "Did not find matching usage in README!"
|
||||
fi
|
||||
}
|
||||
|
||||
source ../lib/functions.sh
|
||||
|
||||
. shunit2
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
test_main() {
|
||||
cv="$SHUNIT_TMPDIR/conv.v"
|
||||
convert "$cv" --oneunit package.svh module.sv
|
||||
simulateAndCompare "reference.v" "$cv" "$SCRIPT_DIR/empty.v"
|
||||
}
|
||||
|
||||
source ../lib/functions.sh
|
||||
|
||||
. shunit2
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
test_default() {
|
||||
cv="$SHUNIT_TMPDIR/conv.v"
|
||||
convert "$cv" package.svh module.sv
|
||||
simulateAndCompare "reference.v" "$cv" "$SCRIPT_DIR/empty.v"
|
||||
}
|
||||
|
||||
test_siloed() {
|
||||
runAndCapture --siloed package.svh module.sv
|
||||
assertFalse "siloed conversion should fail" $result
|
||||
assertNull "stdout should be empty" "$stdout"
|
||||
assertEquals "stderr should have missing macro" \
|
||||
"module.sv:8:35: Lexical error: Undefined macro: FANCY_SEEING_YOU" \
|
||||
"$stderr"
|
||||
}
|
||||
|
||||
source ../lib/functions.sh
|
||||
|
||||
. shunit2
|
||||
Loading…
Reference in New Issue