Merge pull request #5939 from ethereum/libsolc-test

Add last test case for callbacks in libsolc
This commit is contained in:
Alex Beregszaszi 2019-02-05 20:55:35 +00:00 committed by GitHub
commit d3820aa833
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE(with_callback)
"language": "Solidity",
"sources": {
"fileA": {
"content": "import \"found.sol\"; contract A { }"
"content": "import \"found.sol\"; import \"notfound.sol\"; contract A { }"
}
}
}
@ -149,12 +149,17 @@ BOOST_AUTO_TEST_CASE(with_callback)
*o_contents = strdup(content.c_str());
*o_error = nullptr;
}
else
else if (string(_path) == "missing.sol")
{
static string errorMsg{"Missing file."};
*o_error = strdup(errorMsg.c_str());
*o_contents = nullptr;
}
else
{
*o_error = nullptr;
*o_contents = nullptr;
}
}
};
@ -163,6 +168,9 @@ BOOST_AUTO_TEST_CASE(with_callback)
// This ensures that "found.sol" was properly loaded which triggered the second import statement.
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_AUTO_TEST_SUITE_END()