1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:10:04 +08:00

Add test for windows (#4412)

This commit is contained in:
Wang Shidong 2021-08-21 13:21:11 +08:00 committed by GitHub
parent 8f76047cbd
commit fd4b7a6e75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 251 additions and 268 deletions

View File

@ -1,208 +0,0 @@
function install_vim($name)
{
$ver = $name -replace "^Vim\s*", ""
if ($ver -eq "latest-32")
{
$url1 = 'https://github.com/vim/vim-win32-installer/releases/download/v8.2.0129/gvim_8.2.0129_x86.zip'
$Env:THEMIS_VIM = $Env:APPVEYOR_BUILD_FOLDER + '\vim\vim82\vim.exe'
}
elseif ($ver -eq "8.1.2269")
{
$url1 = 'https://github.com/vim/vim-win32-installer/releases/download/v8.1.2269/gvim_8.1.2269_x86.zip'
$Env:THEMIS_VIM = $Env:APPVEYOR_BUILD_FOLDER + '\vim\vim81\vim.exe'
}
elseif ($ver -eq "8.0.1453")
{
$url1 = 'https://github.com/vim/vim-win32-installer/releases/download/v8.0.1453/gvim_8.0.1453_x86.zip'
$Env:THEMIS_VIM = $Env:APPVEYOR_BUILD_FOLDER + '\vim\vim80\vim.exe'
}
elseif ($ver -eq "8.0.0027")
{
$url1 = 'https://github.com/vim/vim-win32-installer/releases/download/v8.0.0027/gvim_8.0.0027_x86.zip'
$Env:THEMIS_VIM = $Env:APPVEYOR_BUILD_FOLDER + '\vim\vim80\vim.exe'
}
elseif ($ver -eq "7.4.1689")
{
$url1 = 'https://github.com/vim/vim-win32-installer/releases/download/v7.4.1689/gvim_7.4.1689_x86.zip'
$Env:THEMIS_VIM = $Env:APPVEYOR_BUILD_FOLDER + '\vim\vim74\vim.exe'
}
$zip1 = $Env:APPVEYOR_BUILD_FOLDER + '\vim.zip'
(New-Object Net.WebClient).DownloadFile($url1, $zip1)
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip1, $Env:APPVEYOR_BUILD_FOLDER)
}
function install_kaoriya_vim($name)
{
$ver = $name -replace "^Kaoriya\s*", ""
if ($ver -eq "latest-32")
{
$url = 'http://vim-jp.org/redirects/koron/vim-kaoriya/latest/win32/'
}
elseif ($ver -eq "latest-64")
{
$url = 'http://vim-jp.org/redirects/koron/vim-kaoriya/latest/win64/'
}
elseif ($ver -eq "8.0.0082-32")
{
$url = 'https://github.com/koron/vim-kaoriya/releases/download/v8.0.0082-20161113/vim80-kaoriya-win32-8.0.0082-20161113.zip'
}
elseif ($ver -eq "8.0.0082-64")
{
$url = 'https://github.com/koron/vim-kaoriya/releases/download/v8.0.0082-20161113/vim80-kaoriya-win64-8.0.0082-20161113.zip'
}
$zip = $Env:APPVEYOR_BUILD_FOLDER + '\kaoriya-vim.zip'
$out = $Env:APPVEYOR_BUILD_FOLDER + '\kaoriya-vim\'
if ($url.StartsWith('http://vim-jp.org/redirects/'))
{
$redirect = Invoke-WebRequest -URI $url
(New-Object Net.WebClient).DownloadFile($redirect.Links[0].href, $zip)
}
else
{
(New-Object Net.WebClient).DownloadFile($url, $zip)
}
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $out)
$Env:THEMIS_VIM = $out + (Get-ChildItem $out).Name + '\vim.exe'
}
function install_nvim($name)
{
$ver = $name -replace "^Neovim\s*", ""
if ($ver -eq "latest-32")
{
$url = 'https://github.com/neovim/neovim/releases/download/nightly/nvim-win32.zip'
}
elseif ($ver -eq "latest-64")
{
$url = 'https://github.com/neovim/neovim/releases/download/nightly/nvim-win64.zip'
}
elseif ($ver -eq "0.4.3-32")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.4.3/nvim-win32.zip'
}
elseif ($ver -eq "0.4.3-64")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.4.3/nvim-win64.zip'
}
elseif ($ver -eq "0.4.2-32")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.4.2/nvim-win32.zip'
}
elseif ($ver -eq "0.4.2-64")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.4.2/nvim-win64.zip'
}
elseif ($ver -eq "0.3.8-32")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.3.8/nvim-win32.zip'
}
elseif ($ver -eq "0.3.8-64")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.3.8/nvim-win64.zip'
}
elseif ($ver -eq "0.3.7-32")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.3.7/nvim-win32.zip'
}
elseif ($ver -eq "0.3.7-64")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.3.7/nvim-win64.zip'
}
elseif ($ver -eq "0.3.5-32")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.3.5/nvim-win32.zip'
}
elseif ($ver -eq "0.3.5-64")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.3.5/nvim-win64.zip'
}
elseif ($ver -eq "0.3.4-32")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.3.4/nvim-win32.zip'
}
elseif ($ver -eq "0.3.4-64")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.3.4/nvim-win64.zip'
}
elseif ($ver -eq "0.3.3-32")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.3.3/nvim-win32.zip'
}
elseif ($ver -eq "0.3.3-64")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.3.3/nvim-win64.zip'
}
elseif ($ver -eq "0.3.2-32")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.3.2/nvim-win32.zip'
}
elseif ($ver -eq "0.3.2-64")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.3.2/nvim-win64.zip'
}
elseif ($ver -eq "0.3.1-32")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.3.1/nvim-win32.zip'
}
elseif ($ver -eq "0.3.1-64")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.3.1/nvim-win64.zip'
}
elseif ($ver -eq "0.3.0-32")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.3.0/nvim-win32.zip'
}
elseif ($ver -eq "0.3.0-64")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.3.0/nvim-win64.zip'
}
elseif ($ver -eq "0.2.2-32")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.2.2/nvim-win32.zip'
}
elseif ($ver -eq "0.2.2-64")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.2.2/nvim-win64.zip'
}
elseif ($ver -eq "0.2.0-32")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.2.0/nvim-win32.zip'
}
elseif ($ver -eq "0.2.0-64")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.2.0/nvim-win64.zip'
}
$zip = $Env:APPVEYOR_BUILD_FOLDER + '\nvim.zip'
(New-Object Net.WebClient).DownloadFile($url, $zip)
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $Env:APPVEYOR_BUILD_FOLDER)
$Env:THEMIS_VIM = $Env:APPVEYOR_BUILD_FOLDER + '\Neovim\bin\nvim.exe'
$Env:THEMIS_ARGS = '-e -s --headless'
}
function download_coreutils() {
$url = 'https://nchc.dl.sourceforge.net/project/gnuwin32/coreutils/5.3.0/coreutils-5.3.0-bin.zip'
$zip = $Env:APPVEYOR_BUILD_FOLDER + '\coreutils.zip'
(New-Object Net.WebClient).DownloadFile($url, $zip)
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $Env:APPVEYOR_BUILD_FOLDER + '\coreutils')
$Env:PATH = $Env:PATH + ';' + $Env:APPVEYOR_BUILD_FOLDER + '\coreutils\bin'
}
if ($Env:CONDITION.StartsWith("Neovim"))
{
install_nvim $Env:CONDITION
download_coreutils
}
elseif ($Env:CONDITION.StartsWith("Vim"))
{
install_vim $Env:CONDITION
download_coreutils
}
else
{
install_kaoriya_vim $Env:CONDITION
}

View File

@ -1 +0,0 @@
Not Found

55
.ci/install/windows.ps1 Normal file
View File

@ -0,0 +1,55 @@
function install_vim($ver)
{
if ($ver -eq "nightly")
{
$url1 = 'https://github.com/vim/vim-win32-installer/releases/download/v8.2.3361/gvim_8.2.3361_x86.zip'
}
else
{
$ver = $ver -replace "^v", ""
$url1 = 'https://github.com/vim/vim-win32-installer/releases/download/v' + $ver + '/gvim_' + $ver + '_x86.zip'
}
$Env:VIM_BIN = $Env:DEPS + '\vim\vim82\vim.exe'
$zip1 = $Env:DEPS + '\vim.zip'
(New-Object Net.WebClient).DownloadFile($url1, $zip1)
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip1, $Env:DEPS)
}
function install_nvim($ver)
{
if ($ver -eq "nightly")
{
$url = 'https://github.com/neovim/neovim/releases/download/nightly/nvim-win32.zip'
}
else
{
$url = 'https://github.com/neovim/neovim/releases/download/' + $ver + '/nvim-win64.zip'
}
$Env:VIM_BIN = $Env:DEPS + '\Neovim\bin\nvim.exe'
$zip = $Env:DEPS + '\nvim.zip'
(New-Object Net.WebClient).DownloadFile($url, $zip)
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $Env:DEPS)
}
function download_lua()
{
$url = 'https://github.com/wsdjeg/vim-galore-zh_cn/releases/download/downdows/lua53.zip'
$zip = $Env:DEPS + '\lua53.zip'
(New-Object Net.WebClient).DownloadFile($url, $zip)
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $Env:DEPS + '\vim\vim82')
}
if ($Env:VIM_BIN.StartsWith("nvim"))
{
mkdir $Env:DEPS
install_nvim $Env:VIM_TAG
}
elseif ($Env:VIM_BIN.StartsWith("vim"))
{
mkdir $Env:DEPS
install_vim $Env:VIM_TAG
download_lua
}

View File

@ -1,9 +1,9 @@
name: build
name: test
on: [push, pull_request]
jobs:
check:
Linux:
strategy:
fail-fast: false
matrix:
@ -72,3 +72,61 @@ jobs:
make test_coverage
covimerage -vv xml --omit 'build/*' --omit 'bundle/*'
codecov -X search gcov pycov -f coverage.xml
Windows:
strategy:
fail-fast: false
matrix:
include:
- vimbin: vim
vimtag: nightly
- vimbin: vim
vimtag: v7.4.1185
- vimbin: vim
vimtag: v7.4.1689
- vimbin: vim
vimtag: v8.0.0027
- vimbin: vim
vimtag: v8.0.1453
- vimbin: vim
vimtag: v8.1.2269
# vimtag: ["v7.4.052", "v7.4.629", "v7.4.1689", "v8.0.0027", "v8.0.1453", "v8.1.2269"]
- vimbin: nvim
vimtag: nightly
- vimbin: nvim
vimtag: v0.5.0
- vimbin: nvim
vimtag: v0.4.4
- vimbin: nvim
vimtag: v0.4.3
- vimbin: nvim
vimtag: v0.4.2
- vimbin: nvim
vimtag: v0.3.8
# vimtag: ["v0.4.3", "v0.4.3", "v0.4.3", "v0.4.2", "v0.3.8", "v0.3.7", "v0.3.5", "v0.3.4", "v0.3.3", "v0.3.2", "v0.3.1", "v0.3.0"]
runs-on: windows-2016
env:
VIM_BIN: ${{ matrix.vimbin }}
VIM_TAG: ${{ matrix.vimtag }}
DEPS: C:\deps
steps:
- name: Checkout
uses: actions/checkout@master
- name: Install ${{ matrix.vimbin }} ${{ matrix.vimtag }}
run: |
.ci/install/windows.ps1 $VIM_BIN $VIM_TAG
- name: Run test
run: |
if ($Env:VIM_BIN.StartsWith("nvim"))
{
$Env:PATH = $Env:DEPS + '\Neovim\bin\;' + $Env:PATH
$Env:VIM = $Env:DEPS + '\Neovim\share\nvim'
}
elseif ($Env:VIM_BIN.StartsWith("vim"))
{
$Env:PATH = $Env:DEPS + '\vim\vim82\;' + $Env:PATH
$Env:VIM = $Env:DEPS + '\vim'
}
# https://github.com/Vimjas/covimerage/issues/95
# https://github.com/Vimjas/covimerage/issues/90
# covimerage do not support windows now
make test

View File

@ -6,6 +6,9 @@ COVIMERAGE=$(shell command -v covimerage 2>/dev/null || echo build/covimerage/bi
test_coverage: $(COVIMERAGE) build/vader | build
$(COVIMERAGE) run --source after --source autoload --source colors --source config --source ftplugin $(VIM_BIN) -Nu test/vimrc -c 'Vader! test/**'
$(COVIMERAGE):
$(COVIMERAGE) run --source after --source autoload --source colors --source config --source ftplugin $(VIM_BIN) -Nu test/vimrc -c 'Vader! test/**'
build/covimerage:
virtualenv $@
build/covimerage/bin/covimerage: | build/covimerage

43
appveyor.yml Normal file
View File

@ -0,0 +1,43 @@
version: 1.5.0.{build}
pull_requests:
do_not_increment_build_number: true
skip_tags: true
clone_depth: 1
environment:
matrix:
- CONDITION: Neovim latest-32
- CONDITION: Neovim 0.4.3-32
- CONDITION: Neovim 0.4.2-32
- CONDITION: Neovim 0.3.8-32
- CONDITION: Neovim 0.3.7-32
- CONDITION: Neovim 0.3.5-32
- CONDITION: Neovim 0.3.4-32
- CONDITION: Neovim 0.3.3-32
- CONDITION: Neovim 0.3.2-32
- CONDITION: Neovim 0.3.1-32
- CONDITION: Neovim 0.3.0-32
- CONDITION: Vim latest-32
- CONDITION: Vim 7.4.1689
- CONDITION: Vim 8.0.0027
- CONDITION: Vim 8.0.1453
- CONDITION: Vim 8.1.2269
install:
- 'reg copy HKLM\SOFTWARE\Python\PythonCore\2.7 HKLM\SOFTWARE\Python\PythonCore\2.7-32 /s /reg:32'
- 'reg copy HKLM\SOFTWARE\Python\PythonCore\2.7 HKLM\SOFTWARE\Python\PythonCore\2.7-32 /s /reg:64'
- 'git config --global user.name "Appveyor"'
- 'git config --global user.email appveyor@example.com'
- 'git clone -q --depth 1 --single-branch https://github.com/junegunn/vader.vim.git build/vader'
- 'git clone -q --depth 1 --single-branch https://github.com/Shougo/dein.vim C:\Users\appveyor\.cache\vimfiles\repos\github.com\Shougo\dein.vim'
- 'set THEMIS_HOME=%TEMP%\vim-themis'
- 'set PATH=%THEMIS_HOME%\bin;%PATH%'
- ps: .ci/install.ps1
test_script:
- 'echo %PATH%'
- 'echo %THEMIS_HOME%'
- 'echo %THEMIS_VIM%'
- 'echo %THEMIS_ARGS%'
- 'cat --version'
- '%THEMIS_VIM% --version'
- '%THEMIS_VIM% -Nu test/vimrc -c "Vader! test/**"'
build: off
deploy: off

View File

@ -1,4 +1,5 @@
Execute ( SpaceVim api: file.fticon ):
scriptencoding utf-8
let g:spacevim_filetype_icons = {}
let file = SpaceVim#api#import('file')
AssertEqual file.fticon('foo.md'), ''

View File

@ -1,9 +1,16 @@
Execute ( SpaceVim api: unicode#tree ):
let box = SpaceVim#api#import('unicode#box')
if &encoding ==# 'utf-8'
AssertEqual box.drawing_box([1,2,3] , 1, 3, 5),
\ [
\ '╭─────┬─────┬─────╮',
\ '│ 1 │ 2 │ 3 │',
\ '╰─────┴─────┴─────╯'
\ ]
else
AssertEqual box.drawing_box([1,2,3] , 1, 3, 5),
\ ['*-----*-----*-----*',
\ '| 1 | 2 | 3 |',
\ '*-----*-----*-----*']
end

View File

@ -1,11 +1,16 @@
Execute ( SpaceVim lua api: file.fticon(ft) ):
if has('nvim') || has('+lua')
let file = SpaceVim#api#import('file')
let cmp = SpaceVim#api#import('vim#compatible')
lua spacevim_file = require('spacevim.api').import('file')
AssertEqual cmp.luaeval('spacevim_file.fticon("foo.md")'), file.fticon('foo.md')
AssertEqual cmp.luaeval('spacevim_file.fticon("foo.mdxx")'), file.fticon('foo.mdxx')
else
Log 'skip lua test'
endif
Execute ( SpaceVim lua api: file.unify_path(path, ...) ):
if has('nvim') || has('+lua')
let file = SpaceVim#api#import('file')
let cmp = SpaceVim#api#import('vim#compatible')
lua spacevim_file = require('spacevim.api').import('file')
@ -19,15 +24,23 @@ Execute ( SpaceVim lua api: file.unify_path(path, ...) ):
\ file.unify_path("autoload", ":p")
AssertEqual cmp.luaeval('spacevim_file.unify_path(fn.bufname("%"), ":.")'),
\ file.unify_path(bufname("%"), ":.")
else
Log 'skip lua test'
endif
Execute ( SpaceVim lua api: file.path_to_fname(path) ):
if has('nvim') || has('+lua')
let file = SpaceVim#api#import('file')
let cmp = SpaceVim#api#import('vim#compatible')
lua spacevim_file = require('spacevim.api').import('file')
AssertEqual cmp.luaeval('spacevim_file.path_to_fname(".SpaceVim.d/init.vim")'),
\ file.path_to_fname('.SpaceVim.d/init.vim')
else
Log 'skip lua test'
endif
Execute ( SpaceVim lua api: file.findfile(what, where, ...) ):
if has('nvim') || has('+lua')
let file = SpaceVim#api#import('file')
let cmp = SpaceVim#api#import('vim#compatible')
lua spacevim_file = require('spacevim.api').import('file')
@ -37,3 +50,6 @@ Execute ( SpaceVim lua api: file.findfile(what, where, ...) ):
AssertEqual cmp.luaeval('spacevim_file.unify_path(spacevim_file.findfile("vimrc", "bundle/dein.vim/autoload/dein.vim"), ":.")'),
\ file.unify_path(file.findfile("vimrc", "bundle/dein.vim/autoload/dein.vim"), ":.")
lua spacevim_file = nil
else
Log 'skip lua test'
endif

View File

@ -1,4 +1,5 @@
Execute ( lua api system ):
if has('nvim') || has('+lua')
let api_system = SpaceVim#api#import('system')
let cmp = SpaceVim#api#import('vim#compatible')
Log 'test system.isWindows'
@ -14,3 +15,6 @@ Execute ( lua api system ):
Log 'test system.fileformat()'
AssertEqual cmp.luaeval('require("spacevim.api").import("system").fileformat()'), api_system.fileformat()
unlet api_system
else
Log 'skip lua test'
endif

View File

@ -1,5 +1,7 @@
Execute ( SpaceVim lua api: logger ):
if has('nvim') || has('+lua')
let cmp = SpaceVim#api#import('vim#compatible')
lua spacevim_logger = require('spacevim.api').import('logger')
lua spacevim_logger.set_name('TestLog')
AssertEqual cmp.luaeval('spacevim_logger.name'), 'TestLog'
endif

View File

@ -1,3 +1,6 @@
let g:_spacevim_root_dir = fnamemodify(fnamemodify(expand('<sfile>'),
\ ':p:h:h:gs?\\?'.((has('win16') || has('win32')
\ || has('win64'))?'\':'/') . '?'), ':p:gs?[\\/]?/?')
filetype off
set rtp+=build/vader
set rtp+=.