mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
InlineAssembly: Extracting tests for switch statement
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
{
|
||||
switch 42
|
||||
default {}
|
||||
case 1 {}
|
||||
}
|
||||
// ----
|
||||
// ParserError 4904: (35-39): Case not allowed after default case.
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
switch 42
|
||||
default {}
|
||||
default {}
|
||||
}
|
||||
// ----
|
||||
// ParserError 6931: (35-42): Only one default case allowed.
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
switch 42
|
||||
case 1 mul
|
||||
case 2 {}
|
||||
default {}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (27-30): Expected '{' but got identifier
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
switch 42
|
||||
case mul(1, 2) {}
|
||||
case 2 {}
|
||||
default {}
|
||||
}
|
||||
// ----
|
||||
// ParserError 4805: (28-29): Literal expected.
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
switch {}
|
||||
case 1 {}
|
||||
default {}
|
||||
}
|
||||
// ----
|
||||
// ParserError 1856: (13-14): Literal or identifier expected.
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
switch mload
|
||||
case 1 {}
|
||||
default {}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (23-27): Expected '(' but got reserved keyword 'case'
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
switch mstore(1, 1)
|
||||
case 1 {}
|
||||
default {}
|
||||
}
|
||||
// ====
|
||||
// dialect: evm
|
||||
// ----
|
||||
// TypeError 3950: (10-22): Expected expression to evaluate to one value, but got 0 values instead.
|
||||
@@ -0,0 +1,3 @@
|
||||
{ switch 42 default {} }
|
||||
// ----
|
||||
// Warning 9592: (2-22): "switch" statement with only a default case.
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
{ switch 42 case 1 {} }
|
||||
{ switch 42 case 1 {} case 2 {} }
|
||||
{ switch 42 case 1 {} default {} }
|
||||
{ switch 42 case 1 {} case 2 {} default {} }
|
||||
{ switch mul(1, 2) case 1 {} case 2 {} default {} }
|
||||
{ function f() -> x {} switch f() case 1 {} case 2 {} default {} }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
switch 42
|
||||
case 1 {}
|
||||
case 1 {}
|
||||
default {}
|
||||
}
|
||||
// ====
|
||||
// dialect: evm
|
||||
// ----
|
||||
// DeclarationError 6792: (25-34): Duplicate case defined.
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
switch 42
|
||||
}
|
||||
// ----
|
||||
// ParserError 2418: (16-17): Switch statement without any cases.
|
||||
Reference in New Issue
Block a user