aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-12-20 00:02:28 +0800
committerGitHub <noreply@github.com>2018-12-20 00:02:28 +0800
commitae08d7c375482cef29567e15468e8867380c9cc6 (patch)
treefd162c6117bece7ea548d8d9474f9e217fbb96a6 /test
parentef59f35a14c6eea65b15ac78db06befb182907c1 (diff)
parent900d100700d6b7ba347bae9779aa7f540387fee8 (diff)
downloaddexon-solidity-ae08d7c375482cef29567e15468e8867380c9cc6.tar.gz
dexon-solidity-ae08d7c375482cef29567e15468e8867380c9cc6.tar.zst
dexon-solidity-ae08d7c375482cef29567e15468e8867380c9cc6.zip
Merge pull request #5681 from ethereum/limitOutput
Do not compile unless requested.
Diffstat (limited to 'test')
-rwxr-xr-xtest/cmdlineTests.sh2
-rw-r--r--test/cmdlineTests/standard.json.stdout2
-rw-r--r--test/cmdlineTests/standard_binaries_requested.json17
-rw-r--r--test/cmdlineTests/standard_binaries_requested.json.stdout1
-rw-r--r--test/cmdlineTests/standard_methodIdentifiersRequested.json17
-rw-r--r--test/cmdlineTests/standard_methodIdentifiersRequested.json.stdout1
-rw-r--r--test/cmdlineTests/standard_only_ast_requested.json17
-rw-r--r--test/cmdlineTests/standard_only_ast_requested.json.stdout1
-rw-r--r--test/libsolidity/LibSolc.cpp4
9 files changed, 59 insertions, 3 deletions
diff --git a/test/cmdlineTests.sh b/test/cmdlineTests.sh
index bb71e012..9d2ffa5f 100755
--- a/test/cmdlineTests.sh
+++ b/test/cmdlineTests.sh
@@ -132,7 +132,7 @@ test_solc_behaviour() {
if [[ "$solc_args" == *"--standard-json"* ]]; then
sed -i -e 's/{[^{]*Warning: This is a pre-release compiler version[^}]*},\{0,1\}//' "$stdout_path"
- sed -i -e 's/,"errors":\[\]//' "$stdout_path"
+ sed -i -e 's/"errors":\[\],\{0,1\}//' "$stdout_path"
else
sed -i -e '/^Warning: This is a pre-release compiler version, please do not use it in production./d' "$stderr_path"
sed -i -e 's/ Consider adding "pragma .*$//' "$stderr_path"
diff --git a/test/cmdlineTests/standard.json.stdout b/test/cmdlineTests/standard.json.stdout
index 490e1f80..59b90c8c 100644
--- a/test/cmdlineTests/standard.json.stdout
+++ b/test/cmdlineTests/standard.json.stdout
@@ -1 +1 @@
-{"contracts":{"A":{"C":{"evm":{}}}},"sources":{"A":{"id":0}}}
+{"sources":{"A":{"id":0}}}
diff --git a/test/cmdlineTests/standard_binaries_requested.json b/test/cmdlineTests/standard_binaries_requested.json
new file mode 100644
index 00000000..65f19543
--- /dev/null
+++ b/test/cmdlineTests/standard_binaries_requested.json
@@ -0,0 +1,17 @@
+{
+ "language": "Solidity",
+ "sources":
+ {
+ "A":
+ {
+ "content": "pragma solidity >=0.0; contract C { function f() public pure {} }"
+ }
+ },
+ "settings":
+ {
+ "outputSelection":
+ {
+ "*": { "*": ["evm.gasEstimates"] }
+ }
+ }
+}
diff --git a/test/cmdlineTests/standard_binaries_requested.json.stdout b/test/cmdlineTests/standard_binaries_requested.json.stdout
new file mode 100644
index 00000000..2baef22a
--- /dev/null
+++ b/test/cmdlineTests/standard_binaries_requested.json.stdout
@@ -0,0 +1 @@
+{"contracts":{"A":{"C":{"evm":{"gasEstimates":{"creation":{"codeDepositCost":"25600","executionCost":"75","totalCost":"25675"},"external":{"f()":"127"}}}}}},"sources":{"A":{"id":0}}} \ No newline at end of file
diff --git a/test/cmdlineTests/standard_methodIdentifiersRequested.json b/test/cmdlineTests/standard_methodIdentifiersRequested.json
new file mode 100644
index 00000000..79a3c75d
--- /dev/null
+++ b/test/cmdlineTests/standard_methodIdentifiersRequested.json
@@ -0,0 +1,17 @@
+{
+ "language": "Solidity",
+ "sources":
+ {
+ "A":
+ {
+ "content": "pragma solidity >=0.0; contract C { function f() public pure {} }"
+ }
+ },
+ "settings":
+ {
+ "outputSelection":
+ {
+ "*": { "*": ["evm.methodIdentifiers"] }
+ }
+ }
+}
diff --git a/test/cmdlineTests/standard_methodIdentifiersRequested.json.stdout b/test/cmdlineTests/standard_methodIdentifiersRequested.json.stdout
new file mode 100644
index 00000000..7e3f139f
--- /dev/null
+++ b/test/cmdlineTests/standard_methodIdentifiersRequested.json.stdout
@@ -0,0 +1 @@
+{"contracts":{"A":{"C":{"evm":{"methodIdentifiers":{"f()":"26121ff0"}}}}},"sources":{"A":{"id":0}}}
diff --git a/test/cmdlineTests/standard_only_ast_requested.json b/test/cmdlineTests/standard_only_ast_requested.json
new file mode 100644
index 00000000..7abd6da5
--- /dev/null
+++ b/test/cmdlineTests/standard_only_ast_requested.json
@@ -0,0 +1,17 @@
+{
+ "language": "Solidity",
+ "sources":
+ {
+ "A":
+ {
+ "content": "pragma solidity >=0.0; contract C { function f() public pure {} }"
+ }
+ },
+ "settings":
+ {
+ "outputSelection":
+ {
+ "*": { "": ["ast"] }
+ }
+ }
+}
diff --git a/test/cmdlineTests/standard_only_ast_requested.json.stdout b/test/cmdlineTests/standard_only_ast_requested.json.stdout
new file mode 100644
index 00000000..b884ab7d
--- /dev/null
+++ b/test/cmdlineTests/standard_only_ast_requested.json.stdout
@@ -0,0 +1 @@
+{"sources":{"A":{"ast":{"absolutePath":"A","exportedSymbols":{"C":[6]},"id":7,"nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity",">=","0.0"],"nodeType":"PragmaDirective","src":"0:22:0"},{"baseContracts":[],"contractDependencies":[],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":6,"linearizedBaseContracts":[6],"name":"C","nodeType":"ContractDefinition","nodes":[{"body":{"id":4,"nodeType":"Block","src":"61:2:0","statements":[]},"documentation":null,"id":5,"implemented":true,"kind":"function","modifiers":[],"name":"f","nodeType":"FunctionDefinition","parameters":{"id":2,"nodeType":"ParameterList","parameters":[],"src":"46:2:0"},"returnParameters":{"id":3,"nodeType":"ParameterList","parameters":[],"src":"61:0:0"},"scope":6,"src":"36:27:0","stateMutability":"pure","superFunction":null,"visibility":"public"}],"scope":7,"src":"23:42:0"}],"src":"0:65:0"},"id":0}}}
diff --git a/test/libsolidity/LibSolc.cpp b/test/libsolidity/LibSolc.cpp
index 09c08700..ec97f22f 100644
--- a/test/libsolidity/LibSolc.cpp
+++ b/test/libsolidity/LibSolc.cpp
@@ -81,7 +81,9 @@ BOOST_AUTO_TEST_CASE(standard_compilation)
// Only tests some assumptions. The StandardCompiler is tested properly in another suite.
BOOST_CHECK(result.isMember("sources"));
- BOOST_CHECK(result.isMember("contracts"));
+ // This used to test that it is a member, but we did not actually request any output,
+ // so there should not be a contract member.
+ BOOST_CHECK(!result.isMember("contracts"));
}
BOOST_AUTO_TEST_SUITE_END()