Add new tests.

This commit is contained in:
Alexander Arlt 2019-09-14 15:56:40 -05:00
parent 62950a9234
commit 54c5e604e5
9 changed files with 212 additions and 0 deletions

View File

@ -0,0 +1,72 @@
{
"absolutePath" : "a",
"exportedSymbols" :
{
"C" :
[
5
]
},
"id" : 6,
"nodeType" : "SourceUnit",
"nodes" :
[
{
"abstract" : true,
"baseContracts" : [],
"contractDependencies" : [],
"contractKind" : "contract",
"documentation" : null,
"fullyImplemented" : true,
"id" : 5,
"linearizedBaseContracts" :
[
5
],
"name" : "C",
"nodeType" : "ContractDefinition",
"nodes" :
[
{
"body" :
{
"id" : 3,
"nodeType" : "Block",
"src" : "44:4:1",
"statements" : []
},
"documentation" : null,
"id" : 4,
"implemented" : true,
"kind" : "constructor",
"modifiers" : [],
"name" : "",
"nodeType" : "FunctionDefinition",
"overrides" : null,
"parameters" :
{
"id" : 1,
"nodeType" : "ParameterList",
"parameters" : [],
"src" : "34:2:1"
},
"returnParameters" :
{
"id" : 2,
"nodeType" : "ParameterList",
"parameters" : [],
"src" : "44:0:1"
},
"scope" : 5,
"src" : "23:25:1",
"stateMutability" : "nonpayable",
"superFunction" : null,
"visibility" : "public"
}
],
"scope" : 6,
"src" : "0:50:1"
}
],
"src" : "0:51:1"
}

View File

@ -0,0 +1,6 @@
abstract contract C {
constructor() public {
}
}
// ----

View File

@ -0,0 +1,112 @@
{
"attributes" :
{
"absolutePath" : "a",
"exportedSymbols" :
{
"C" :
[
5
]
}
},
"children" :
[
{
"attributes" :
{
"abstract" : true,
"baseContracts" :
[
null
],
"contractDependencies" :
[
null
],
"contractKind" : "contract",
"documentation" : null,
"fullyImplemented" : true,
"linearizedBaseContracts" :
[
5
],
"name" : "C",
"scope" : 6
},
"children" :
[
{
"attributes" :
{
"documentation" : null,
"implemented" : true,
"isConstructor" : true,
"kind" : "constructor",
"modifiers" :
[
null
],
"name" : "",
"overrides" : null,
"scope" : 5,
"stateMutability" : "nonpayable",
"superFunction" : null,
"visibility" : "public"
},
"children" :
[
{
"attributes" :
{
"parameters" :
[
null
]
},
"children" : [],
"id" : 1,
"name" : "ParameterList",
"src" : "34:2:1"
},
{
"attributes" :
{
"parameters" :
[
null
]
},
"children" : [],
"id" : 2,
"name" : "ParameterList",
"src" : "44:0:1"
},
{
"attributes" :
{
"statements" :
[
null
]
},
"children" : [],
"id" : 3,
"name" : "Block",
"src" : "44:4:1"
}
],
"id" : 4,
"name" : "FunctionDefinition",
"src" : "23:25:1"
}
],
"id" : 5,
"name" : "ContractDefinition",
"src" : "0:50:1"
}
],
"id" : 6,
"name" : "SourceUnit",
"src" : "0:51:1"
}

View File

@ -0,0 +1,3 @@
abstract abstract contract A { constructor() public {} }
// ----
// ParserError: (9-17): Contract expected.

View File

@ -0,0 +1 @@
abstract contract A { constructor() public {} }

View File

@ -0,0 +1,3 @@
abstract interface A { }
// ----
// ParserError: (0-8): Only contracts can be abstract.

View File

@ -0,0 +1,3 @@
abstract library A { }
// ----
// ParserError: (0-8): Only contracts can be abstract.

View File

@ -0,0 +1,5 @@
contract A {
function a() public;
}
// ----
// TypeError: (0-39): Contract "A" should be marked as abstract.

View File

@ -0,0 +1,7 @@
abstract contract A {
function a() public;
}
contract B is A {
}
// ----
// TypeError: (49-68): Contract "B" should be marked as abstract.