aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2017-01-19 20:18:56 +0800
committerchriseth <c@ethdev.com>2017-01-19 20:23:58 +0800
commitda178d967fb66ca508d16bbe3feecf1962dcf6ef (patch)
treec8707bf91d1fd513a373c53dd276bd9023b4ebd7 /test
parent3fed790a56cea7bae481d01c15949aa500823968 (diff)
downloaddexon-solidity-da178d967fb66ca508d16bbe3feecf1962dcf6ef.tar
dexon-solidity-da178d967fb66ca508d16bbe3feecf1962dcf6ef.tar.gz
dexon-solidity-da178d967fb66ca508d16bbe3feecf1962dcf6ef.tar.bz2
dexon-solidity-da178d967fb66ca508d16bbe3feecf1962dcf6ef.tar.lz
dexon-solidity-da178d967fb66ca508d16bbe3feecf1962dcf6ef.tar.xz
dexon-solidity-da178d967fb66ca508d16bbe3feecf1962dcf6ef.tar.zst
dexon-solidity-da178d967fb66ca508d16bbe3feecf1962dcf6ef.zip
Properly escape user strings and lists.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityTypes.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/libsolidity/SolidityTypes.cpp b/test/libsolidity/SolidityTypes.cpp
index 1e7bcc7b..b4c06873 100644
--- a/test/libsolidity/SolidityTypes.cpp
+++ b/test/libsolidity/SolidityTypes.cpp
@@ -109,39 +109,39 @@ BOOST_AUTO_TEST_CASE(type_identifiers)
BOOST_CHECK_EQUAL(Type::fromElementaryTypeName("bytes")->identifier(), "t_bytes_storage_ptr");
BOOST_CHECK_EQUAL(Type::fromElementaryTypeName("string")->identifier(), "t_string_storage_ptr");
ArrayType largeintArray(DataLocation::Memory, Type::fromElementaryTypeName("int128"), u256("2535301200456458802993406410752"));
- BOOST_CHECK_EQUAL(largeintArray.identifier(), "t_int128_array2535301200456458802993406410752_memory_ptr");
+ BOOST_CHECK_EQUAL(largeintArray.identifier(), "t_array$_t_int128_$2535301200456458802993406410752_memory_ptr");
TypePointer stringArray = make_shared<ArrayType>(DataLocation::Storage, Type::fromElementaryTypeName("string"), u256("20"));
TypePointer multiArray = make_shared<ArrayType>(DataLocation::Storage, stringArray);
- BOOST_CHECK_EQUAL(multiArray->identifier(), "t_string_storage_array20_storage_arraydyn_storage_ptr");
+ BOOST_CHECK_EQUAL(multiArray->identifier(), "t_array$_t_array$_t_string_storage_$20_storage_$dyn_storage_ptr");
- ContractDefinition c(SourceLocation{}, make_shared<string>("MyContract"), {}, {}, {}, false);
- BOOST_CHECK_EQUAL(c.type()->identifier(), "t_type_t_contract_MyContract_2");
- BOOST_CHECK_EQUAL(ContractType(c, true).identifier(), "t_super_MyContract_2");
+ ContractDefinition c(SourceLocation{}, make_shared<string>("MyContract$"), {}, {}, {}, false);
+ BOOST_CHECK_EQUAL(c.type()->identifier(), "t_type$_t_contract$_MyContract$$$_$2_$");
+ BOOST_CHECK_EQUAL(ContractType(c, true).identifier(), "t_super$_MyContract$$$_$2");
StructDefinition s({}, make_shared<string>("Struct"), {});
- BOOST_CHECK_EQUAL(s.type()->identifier(), "t_type_t_struct_Struct_3_storage_ptr");
+ BOOST_CHECK_EQUAL(s.type()->identifier(), "t_type$_t_struct$_Struct_$3_storage_ptr_$");
EnumDefinition e({}, make_shared<string>("Enum"), {});
- BOOST_CHECK_EQUAL(e.type()->identifier(), "t_type_t_enum_Enum_4");
+ BOOST_CHECK_EQUAL(e.type()->identifier(), "t_type$_t_enum$_Enum_$4_$");
TupleType t({e.type(), s.type(), stringArray, nullptr});
- BOOST_CHECK_EQUAL(t.identifier(), "t_tuple4_t_type_t_enum_Enum_4_t_type_t_struct_Struct_3_storage_ptr_t_string_storage_array20_storage_ptr_t_empty_tuple_end");
+ BOOST_CHECK_EQUAL(t.identifier(), "t_tuple$_t_type$_t_enum$_Enum_$4_$_$_t_type$_t_struct$_Struct_$3_storage_ptr_$_$_t_array$_t_string_storage_$20_storage_ptr_$__$");
TypePointer sha3fun = make_shared<FunctionType>(strings{}, strings{}, FunctionType::Location::SHA3);
- BOOST_CHECK_EQUAL(sha3fun->identifier(), "t_function_sha3_param0_return0_function_end");
+ BOOST_CHECK_EQUAL(sha3fun->identifier(), "t_function_sha3$__$returns$__$");
FunctionType metaFun(TypePointers{sha3fun}, TypePointers{s.type()});
- BOOST_CHECK_EQUAL(metaFun.identifier(), "t_function_internal_param1_t_function_sha3_param0_return0_function_end_return1_t_type_t_struct_Struct_3_storage_ptr_function_end");
+ BOOST_CHECK_EQUAL(metaFun.identifier(), "t_function_internal$_t_function_sha3$__$returns$__$_$returns$_t_type$_t_struct$_Struct_$3_storage_ptr_$_$");
TypePointer m = make_shared<MappingType>(Type::fromElementaryTypeName("bytes32"), s.type());
MappingType m2(Type::fromElementaryTypeName("uint64"), m);
- BOOST_CHECK_EQUAL(m2.identifier(), "t_mapping_t_uint64_to_t_mapping_t_bytes32_to_t_type_t_struct_Struct_3_storage_ptr_mapping_end_mapping_end");
+ BOOST_CHECK_EQUAL(m2.identifier(), "t_mapping$_t_uint64_$_t_mapping$_t_bytes32_$_t_type$_t_struct$_Struct_$3_storage_ptr_$_$_$");
// TypeType is tested with contract
auto emptyParams = make_shared<ParameterList>(SourceLocation(), std::vector<ASTPointer<VariableDeclaration>>());
ModifierDefinition mod(SourceLocation{}, make_shared<string>("modif"), {}, emptyParams, {});
- BOOST_CHECK_EQUAL(ModifierType(mod).identifier(), "t_modifier_param0_end_modifier");
+ BOOST_CHECK_EQUAL(ModifierType(mod).identifier(), "t_modifier$__$");
SourceUnit su({}, {});
BOOST_CHECK_EQUAL(ModuleType(su).identifier(), "t_module_7");