From 061b50ae19b0f8b9dcffc8dab5f08c4e26e884fb Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 2 Nov 2016 12:32:55 +0100 Subject: Add tests for the std files. --- scripts/tests.sh | 17 +++++++++++++++-- std/StandardToken.sol | 2 ++ std/Token.sol | 2 ++ std/mortal.sol | 2 ++ std/owned.sol | 2 ++ std/std.sol | 2 ++ 6 files changed, 25 insertions(+), 2 deletions(-) diff --git a/scripts/tests.sh b/scripts/tests.sh index 93afd2d2..5fa75d4d 100755 --- a/scripts/tests.sh +++ b/scripts/tests.sh @@ -28,8 +28,21 @@ set -e -# There is an implicit assumption here that we HAVE to run from root directory. -REPO_ROOT=$(pwd) +REPO_ROOT="$(dirname "$0")"/.. + + # Compile all files in std and examples. + +for f in "$REPO_ROOT"/std/*.sol +do + echo "Compiling $f..." + set +e + output=$("$REPO_ROOT"/build/solc/solc "$f" 2>&1) + failed=$? + output=$(echo "$output" | grep -v 'pre-release') + echo "$output" + set -e + test -z "$output" -a "$failed" -eq 0 +done # This conditional is only needed because we don't have a working Homebrew # install for `eth` at the time of writing, so we unzip the ZIP file locally diff --git a/std/StandardToken.sol b/std/StandardToken.sol index 41f2d709..4ff1b8f9 100644 --- a/std/StandardToken.sol +++ b/std/StandardToken.sol @@ -1,3 +1,5 @@ +pragma solidity ^0.4.0; + import "./Token.sol"; contract StandardToken is Token { diff --git a/std/Token.sol b/std/Token.sol index 396dbf9e..59566f26 100644 --- a/std/Token.sol +++ b/std/Token.sol @@ -1,3 +1,5 @@ +pragma solidity ^0.4.0; + contract Token { event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); diff --git a/std/mortal.sol b/std/mortal.sol index 8de019ab..f0a6f4ce 100644 --- a/std/mortal.sol +++ b/std/mortal.sol @@ -1,3 +1,5 @@ +pragma solidity ^0.4.0; + import "./owned.sol"; contract mortal is owned { diff --git a/std/owned.sol b/std/owned.sol index 3d7674f5..bbb8d957 100644 --- a/std/owned.sol +++ b/std/owned.sol @@ -1,3 +1,5 @@ +pragma solidity ^0.4.0; + contract owned { address owner; diff --git a/std/std.sol b/std/std.sol index c3f66b1b..4d65bef2 100644 --- a/std/std.sol +++ b/std/std.sol @@ -1,3 +1,5 @@ +pragma solidity ^0.4.0; + import "./owned.sol"; import "./mortal.sol"; import "./Token.sol"; -- cgit