mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adjust and add more tests
This commit is contained in:
parent
3a617f9cf2
commit
6e381326fe
@ -1,4 +1,4 @@
|
|||||||
{"errors":[{"component":"general","formattedMessage":"A:1:40: TypeError: Unknown data object \"NamedObject.\".
|
{"errors":[{"component":"general","formattedMessage":"A:1:51: TypeError: Unknown data object \"NamedObject.\".
|
||||||
object \"NamedObject\" { code { let x := dataoffset(\"NamedObject.\") sstore(add(x, 0), 0) } object \"OtherObject\" { code { revert(0, 0) } } }
|
object \"NamedObject\" { code { let x := dataoffset(\"NamedObject.\") sstore(add(x, 0), 0) } object \"OtherObject\" { code { revert(0, 0) } } }
|
||||||
^--------^
|
^------------^
|
||||||
","message":"Unknown data object \"NamedObject.\".","severity":"error","sourceLocation":{"end":49,"file":"A","start":39},"type":"TypeError"}]}
|
","message":"Unknown data object \"NamedObject.\".","severity":"error","sourceLocation":{"end":64,"file":"A","start":50},"type":"TypeError"}]}
|
||||||
|
@ -258,6 +258,16 @@ BOOST_AUTO_TEST_CASE(arg_to_dataoffset_must_be_literal)
|
|||||||
CHECK_ERROR(code, TypeError, "Function expects direct literals as arguments.");
|
CHECK_ERROR(code, TypeError, "Function expects direct literals as arguments.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(arg_to_dataoffset_must_be_string_literal)
|
||||||
|
{
|
||||||
|
string code = R"(
|
||||||
|
object "outer" {
|
||||||
|
code { let y := dataoffset(0) }
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_ERROR(code, TypeError, "Function expects string literal.");
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(arg_to_datasize_must_be_literal)
|
BOOST_AUTO_TEST_CASE(arg_to_datasize_must_be_literal)
|
||||||
{
|
{
|
||||||
string code = R"(
|
string code = R"(
|
||||||
@ -268,6 +278,16 @@ BOOST_AUTO_TEST_CASE(arg_to_datasize_must_be_literal)
|
|||||||
CHECK_ERROR(code, TypeError, "Function expects direct literals as arguments.");
|
CHECK_ERROR(code, TypeError, "Function expects direct literals as arguments.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(arg_to_datasize_must_be_string_literal)
|
||||||
|
{
|
||||||
|
string code = R"(
|
||||||
|
object "outer" {
|
||||||
|
code { let y := datasize(0) }
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_ERROR(code, TypeError, "Function expects string literal.");
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(args_to_datacopy_are_arbitrary)
|
BOOST_AUTO_TEST_CASE(args_to_datacopy_are_arbitrary)
|
||||||
{
|
{
|
||||||
string code = R"(
|
string code = R"(
|
||||||
|
12
test/libyul/yulSyntaxTests/datacopy.yul
Normal file
12
test/libyul/yulSyntaxTests/datacopy.yul
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
datacopy(0, 1, 2)
|
||||||
|
datasize("")
|
||||||
|
datasize(0) // This should not be valid.
|
||||||
|
dataoffset("")
|
||||||
|
dataoffset(0) // This should not be valid.
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// TypeError 3517: (37-39): Unknown data object "".
|
||||||
|
// TypeError 5859: (54-55): Function expects string literal.
|
||||||
|
// TypeError 3517: (101-103): Unknown data object "".
|
||||||
|
// TypeError 5859: (120-121): Function expects string literal.
|
11
test/libyul/yulSyntaxTests/linkersymbol_bad_literal.yul
Normal file
11
test/libyul/yulSyntaxTests/linkersymbol_bad_literal.yul
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
pop(linkersymbol(0))
|
||||||
|
pop(linkersymbol(true))
|
||||||
|
pop(linkersymbol(false))
|
||||||
|
}
|
||||||
|
// ====
|
||||||
|
// dialect: evm
|
||||||
|
// ----
|
||||||
|
// TypeError 5859: (23-24): Function expects string literal.
|
||||||
|
// TypeError 5859: (48-52): Function expects string literal.
|
||||||
|
// TypeError 5859: (76-81): Function expects string literal.
|
11
test/libyul/yulSyntaxTests/loadimmutable_bad_literal.yul
Normal file
11
test/libyul/yulSyntaxTests/loadimmutable_bad_literal.yul
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
pop(loadimmutable(0))
|
||||||
|
pop(loadimmutable(true))
|
||||||
|
pop(loadimmutable(false))
|
||||||
|
}
|
||||||
|
// ====
|
||||||
|
// dialect: evm
|
||||||
|
// ----
|
||||||
|
// TypeError 5859: (24-25): Function expects string literal.
|
||||||
|
// TypeError 5859: (50-54): Function expects string literal.
|
||||||
|
// TypeError 5859: (79-84): Function expects string literal.
|
11
test/libyul/yulSyntaxTests/setimmutable_bad_literal.yul
Normal file
11
test/libyul/yulSyntaxTests/setimmutable_bad_literal.yul
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
setimmutable(0, 0x1234567890123456789012345678901234567890)
|
||||||
|
setimmutable(true, 0x1234567890123456789012345678901234567890)
|
||||||
|
setimmutable(false, 0x1234567890123456789012345678901234567890)
|
||||||
|
}
|
||||||
|
// ====
|
||||||
|
// dialect: evm
|
||||||
|
// ----
|
||||||
|
// TypeError 5859: (19-20): Function expects string literal.
|
||||||
|
// TypeError 5859: (83-87): Function expects string literal.
|
||||||
|
// TypeError 5859: (150-155): Function expects string literal.
|
Loading…
Reference in New Issue
Block a user