1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
14# # solc 0.4.5 ##
25solc-select use 0.4.5 & > /dev/null
36solc ./scripts/solidity_tests/solc045_success.sol
@@ -8,7 +11,7 @@ if [[ $? != 0 ]]; then
811fi
912echo " SUCCESS: solc045_success"
1013
11- execute=$( solc ./scripts/solidity_tests/solc045_fail_compile.sol 2>&1 )
14+ execute=$( solc ./scripts/solidity_tests/solc045_fail_compile.sol 2>&1 || true )
1215if [[ " $execute " != * " Error: Expected token Semicolon got 'Function'" * ]]; then
1316 echo " FAILED: solc045_fail_compile"
1417 echo " $execute "
@@ -26,7 +29,7 @@ if [[ $? != 0 ]]; then
2629fi
2730echo " SUCCESS: solc050_success"
2831
29- execute=$( solc ./scripts/solidity_tests/solc050_fail_compile.sol 2>&1 )
32+ execute=$( solc ./scripts/solidity_tests/solc050_fail_compile.sol 2>&1 || true )
3033if [[ " $execute " != * " Error: Functions are not allowed to have the same name as the contract." * ]]; then
3134 echo " FAILED: solc050_fail_compile"
3235 exit 255
@@ -35,17 +38,14 @@ echo "SUCCESS: solc050_fail_compile"
3538
3639# # solc 0.6.0 ##
3740solc-select use 0.6.0 & > /dev/null
38- solc ./scripts/solidity_tests/solc060_success_trycatch.sol
3941
40- if [[ $? != 0 ]] ; then
42+ if ! solc ./scripts/solidity_tests/solc060_success_trycatch.sol ; then
4143 echo " FAILED: solc060_success_trycatch" $?
4244 exit 255
4345fi
4446echo " SUCCESS: solc060_success_trycatch"
4547
46- solc ./scripts/solidity_tests/solc060_success_receive.sol
47-
48- if [[ $? != 0 ]]; then
48+ if ! solc ./scripts/solidity_tests/solc060_success_receive.sol; then
4949 echo " FAILED: solc060_success_receive" $?
5050 exit 255
5151fi
@@ -54,39 +54,36 @@ echo "SUCCESS: solc060_success_receive"
5454# # solc 0.7.0 ##
5555solc-select use 0.7.0 & > /dev/null
5656
57- execute=$( solc ./scripts/solidity_tests/solc070_fail_compile.sol 2>&1 )
57+ execute=$( solc ./scripts/solidity_tests/solc070_fail_compile.sol 2>&1 || true )
5858if [[ " $execute " != * " \" now\" has been deprecated." * ]]; then
5959 echo " FAILED: solc070_fail_compile" " $execute "
6060 exit 255
6161fi
6262echo " SUCCESS: solc070_fail_compile"
6363
64- solc ./scripts/solidity_tests/solc070_success.sol
65-
66- if [[ $? != 0 ]]; then
64+ if ! solc ./scripts/solidity_tests/solc070_success.sol; then
6765 echo " FAILED: solc070_success" $?
6866 exit 255
6967fi
7068echo " SUCCESS: solc070_success"
7169
7270# # solc 0.8.0 ##
7371solc-select use 0.8.0 & > /dev/null
74- solc ./scripts/solidity_tests/solc080_success.sol
7572
76- if [[ $? != 0 ]] ; then
73+ if ! solc ./scripts/solidity_tests/solc080_success.sol ; then
7774 echo " FAILED: solc080_success" $?
7875 exit 255
7976fi
8077echo " SUCCESS: solc080_success"
8178
82- execute=$( solc ./scripts/solidity_tests/solc080_success_warning.sol 2>&1 )
79+ execute=$( solc ./scripts/solidity_tests/solc080_success_warning.sol 2>&1 || true )
8380if [[ " $execute " != * " Warning: Function state mutability can be restricted to pure" * ]]; then
8481 echo " FAILED: solc080_success_warning"
8582 exit 255
8683fi
8784echo " SUCCESS: solc080_success_warning"
8885
89- execute=$( solc ./scripts/solidity_tests/solc080_fail_compile.sol 2>&1 )
86+ execute=$( solc ./scripts/solidity_tests/solc080_fail_compile.sol 2>&1 || true )
9087if [[ " $execute " != * " Error: Explicit type conversion not allowed" * ]]; then
9188 echo " FAILED: solc080_fail_compile"
9289 exit 255
@@ -100,11 +97,11 @@ if [[ "$execute" != *"Switched global version to 0.8.9"* ]]; then
10097 echo " FAILED: use - always install"
10198 exit 255
10299fi
103- echo " SUCCESS: use - always install"
100+ echo " SUCCESS: use - always install"
104101
105102UNINSTALL_PATH=$HOME /.solc-select/artifacts/solc-0.8.1
106103rm -rf $UNINSTALL_PATH # uninstall solc 0.8.1
107- execute=$( solc-select use 0.8.1 2>&1 )
104+ execute=$( solc-select use 0.8.1 2>&1 || true )
108105if [[ $execute != * " '0.8.1' must be installed prior to use" * ]]; then
109106 echo " FAILED: use - no install"
110107 exit 255
0 commit comments