From 21611f6b6fa133882d266eed9db48dece8b3a28d Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Tue, 14 Jan 2020 18:42:43 +0100 Subject: [PATCH] Add test for incorrect evm version when importing an ast tree --- .../ast_json_import_wrong_evmVersion/args | 1 + .../ast_json_import_wrong_evmVersion/err | 1 + .../ast_json_import_wrong_evmVersion/exit | 1 + .../input.sol | 117 ++++++++++++++++++ 4 files changed, 120 insertions(+) create mode 100644 test/cmdlineTests/ast_json_import_wrong_evmVersion/args create mode 100644 test/cmdlineTests/ast_json_import_wrong_evmVersion/err create mode 100644 test/cmdlineTests/ast_json_import_wrong_evmVersion/exit create mode 100644 test/cmdlineTests/ast_json_import_wrong_evmVersion/input.sol diff --git a/test/cmdlineTests/ast_json_import_wrong_evmVersion/args b/test/cmdlineTests/ast_json_import_wrong_evmVersion/args new file mode 100644 index 000000000..87444708c --- /dev/null +++ b/test/cmdlineTests/ast_json_import_wrong_evmVersion/args @@ -0,0 +1 @@ +--evm-version=homestead --import-ast --combined-json ast,compact-format --pretty-json diff --git a/test/cmdlineTests/ast_json_import_wrong_evmVersion/err b/test/cmdlineTests/ast_json_import_wrong_evmVersion/err new file mode 100644 index 000000000..1b86e4997 --- /dev/null +++ b/test/cmdlineTests/ast_json_import_wrong_evmVersion/err @@ -0,0 +1 @@ +Failed to import AST: Imported tree evm version differs from configured evm version! diff --git a/test/cmdlineTests/ast_json_import_wrong_evmVersion/exit b/test/cmdlineTests/ast_json_import_wrong_evmVersion/exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/test/cmdlineTests/ast_json_import_wrong_evmVersion/exit @@ -0,0 +1 @@ +1 diff --git a/test/cmdlineTests/ast_json_import_wrong_evmVersion/input.sol b/test/cmdlineTests/ast_json_import_wrong_evmVersion/input.sol new file mode 100644 index 000000000..a8e59cfa4 --- /dev/null +++ b/test/cmdlineTests/ast_json_import_wrong_evmVersion/input.sol @@ -0,0 +1,117 @@ +{ + "contracts": + { + "test/cmdlineTests/ast_json_import_wrong_evmVersion/input.sol:C": {} + }, + "sourceList": + [ + "test/cmdlineTests/ast_json_import_wrong_evmVersion/input.sol" + ], + "sources": + { + "test/cmdlineTests/ast_json_import_wrong_evmVersion/input.sol": + { + "AST": + { + "absolutePath": "test/cmdlineTests/ast_json_import_wrong_evmVersion/input.sol", + "exportedSymbols": + { + "C": + [ + 7 + ] + }, + "id": 8, + "nodeType": "SourceUnit", + "nodes": + [ + { + "id": 1, + "literals": + [ + "solidity", + ">=", + "0.0" + ], + "nodeType": "PragmaDirective", + "src": "0:22:0" + }, + { + "abstract": false, + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 7, + "linearizedBaseContracts": + [ + 7 + ], + "name": "C", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 5, + "nodeType": "Block", + "src": "65:21:0", + "statements": + [ + { + "AST": + { + "nodeType": "YulBlock", + "src": "78:2:0", + "statements": [] + }, + "evmVersion": "istanbul", + "externalReferences": [], + "id": 4, + "nodeType": "InlineAssembly", + "src": "69:11:0" + } + ] + }, + "documentation": null, + "functionSelector": "26121ff0", + "id": 6, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nodeType": "FunctionDefinition", + "overrides": null, + "parameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "50:2:0" + }, + "returnParameters": + { + "id": 3, + "nodeType": "ParameterList", + "parameters": [], + "src": "65:0:0" + }, + "scope": 7, + "src": "40:46:0", + "stateMutability": "pure", + "virtual": false, + "visibility": "public" + } + ], + "scope": 8, + "src": "23:65:0" + } + ], + "src": "0:89:0" + } + } + }, + "version": "0.6.2-develop.2020.1.14+commit.e8556fa1.mod.Linux.g++" +}