]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/script/run-lua-tests

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Do not set EDITOR/VISUAL for shell
[etc/vim.git] / .vim / bundle / ale / test / script / run-lua-tests
1 #!/usr/bin/env bash
2
3 set -e
4 set -u
5
6 docker_flags=(--rm -v "$PWD:/testplugin" -v "$PWD/test:/home" -w /testplugin/test/lua "$DOCKER_RUN_IMAGE")
7
8 quiet=0
9
10 while [ $# -ne 0 ]; do
11     case $1 in
12     -q)
13         quiet=1
14         shift
15     ;;
16     --)
17         shift
18         break
19     ;;
20     -?*)
21         echo "Invalid argument: $1" 1>&2
22         exit 1
23     ;;
24     *)
25         break
26     ;;
27     esac
28 done
29
30 function filter-busted-output() {
31     local hit_failure_line=0
32
33     while read -r; do
34         if ((quiet)); then
35             # If we're using the quiet flag, the filter out lines until we hit
36             # the first line with "Failure" and then print the rest.
37             if ((hit_failure_line)); then
38                 echo "$REPLY"
39             elif [[ "$REPLY" = *'Failure'* ]]; then
40                 hit_failure_line=1
41                 echo "$REPLY"
42             fi
43         else
44             echo "$REPLY"
45         fi
46     done
47 }
48
49 exit_code=0
50
51 set -o pipefail
52 "$DOCKER" run -a stdout "${docker_flags[@]}" /usr/bin/busted-5.1 \
53     -m '../../lua/?.lua;../../lua/?/init.lua' . \
54     --output utfTerminal | filter-busted-output || exit_code=$?
55 set +o pipefail
56
57 exit "$exit_code"