Change the error message of empty callback/error in libsolc

This commit is contained in:
Alex Beregszaszi 2019-11-21 17:25:51 +00:00
parent 576954c19b
commit 44c1f4a3bf
3 changed files with 4 additions and 2 deletions

View File

@ -53,7 +53,7 @@ ReadCallback::Callback wrapReadCallback(CStyleReadFileCallback _readCallback = n
if (!contents_c && !error_c)
{
result.success = false;
result.responseOrErrorMessage = "File not found.";
result.responseOrErrorMessage = "Callback not supported.";
}
if (contents_c)
{

View File

@ -40,6 +40,8 @@ extern "C" {
/// @param o_contents A pointer to the contents of the file, if found.
/// @param o_error A pointer to an error message, if there is one.
///
/// If the callback is not supported, o_contents and o_error should be set to NULL.
///
/// The two pointers (o_contents and o_error) should be heap-allocated and are free'd by the caller.
typedef void (*CStyleReadFileCallback)(char const* _path, char** o_contents, char** o_error);

View File

@ -167,7 +167,7 @@ BOOST_AUTO_TEST_CASE(with_callback)
BOOST_CHECK(containsError(result, "ParserError", "Source \"missing.sol\" not found: Missing file."));
// This should be placed due to the missing "notfound.sol" which sets both pointers to null.
BOOST_CHECK(containsError(result, "ParserError", "Source \"notfound.sol\" not found: File not found."));
BOOST_CHECK(containsError(result, "ParserError", "Source \"notfound.sol\" not found: Callback not supported."));
}
BOOST_AUTO_TEST_SUITE_END()