-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Extract examples from documentation and run tests on it #2553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cbe95c6
to
a3078e3
Compare
test/cmdlineTests.sh
Outdated
do | ||
echo "trying $f" | ||
set +e | ||
output=$("$SOLC" "$f" 2>&1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a copy of the previous test block. @chriseth if you could transform it into a bash function that could simplify it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want these to be more strict, e.g. require no warnings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could aim for that (with the exception of the pre-release compiler warning).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, but I won't add that to this pull request for now...
|
||
def write_cases(tests): | ||
for test in tests: | ||
open('test_%s.sol' % hashlib.sha256(test).hexdigest(), 'wb').write(test) | ||
|
||
if __name__ == '__main__': | ||
path = sys.argv[1] | ||
docs = False | ||
if len(sys.argv) > 2 and sys.argv[2] == 'docs': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just do both all the time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They require a different source directory (argv[1]).
Trying to convert to a function. |
Fails on paths:
|
Actually I think we should first merge #2522 |
a3078e3
to
33c0a08
Compare
test/cmdlineTests.sh
Outdated
@@ -28,27 +28,86 @@ | |||
|
|||
set -e | |||
|
|||
REPO_ROOT="$(dirname "$0")"/.. | |||
REPO_ROOT=$(cd "$REPO_ROOT" && pwd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$(...)
executes the command(s) inside the parantheses and returns the output of that command as a value. &&
just means "only execute the next command if the previous command succeeded" i.e. exactly as the &&
in C. pwd
prints the (absolute) path to the current directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean it references REPO_ROOT
which is just an empty string at that point, so effectively it does cd
and doesn't changes the current directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, now I see what you mean! Sorry, will fix it.
docs/contracts.rst
Outdated
Such contracts cannot be compiled (even if they contain implemented functions alongside non-implemented functions), but they can be used as base contracts:: | ||
// Such contracts cannot be compiled (even if they contain | ||
// implemented functions alongside non-implemented functions), | ||
// but they can be used as base contracts:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're better off keeping this text unchanged and duplicating the Feline
contract here.
docs/security-considerations.rst
Outdated
:: | ||
|
||
pragma solidity ^0.4.0; | ||
// Now someone tricks you into sending ether to the address of this attack wallet: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could keep the original text and add the interface of transferTo
.
Addressed all comments. |
docs/security-considerations.rst
Outdated
// Now someone tricks you into sending ether to the address of this attack wallet: | ||
Now someone tricks you into sending ether to the address of this attack wallet:: | ||
|
||
interface TxUserWallet { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pragma is missing here
Changing this to fix the above. |
@chriseth this is ready from my side |
62247cd
to
a8d78bb
Compare
@chriseth you need to approve this in order to merge |
Fixes #2552.