Vim documentation: vital/Assertion
main help file
vital/Assertion.txt assertion library.
Maintainer: rbtnn <naru123456789@gmail.com>
==============================================================================
CONTENTS Vital.Assertion-contents
INTRODUCTION Vital.Assertion-introduction
INTERFACE Vital.Assertion-interface
FUNCTIONS Vital.Assertion-functions
==============================================================================
INTRODUCTION Vital.Assertion-introduction
Vital.Assertion provides domain specific language (DSL) for assertion as a
Vim command.
==============================================================================
INTERFACE Vital.Assertion-interface
------------------------------------------------------------------------------
FUNCTIONS Vital.Assertion-functions
define({assert_command_name}, ...) Vital.Assertion.define()
Define a command of Vital.Assertion that is named {assert_command_name}.
{a:1} is a bool value to enable the command defined by .
Default value of {a:1} is .
A command defined by has two operators.
A. <=>
It means 'equal'.
1) Succeeded
let s:V = vital#{plugin-name}#new()
let s:A = s:V.import('Assertion')
call s:A.define('Assert', 1)
Assert 1 <=> 1
" Assert 2 <=> 2 :Succeeded
2) Failed
let s:V = vital#{plugin-name}#new()
let s:A = s:V.import('Assertion')
call s:A.define('Assert', 1)
Assert 0 <=> 1
" Assert 3 <=> 2 :Failed
" > assert_point: /tmp/a.vim, line 7
" > lhs: 3
" > rhs: 2
" function <SNR>140__assertion..<SNR>140__outputter, line 15
B. <!>
It means 'not equal'.
1) Succeeded
let s:V = vital#{plugin-name}#new()
let s:A = s:V.import('Assertion')
call s:A.define('Assert', 1)
Assert 3 <!> 2
" Assert 3 <!> 2 :Succeeded
2) Failed
let s:V = vital#{plugin-name}#new()
let s:A = s:V.import('Assertion')
call s:A.define('Assert', 1)
function! s:hoge()
endfunction
function! s:foo()
" it can be used in a function.
Assert 3 <!> 3
" a script function can not be used.
" Assert 3 <!> s:hoge()
endfunction
call s:foo()
" Assert 3 <!> 3 :Failed
" > assert_point: function <SNR>183_foo, line 1
" > lhs: 3
" > rhs: 3
" function <SNR>183_foo..<SNR>140__assertion..<SNR>140__outputter, line 15
==============================================================================
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl
top - main help file - tag index