Something went wrong. Try again.
Newt - a dependent typed programming language
This is a mirror of the main github repository. newt.cloakedarrow.com
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869#!/bin/shSAMPLES=$(find playground/samples -name "*.newt")# NEWT ="bun run build/newt.js"NEWT=${NEWT:="node build/newt.js"}OUTFILE=${OUTFILE:="tmp/out.js"}RUNOUT=${RUNOUT:="node"}mkdir -p tmptotal=0failed=0tests=$(find tests -name '*.newt')faillist=()for fn in $tests; do total=$((total + 1)) echo Test $fn bn=$(basename $fn) if [ -f ${fn}.skip ]; then continue elif [ -f ${fn}.golden ]; then $NEWT $fn -o $OUTFILE > tmp/${bn}.compile else # we've dropped support for compiling things without main for now. $NEWT $fn > tmp/${bn}.compile fi cerr=$? if [ -f ${fn}.fail ]; then if ! diff -q tmp/${bn}.compile ${fn}.fail; then echo "Compile failure mismatch for $fn" diff ${fn}.fail tmp/${bn}.compile failed=$((failed + 1)) faillist+=$fn if [ x$1 = "x-u" ]; then cp tmp/${bn}.compile ${fn}.fail fi continue fi elif [ $cerr != "0" ]; then echo Compile failed for $fn failed=$((failed + 1)) faillist+="\n$fn" cat tmp/${bn}.compile continue fi # if there is a golden file, run the code and compare output if [ -f ${fn}.golden ]; then $RUNOUT $OUTFILE > tmp/${bn}.out if [ $? != "0" ]; then echo Run failed for $fn failed=$((failed + 1)) faillist+="\n$fn" continue fi if ! diff -q tmp/${bn}.out ${fn}.golden; then echo "Output mismatch for $fn" diff ${fn}.golden tmp/${bn}.out failed=$((failed + 1)) if [ x$1 = "x-u" ]; then cp tmp/${bn}.out ${fn}.golden fi fi fidoneecho "Total tests: $total"if [ "$failed" -ne 0 ]; then echo "Failed $failed tests: $faillist" echo "-u to update"fi