Skip to content

Commit 3d4be2f

Browse files
author
Jan Xie
committed
fix tests
1 parent 8bc90b0 commit 3d4be2f

File tree

8 files changed

+32
-4
lines changed

8 files changed

+32
-4
lines changed

lib/ethereum/tester/abi_contract.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def initialize(state, abi, address, listen: true, log_listener: nil, default_key
2828
end
2929
end
3030

31-
def listen(x)
32-
@translator.listen x
31+
def listen(x, noprint: true)
32+
@translator.listen x, noprint: noprint
3333
end
3434

3535
private

test/contracts/contract_names.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
pragma solidity ^0.4.0;
2+
13
contract AContract {}
24
library ALibrary {}
35

test/contracts/seven_contract.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
pragma solidity ^0.4.0;
2+
13
import "seven_library.sol";
24

35
contract SevenContract {

test/contracts/seven_contract_without_import.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
pragma solidity ^0.4.0;
2+
13
library SevenLibrary {
24
function seven() returns (int256 y);
35
}

test/contracts/seven_library.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
pragma solidity ^0.4.0;
2+
13
library SevenLibrary {
24
function seven() returns (int256 y) {
35
y = 7;

test/contracts/simple_contract.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
pragma solidity ^0.4.0;
12
contract Simple {
23
function test() returns (int256) {
34
return 1;

test/contracts_test.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,12 @@ def test_abi_logging
13561356
c = @s.abi_contract ABI_LOGGING_CODE
13571357
o = []
13581358

1359-
@s.block.add_listener(->(x) { o.push(c.listen(x) ) })
1359+
@s.block.add_listener(->(x) {
1360+
result = c.listen(x, noprint: false)
1361+
result.delete('_from')
1362+
o.push(result)
1363+
})
1364+
13601365
c.test_rabbit(3)
13611366
assert_equal [{"_event_type" => "rabbit", "x" => 3}], o
13621367

@@ -1443,7 +1448,13 @@ def moo():
14431448
def test_string_logging
14441449
c = @s.abi_contract STRING_LOGGING_CODE
14451450
o = []
1446-
@s.block.add_listener(->(x) { o.push c.listen(x) })
1451+
1452+
@s.block.add_listener(->(x) {
1453+
result = c.listen(x, noprint: false)
1454+
result.delete('_from')
1455+
o.push(result)
1456+
})
1457+
14471458
c.moo
14481459

14491460
expect = [

test/solidity_test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def test_compile_from_file
1313
Dir.mktmpdir('contracts-') do |dir|
1414
lib_path = File.join dir, 'Other.sol'
1515
File.write lib_path, <<-EOF
16+
pragma solidity ^0.4.0;
1617
library Other {
1718
function seven() returns (int256 y) {
1819
y = 7;
@@ -22,6 +23,7 @@ def test_compile_from_file
2223

2324
user_path = File.join dir, 'user.sol'
2425
File.write user_path, <<-EOF
26+
pragma solidity ^0.4.0;
2527
import "Other.sol";
2628
contract user {
2729
function test() returns (int256 seven) {
@@ -53,6 +55,8 @@ def sub1():
5355
return(5)
5456
EOF
5557
SOLIDITY_CONTRACT = <<-EOF
58+
pragma solidity ^0.4.0;
59+
5660
contract serpent { function sub1() returns (int256 y) {} }
5761
5862
contract zoo {
@@ -78,6 +82,7 @@ def test_interop
7882
end
7983

8084
COMPILE_RICH_CONTRACT = <<-EOF
85+
pragma solidity ^0.4.0;
8186
contract contract_add {
8287
function add7(uint a) returns(uint d) { return a + 7; }
8388
function add42(uint a) returns(uint d) { return a + 42; }
@@ -104,6 +109,7 @@ def test_solidity_compile_rich
104109
end
105110

106111
CONSTRUCTOR_CONTRACT = <<-EOF
112+
pragma solidity ^0.4.0;
107113
contract testme {
108114
uint value;
109115
function testme(uint a) {
@@ -121,6 +127,7 @@ def test_constructor
121127

122128
def test_abi_contract
123129
one_contract = <<-EOF
130+
pragma solidity ^0.4.0;
124131
contract foo {
125132
function seven() returns (int256 y) {
126133
y = 7;
@@ -132,6 +139,7 @@ def test_abi_contract
132139
EOF
133140

134141
two_contracts = one_contract + <<-EOF
142+
pragma solidity ^0.4.0;
135143
contract baz {
136144
function echo(address a) returns (address b) {
137145
b = a;

0 commit comments

Comments
 (0)