diff options
author | Erik Kundt <bitshift@posteo.org> | 2018-03-21 23:40:19 +0800 |
---|---|---|
committer | Daniel Kirchner <daniel@ekpyron.org> | 2018-04-13 03:14:50 +0800 |
commit | 8935c0dd2f47a20ed7cc2d1b6e11fa7cdd978b79 (patch) | |
tree | 671c1476992ceae819bab76f1a8f99f4050185a0 /test/libsolidity/ASTJSON.cpp | |
parent | 7054defdd6c202d0943c11cb87ac2748b9bdc62b (diff) | |
download | dexon-solidity-8935c0dd2f47a20ed7cc2d1b6e11fa7cdd978b79.tar dexon-solidity-8935c0dd2f47a20ed7cc2d1b6e11fa7cdd978b79.tar.gz dexon-solidity-8935c0dd2f47a20ed7cc2d1b6e11fa7cdd978b79.tar.bz2 dexon-solidity-8935c0dd2f47a20ed7cc2d1b6e11fa7cdd978b79.tar.lz dexon-solidity-8935c0dd2f47a20ed7cc2d1b6e11fa7cdd978b79.tar.xz dexon-solidity-8935c0dd2f47a20ed7cc2d1b6e11fa7cdd978b79.tar.zst dexon-solidity-8935c0dd2f47a20ed7cc2d1b6e11fa7cdd978b79.zip |
Uses short string representation of TypePointer
Diffstat (limited to 'test/libsolidity/ASTJSON.cpp')
-rw-r--r-- | test/libsolidity/ASTJSON.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/libsolidity/ASTJSON.cpp b/test/libsolidity/ASTJSON.cpp index b44dd331..b585d13f 100644 --- a/test/libsolidity/ASTJSON.cpp +++ b/test/libsolidity/ASTJSON.cpp @@ -181,6 +181,36 @@ BOOST_AUTO_TEST_CASE(array_type_name) BOOST_CHECK_EQUAL(array["src"], "13:6:1"); } +BOOST_AUTO_TEST_CASE(short_type_name) +{ + CompilerStack c; + c.addSource("a", "contract c { function f() { uint[] memory x; } }"); + c.setEVMVersion(dev::test::Options::get().evmVersion()); + c.parseAndAnalyze(); + map<string, unsigned> sourceIndices; + sourceIndices["a"] = 1; + Json::Value astJson = ASTJsonConverter(false, sourceIndices).toJson(c.ast("a")); + Json::Value varDecl = astJson["nodes"][0]["nodes"][0]["body"]["statements"][0]["declarations"][0]; + BOOST_CHECK_EQUAL(varDecl["storageLocation"], "memory"); + BOOST_CHECK_EQUAL(varDecl["typeDescriptions"]["typeIdentifier"], "t_array$_t_uint256_$dyn_memory_ptr"); + BOOST_CHECK_EQUAL(varDecl["typeDescriptions"]["typeString"], "uint256[]"); +} + +BOOST_AUTO_TEST_CASE(short_type_name_ref) +{ + CompilerStack c; + c.addSource("a", "contract c { function f() { uint[][] memory rows; } }"); + c.setEVMVersion(dev::test::Options::get().evmVersion()); + c.parseAndAnalyze(); + map<string, unsigned> sourceIndices; + sourceIndices["a"] = 1; + Json::Value astJson = ASTJsonConverter(false, sourceIndices).toJson(c.ast("a")); + Json::Value varDecl = astJson["nodes"][0]["nodes"][0]["body"]["statements"][0]["declarations"][0]; + BOOST_CHECK_EQUAL(varDecl["storageLocation"], "memory"); + BOOST_CHECK_EQUAL(varDecl["typeName"]["typeDescriptions"]["typeIdentifier"], "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr"); + BOOST_CHECK_EQUAL(varDecl["typeName"]["typeDescriptions"]["typeString"], "uint256[][]"); +} + BOOST_AUTO_TEST_CASE(placeholder_statement) { CompilerStack c; |