blob d57f2af1 (735B) - Raw
1 #!/bin/bash 2 if [[ $1 == --enable-fixed-behavior ]]; then 3 declare -A offsets 4 git g -n stage2_c test/behavior | while read -r match; do 5 printf '\e[36mTrying to enable... %s\e[m\n' "$match" 6 file=`cut -d: -f1 <<<"$match"` 7 offset=${offsets[$file]:=0} 8 let line=`cut -d: -f2 <<<"$match"`-$offset 9 contents=`cut -d: -f3- <<<"$match"` 10 sed --in-place "${line}d" "$file" 11 if zigd test -Itest test/behavior.zig -fno-stage1 -fno-LLVM -ofmt=c; then 12 printf '\e[32mTest was enabled! :)\e[m\n' 13 let offsets[$file]+=1 14 else 15 printf '\e[31mTest kept disabled. :(\e[m\n' 16 sed --in-place "${line}i\\ 17 $contents" "$file" 18 fi 19 done 20 fi