Skip to content

Commit 4a08288

Browse files
committed
qa: better error reporting on descriptor parsing error
A nit, but was helpful when writing unit tests for Miniscript parsing
1 parent d25d58b commit 4a08288

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/test/descriptor_tests.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,13 @@ void DoCheck(const std::string& prv, const std::string& pub, const std::string&
141141
} else {
142142
parse_priv = Parse(prv, keys_priv, error);
143143
}
144+
BOOST_CHECK_MESSAGE(parse_priv, error);
144145
if (replace_apostrophe_with_h_in_pub) {
145146
parse_pub = Parse(UseHInsteadOfApostrophe(pub), keys_pub, error);
146147
} else {
147148
parse_pub = Parse(pub, keys_pub, error);
148149
}
149-
150-
BOOST_CHECK(parse_priv);
151-
BOOST_CHECK(parse_pub);
150+
BOOST_CHECK_MESSAGE(parse_pub, error);
152151

153152
// Check that the correct OutputType is inferred
154153
BOOST_CHECK(parse_priv->GetOutputType() == type);
@@ -161,8 +160,8 @@ void DoCheck(const std::string& prv, const std::string& pub, const std::string&
161160
// Check that both versions serialize back to the public version.
162161
std::string pub1 = parse_priv->ToString();
163162
std::string pub2 = parse_pub->ToString();
164-
BOOST_CHECK(EqualDescriptor(pub, pub1));
165-
BOOST_CHECK(EqualDescriptor(pub, pub2));
163+
BOOST_CHECK_MESSAGE(EqualDescriptor(pub, pub1), "Private ser: " + pub1 + " Public desc: " + pub);
164+
BOOST_CHECK_MESSAGE(EqualDescriptor(pub, pub2), "Public ser: " + pub2 + " Public desc: " + pub);
166165

167166
// Check that both can be serialized with private key back to the private version, but not without private key.
168167
if (!(flags & MISSING_PRIVKEYS)) {

0 commit comments

Comments
 (0)