aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-02-27 03:27:26 +0800
committerGitHub <noreply@github.com>2018-02-27 03:27:26 +0800
commitb62d43912badc10f07b693a79834dcd3249f082a (patch)
tree93ad8bb8e667f858ce478e66bbecf70b50408ed0 /test/libsolidity
parentcd2d893634b490236ef29fe857556bde4901a74d (diff)
parent0736d91eaa0807c21364376b455c0b72c1aeb9be (diff)
downloaddexon-solidity-b62d43912badc10f07b693a79834dcd3249f082a.tar.gz
dexon-solidity-b62d43912badc10f07b693a79834dcd3249f082a.tar.zst
dexon-solidity-b62d43912badc10f07b693a79834dcd3249f082a.zip
Merge pull request #3589 from ethereum/identifiers
Clean up type identifiers
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityTypes.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityTypes.cpp b/test/libsolidity/SolidityTypes.cpp
index 9f385a04..bc9f2fe1 100644
--- a/test/libsolidity/SolidityTypes.cpp
+++ b/test/libsolidity/SolidityTypes.cpp
@@ -88,6 +88,21 @@ BOOST_AUTO_TEST_CASE(storage_layout_arrays)
BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared<FixedBytesType>(32), 9).storageSize() == 9);
}
+BOOST_AUTO_TEST_CASE(type_escaping)
+{
+ BOOST_CHECK_EQUAL(Type::escapeIdentifier("("), "$_");
+ BOOST_CHECK_EQUAL(Type::escapeIdentifier(")"), "_$");
+ BOOST_CHECK_EQUAL(Type::escapeIdentifier(","), "_$_");
+ BOOST_CHECK_EQUAL(Type::escapeIdentifier("$"), "$$$");
+ BOOST_CHECK_EQUAL(Type::escapeIdentifier("()"), "$__$");
+ BOOST_CHECK_EQUAL(Type::escapeIdentifier("(,)"), "$__$__$");
+ BOOST_CHECK_EQUAL(Type::escapeIdentifier("(,$,)"), "$__$_$$$_$__$");
+ BOOST_CHECK_EQUAL(
+ Type::escapeIdentifier("((__(_$_$$,__($$,,,$$),$,,,)))$$,$$"),
+ "$_$___$__$$$_$$$$$$_$___$_$$$$$$_$__$__$_$$$$$$_$_$_$$$_$__$__$__$_$_$$$$$$$_$_$$$$$$"
+ );
+}
+
BOOST_AUTO_TEST_CASE(type_identifiers)
{
ASTNode::resetID();