mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2818 from ethereum/testGnosis
Also test gnosis contracts.
This commit is contained in:
+28
-17
@@ -36,21 +36,32 @@ fi
|
||||
|
||||
SOLJSON="$1"
|
||||
|
||||
DIR=$(mktemp -d)
|
||||
(
|
||||
echo "Running Zeppelin tests..."
|
||||
git clone --depth 1 https://github.com/OpenZeppelin/zeppelin-solidity.git "$DIR"
|
||||
cd "$DIR"
|
||||
function test_truffle
|
||||
{
|
||||
name="$1"
|
||||
repo="$2"
|
||||
echo "Running $name tests..."
|
||||
DIR=$(mktemp -d)
|
||||
(
|
||||
git clone --depth 1 "$repo" "$DIR"
|
||||
cd "$DIR"
|
||||
npm install
|
||||
find . -name soljson.js -exec cp "$SOLJSON" {} \;
|
||||
if [ "$name" == "Zeppelin" ]; then
|
||||
# Fix some things that look like bugs (only seemed to fail on Node 6 and not Node 8)
|
||||
# FIXME: report upstream or to web3.js?
|
||||
sed -i -e 's/let token = await ERC827TokenMock.new();//;' test/token/ERC827/ERC827Token.js
|
||||
sed -i -e 's/CappedCrowdsale.new(this.startTime, this.endTime, rate, wallet, 0)/CappedCrowdsale.new(this.startTime, this.endTime, rate, wallet, 0, this.token.address)/' test/crowdsale/CappedCrowdsale.test.js
|
||||
sed -i -e 's/RefundableCrowdsale.new(this.startTime, this.endTime, rate, wallet, 0, { from: owner })/RefundableCrowdsale.new(this.startTime, this.endTime, rate, wallet, 0, this.token.address, { from: owner })/' test/crowdsale/RefundableCrowdsale.test.js
|
||||
fi
|
||||
if [ "$name" == "Gnosis" ]; then
|
||||
# Replace fixed-version pragmas in Gnosis (part of Consensys best practice)
|
||||
find contracts test -name '*.sol' -type f -print0 | xargs -0 sed -i -e 's/pragma solidity 0/pragma solidity ^0/'
|
||||
fi
|
||||
npm run test
|
||||
)
|
||||
rm -rf "$DIR"
|
||||
}
|
||||
|
||||
# Fix some things that look like bugs (only seemed to fail on Node 6 and not Node 8)
|
||||
# FIXME: report upstream or to web3.js?
|
||||
sed -i -e 's/let token = await ERC827TokenMock.new();//;' test/token/ERC827/ERC827Token.js
|
||||
sed -i -e 's/CappedCrowdsale.new(this.startTime, this.endTime, rate, wallet, 0)/CappedCrowdsale.new(this.startTime, this.endTime, rate, wallet, 0, this.token.address)/' test/crowdsale/CappedCrowdsale.test.js
|
||||
sed -i -e 's/RefundableCrowdsale.new(this.startTime, this.endTime, rate, wallet, 0, { from: owner })/RefundableCrowdsale.new(this.startTime, this.endTime, rate, wallet, 0, this.token.address, { from: owner })/' test/crowdsale/RefundableCrowdsale.test.js
|
||||
|
||||
npm install
|
||||
find . -name soljson.js -exec cp "$SOLJSON" {} \;
|
||||
|
||||
npm run test
|
||||
)
|
||||
rm -rf "$DIR"
|
||||
test_truffle Gnosis https://github.com/gnosis/gnosis-contracts.git
|
||||
test_truffle Zeppelin https://github.com/OpenZeppelin/zeppelin-solidity.git
|
||||
|
||||
Reference in New Issue
Block a user