mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #5939 from ethereum/libsolc-test
Add last test case for callbacks in libsolc
This commit is contained in:
commit
d3820aa833
@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE(with_callback)
|
|||||||
"language": "Solidity",
|
"language": "Solidity",
|
||||||
"sources": {
|
"sources": {
|
||||||
"fileA": {
|
"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_contents = strdup(content.c_str());
|
||||||
*o_error = nullptr;
|
*o_error = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else if (string(_path) == "missing.sol")
|
||||||
{
|
{
|
||||||
static string errorMsg{"Missing file."};
|
static string errorMsg{"Missing file."};
|
||||||
*o_error = strdup(errorMsg.c_str());
|
*o_error = strdup(errorMsg.c_str());
|
||||||
*o_contents = nullptr;
|
*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.
|
// 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."));
|
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()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
Loading…
Reference in New Issue
Block a user