Skip to content

Commit

Permalink
Add tests for the std files.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseth committed Nov 11, 2016
1 parent a40dcfe commit 061b50a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 2 deletions.
17 changes: 15 additions & 2 deletions scripts/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions std/StandardToken.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pragma solidity ^0.4.0;

import "./Token.sol";

contract StandardToken is Token {
Expand Down
2 changes: 2 additions & 0 deletions std/Token.sol
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 2 additions & 0 deletions std/mortal.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pragma solidity ^0.4.0;

import "./owned.sol";

contract mortal is owned {
Expand Down
2 changes: 2 additions & 0 deletions std/owned.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pragma solidity ^0.4.0;

contract owned {
address owner;

Expand Down
2 changes: 2 additions & 0 deletions std/std.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pragma solidity ^0.4.0;

import "./owned.sol";
import "./mortal.sol";
import "./Token.sol";
Expand Down

0 comments on commit 061b50a

Please sign in to comment.