diff options
author | chriseth <chris@ethereum.org> | 2018-12-19 02:39:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-19 02:39:46 +0800 |
commit | 20189c3f3bb553096b0eb8a783d80d04ba6d49e9 (patch) | |
tree | fdcdc267b6767b49aea66a0dbd5cd3c7d5b3fa4d | |
parent | e33545292ac2a5a40e03f3d3b6a43773b7f04333 (diff) | |
parent | c43d96f2bf5614136bfbcaf45d0850c914bf81ee (diff) | |
download | dexon-solidity-20189c3f3bb553096b0eb8a783d80d04ba6d49e9.tar.gz dexon-solidity-20189c3f3bb553096b0eb8a783d80d04ba6d49e9.tar.zst dexon-solidity-20189c3f3bb553096b0eb8a783d80d04ba6d49e9.zip |
Merge pull request #5637 from ethereum/better-json-error-reporting
Json: Provide better error message when 'settings' is not an object
47 files changed, 330 insertions, 13 deletions
diff --git a/Changelog.md b/Changelog.md index 63c0280a..60e3904c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -17,6 +17,7 @@ Compiler Features: Bugfixes: + * Compiler Interface: Report specific error message for json input errors instead of internal compiler error Build System: diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp index 5be267e9..e99b1324 100644 --- a/libsolidity/interface/StandardCompiler.cpp +++ b/libsolidity/interface/StandardCompiler.cpp @@ -228,48 +228,97 @@ Json::Value collectEVMObject(eth::LinkerObject const& _object, string const* _so return output; } -boost::optional<Json::Value> checkKeys(Json::Value const& _input, set<string> const& _keys) +boost::optional<Json::Value> checkKeys(Json::Value const& _input, set<string> const& _keys, string const& _name) { + if (!!_input && !_input.isObject()) + return formatFatalError("JSONError", "\"" + _name + "\" must be an object"); + for (auto const& member: _input.getMemberNames()) if (!_keys.count(member)) return formatFatalError("JSONError", "Unknown key \"" + member + "\""); + return boost::none; } boost::optional<Json::Value> checkRootKeys(Json::Value const& _input) { static set<string> keys{"auxiliaryInput", "language", "settings", "sources"}; - return checkKeys(_input, keys); + return checkKeys(_input, keys, "root"); } -boost::optional<Json::Value> checkSourceKeys(Json::Value const& _input) +boost::optional<Json::Value> checkSourceKeys(Json::Value const& _input, string const& _name) { static set<string> keys{"content", "keccak256", "urls"}; - return checkKeys(_input, keys); + return checkKeys(_input, keys, "sources." + _name); } boost::optional<Json::Value> checkAuxiliaryInputKeys(Json::Value const& _input) { static set<string> keys{"smtlib2responses"}; - return checkKeys(_input, keys); + return checkKeys(_input, keys, "auxiliaryInput"); } boost::optional<Json::Value> checkSettingsKeys(Json::Value const& _input) { static set<string> keys{"evmVersion", "libraries", "metadata", "optimizer", "outputSelection", "remappings"}; - return checkKeys(_input, keys); + return checkKeys(_input, keys, "settings"); } boost::optional<Json::Value> checkOptimizerKeys(Json::Value const& _input) { static set<string> keys{"enabled", "runs"}; - return checkKeys(_input, keys); + return checkKeys(_input, keys, "settings.optimizer"); } boost::optional<Json::Value> checkMetadataKeys(Json::Value const& _input) { static set<string> keys{"useLiteralContent"}; - return checkKeys(_input, keys); + return checkKeys(_input, keys, "settings.metadata"); +} + +boost::optional<Json::Value> checkOutputSelection(Json::Value const& _outputSelection) +{ + if (!!_outputSelection && !_outputSelection.isObject()) + return formatFatalError("JSONError", "\"settings.outputSelection\" must be an object"); + + for (auto const& sourceName: _outputSelection.getMemberNames()) + { + auto const& sourceVal = _outputSelection[sourceName]; + + if (!sourceVal.isObject()) + return formatFatalError( + "JSONError", + "\"settings.outputSelection." + sourceName + "\" must be an object" + ); + + for (auto const& contractName: sourceVal.getMemberNames()) + { + auto const& contractVal = sourceVal[contractName]; + + if (!contractVal.isArray()) + return formatFatalError( + "JSONError", + "\"settings.outputSelection." + + sourceName + + "." + + contractName + + "\" must be a string array" + ); + + for (auto const& output: contractVal) + if (!output.isString()) + return formatFatalError( + "JSONError", + "\"settings.outputSelection." + + sourceName + + "." + + contractName + + "\" must be a string array" + ); + } + } + + return boost::none; } } @@ -301,10 +350,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) { string hash; - if (!sources[sourceName].isObject()) - return formatFatalError("JSONError", "Source input is not a JSON object."); - - if (auto result = checkSourceKeys(sources[sourceName])) + if (auto result = checkSourceKeys(sources[sourceName], sourceName)) return *result; if (sources[sourceName]["keccak256"].isString()) @@ -380,6 +426,10 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) { Json::Value const& smtlib2Responses = auxInputs["smtlib2responses"]; if (!!smtlib2Responses) + { + if (!smtlib2Responses.isObject()) + return formatFatalError("JSONError", "\"auxiliaryInput.smtlib2responses\" must be an object."); + for (auto const& hashString: smtlib2Responses.getMemberNames()) { h256 hash; @@ -392,8 +442,15 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) return formatFatalError("JSONError", "Invalid hex encoding of SMTLib2 auxiliary input."); } + if (!smtlib2Responses[hashString].isString()) + return formatFatalError( + "JSONError", + "\"smtlib2Responses." + hashString + "\" must be a string." + ); + m_compilerStack.addSMTLib2Response(hash, smtlib2Responses[hashString].asString()); } + } } Json::Value const& settings = _input.get("settings", Json::Value()); @@ -411,11 +468,14 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) m_compilerStack.setEVMVersion(*version); } + if (settings.isMember("remappings") && !settings["remappings"].isArray()) + return formatFatalError("JSONError", "\"settings.remappings\" must be an array of strings."); + vector<CompilerStack::Remapping> remappings; for (auto const& remapping: settings.get("remappings", Json::Value())) { if (!remapping.isString()) - return formatFatalError("JSONError", "Remapping entry must be a string."); + return formatFatalError("JSONError", "\"settings.remappings\" must be an array of strings"); if (auto r = CompilerStack::parseRemapping(remapping.asString())) remappings.emplace_back(std::move(*r)); else @@ -498,6 +558,10 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) m_compilerStack.useMetadataLiteralSources(metadataSettings.get("useLiteralContent", Json::Value(false)).asBool()); Json::Value outputSelection = settings.get("outputSelection", Json::Value()); + + if (auto jsonError = checkOutputSelection(outputSelection)) + return *jsonError; + m_compilerStack.setRequestedContractNames(requestedContractNames(outputSelection)); try diff --git a/test/cmdlineTests/standard_wrong_type_auxiliary_input.json b/test/cmdlineTests/standard_wrong_type_auxiliary_input.json new file mode 100644 index 00000000..8d2c7593 --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_auxiliary_input.json @@ -0,0 +1,11 @@ +{ + "language": "Solidity", + "sources": + { + "A": + { + "content": "pragma solidity >=0.0; contract C { function f() public pure {} }" + } + }, + "auxiliaryInput": [1, 2, 3] +} diff --git a/test/cmdlineTests/standard_wrong_type_auxiliary_input.json.exit b/test/cmdlineTests/standard_wrong_type_auxiliary_input.json.exit new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_auxiliary_input.json.exit @@ -0,0 +1 @@ +0 diff --git a/test/cmdlineTests/standard_wrong_type_auxiliary_input.json.stdout b/test/cmdlineTests/standard_wrong_type_auxiliary_input.json.stdout new file mode 100644 index 00000000..046cb6d9 --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_auxiliary_input.json.stdout @@ -0,0 +1,2 @@ +{"errors":[{"component":"general","formattedMessage":"\"auxiliaryInput\" must be an object","message":"\"auxiliaryInput\" must be an object","severity":"error","type":"JSONError"}]} + diff --git a/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses.json b/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses.json new file mode 100644 index 00000000..9175050f --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses.json @@ -0,0 +1,20 @@ +{ + "language": "Solidity", + "sources": { + "fileA": { + "content": "contract A { }" + } + }, + "settings": { + "outputSelection": { + "fileA": { + "A": [ "abi", "devdoc", "userdoc", "evm.bytecode", "evm.assembly", "evm.gasEstimates", "evm.legacyAssembly", "metadata" ], + "": [ "legacyAST" ] + } + } + }, + "auxiliaryInput": + { + "smtlib2responses": "not an object" + } +} diff --git a/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses.json.exit b/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses.json.exit new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses.json.exit @@ -0,0 +1 @@ +0 diff --git a/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses.json.stdout b/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses.json.stdout new file mode 100644 index 00000000..3efaea20 --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses.json.stdout @@ -0,0 +1 @@ +{"errors":[{"component":"general","formattedMessage":"\"auxiliaryInput.smtlib2responses\" must be an object.","message":"\"auxiliaryInput.smtlib2responses\" must be an object.","severity":"error","type":"JSONError"}]} diff --git a/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses_member.json b/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses_member.json new file mode 100644 index 00000000..aa7d451b --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses_member.json @@ -0,0 +1,23 @@ +{ + "language": "Solidity", + "sources": { + "fileA": { + "content": "contract A { }" + } + }, + "settings": { + "outputSelection": { + "fileA": { + "A": [ "abi", "devdoc", "userdoc", "evm.bytecode", "evm.assembly", "evm.gasEstimates", "evm.legacyAssembly", "metadata" ], + "": [ "legacyAST" ] + } + } + }, + "auxiliaryInput": + { + "smtlib2responses": + { + "abc": ["not a string"] + } + } +} diff --git a/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses_member.json.exit b/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses_member.json.exit new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses_member.json.exit @@ -0,0 +1 @@ +0 diff --git a/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses_member.json.stdout b/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses_member.json.stdout new file mode 100644 index 00000000..a05176be --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_auxiliary_input_smtlib2responses_member.json.stdout @@ -0,0 +1 @@ +{"errors":[{"component":"general","formattedMessage":"\"smtlib2Responses.abc\" must be a string.","message":"\"smtlib2Responses.abc\" must be a string.","severity":"error","type":"JSONError"}]} diff --git a/test/cmdlineTests/standard_wrong_type_metadata.json b/test/cmdlineTests/standard_wrong_type_metadata.json new file mode 100644 index 00000000..d4dd06a1 --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_metadata.json @@ -0,0 +1,19 @@ +{ + "language": "Solidity", + "sources": + { + "A": + { + "content": "pragma solidity >=0.0; contract C { function f() public pure {} }" + } + }, + "settings": + { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "byzantium", + "metadata": ["meta1", "meta2", "meta3"] + } +} diff --git a/test/cmdlineTests/standard_wrong_type_metadata.json.exit b/test/cmdlineTests/standard_wrong_type_metadata.json.exit new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_metadata.json.exit @@ -0,0 +1 @@ +0 diff --git a/test/cmdlineTests/standard_wrong_type_metadata.json.stdout b/test/cmdlineTests/standard_wrong_type_metadata.json.stdout new file mode 100644 index 00000000..7b997cec --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_metadata.json.stdout @@ -0,0 +1 @@ +{"errors":[{"component":"general","formattedMessage":"\"settings.metadata\" must be an object","message":"\"settings.metadata\" must be an object","severity":"error","type":"JSONError"}]} diff --git a/test/cmdlineTests/standard_wrong_type_optimizer.json b/test/cmdlineTests/standard_wrong_type_optimizer.json new file mode 100644 index 00000000..b42ca550 --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_optimizer.json @@ -0,0 +1,18 @@ +{ + "language": "Solidity", + "sources": + { + "A": + { + "content": "pragma solidity >=0.0; contract C { function f() public pure {} }" + } + }, + "settings": + { + "optimizer": 1, + "evmVersion": "byzantium", + "metadata": { + "useLiteralContent": true + } + } +} diff --git a/test/cmdlineTests/standard_wrong_type_optimizer.json.exit b/test/cmdlineTests/standard_wrong_type_optimizer.json.exit new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_optimizer.json.exit @@ -0,0 +1 @@ +0 diff --git a/test/cmdlineTests/standard_wrong_type_optimizer.json.stdout b/test/cmdlineTests/standard_wrong_type_optimizer.json.stdout new file mode 100644 index 00000000..d43b6470 --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_optimizer.json.stdout @@ -0,0 +1 @@ +{"errors":[{"component":"general","formattedMessage":"\"settings.optimizer\" must be an object","message":"\"settings.optimizer\" must be an object","severity":"error","type":"JSONError"}]} diff --git a/test/cmdlineTests/standard_wrong_type_output_selection.json b/test/cmdlineTests/standard_wrong_type_output_selection.json new file mode 100644 index 00000000..a7b615d1 --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_output_selection.json @@ -0,0 +1,11 @@ +{ + "language": "Solidity", + "sources": { + "fileA": { + "content": "contract A { }" + } + }, + "settings": { + "outputSelection": "not an object" + } +} diff --git a/test/cmdlineTests/standard_wrong_type_output_selection.json.exit b/test/cmdlineTests/standard_wrong_type_output_selection.json.exit new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_output_selection.json.exit @@ -0,0 +1 @@ +0 diff --git a/test/cmdlineTests/standard_wrong_type_output_selection.json.stdout b/test/cmdlineTests/standard_wrong_type_output_selection.json.stdout new file mode 100644 index 00000000..39e74882 --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_output_selection.json.stdout @@ -0,0 +1 @@ +{"errors":[{"component":"general","formattedMessage":"\"settings.outputSelection\" must be an object","message":"\"settings.outputSelection\" must be an object","severity":"error","type":"JSONError"}]} diff --git a/test/cmdlineTests/standard_wrong_type_output_selection_contract.json b/test/cmdlineTests/standard_wrong_type_output_selection_contract.json new file mode 100644 index 00000000..9840a97e --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_output_selection_contract.json @@ -0,0 +1,16 @@ +{ + "language": "Solidity", + "sources": { + "fileA": { + "content": "contract A { }" + } + }, + "settings": { + "outputSelection": { + "fileA": { + "A": "it's a contract, but not an array!", + "": [ "legacyAST" ] + } + } + } +} diff --git a/test/cmdlineTests/standard_wrong_type_output_selection_contract.json.exit b/test/cmdlineTests/standard_wrong_type_output_selection_contract.json.exit new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_output_selection_contract.json.exit @@ -0,0 +1 @@ +0 diff --git a/test/cmdlineTests/standard_wrong_type_output_selection_contract.json.stdout b/test/cmdlineTests/standard_wrong_type_output_selection_contract.json.stdout new file mode 100644 index 00000000..a4ba320e --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_output_selection_contract.json.stdout @@ -0,0 +1 @@ +{"errors":[{"component":"general","formattedMessage":"\"settings.outputSelection.fileA.A\" must be a string array","message":"\"settings.outputSelection.fileA.A\" must be a string array","severity":"error","type":"JSONError"}]} diff --git a/test/cmdlineTests/standard_wrong_type_output_selection_file.json b/test/cmdlineTests/standard_wrong_type_output_selection_file.json new file mode 100644 index 00000000..7ab12ba8 --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_output_selection_file.json @@ -0,0 +1,13 @@ +{ + "language": "Solidity", + "sources": { + "fileA": { + "content": "contract A { }" + } + }, + "settings": { + "outputSelection": { + "fileA": "awesome file!" + } + } +} diff --git a/test/cmdlineTests/standard_wrong_type_output_selection_file.json.exit b/test/cmdlineTests/standard_wrong_type_output_selection_file.json.exit new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_output_selection_file.json.exit @@ -0,0 +1 @@ +0 diff --git a/test/cmdlineTests/standard_wrong_type_output_selection_file.json.stdout b/test/cmdlineTests/standard_wrong_type_output_selection_file.json.stdout new file mode 100644 index 00000000..8874e636 --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_output_selection_file.json.stdout @@ -0,0 +1 @@ +{"errors":[{"component":"general","formattedMessage":"\"settings.outputSelection.fileA\" must be an object","message":"\"settings.outputSelection.fileA\" must be an object","severity":"error","type":"JSONError"}]} diff --git a/test/cmdlineTests/standard_wrong_type_output_selection_output.json b/test/cmdlineTests/standard_wrong_type_output_selection_output.json new file mode 100644 index 00000000..3e5cd661 --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_output_selection_output.json @@ -0,0 +1,16 @@ +{ + "language": "Solidity", + "sources": { + "fileA": { + "content": "contract A { }" + } + }, + "settings": { + "outputSelection": { + "fileA": { + "A": [ 1, 2, 3 ,4], + "": [ "legacyAST" ] + } + } + } +} diff --git a/test/cmdlineTests/standard_wrong_type_output_selection_output.json.exit b/test/cmdlineTests/standard_wrong_type_output_selection_output.json.exit new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_output_selection_output.json.exit @@ -0,0 +1 @@ +0 diff --git a/test/cmdlineTests/standard_wrong_type_output_selection_output.json.stdout b/test/cmdlineTests/standard_wrong_type_output_selection_output.json.stdout new file mode 100644 index 00000000..a4ba320e --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_output_selection_output.json.stdout @@ -0,0 +1 @@ +{"errors":[{"component":"general","formattedMessage":"\"settings.outputSelection.fileA.A\" must be a string array","message":"\"settings.outputSelection.fileA.A\" must be a string array","severity":"error","type":"JSONError"}]} diff --git a/test/cmdlineTests/standard_wrong_type_remappings.json b/test/cmdlineTests/standard_wrong_type_remappings.json new file mode 100644 index 00000000..1436e014 --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_remappings.json @@ -0,0 +1,17 @@ +{ + "language": "Solidity", + "sources": { + "fileA": { + "content": "contract A { }" + } + }, + "settings": { + "outputSelection": { + "fileA": { + "A": [ "abi", "devdoc", "userdoc", "evm.bytecode", "evm.assembly", "evm.gasEstimates", "evm.legacyAssembly", "metadata" ], + "": [ "legacyAST" ] + } + }, + "remappings": "not an object" + } +} diff --git a/test/cmdlineTests/standard_wrong_type_remappings.json.exit b/test/cmdlineTests/standard_wrong_type_remappings.json.exit new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_remappings.json.exit @@ -0,0 +1 @@ +0 diff --git a/test/cmdlineTests/standard_wrong_type_remappings.json.stdout b/test/cmdlineTests/standard_wrong_type_remappings.json.stdout new file mode 100644 index 00000000..b5e4ea5c --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_remappings.json.stdout @@ -0,0 +1 @@ +{"errors":[{"component":"general","formattedMessage":"\"settings.remappings\" must be an array of strings.","message":"\"settings.remappings\" must be an array of strings.","severity":"error","type":"JSONError"}]} diff --git a/test/cmdlineTests/standard_wrong_type_remappings_entry.json b/test/cmdlineTests/standard_wrong_type_remappings_entry.json new file mode 100644 index 00000000..c96611f3 --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_remappings_entry.json @@ -0,0 +1,17 @@ +{ + "language": "Solidity", + "sources": { + "fileA": { + "content": "contract A { }" + } + }, + "settings": { + "outputSelection": { + "fileA": { + "A": [ "abi", "devdoc", "userdoc", "evm.bytecode", "evm.assembly", "evm.gasEstimates", "evm.legacyAssembly", "metadata" ], + "": [ "legacyAST" ] + } + }, + "remappings": [1, 2 ,3 ,4] + } +} diff --git a/test/cmdlineTests/standard_wrong_type_remappings_entry.json.exit b/test/cmdlineTests/standard_wrong_type_remappings_entry.json.exit new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_remappings_entry.json.exit @@ -0,0 +1 @@ +0 diff --git a/test/cmdlineTests/standard_wrong_type_remappings_entry.json.stdout b/test/cmdlineTests/standard_wrong_type_remappings_entry.json.stdout new file mode 100644 index 00000000..0fc71ded --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_remappings_entry.json.stdout @@ -0,0 +1 @@ +{"errors":[{"component":"general","formattedMessage":"\"settings.remappings\" must be an array of strings","message":"\"settings.remappings\" must be an array of strings","severity":"error","type":"JSONError"}]} diff --git a/test/cmdlineTests/standard_wrong_type_root.json b/test/cmdlineTests/standard_wrong_type_root.json new file mode 100644 index 00000000..4763607a --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_root.json @@ -0,0 +1 @@ +["abc"] diff --git a/test/cmdlineTests/standard_wrong_type_root.json.exit b/test/cmdlineTests/standard_wrong_type_root.json.exit new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_root.json.exit @@ -0,0 +1 @@ +0 diff --git a/test/cmdlineTests/standard_wrong_type_root.json.stdout b/test/cmdlineTests/standard_wrong_type_root.json.stdout new file mode 100644 index 00000000..15c12e77 --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_root.json.stdout @@ -0,0 +1 @@ +{"errors":[{"component":"general","formattedMessage":"Input is not a JSON object.","message":"Input is not a JSON object.","severity":"error","type":"JSONError"}]} diff --git a/test/cmdlineTests/standard_wrong_type_settings.json b/test/cmdlineTests/standard_wrong_type_settings.json new file mode 100644 index 00000000..7cdb0881 --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_settings.json @@ -0,0 +1,23 @@ +{ + "language": "Solidity", + "sources": + { + "A": + { + "content": "pragma solidity >=0.0; contract C { function f() public pure {} }" + } + }, + "settings": + [ + { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "byzantium", + "metadata": { + "useLiteralContent": true + } + } + ] +} diff --git a/test/cmdlineTests/standard_wrong_type_settings.json.exit b/test/cmdlineTests/standard_wrong_type_settings.json.exit new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_settings.json.exit @@ -0,0 +1 @@ +0 diff --git a/test/cmdlineTests/standard_wrong_type_settings.json.stdout b/test/cmdlineTests/standard_wrong_type_settings.json.stdout new file mode 100644 index 00000000..c78c6086 --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_settings.json.stdout @@ -0,0 +1 @@ +{"errors":[{"component":"general","formattedMessage":"\"settings\" must be an object","message":"\"settings\" must be an object","severity":"error","type":"JSONError"}]} diff --git a/test/cmdlineTests/standard_wrong_type_source.json b/test/cmdlineTests/standard_wrong_type_source.json new file mode 100644 index 00000000..d58504fe --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_source.json @@ -0,0 +1,12 @@ +{ + "language": "Solidity", + "sources": + { + "A": "not an object :o", + "B": [1, 2, 3], + "C": + { + "content": "pragma solidity >=0.0; contract C { function f() public pure {} }" + } + } +} diff --git a/test/cmdlineTests/standard_wrong_type_source.json.exit b/test/cmdlineTests/standard_wrong_type_source.json.exit new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_source.json.exit @@ -0,0 +1 @@ +0 diff --git a/test/cmdlineTests/standard_wrong_type_source.json.stdout b/test/cmdlineTests/standard_wrong_type_source.json.stdout new file mode 100644 index 00000000..98fe32fd --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_source.json.stdout @@ -0,0 +1 @@ +{"errors":[{"component":"general","formattedMessage":"\"sources.A\" must be an object","message":"\"sources.A\" must be an object","severity":"error","type":"JSONError"}]} diff --git a/test/cmdlineTests/standard_wrong_type_sources.json b/test/cmdlineTests/standard_wrong_type_sources.json new file mode 100644 index 00000000..76e1ae7d --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_sources.json @@ -0,0 +1,4 @@ +{ + "language": "Solidity", + "sources": ["source1", "source2", "source3"] +} diff --git a/test/cmdlineTests/standard_wrong_type_sources.json.exit b/test/cmdlineTests/standard_wrong_type_sources.json.exit new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_sources.json.exit @@ -0,0 +1 @@ +0 diff --git a/test/cmdlineTests/standard_wrong_type_sources.json.stdout b/test/cmdlineTests/standard_wrong_type_sources.json.stdout new file mode 100644 index 00000000..ac6c613f --- /dev/null +++ b/test/cmdlineTests/standard_wrong_type_sources.json.stdout @@ -0,0 +1 @@ +{"errors":[{"component":"general","formattedMessage":"\"sources\" is not a JSON object.","message":"\"sources\" is not a JSON object.","severity":"error","type":"JSONError"}]} |