Travis testing
This commit is contained in:
parent
a47fb5e0fa
commit
c76c977414
8 changed files with 119 additions and 16 deletions
15
.travis.yml
15
.travis.yml
|
|
@ -1,2 +1,17 @@
|
|||
language: viml
|
||||
script: ./other/travis.sh
|
||||
cache:
|
||||
apt: true
|
||||
directories:
|
||||
- other/tmp
|
||||
before_install:
|
||||
- sudo apt-get -qq install software-properties-common
|
||||
- sudo add-apt-repository -y ppa:neovim-ppa/unstable
|
||||
- sudo apt-get -qq update
|
||||
- sudo apt-get -qq install neovim
|
||||
- sudo apt-get -qq install tree
|
||||
- sudo apt-get -qq install python-dev python-pip python3-dev python3-pip
|
||||
- sudo pip install pytest
|
||||
- sudo pip install neovim
|
||||
# - sudo apt-get -qq install nim
|
||||
# - sudo apt-get -qq install nimble
|
||||
|
|
|
|||
|
|
@ -2,6 +2,3 @@ if exists("s:loaded")
|
|||
finish
|
||||
endif
|
||||
let s:loaded = 1
|
||||
|
||||
au BufNewFile,BufRead *.nim set filetype=nim
|
||||
au BufNewFile,BufRead *.nims set filetype=nims
|
||||
|
|
|
|||
17
other/nvimcfg/init.vim
Normal file
17
other/nvimcfg/init.vim
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
if has('nvim')
|
||||
runtime! plugin/python_setup.vim
|
||||
endif
|
||||
|
||||
call plug#begin('$HOME/.config/nvim/plugged')
|
||||
Plug 'baabelfish/nvim-nim'
|
||||
call plug#end()
|
||||
|
||||
filetype plugin indent on
|
||||
|
||||
if has("multi_byte") && has("starting")
|
||||
if &termencoding == ""
|
||||
let &termencoding = &encoding
|
||||
endif
|
||||
setglobal fileencoding=utf-8
|
||||
scriptencoding utf-8
|
||||
endif
|
||||
11
other/run_tests.sh
Executable file
11
other/run_tests.sh
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
export NVIM_LISTEN_ADDRESS="/tmp/nvim"
|
||||
nvim --headless&
|
||||
nvimpid=$!
|
||||
sleep 2
|
||||
sh -c "py.test -v tests/vim/**.py"
|
||||
haderr=$?
|
||||
sleep 1
|
||||
kill $nvimpid
|
||||
wait
|
||||
exit $haderr
|
||||
24
other/tests/vim/smoke.py
Normal file
24
other/tests/vim/smoke.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
from vimtest import cleanup, startNvim
|
||||
from time import sleep
|
||||
|
||||
nvim = startNvim()
|
||||
|
||||
|
||||
def test_buffer():
|
||||
cleanup(nvim)
|
||||
nvim.command("norm ihello world")
|
||||
assert nvim.current.buffer[:] == ["hello world"]
|
||||
|
||||
|
||||
def test_another():
|
||||
cleanup(nvim)
|
||||
nvim.command("norm ihello world")
|
||||
nvim.command("norm ggdG")
|
||||
assert nvim.current.buffer[:] == ['']
|
||||
|
||||
|
||||
def test_plugin_loading():
|
||||
cleanup(nvim)
|
||||
nvim.command("e testi.nim")
|
||||
assert nvim.eval("&ft") == "nim"
|
||||
assert nvim.eval('exists(":NimUsages")') == 2
|
||||
12
other/tests/vim/vimtest.py
Normal file
12
other/tests/vim/vimtest.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from neovim import attach
|
||||
|
||||
|
||||
def cleanup(nvim):
|
||||
nvim.command('bd!')
|
||||
|
||||
|
||||
def startNvim():
|
||||
nvim = attach("socket", path="/tmp/nvim")
|
||||
nvim.command("PlugInstall")
|
||||
cleanup(nvim)
|
||||
return nvim
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
current=$PWD
|
||||
|
||||
|
||||
install_nim() {
|
||||
wget "http://nim-lang.org/download/nim-0.13.0.tar.xz" -O nim.tar.xz
|
||||
mkdir nim
|
||||
|
|
@ -29,22 +30,32 @@ install_nimsuggest() {
|
|||
cd ..
|
||||
}
|
||||
|
||||
mkdir tmp
|
||||
cd tmp
|
||||
|
||||
echo "Installing nim"
|
||||
install_nim
|
||||
if [[ ! -d "tmp" ]]; then
|
||||
mkdir tmp
|
||||
cd tmp
|
||||
|
||||
echo "Installing nimble"
|
||||
install_nimble
|
||||
echo "Installing nim"
|
||||
install_nim
|
||||
|
||||
echo "Installing nimsuggest"
|
||||
install_nimsuggest
|
||||
echo "Installing nimble"
|
||||
install_nimble
|
||||
|
||||
cd ..
|
||||
echo "Installing nimsuggest"
|
||||
install_nimsuggest
|
||||
|
||||
cd ..
|
||||
fi
|
||||
|
||||
export PATH=$PATH:$current/tmp/nim/bin
|
||||
export PATH=$PATH:$current/nimble/src
|
||||
export PATH=$PATH:$current/nimble/nimsuggest
|
||||
|
||||
echo "================================================================================"
|
||||
|
||||
echo -e "\nNeovim:"
|
||||
nvim --version
|
||||
|
||||
echo -e "\nNim:"
|
||||
nim --version
|
||||
|
||||
|
|
@ -55,8 +66,21 @@ echo -e "\nNimsuggest:"
|
|||
nimsuggest --version
|
||||
|
||||
echo "================================================================================"
|
||||
|
||||
echo "Run tests in $PWD"
|
||||
cd $current/other
|
||||
nim c tests/nimsuggest/suggestions.nim
|
||||
nim c tests/edb/edb.nim
|
||||
|
||||
curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
cp nvimcfg/init.vim ~/.config/nvim/
|
||||
mkdir -p "$HOME/.config/nvim/undodir"
|
||||
mkdir -p "$HOME/.config/nvim/autoload"
|
||||
mkdir -p "$HOME/.config/nvim/view"
|
||||
cat ~/.config/nvim/autoload/plug.vim
|
||||
|
||||
tree ~/.config/nvim
|
||||
|
||||
|
||||
# echo "Run nim tests"
|
||||
# nim c tests/nimsuggest/suggestions.nim
|
||||
|
||||
echo "================================================================================"
|
||||
echo "Run vim tests"
|
||||
./run_tests.sh
|
||||
|
|
|
|||
|
|
@ -47,3 +47,6 @@ let g:nvim_nim_repl_height = 14
|
|||
let g:nvim_nim_repl_vsplit = 0
|
||||
|
||||
let g:nvim_nim_highlighter_semantics = ["skConst", "skForVar", "skGlobalVar", "skGlobalLet", "skLet", "skModule", "skParam", "skTemp", "skVar"]
|
||||
|
||||
au BufNewFile,BufRead *.nim setlocal filetype=nim
|
||||
au BufNewFile,BufRead *.nims setlocal filetype=nims
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue