Added new kind of test: check for specific properties of AST

This commit is contained in:
Matheus Aguiar
2023-08-21 12:37:40 -03:00
parent ee21b03e6c
commit 969aea6d33
13 changed files with 371 additions and 1 deletions
@@ -0,0 +1,9 @@
/// TestCase1: name
contract C {
///
///
function f() public pure { }
}
// ----
// TestCase1: C
//
@@ -0,0 +1,13 @@
contract C {
function f() public pure {
/// TestCase1: condition.operator
/// TestCase2: initializationExpression.initialValue.value
/// TestCase3: loopExpression.expression.subExpression.name
for(uint i = 1; i < 42; i++) {
}
}
}
// ----
// TestCase1: <
// TestCase2: 1
// TestCase3: i
@@ -0,0 +1,11 @@
contract C {
/// TestCase1: name
/// TestCase2: functionSelector
/// TestCase3: visibility
function singleFunction() public pure {
}
}
// ----
// TestCase1: singleFunction
// TestCase2: 3d33252c
// TestCase3: public
@@ -0,0 +1,17 @@
contract C {
function f() public pure {
/// TestCase1: condition.operator
for(uint i = 0; i < 42; ++i) {
}
/// TestCase2: initializationExpression.initialValue.value
for(uint i = 1; i < 42; i = i * 2) {
}
/// TestCase3: loopExpression.expression.subExpression.name
for(uint i = 0; i < 42; i++) {
}
}
}
// ----
// TestCase1: <
// TestCase2: 1
// TestCase3: i
@@ -0,0 +1,9 @@
/// TestCase1: nameLocation
/// TestCase2: src
contract C {
function f() public pure {
}
}
// ----
// TestCase1: 115:1:-1
// TestCase2: 106:51:-1
@@ -0,0 +1,12 @@
/// TestContractC: name
contract C {
/// TestStateVarX: stateVariable
uint x;
/// TestFunctionF: visibility
function f() public pure {
}
}
// ----
// TestContractC: C
// TestStateVarX: true
// TestFunctionF: public