Browse Source

Add support for "make test", automatically installing deps

Daniel Hahler 4 years ago
parent
commit
ca3005b756
6 changed files with 34 additions and 10 deletions
  1. 1
    0
      .gitignore
  2. 1
    2
      .travis.yml
  3. 13
    0
      Makefile
  4. 3
    5
      test/README.md
  5. 14
    1
      test/run-tests.sh
  6. 2
    2
      test/vimrc

+ 1
- 0
.gitignore View File

@@ -0,0 +1 @@
1
+build

+ 1
- 2
.travis.yml View File

@@ -21,5 +21,4 @@ before_script: |
21 21
   git clone https://github.com/junegunn/vader.vim
22 22
 
23 23
 script: |
24
-  cd "$TRAVIS_BUILD_DIR"
25
-  ./test/run-tests.sh
24
+  make test

+ 13
- 0
Makefile View File

@@ -15,3 +15,16 @@ install:
15 15
 	cp -v after/ftplugin/markdown.vim ${ADDONS}/after/ftplugin/markdown.vim
16 16
 	mkdir -pv ${REGISTRY}
17 17
 	cp -v registry/markdown.yaml ${REGISTRY}/markdown.yaml
18
+
19
+test: build/tabular build/vader.vim
20
+	test/run-tests.sh
21
+.PHONY: test
22
+
23
+build/tabular: | build
24
+	git clone https://github.com/godlygeek/tabular build/tabular
25
+
26
+build/vader.vim: | build
27
+	git clone https://github.com/junegunn/vader.vim build/vader.vim
28
+
29
+build:
30
+	mkdir build

+ 3
- 5
test/README.md View File

@@ -1,7 +1,5 @@
1
-To run the tests, you must install [Vader](https://github.com/junegunn/vader.vim).
1
+You can run the tests using the Makefile from the top directory:
2 2
 
3
-Vader and other plugins must be installed in the same directory as this repository.
3
+    make test
4 4
 
5
-Run the tests with:
6
-
7
-    ./run-tests.sh
5
+To run them manually please refer to the instructions/commands in the Makefile.

+ 14
- 1
test/run-tests.sh View File

@@ -1,3 +1,16 @@
1 1
 #!/usr/bin/env bash
2 2
 
3
-cd "$( dirname "${BASH_SOURCE[0]}" )" && vim -Nu vimrc -c 'Vader! *' > /dev/null
3
+# Exit on error.
4
+set -e
5
+
6
+cd "$( dirname "${BASH_SOURCE[0]}" )"
7
+
8
+for dep in ../build/tabular ../build/vader.vim; do
9
+  if [[ ! -d $dep ]]; then
10
+    echo "Missing dependency: $dep"
11
+    echo "You may just want to use 'make test'."
12
+    exit 1
13
+  fi
14
+done
15
+
16
+vim -Nu vimrc -c 'Vader! *' > /dev/null

+ 2
- 2
test/vimrc View File

@@ -1,7 +1,7 @@
1 1
 set nocompatible
2 2
 set rtp+=../
3
-set rtp+=../../tabular/
4
-set rtp+=../../vader.vim/
3
+set rtp+=../build/tabular/
4
+set rtp+=../build/vader.vim/
5 5
 filetype on
6 6
 filetype plugin on
7 7
 filetype indent on

Loading…
Cancel
Save