summaryrefslogtreecommitdiff
path: root/update-tests.sh
diff options
context:
space:
mode:
authorNadrieril2020-03-11 17:26:09 +0000
committerNadrieril2020-03-11 17:26:09 +0000
commit66972b05e5996132a83332ef0c6879c3a1679dc7 (patch)
treea6c148a6513063b14a1aebe53dd4a0cc927ecb3a /update-tests.sh
parent65e8aa46344b9dc32c3ad776856791d18cc616c3 (diff)
Implement record puns
Diffstat (limited to 'update-tests.sh')
-rwxr-xr-xupdate-tests.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/update-tests.sh b/update-tests.sh
index 7be40c4..ce5a67c 100755
--- a/update-tests.sh
+++ b/update-tests.sh
@@ -75,16 +75,18 @@ function generate_output_file() {
file="$2"
INPUT_FILE="$(${folder}_input_file "$file")"
OUTPUT_FILE="$(${folder}_output_file "$file")"
+
if [ ! -f "$OUTPUT_FILE" ]; then
echo "$OUTPUT_FILE"
${folder}_process "$INPUT_FILE" > "$tmpfile"
if [ $? -eq 0 ]; then
mv "$tmpfile" "$OUTPUT_FILE"
- if [ "$folder" = "parser" ]; then
- cat "$OUTPUT_FILE" | cbor2diag.rb > "${file}B.diag"
- fi
fi
fi
+
+ if [ -f "$OUTPUT_FILE" -a "$folder" = "parser" -a ! -f "${file}B.diag" ]; then
+ cat "$OUTPUT_FILE" | cbor2diag.rb > "${file}B.diag"
+ fi
}
if [ "$1" = "missing" ]; then
@@ -94,7 +96,7 @@ if [ "$1" = "missing" ]; then
# This is not robust to spaces in filenames, but hopefully there should be none
fd 'A\.dhallb?$' "$root/$folder/success" \
| sed 's/A.dhallb\?$//' \
- | while read file; do
+ | while read -r file; do
generate_output_file "$folder" "$file"
done
done
@@ -105,10 +107,11 @@ elif [ "$1" = "add" ]; then
# normalization/unit/TextShowEmpty Text/show ""
# This will add a test to the local tests folder for each such line, and generate
# the output using the `dhall` command in the PATH.
- while read file contents; do
+ while read -r file contents; do
folder="$(echo "$file" | cut -d/ -f1)"
is_success="$(echo "$file" | cut -d/ -f2)"
file="./dhall/tests/$file"
+ # file="./dhall-lang/tests/$file"
mkdir -p "$(dirname "$file")"
if [ "$is_success" = "success" ]; then