@@ -3,6 +3,30 @@ scriptencoding utf-8
3
3
let s: suite = themis#suite (' Validator.Args' )
4
4
let s: assert = themis#helper (' assert' )
5
5
6
+ function ! s: assert_null_support () abort
7
+ if ! exists (' v:null' )
8
+ Skip " this version of vim/neovim does not support v:null"
9
+ endif
10
+ endfunction
11
+
12
+ function ! s: assert_job_support () abort
13
+ if ! exists (' *test_null_job' )
14
+ Skip " this version of vim does not support job"
15
+ endif
16
+ endfunction
17
+
18
+ function ! s: assert_channel_support () abort
19
+ if ! exists (' *test_null_channel' )
20
+ Skip " this version of vim does not support channel"
21
+ endif
22
+ endfunction
23
+
24
+ function ! s: assert_blob_support () abort
25
+ if ! exists (' *test_null_blob' )
26
+ Skip " this version of vim does not support blob"
27
+ endif
28
+ endfunction
29
+
6
30
function ! s: suite .before ()
7
31
let s: A = vital#vital#import (' Validator.Args' )
8
32
endfunction
@@ -25,12 +49,16 @@ function! s:suite.__of__()
25
49
\ A.of (3.14 )
26
50
Throws /^vital: Validator.Args: of(): expected string argument but got bool/
27
51
\ A.of (v: false )
52
+ call s: assert_null_support ()
28
53
Throws /^vital: Validator.Args: of(): expected string argument but got none/
29
54
\ A.of (v: null )
55
+ call s: assert_job_support ()
30
56
Throws /^vital: Validator.Args: of(): expected string argument but got job/
31
57
\ A.of (test_null_job ())
58
+ call s: assert_channel_support ()
32
59
Throws /^vital: Validator.Args: of(): expected string argument but got channel/
33
60
\ A.of (test_null_channel ())
61
+ call s: assert_blob_support ()
34
62
Throws /^vital: Validator.Args: of(): expected string argument but got blob/
35
63
\ A.of (test_null_blob ())
36
64
endfunction
@@ -79,12 +107,16 @@ function! s:suite.__of__()
79
107
\ A.of (' test()' ).type ([v: t_string , v: t_func ]).validate ([3.14 ])
80
108
Throws /^test(): invalid type arguments were given (expected: string or func, got: bool)/
81
109
\ A.of (' test()' ).type ([v: t_string , v: t_func ]).validate ([v: false ])
110
+ call s: assert_null_support ()
82
111
Throws /^test(): invalid type arguments were given (expected: string or func, got: none)/
83
112
\ A.of (' test()' ).type ([v: t_string , v: t_func ]).validate ([v: null ])
113
+ call s: assert_job_support ()
84
114
Throws /^test(): invalid type arguments were given (expected: string or func, got: job)/
85
115
\ A.of (' test()' ).type ([v: t_string , v: t_func ]).validate ([test_null_job ()])
116
+ call s: assert_channel_support ()
86
117
Throws /^test(): invalid type arguments were given (expected: string or func, got: channel)/
87
118
\ A.of (' test()' ).type ([v: t_string , v: t_func ]).validate ([test_null_channel ()])
119
+ call s: assert_blob_support ()
88
120
Throws /^test(): invalid type arguments were given (expected: string or func, got: blob)/
89
121
\ A.of (' test()' ).type ([v: t_string , v: t_func ]).validate ([test_null_blob ()])
90
122
endfunction
@@ -97,9 +129,13 @@ function! s:suite.__of__()
97
129
call s: A .of (' test()' ).type (' any' ).validate ([{}])
98
130
call s: A .of (' test()' ).type (' any' ).validate ([3.14 ])
99
131
call s: A .of (' test()' ).type (' any' ).validate ([v: false ])
132
+ call s: assert_null_support ()
100
133
call s: A .of (' test()' ).type (' any' ).validate ([v: null ])
134
+ call s: assert_job_support ()
101
135
call s: A .of (' test()' ).type (' any' ).validate ([test_null_job ()])
136
+ call s: assert_channel_support ()
102
137
call s: A .of (' test()' ).type (' any' ).validate ([test_null_channel ()])
138
+ call s: assert_blob_support ()
103
139
call s: A .of (' test()' ).type (' any' ).validate ([test_null_blob ()])
104
140
endfunction
105
141
@@ -118,12 +154,16 @@ function! s:suite.__of__()
118
154
\ A.of (' test()' ).type (v: t_string ).validate ([3.14 ])
119
155
Throws /^test(): invalid type arguments were given (expected: string, got: bool)/
120
156
\ A.of (' test()' ).type (v: t_string ).validate ([v: false ])
157
+ call s: assert_null_support ()
121
158
Throws /^test(): invalid type arguments were given (expected: string, got: none)/
122
159
\ A.of (' test()' ).type (v: t_string ).validate ([v: null ])
160
+ call s: assert_job_support ()
123
161
Throws /^test(): invalid type arguments were given (expected: string, got: job)/
124
162
\ A.of (' test()' ).type (v: t_string ).validate ([test_null_job ()])
163
+ call s: assert_channel_support ()
125
164
Throws /^test(): invalid type arguments were given (expected: string, got: channel)/
126
165
\ A.of (' test()' ).type (v: t_string ).validate ([test_null_channel ()])
166
+ call s: assert_blob_support ()
127
167
Throws /^test(): invalid type arguments were given (expected: string, got: blob)/
128
168
\ A.of (' test()' ).type (v: t_string ).validate ([test_null_blob ()])
129
169
endfunction
@@ -143,12 +183,16 @@ function! s:suite.__of__()
143
183
\ A.of (' test()' ).type (' any' ).validate (3.14 )
144
184
Throws /^vital: Validator.Args: Validator.validate(): expected list argument but got bool/
145
185
\ A.of (' test()' ).type (' any' ).validate (v: false )
186
+ call s: assert_null_support ()
146
187
Throws /^vital: Validator.Args: Validator.validate(): expected list argument but got none/
147
188
\ A.of (' test()' ).type (' any' ).validate (v: null )
189
+ call s: assert_job_support ()
148
190
Throws /^vital: Validator.Args: Validator.validate(): expected list argument but got job/
149
191
\ A.of (' test()' ).type (' any' ).validate (test_null_job ())
192
+ call s: assert_channel_support ()
150
193
Throws /^vital: Validator.Args: Validator.validate(): expected list argument but got channel/
151
194
\ A.of (' test()' ).type (' any' ).validate (test_null_channel ())
195
+ call s: assert_blob_support ()
152
196
Throws /^vital: Validator.Args: Validator.validate(): expected list argument but got blob/
153
197
\ A.of (' test()' ).type (' any' ).validate (test_null_blob ())
154
198
endfunction
0 commit comments