Commit c048ce5b by Zachary Snow

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
parent 9ae29853
......@@ -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 }
......
#!/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
#!/bin/bash
test_main() {
test_default() {
cv="$SHUNIT_TMPDIR/conv.v"
convert "$cv" --oneunit package.svh module.sv
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment