Static Analysis: more unit tests

pull/1/head
Michael Fröwis 8 years ago committed by chriseth
parent f9f03813d0
commit b8e2db29b9
  1. 7
      test/staticanalysis/staticAnalysisCommon-test.js

@ -412,6 +412,9 @@ test('staticAnalysisCommon.getSuperLocalCallName', function (t) {
],
'name': 'MemberAccess'
}
test('staticAnalysisCommon.getExternalDirectCallContractName', function (t) {
t.plan(3)
var localCall = {
'attributes': {
'type': 'tuple()',
@ -520,6 +523,7 @@ test('staticAnalysisCommon.getExternalDirectCallContractName', function (t) {
name: 'MemberAccess',
src: '405:6:0'
}
t.ok(common.getExternalDirectCallContractName(externalDirect) === 'InfoFeed', 'external direct call contract name from node')
t.throws(() => common.getExternalDirectCallContractName(thisLocalCall), undefined, 'throws on other nodes')
t.throws(() => common.getExternalDirectCallContractName(localCall), undefined, 'throws on other nodes')
@ -811,6 +815,7 @@ test('staticAnalysisCommon.getStateVariableDeclarationsFormContractNode', functi
'name': 'ContractDefinition'
}
var res = common.getStateVariableDeclarationsFormContractNode(contract).map(common.getDeclaredVariableName)
t.ok(res[0] === 'chairperson', 'var 1 should be ')
t.ok(res[1] === 'voters', 'var 2 should be ')
t.ok(res[2] === 'proposals', 'var 3 should be ')
@ -1192,6 +1197,7 @@ test('staticAnalysisCommon.isBuiltinFunctionCall', function (t) {
t.notOk(common.isBuiltinFunctionCall(localCall), 'local call is not builtin')
})
test('staticAnalysisCommon.isStorageVariableDeclaration', function (t) {
t.plan(3)
var node1 = {
@ -1713,6 +1719,7 @@ test('staticAnalysisCommon.isBlockTimestampAccess', function (t) {
t.notOk(common.isNowAccess(node), 'is now used should not work')
})
<<<<<<< 1ca54743848c4b5087105325dbc095c1b6a8b428
test('staticAnalysisCommon.isBlockBlockhashAccess', function (t) {
t.plan(4)
var node = {

Loading…
Cancel
Save