mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add new tests.
This commit is contained in:
parent
62950a9234
commit
54c5e604e5
72
test/libsolidity/ASTJSON/abstract_contract.json
Normal file
72
test/libsolidity/ASTJSON/abstract_contract.json
Normal 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"
|
||||
}
|
6
test/libsolidity/ASTJSON/abstract_contract.sol
Normal file
6
test/libsolidity/ASTJSON/abstract_contract.sol
Normal file
@ -0,0 +1,6 @@
|
||||
abstract contract C {
|
||||
constructor() public {
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
112
test/libsolidity/ASTJSON/abstract_contract_legacy.json
Normal file
112
test/libsolidity/ASTJSON/abstract_contract_legacy.json
Normal 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"
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
abstract abstract contract A { constructor() public {} }
|
||||
// ----
|
||||
// ParserError: (9-17): Contract expected.
|
1
test/libsolidity/syntaxTests/abstract/contract.sol
Normal file
1
test/libsolidity/syntaxTests/abstract/contract.sol
Normal file
@ -0,0 +1 @@
|
||||
abstract contract A { constructor() public {} }
|
3
test/libsolidity/syntaxTests/abstract/interface.sol
Normal file
3
test/libsolidity/syntaxTests/abstract/interface.sol
Normal file
@ -0,0 +1,3 @@
|
||||
abstract interface A { }
|
||||
// ----
|
||||
// ParserError: (0-8): Only contracts can be abstract.
|
3
test/libsolidity/syntaxTests/abstract/library.sol
Normal file
3
test/libsolidity/syntaxTests/abstract/library.sol
Normal file
@ -0,0 +1,3 @@
|
||||
abstract library A { }
|
||||
// ----
|
||||
// ParserError: (0-8): Only contracts can be abstract.
|
@ -0,0 +1,5 @@
|
||||
contract A {
|
||||
function a() public;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (0-39): Contract "A" should be marked as abstract.
|
@ -0,0 +1,7 @@
|
||||
abstract contract A {
|
||||
function a() public;
|
||||
}
|
||||
contract B is A {
|
||||
}
|
||||
// ----
|
||||
// TypeError: (49-68): Contract "B" should be marked as abstract.
|
Loading…
Reference in New Issue
Block a user