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:
Rhett Aultman
2017-01-16 12:32:57 -05:00
committed by Rhett Aultman
parent f10bf36ae3
commit f8914c6b28
5 changed files with 10 additions and 6 deletions
+2 -2
View File
@@ -762,8 +762,8 @@ BOOST_AUTO_TEST_CASE(metadata_stamp)
}
)";
BOOST_REQUIRE(m_compilerStack.compile(std::string(sourceCode)));
bytes const& bytecode = m_compilerStack.runtimeObject("test").bytecode;
bytes hash = dev::swarmHash(m_compilerStack.onChainMetadata("test")).asBytes();
bytes const& bytecode = m_compilerStack.runtimeObject(":test").bytecode;
bytes hash = dev::swarmHash(m_compilerStack.onChainMetadata(":test")).asBytes();
BOOST_REQUIRE(hash.size() == 32);
BOOST_REQUIRE(bytecode.size() >= 2);
size_t metadataCBORSize = (size_t(bytecode.end()[-2]) << 8) + size_t(bytecode.end()[-1]);
@@ -67,7 +67,11 @@ public:
);
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());
sendMessage(obj.bytecode + _arguments, true, _value);
return m_output;