mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 01:00:05 +08:00
Add test layer
This commit is contained in:
parent
d70ad4c0b7
commit
51ab3b9bc0
40
autoload/SpaceVim/layers/test.vim
Normal file
40
autoload/SpaceVim/layers/test.vim
Normal file
@ -0,0 +1,40 @@
|
||||
"=============================================================================
|
||||
" test.vim --- test layer file for SpaceVim
|
||||
" Copyright (c) 2018 Shidong Wang & Contributors
|
||||
" Author: Shidong Wang < wsdjeg at 163.com >
|
||||
" URL: https://spacevim.org
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
""
|
||||
" @section github, layer-test
|
||||
" @parentsection layers
|
||||
" This layer allows to run tests on SpaceVim
|
||||
"
|
||||
" @subsection Mappings
|
||||
" >
|
||||
" Mode Key Function
|
||||
" -------------------------------------------------------------
|
||||
" normal SPC k n run nearest test
|
||||
" normal SPC k f run test file
|
||||
" normal SPC k s run test suite
|
||||
" normal SPC k l run the latest test
|
||||
" normal SPC k v visits the last run test file
|
||||
" <
|
||||
|
||||
function! SpaceVim#layers#test#plugins() abort
|
||||
return [
|
||||
\ ['janko-m/vim-test'],
|
||||
\ ]
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#test#config() abort
|
||||
let g:_spacevim_mappings_space.k = get(g:_spacevim_mappings_space, 'k', {'name' : '+Test'})
|
||||
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['k', 'n'], 'TestNearest', 'nearest', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['k', 'f'], 'TestFile', 'file', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['k', 's'], 'TestSuite', 'suite', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['k', 'l'], 'TestLast', 'last', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['k', 'v'], 'TestVisit', 'visit', 1)
|
||||
endfunction
|
||||
|
@ -72,8 +72,9 @@ CONTENTS *SpaceVim-contents*
|
||||
28. lang#xml...................................|SpaceVim-layer-lang-xml|
|
||||
29. operator...................................|SpaceVim-layer-operator|
|
||||
30. shell.........................................|SpaceVim-layer-shell|
|
||||
31. tmux...........................................|SpaceVim-layer-tmux|
|
||||
32. tools#dash...............................|SpaceVim-layer-tools-dash|
|
||||
31. test...........................................|SpaceVim-layer-test|
|
||||
32. tmux...........................................|SpaceVim-layer-tmux|
|
||||
33. tools#dash...............................|SpaceVim-layer-tools-dash|
|
||||
7. API........................................................|SpaceVim-api|
|
||||
1. cmdlinemenu................................|SpaceVim-api-cmdlinemenu|
|
||||
2. data#dict....................................|SpaceVim-api-data-dict|
|
||||
@ -1284,6 +1285,23 @@ For more info, read |deol| and |vimshell|.
|
||||
VARIABLE
|
||||
default_shell
|
||||
|
||||
==============================================================================
|
||||
TEST *SpaceVim-layer-test*
|
||||
|
||||
This layer allow to run tests directly on SpaceVim
|
||||
This layer is not added by default. To include
|
||||
it, add `[[layers]] name = "test"` to your `~/.SpaceVim.d/init.toml`.
|
||||
|
||||
MAPPINGS
|
||||
|
||||
>
|
||||
Mode Key Function
|
||||
-----------------------------------------------
|
||||
normal SPC k n Run nearest test
|
||||
normal SPC k f Run test file
|
||||
normal SPC k s Run test suite
|
||||
normal SPC k l Run last test
|
||||
normal SPC k v Visit the last test file
|
||||
|
||||
==============================================================================
|
||||
TMUX *SpaceVim-layer-tmux*
|
||||
|
@ -132,6 +132,7 @@ enable = false
|
||||
| [shell](shell/) | This layer provide shell support in SpaceVim |
|
||||
| [sudo](sudo/) | sudo layer provides ability to read and write file elevated privileges in SpaceVim |
|
||||
| [tags](tags/) | This layer provide tags manager for project |
|
||||
| [tests](tests/) | This layer allows to run tests directly on SpaceVim |
|
||||
| [tmux](tmux/) | This layers adds extensive support for tmux |
|
||||
| [tools#dash](tools/dash/) | This layer provides Dash integration for SpaceVim |
|
||||
| [tools](tools/) | This layer provides some tools for vim |
|
||||
|
38
docs/layers/test.md
Normal file
38
docs/layers/test.md
Normal file
@ -0,0 +1,38 @@
|
||||
---
|
||||
title: "SpaceVim test layer"
|
||||
description: "This layer allows to run tests directly on SpaceVim"
|
||||
---
|
||||
|
||||
# [Available Layers](../) >> test
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
- [Description](#description)
|
||||
- [Install](#install)
|
||||
- [Key bindings](#key-bindings)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
## Description
|
||||
|
||||
This layers allow to run tests directly on Vim.
|
||||
|
||||
## Install
|
||||
|
||||
To use this configuration layer, add following snippet to your custom configuration file.
|
||||
|
||||
```toml
|
||||
[[layers]]
|
||||
name = "test"
|
||||
```
|
||||
|
||||
## Key bindings
|
||||
|
||||
| Key Binding | Description |
|
||||
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `SPC k n` | Run nearest test |
|
||||
| `SPC k f` | Run test file |
|
||||
| `SPC k s` | Runs the whole test suite (if the current file is a test file, runs that framework's test suite, otherwise determines the test framework from the last run test). |
|
||||
| `SPC k l` | Runs the last test |
|
||||
| `SPC k v` | Visits the test file from which you last run your tests (useful when you're trying to make a test pass, and you dive deep into application code and close your test buffer to make more space, and once you've made it pass you want to go back to the test file to write more tests) |
|
||||
|
Loading…
Reference in New Issue
Block a user