Update tests and error messages.

This commit is contained in:
chriseth 2017-06-01 12:26:13 +02:00 committed by Alex Beregszaszi
parent 59ea19b3b9
commit 22f85d5af3
3 changed files with 14 additions and 14 deletions

View File

@ -333,7 +333,7 @@ void ContractCompiler::appendCalldataUnpacker(TypePointers const& _typeParameter
{
// stack: v1 v2 ... v(k-1) base_offset current_offset
TypePointer type = parameterType->decodingType();
solAssert(type, "No decoding type found.");
solUnimplementedAssert(type, "No decoding type found.");
if (type->category() == Type::Category::Array)
{
auto const& arrayType = dynamic_cast<ArrayType const&>(*type);

View File

@ -9691,10 +9691,10 @@ BOOST_AUTO_TEST_CASE(return_structs)
function f() returns (uint x, S s) {
x = 7;
s.a = 8;
s.sub = new S[](3);
s.sub[0][0] = 9;
s.sub[1][0] = 10;
s.sub[2][1] = 11;
s.sub = new T[](3);
s.sub[0].x[0] = 9;
s.sub[1].x[0] = 10;
s.sub[2].x[1] = 11;
}
}
)";

View File

@ -3283,7 +3283,7 @@ BOOST_AUTO_TEST_CASE(library_memory_struct)
function f() public returns (S ) {}
}
)";
CHECK_ERROR(text, TypeError, "Internal type is not allowed for public or external functions.");
CHECK_SUCCESS(text);
}
BOOST_AUTO_TEST_CASE(using_for_arbitrary_mismatch)
@ -5402,7 +5402,7 @@ BOOST_AUTO_TEST_CASE(return_structs)
contract C {
struct S { uint a; T[] sub; }
struct T { uint[] x; }
function f() returns (uint x, S s) {
function f() returns (uint, S) {
}
}
)";
@ -5414,36 +5414,36 @@ BOOST_AUTO_TEST_CASE(return_recursive_structs)
char const* text = R"(
contract C {
struct S { uint a; S[] sub; }
function f() returns (uint x, S s) {
function f() returns (uint, S) {
}
}
)";
success(text);
CHECK_ERROR(text, TypeError, "Internal or recursive type is not allowed for public or external functions.");
}
BOOST_AUTO_TEST_CASE(return_recursive_structs2)
{
char const* text = R"(
contract C {
struct S { uint a; S[2] sub; }
function f() returns (uint x, S s) {
struct S { uint a; S[2][] sub; }
function f() returns (uint, S) {
}
}
)";
CHECK_ERROR(text, TypeError, "recursive data types in external functions.");
CHECK_ERROR(text, TypeError, "Internal or recursive type is not allowed for public or external functions.");
}
BOOST_AUTO_TEST_CASE(return_recursive_structs3)
{
char const* text = R"(
contract C {
struct S { uint a; S sub; }
struct S { uint a; S[][][] sub; }
struct T { S s; }
function f() returns (uint x, T t) {
}
}
)";
CHECK_ERROR(text, TypeError, "recursive data types in external functions.");
CHECK_ERROR(text, TypeError, "Internal or recursive type is not allowed for public or external functions.");
}
BOOST_AUTO_TEST_CASE(address_checksum_type_deduction)