mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Re-introduce string type.
This commit is contained in:
parent
cfaa99727a
commit
786b57b884
@ -568,6 +568,33 @@ BOOST_AUTO_TEST_CASE(return_param_in_abi)
|
||||
checkInterface(sourceCode, interface);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(strings_and_arrays)
|
||||
{
|
||||
// bug #1801
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f(string a, bytes b, uint[] c) external {}
|
||||
}
|
||||
)";
|
||||
|
||||
char const* interface = R"(
|
||||
[
|
||||
{
|
||||
"constant" : false,
|
||||
"name": "f",
|
||||
"inputs": [
|
||||
{ "name": "a", "type": "string" },
|
||||
{ "name": "b", "type": "bytes" },
|
||||
{ "name": "c", "type": "uint256[]" }
|
||||
],
|
||||
"outputs": [],
|
||||
"type" : "function"
|
||||
}
|
||||
]
|
||||
)";
|
||||
checkInterface(sourceCode, interface);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
@ -1783,6 +1783,39 @@ BOOST_AUTO_TEST_CASE(uninitialized_var)
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(string)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract C {
|
||||
string s;
|
||||
function f(string x) external { s = x; }
|
||||
}
|
||||
)";
|
||||
BOOST_CHECK_NO_THROW(parseTextAndResolveNames(sourceCode));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(string_index)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract C {
|
||||
string s;
|
||||
function f() { var a = s[2]; }
|
||||
}
|
||||
)";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(string_length)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract C {
|
||||
string s;
|
||||
function f() { var a = s.length; }
|
||||
}
|
||||
)";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user