aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/Metadata.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-05-24 16:54:25 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-05-24 19:24:00 +0800
commit4612c7681cd9304a835a996810cf831499738440 (patch)
treeecb4f1c8b3c7d50c821f0f44dbc87fbbd798fc6e /test/libsolidity/Metadata.cpp
parent804e99c6339c3fc3cb42737d492b035f38384dab (diff)
downloaddexon-solidity-4612c7681cd9304a835a996810cf831499738440.tar.gz
dexon-solidity-4612c7681cd9304a835a996810cf831499738440.tar.zst
dexon-solidity-4612c7681cd9304a835a996810cf831499738440.zip
Validate metadata JSON too
Diffstat (limited to 'test/libsolidity/Metadata.cpp')
-rw-r--r--test/libsolidity/Metadata.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/libsolidity/Metadata.cpp b/test/libsolidity/Metadata.cpp
index 7f089a1d..60bb2e4e 100644
--- a/test/libsolidity/Metadata.cpp
+++ b/test/libsolidity/Metadata.cpp
@@ -19,6 +19,7 @@
* Unit tests for the metadata output.
*/
+#include "../Metadata.h"
#include "../TestHelper.h"
#include <libsolidity/interface/CompilerStack.h>
#include <libdevcore/SwarmHash.h>
@@ -44,7 +45,9 @@ BOOST_AUTO_TEST_CASE(metadata_stamp)
CompilerStack compilerStack;
BOOST_REQUIRE(compilerStack.compile(std::string(sourceCode)));
bytes const& bytecode = compilerStack.runtimeObject("test").bytecode;
- bytes hash = dev::swarmHash(compilerStack.onChainMetadata("test")).asBytes();
+ std::string const& metadata = compilerStack.onChainMetadata("test");
+ BOOST_CHECK(dev::test::isValidMetadata(metadata));
+ bytes hash = dev::swarmHash(metadata).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]);