-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUT.vim
More file actions
86 lines (76 loc) · 2.25 KB
/
Copy pathUT.vim
File metadata and controls
86 lines (76 loc) · 2.25 KB
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
"=============================================================================
" File: tests/lh/UT.vim {{{1
" Author: Luc Hermitte <EMAIL:hermitte {at} free {dot} fr>
" <URL:http://github.com/LucHermitte/vim-UT>
" Version: 0.4.0
" Created: 11th Feb 2009
" Last Update: 09th Dec 2015
"------------------------------------------------------------------------
" Description: UnitTests for the UT plugin.
" - Tests global assertions
" - Tests assertions definied in tests (functions s:Test)
"
"------------------------------------------------------------------------
" Installation: «install details»
" History: «history»
" TODO: «missing features»
" }}}1
"=============================================================================
let s:cpo_save=&cpo
set cpo&vim
"------------------------------------------------------------------------
UTSuite [lh#UT] Testing global and local assertions
Assert 1 == 1
:Assert 1 == 1
AssertEqual(1,1)
:AssertEqual(1,1)
Assert 1 != 42
AssertDiffers(1, 42)
:AssertDiffers(1, 42)
Assert 1 < 20
Assert 1 > 20
let st = "string"
Assert st =~ 'str'
AssertMatches(st, 'str')
:AssertMatches(st, 'str')
Assert st !~ 'str'
Assert st == 'str'
Assert st != 'str'
Assert st == 0
AssertThrows 0 + [0]
function! s:One()
return 1
endfunction
Assert s:One() == 1
"------------------------------------------------------------------------
function! s:TestOK()
Comment "TestOK"
Assert! 1 == 1
Assert 1 == 1
Assert repeat('1', 5) == '11111'
Assert! repeat('1', 5) == '11111'
endfunction
"------------------------------------------------------------------------
function! s:TestCriticalNOK()
Comment "TestCriticalNOK"
Assert! 1 == 0
Assert repeat('1', 5) == '1111'
endfunction
"------------------------------------------------------------------------
function! s:TestNOK()
Comment "TestNOK"
Assert 0 == 1
Assert repeat('1', 5) == '1111'
endfunction
function! s:Foo() abort
throw "No way!!!"
endfunction
function! s:TestException()
Comment "Test Exception"
AssertThrows s:Foo()
Assert s:Foo() == 1
endfunction
"------------------------------------------------------------------------
let &cpo=s:cpo_save
"=============================================================================
" vim600: set fdm=marker: