# Variables ROOT=$(git rev-parse --show-toplevel) FILTER=$ROOT/src/literate.lua ARGS=() # Removes unwanted args for arg in "$@"; do case $arg in "--dist") FILTER=$ROOT/dist/literate.min.lua ;; *) ARGS+=($arg) ;; esac done # Moves to tests directory and clears the terminal cd $ROOT/tests clear # Checks args if [ -z "$*" ]; then echo "ERROR: At least one argument is needed. For example:" echo " sh $0 native" echo " sh $0 native markdown" exit 1 fi # Does tests echo "🐾 Starting tests" for arg in "$ARGS"; do echo && echo "⚗️ Test in '$arg' format:" mds=$'\n\n'`(pandoc -t markdown *.md)` rst=$'\n\n'`(pandoc -t markdown *.rst)` org=$'\n\n'`(pandoc -t markdown *.org)` echo "$mds" "$rst" "$org" | pandoc --lua-filter $FILTER -t $arg done