useLiteralContent data validation

Squashed commit of the following:

commit bbceee6997c1b951eb6054f7d5b7560fe1773690
Author: Mudit Gupta <guptamudit@ymail.com>
Date:   Tue Jan 22 23:27:49 2019 +0530

    Removed extra check

commit 4f7c3cc58e94836b1dddcc5f2938da14adad6252
Author: Mudit Gupta <guptamudit@ymail.com>
Date:   Tue Jan 22 17:51:05 2019 +0530

    Updated test error message

commit 5da45f2a23840e7bb1978853e1c184faec65b3e0
Author: Mudit Gupta <guptamudit@ymail.com>
Date:   Tue Jan 22 17:46:09 2019 +0530

    Renamed test

commit e661418deac25f31c49091be3c80244f566fc14c
Author: Leonardo <leo@ethereum.org>
Date:   Tue Jan 22 17:41:56 2019 +0530

    Update libsolidity/interface/StandardCompiler.cpp

    Co-Authored-By: maxsam4 <guptamudit@ymail.com>

commit d289b4dc1956ab736aada613e810cf2e2d124d4d
Author: Mudit Gupta <guptamudit@ymail.com>
Date:   Tue Jan 22 17:29:40 2019 +0530

    changed style

commit 5a7cf08db3027d75081d2e698dd51b807bef5abb
Author: Mudit Gupta <guptamudit@ymail.com>
Date:   Tue Jan 22 17:20:37 2019 +0530

    Added test case for missing useLiteralContent

commit 6e866c46aa92d6a89f2b341bd717c3886946f3ff
Author: Mudit Gupta <guptamudit@ymail.com>
Date:   Tue Jan 22 17:09:30 2019 +0530

    input check for useLiteralContent
This commit is contained in:
Mudit Gupta 2019-01-23 10:22:27 +05:30
parent 7b66eb273d
commit 2f91781a80
No known key found for this signature in database
GPG Key ID: 48CAE3D379D3772A
7 changed files with 46 additions and 0 deletions

View File

@ -298,6 +298,8 @@ boost::optional<Json::Value> checkOptimizerKeys(Json::Value const& _input)
boost::optional<Json::Value> checkMetadataKeys(Json::Value const& _input) boost::optional<Json::Value> checkMetadataKeys(Json::Value const& _input)
{ {
if (_input.isObject() && _input.isMember("useLiteralContent") && !_input["useLiteralContent"].isBool())
return formatFatalError("JSONError", "\"settings.metadata.useLiteralContent\" must be Boolean");
static set<string> keys{"useLiteralContent"}; static set<string> keys{"useLiteralContent"};
return checkKeys(_input, keys, "settings.metadata"); return checkKeys(_input, keys, "settings.metadata");
} }

View File

@ -0,0 +1 @@
0

View File

@ -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": {}
}
}

View File

@ -0,0 +1 @@
{"sources":{"A":{"id":0}}}

View File

@ -0,0 +1 @@
0

View File

@ -0,0 +1,21 @@
{
"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": "literalContent"
}
}
}

View File

@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"\"settings.metadata.useLiteralContent\" must be Boolean","message":"\"settings.metadata.useLiteralContent\" must be Boolean","severity":"error","type":"JSONError"}]}