aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-01-05 21:24:07 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-01-05 21:24:07 +0800
commit9e7e312fdfc2598d0bd43efc72738845bf2e3992 (patch)
treebcdc2cb13d9b1e621d15571259672ce0b32da2e4 /test/libsolidity
parent35095e9fcc53f76a1c73251497c265f399a9896c (diff)
downloaddexon-solidity-9e7e312fdfc2598d0bd43efc72738845bf2e3992.tar.gz
dexon-solidity-9e7e312fdfc2598d0bd43efc72738845bf2e3992.tar.zst
dexon-solidity-9e7e312fdfc2598d0bd43efc72738845bf2e3992.zip
Properly support library file names containing a colon (such as URLs).
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/StandardCompiler.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp
index fa0f1e59..e48624e5 100644
--- a/test/libsolidity/StandardCompiler.cpp
+++ b/test/libsolidity/StandardCompiler.cpp
@@ -480,6 +480,41 @@ BOOST_AUTO_TEST_CASE(filename_with_colon)
BOOST_CHECK_EQUAL(dev::jsonCompactPrint(contract["abi"]), "[]");
}
+BOOST_AUTO_TEST_CASE(library_filename_with_colon)
+{
+ char const* input = R"(
+ {
+ "language": "Solidity",
+ "settings": {
+ "outputSelection": {
+ "fileA": {
+ "A": [
+ "evm.bytecode"
+ ]
+ }
+ }
+ },
+ "sources": {
+ "fileA": {
+ "content": "import \"git:library.sol\"; contract A { function f() returns (uint) { return L.g(); } }"
+ },
+ "git:library.sol": {
+ "content": "library L { function g() returns (uint) { return 1; } }"
+ }
+ }
+ }
+ )";
+ Json::Value result = compile(input);
+ BOOST_CHECK(containsAtMostWarnings(result));
+ Json::Value contract = getContractResult(result, "fileA", "A");
+ BOOST_CHECK(contract.isObject());
+ BOOST_CHECK(contract["evm"]["bytecode"].isObject());
+ BOOST_CHECK(contract["evm"]["bytecode"]["linkReferences"].isObject());
+ BOOST_CHECK(contract["evm"]["bytecode"]["linkReferences"]["git:library.sol"].isObject());
+ BOOST_CHECK(contract["evm"]["bytecode"]["linkReferences"]["git:library.sol"]["L"].isArray());
+ BOOST_CHECK(contract["evm"]["bytecode"]["linkReferences"]["git:library.sol"]["L"][0].isObject());
+}
+
BOOST_AUTO_TEST_SUITE_END()