mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix contract lookup in tests
The fully-qualified name of a contract with no source unit is :<Name> instead of just <Name>, so the test system needed to be adjusted accordingly.
This commit is contained in:
parent
f10bf36ae3
commit
f8914c6b28
@ -224,7 +224,7 @@ protected:
|
|||||||
m_compiler.reset(false);
|
m_compiler.reset(false);
|
||||||
m_compiler.addSource("", registrarCode);
|
m_compiler.addSource("", registrarCode);
|
||||||
ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed");
|
ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed");
|
||||||
s_compiledRegistrar.reset(new bytes(m_compiler.object("GlobalRegistrar").bytecode));
|
s_compiledRegistrar.reset(new bytes(m_compiler.object(":GlobalRegistrar").bytecode));
|
||||||
}
|
}
|
||||||
sendMessage(*s_compiledRegistrar, true);
|
sendMessage(*s_compiledRegistrar, true);
|
||||||
BOOST_REQUIRE(!m_output.empty());
|
BOOST_REQUIRE(!m_output.empty());
|
||||||
|
@ -136,7 +136,7 @@ protected:
|
|||||||
m_compiler.reset(false);
|
m_compiler.reset(false);
|
||||||
m_compiler.addSource("", registrarCode);
|
m_compiler.addSource("", registrarCode);
|
||||||
ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed");
|
ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed");
|
||||||
s_compiledRegistrar.reset(new bytes(m_compiler.object("FixedFeeRegistrar").bytecode));
|
s_compiledRegistrar.reset(new bytes(m_compiler.object(":FixedFeeRegistrar").bytecode));
|
||||||
}
|
}
|
||||||
sendMessage(*s_compiledRegistrar, true);
|
sendMessage(*s_compiledRegistrar, true);
|
||||||
BOOST_REQUIRE(!m_output.empty());
|
BOOST_REQUIRE(!m_output.empty());
|
||||||
|
@ -451,7 +451,7 @@ protected:
|
|||||||
m_compiler.reset(false);
|
m_compiler.reset(false);
|
||||||
m_compiler.addSource("", walletCode);
|
m_compiler.addSource("", walletCode);
|
||||||
ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed");
|
ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed");
|
||||||
s_compiledWallet.reset(new bytes(m_compiler.object("Wallet").bytecode));
|
s_compiledWallet.reset(new bytes(m_compiler.object(":Wallet").bytecode));
|
||||||
}
|
}
|
||||||
bytes args = encodeArgs(u256(0x60), _required, _dailyLimit, u256(_owners.size()), _owners);
|
bytes args = encodeArgs(u256(0x60), _required, _dailyLimit, u256(_owners.size()), _owners);
|
||||||
sendMessage(*s_compiledWallet + args, true, _value);
|
sendMessage(*s_compiledWallet + args, true, _value);
|
||||||
|
@ -762,8 +762,8 @@ BOOST_AUTO_TEST_CASE(metadata_stamp)
|
|||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
BOOST_REQUIRE(m_compilerStack.compile(std::string(sourceCode)));
|
BOOST_REQUIRE(m_compilerStack.compile(std::string(sourceCode)));
|
||||||
bytes const& bytecode = m_compilerStack.runtimeObject("test").bytecode;
|
bytes const& bytecode = m_compilerStack.runtimeObject(":test").bytecode;
|
||||||
bytes hash = dev::swarmHash(m_compilerStack.onChainMetadata("test")).asBytes();
|
bytes hash = dev::swarmHash(m_compilerStack.onChainMetadata(":test")).asBytes();
|
||||||
BOOST_REQUIRE(hash.size() == 32);
|
BOOST_REQUIRE(hash.size() == 32);
|
||||||
BOOST_REQUIRE(bytecode.size() >= 2);
|
BOOST_REQUIRE(bytecode.size() >= 2);
|
||||||
size_t metadataCBORSize = (size_t(bytecode.end()[-2]) << 8) + size_t(bytecode.end()[-1]);
|
size_t metadataCBORSize = (size_t(bytecode.end()[-2]) << 8) + size_t(bytecode.end()[-1]);
|
||||||
|
@ -67,7 +67,11 @@ public:
|
|||||||
);
|
);
|
||||||
BOOST_ERROR("Compiling contract failed");
|
BOOST_ERROR("Compiling contract failed");
|
||||||
}
|
}
|
||||||
eth::LinkerObject obj = m_compiler.object(_contractName);
|
eth::LinkerObject obj;
|
||||||
|
if (_contractName.empty())
|
||||||
|
obj = m_compiler.object(_contractName);
|
||||||
|
else
|
||||||
|
obj = m_compiler.object(":" + _contractName);
|
||||||
BOOST_REQUIRE(obj.linkReferences.empty());
|
BOOST_REQUIRE(obj.linkReferences.empty());
|
||||||
sendMessage(obj.bytecode + _arguments, true, _value);
|
sendMessage(obj.bytecode + _arguments, true, _value);
|
||||||
return m_output;
|
return m_output;
|
||||||
|
Loading…
Reference in New Issue
Block a user