Skip to content

Commit

Permalink
qt6, test: Handle deprecated QVERIFY_EXCEPTION_THROWN
Browse files Browse the repository at this point in the history
This change ensures compatibility across all supported Qt versions.

Co-Authored-By: João Barbosa <[email protected]>
  • Loading branch information
hebasto and promag committed Oct 3, 2024
1 parent cb750b4 commit 5625840
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/qt/test/rpcnestedtests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ void RPCNestedTests::rpcNestedTests()
RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest( abc , cba )");
QVERIFY(result == "[\"abc\",\"cba\"]");

// Handle deprecated macro, can be removed once minimum Qt is at least 6.3.0.
#if (QT_VERSION >= QT_VERSION_CHECK(6, 3, 0))
#undef QVERIFY_EXCEPTION_THROWN
#define QVERIFY_EXCEPTION_THROWN(expression, exceptiontype) QVERIFY_THROWS_EXCEPTION(exceptiontype, expression)
#endif
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo() .\n"), std::runtime_error); //invalid syntax
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo() getblockchaininfo()"), std::runtime_error); //invalid syntax
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo("); //tolerate non closing brackets if we have no arguments
Expand Down

0 comments on commit 5625840

Please sign in to comment.