mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-19 15:19:05 +00:00
logcmd.cc: Check length before unquoting
`log "` should log `"`. Also fix test script to correctly fail when more than one test fails.
This commit is contained in:
parent
c87b4782a8
commit
db90d1a4c2
|
@ -97,7 +97,7 @@ struct LogPass : public Pass {
|
|||
text += args[argidx] + ' ';
|
||||
if (!text.empty()) text.resize(text.size()-1);
|
||||
|
||||
if (text[0] == '"' && text[text.size()-1] == '"')
|
||||
if (text.size() > 1 && text[0] == '"' && text[text.size()-1] == '"')
|
||||
text = text.substr(1, text.size()-2);
|
||||
|
||||
const char *fmtline = newline ? "%s\n" : "%s";
|
||||
|
|
|
@ -31,7 +31,10 @@ test_log "\"!bang\"" "!bang"
|
|||
test_log "\"spaces are cool too\"" "spaces are cool too"
|
||||
test_log "\"log a\"; log b" "log a"
|
||||
test_log "\"log a\"; log b" "b"
|
||||
test_log "\"" "\""
|
||||
test_log "\\\"" "\\\\\"" #\" == \"
|
||||
|
||||
if [ -f quotes-*.err ] ; then
|
||||
errors=( quotes-*.err )
|
||||
if [ -f $errors ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue