diff options
author | Mathias Baumann <marenz@supradigital.org> | 2018-12-12 22:49:10 +0800 |
---|---|---|
committer | Mathias Baumann <marenz@supradigital.org> | 2018-12-19 01:36:50 +0800 |
commit | c43d96f2bf5614136bfbcaf45d0850c914bf81ee (patch) | |
tree | 54e43b15f19a0d52664446244c90acf5e5dd38b3 /test | |
parent | 4e475cdbe91e38e7b129248d4578b3a4fbf926be (diff) | |
download | dexon-solidity-c43d96f2bf5614136bfbcaf45d0850c914bf81ee.tar dexon-solidity-c43d96f2bf5614136bfbcaf45d0850c914bf81ee.tar.gz dexon-solidity-c43d96f2bf5614136bfbcaf45d0850c914bf81ee.tar.bz2 dexon-solidity-c43d96f2bf5614136bfbcaf45d0850c914bf81ee.tar.lz dexon-solidity-c43d96f2bf5614136bfbcaf45d0850c914bf81ee.tar.xz dexon-solidity-c43d96f2bf5614136bfbcaf45d0850c914bf81ee.tar.zst dexon-solidity-c43d96f2bf5614136bfbcaf45d0850c914bf81ee.zip |
Json: Provide better error messages for wrong types
Diffstat (limited to 'test')
45 files changed, 252 insertions, 0 deletions
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"}]} |