Improve error reporting APIs for full-fidelity parser.
[hiphop-php.git] / hphp / hack / test / review.sh
blobf8689cacc2b9d00a63403d69bb0adb785dd022f5
1 #! /usr/bin/env bash
3 # Usage: First do 'make -C ../src test' to generate the .out files. If there are
4 # failures, their test filenames will be printed to stdout. Pass these as
5 # arguments to this script.
7 # note: we don't use [ -z $FOO ] to check if FOO is unset because that is also
8 # true if FOO=""
9 if [ -z "${OUT_EXT+x}" ]; then
10 OUT_EXT=".out"
13 if [ -z "${EXP_EXT+x}" ]; then
14 EXP_EXT=".exp"
17 DIFF=`command -v colordiff || echo diff`
19 for f in $@; do
20 nl --body-numbering=a $f
21 if [ -e "$f$EXP_EXT" ]; then
22 EXP="$f$EXP_EXT"
23 else
24 EXP=/dev/null
26 cat $EXP
27 $DIFF $EXP "$f$OUT_EXT"
28 read -p "Copy output to expected output? (y|n|q)" -n 1 -r
29 echo ""
30 if [ "$REPLY" = "y" ]; then
31 cp "$f$OUT_EXT" "$f$EXP_EXT"
32 elif [ "$REPLY" = "q" ]; then
33 exit 0
35 done