Skip to content

Commit

Permalink
Fix for printing success with echo (cvc5#10272)
Browse files Browse the repository at this point in the history
Fixes cvc5#10257.
  • Loading branch information
ajreynol authored Jan 11, 2024
1 parent 745a942 commit 62a9a00
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
9 changes: 2 additions & 7 deletions src/parser/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,14 @@ std::string EchoCommand::getOutput() const { return d_output; }

void EchoCommand::invoke(cvc5::Solver* solver, SymManager* sm)
{
/* we don't have an output stream here, nothing to do */
d_commandStatus = CommandSuccess::instance();
}

void EchoCommand::invoke(cvc5::Solver* solver,
SymManager* sm,
std::ostream& out)
void EchoCommand::printResult(cvc5::Solver* solver, std::ostream& out) const
{
out << cvc5::internal::quoteString(d_output) << std::endl;
Trace("dtview::command") << "* ~COMMAND: echo |" << d_output << "|~"
<< std::endl;
d_commandStatus = CommandSuccess::instance();
printResult(solver, out);
out << cvc5::internal::quoteString(d_output) << std::endl;
}

std::string EchoCommand::getCommandName() const { return "echo"; }
Expand Down
5 changes: 2 additions & 3 deletions src/parser/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,8 @@ class CVC5_EXPORT EchoCommand : public Cmd
std::string getOutput() const;

void invoke(cvc5::Solver* solver, parser::SymManager* sm) override;
void invoke(cvc5::Solver* solver,
parser::SymManager* sm,
std::ostream& out) override;
/** The result is the printed string */
void printResult(cvc5::Solver* solver, std::ostream& out) const override;

std::string getCommandName() const override;
void toStream(std::ostream& out) const override;
Expand Down
1 change: 1 addition & 0 deletions test/regress/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,7 @@ set(regress_0_tests
regress0/parser/non_well_founded_dt.smt2
regress0/parser/non_well_founded_dts.smt2
regress0/parser/parser-line-error.smt2
regress0/parser/print-success.smt2
regress0/parser/proj-issue370-push-pop-global.smt2
regress0/parser/quoted-define-fun.smt2
regress0/parser/real-numerals.smt2
Expand Down
12 changes: 12 additions & 0 deletions test/regress/cli/regress0/parser/print-success.smt2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
; COMMAND-LINE: --print-success
; EXPECT: success
; EXPECT: success
; EXPECT: true
; EXPECT: success
; EXPECT: "done"
; DISABLE-TESTER: dump
(set-logic ALL)
(set-option :produce-proofs true)
(get-option :produce-proofs)
(assert false)
(echo "done")

0 comments on commit 62a9a00

Please sign in to comment.