From 09d9ef6bf7819cb65878f4a46c706761c16a6f97 Mon Sep 17 00:00:00 2001 From: kazukazuinaina Date: Wed, 29 Jun 2022 00:20:09 +0900 Subject: [PATCH 1/5] [add] vim-themis's test --- .github/workflows/ci.yml | 22 ++++++---------------- test/.themisrc | 2 ++ test/airline-themes.vim | 18 ++++++++++++++++++ 3 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 test/.themisrc create mode 100644 test/airline-themes.vim diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea54c54..db90557 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,6 @@ jobs: strategy: matrix: vim: - - v8.2.2000 - v8.2.1000 - v8.2.0000 - v8.1.0000 @@ -20,25 +19,16 @@ jobs: steps: - name: Checkout code uses: actions/checkout@main + with: + repository: thinca/vim-themis + path: vim-themis - name: Setup Vim uses: rhysd/action-setup-vim@v1 with: version: ${{ matrix.vim }} - - name: Install Dependencies - run: | - git clone https://github.com/junegunn/vader.vim.git - git clone https://github.com/vim-airline/vim-airline - find $PWD/autoload/airline/themes -name "*.vim" > themes.txt - name: Run Test - run: | - vim --not-a-term -Nu <(cat << VIMRC - filetype off - set rtp+=vader.vim - set rtp+=vim-airline - set rtp+=. - set rtp+=after - filetype plugin indent on - syntax enable - VIMRC) -c 'Vader! test/*' > /dev/null + env: + THEMIS_VIM: ${{ steps.vim.outputs.executable }} + run: ./vim-themis/bin/themis --reporter spec diff --git a/test/.themisrc b/test/.themisrc new file mode 100644 index 0000000..468596f --- /dev/null +++ b/test/.themisrc @@ -0,0 +1,2 @@ +let s:deps = themis#helper('deps') +call s:deps.git('vim-airline/vim-airline') diff --git a/test/airline-themes.vim b/test/airline-themes.vim new file mode 100644 index 0000000..7890fcf --- /dev/null +++ b/test/airline-themes.vim @@ -0,0 +1,18 @@ +scriptencoding utf-8 + +let s:themes_dir = expand(':h:h') . '/autoload/airline/themes' +let s:themes = map(glob(s:themes_dir . '/*.vim', 1, 1), 'fnamemodify(v:val, ":t:r")') +let s:suite = themis#suite('vim-airline-themes') + +call themis#helper('command') + +function! s:Test(theme) + Throws execute('AirlineTheme ' . a:theme) +endfunction + +function! s:suite.__themes__() + let child = themis#suite('ExistThemes') + for theme in s:themes + let child[theme] = funcref('s:Test', [theme]) + endfor +endfunction From 8ff94b21385a9406b8bc851917c6d8b0bf54b948 Mon Sep 17 00:00:00 2001 From: kazukazuinaina Date: Wed, 29 Jun 2022 00:41:19 +0900 Subject: [PATCH 2/5] [delete] vader.vim --- test/airline-themes.vader | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 test/airline-themes.vader diff --git a/test/airline-themes.vader b/test/airline-themes.vader deleted file mode 100644 index 253ef36..0000000 --- a/test/airline-themes.vader +++ /dev/null @@ -1,38 +0,0 @@ -# Make sure that theme and 5 basic modes don't throw an error -# Get list of all included themes -Execute (validate themes): - let themes = readfile('themes.txt') - call sort(themes) - - let err_proc = v:false - try - - for themePath in themes - - " Check all the basic modes and their modified counterparts - " This test only fails on exceptional cases - let theme = fnamemodify(themePath, ':t:r') - Log theme - execute('AirlineTheme ' . theme) - execute('source ' . themePath) - normal! i - normal! : - normal! R - normal! v - setlocal mod - normal! i - normal! : - normal! R - normal! v - setlocal nomod - - endfor - - catch - let err_proc = v:true - Log "Failed validation testing with exception:" - Log string(v:exception) - endtry - AirlineRefresh - - Assert !err_proc From 1c6ad8bf8fb611397154420dc58899042dbd0a2a Mon Sep 17 00:00:00 2001 From: kazukazuinaina Date: Wed, 29 Jun 2022 00:46:17 +0900 Subject: [PATCH 3/5] update --- .github/workflows/ci.yml | 1 + test/.themisrc | 2 ++ test/{airline-themes.vim => test.vim} | 2 -- 3 files changed, 3 insertions(+), 2 deletions(-) rename test/{airline-themes.vim => test.vim} (93%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db90557..310a32f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,7 @@ jobs: - name: Setup Vim uses: rhysd/action-setup-vim@v1 + id: vim with: version: ${{ matrix.vim }} diff --git a/test/.themisrc b/test/.themisrc index 468596f..0390ae8 100644 --- a/test/.themisrc +++ b/test/.themisrc @@ -1,2 +1,4 @@ let s:deps = themis#helper('deps') call s:deps.git('vim-airline/vim-airline') + +call themis#helper('command') diff --git a/test/airline-themes.vim b/test/test.vim similarity index 93% rename from test/airline-themes.vim rename to test/test.vim index 7890fcf..947d61b 100644 --- a/test/airline-themes.vim +++ b/test/test.vim @@ -4,8 +4,6 @@ let s:themes_dir = expand(':h:h') . '/autoload/airline/themes' let s:themes = map(glob(s:themes_dir . '/*.vim', 1, 1), 'fnamemodify(v:val, ":t:r")') let s:suite = themis#suite('vim-airline-themes') -call themis#helper('command') - function! s:Test(theme) Throws execute('AirlineTheme ' . a:theme) endfunction From c528f796a8f7079210e12d15057f8a32f381847d Mon Sep 17 00:00:00 2001 From: kazukazuinaina Date: Wed, 29 Jun 2022 00:51:41 +0900 Subject: [PATCH 4/5] fix --- .github/workflows/ci.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 310a32f..775203f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,12 @@ +name: CI + on: push: branches: - master pull_request: + branches: + - master jobs: test: @@ -15,10 +19,14 @@ jobs: - v8.2.0000 - v8.1.0000 - v8.0.0000 + - v7.4 steps: - name: Checkout code - uses: actions/checkout@main + uses: actions/checkout@v3 + + - name: Checkout vim-themis + uses: actions/checkout@v3 with: repository: thinca/vim-themis path: vim-themis @@ -29,7 +37,7 @@ jobs: with: version: ${{ matrix.vim }} - - name: Run Test + - name: Test env: THEMIS_VIM: ${{ steps.vim.outputs.executable }} run: ./vim-themis/bin/themis --reporter spec From 79a3beecfe04baedfe72b85b1bdd1d9521b7210e Mon Sep 17 00:00:00 2001 From: kazukazuinaina Date: Wed, 29 Jun 2022 01:21:54 +0900 Subject: [PATCH 5/5] [add] test --- .gitignore | 1 + test/airline-themes.vim | 35 +++++++++++++++++++++++++++++++++++ test/test.vim | 16 ---------------- 3 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 test/airline-themes.vim delete mode 100644 test/test.vim diff --git a/.gitignore b/.gitignore index 17402e5..553bae5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_Store doc/tags +test/.deps diff --git a/test/airline-themes.vim b/test/airline-themes.vim new file mode 100644 index 0000000..f7856c6 --- /dev/null +++ b/test/airline-themes.vim @@ -0,0 +1,35 @@ +scriptencoding utf-8 + +let s:themes_dir = expand(':h:h') . '/autoload/airline/themes' +let s:themes = map(glob(s:themes_dir . '/*.vim', 1, 1), 'fnamemodify(v:val, ":t:r")') +let s:suite = themis#suite('vim-airline-themes') + +function! s:Test_AirlineTheme(theme) + Throws execute('AirlineTheme ' . a:theme) +endfunction + +function! s:command_insert(theme) + execute('AirlineTheme ' . a:theme) + execute('source ' . expand(':h:h') . '/autoload/airline/themes/' . a:theme . '.vim') + Throws normal! i +endfunction + +function! s:command_command(theme) + execute('AirlineTheme ' . a:theme) + execute('source ' . expand(':h:h') . '/autoload/airline/themes/' . a:theme . '.vim') + Throws normal! : +endfunction + +function! s:suite.__insert__() + let child = themis#suite('INSERT') + for theme in s:themes + let child[theme] = funcref('s:command_insert', [theme]) + endfor +endfunction + +function! s:suite.__command__() + let child = themis#suite('COMMAND') + for theme in s:themes + let child[theme] = funcref('s:command_command', [theme]) + endfor +endfunction diff --git a/test/test.vim b/test/test.vim deleted file mode 100644 index 947d61b..0000000 --- a/test/test.vim +++ /dev/null @@ -1,16 +0,0 @@ -scriptencoding utf-8 - -let s:themes_dir = expand(':h:h') . '/autoload/airline/themes' -let s:themes = map(glob(s:themes_dir . '/*.vim', 1, 1), 'fnamemodify(v:val, ":t:r")') -let s:suite = themis#suite('vim-airline-themes') - -function! s:Test(theme) - Throws execute('AirlineTheme ' . a:theme) -endfunction - -function! s:suite.__themes__() - let child = themis#suite('ExistThemes') - for theme in s:themes - let child[theme] = funcref('s:Test', [theme]) - endfor -endfunction