Skip to content

Commit fd98d3e

Browse files
committed
ImportExportTest.sh: Add direct import/export tests.
1 parent 3981e40 commit fd98d3e

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

scripts/ImportExportTest.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,40 @@ function testImportExportEquivalence {
145145
done
146146
done
147147

148+
if ! $SOLC --combined-json asm --pretty-json --import-asm-json expected.asm > obtained_direct_import_export.json 2> obtained_direct_import_export.error
149+
then
150+
printf "\n"
151+
echo "$nth_input_file"
152+
cat obtained_direct_import_export.error
153+
FAILED=$((FAILED + 1))
154+
return 0
155+
else
156+
for obtained_contract in $(jq '.contracts | keys | .[]' obtained_direct_import_export.json 2> /dev/null)
157+
do
158+
jq --raw-output ".contracts.${obtained_contract}.\"asm\"" obtained_direct_import_export.json > obtained_direct_import_export.asm
159+
set +e
160+
DIFF="$(diff expected.asm obtained_direct_import_export.asm)"
161+
set -e
162+
if [ "$DIFF" != "" ]
163+
then
164+
if [ "$DIFFVIEW" == "" ]
165+
then
166+
echo -e "ERROR: JSONS differ for $1: \n $DIFF \n"
167+
echo "Expected:"
168+
cat expected.asm
169+
echo "Obtained:"
170+
cat obtained_direct_import_export.asm
171+
else
172+
# Use user supplied diff view binary
173+
$DIFFVIEW expected.asm obtained_direct_import_export.asm
174+
fi
175+
_TESTED=
176+
FAILED=$((FAILED + 1))
177+
return 0
178+
fi
179+
done
180+
fi
181+
148182
rm obtained.json
149183
rm -f obtained.error
150184
for type in "${types[@]}"

0 commit comments

Comments
 (0)