-
Notifications
You must be signed in to change notification settings - Fork 64
/
Assertion.txt
109 lines (74 loc) · 2.86 KB
/
Assertion.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
*vital/Assertion.txt* assertion library.
Maintainer: rbtnn <[email protected]>
==============================================================================
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 `define()`.
Default value of {a:1} is `0`.
A command defined by `define()` 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