1
1
let s: newline = " \\ n"
2
+ let s: assert = themis#helper (' assert' )
2
3
3
- let s: t = vimtest#new (' convert_to_content' ) " {{{
4
+ let s: t = themis#suite (' convert_to_content' ) " {{{
4
5
5
6
function ! s: t .empty_lines ()
6
7
let arg = []
7
8
let expected = ' '
8
- call self . assert.equals (expected, previm#convert_to_content (arg))
9
+ call s: assert .equals (expected, previm#convert_to_content (arg))
9
10
endfunction
10
11
11
12
function ! s: t .not_exists_escaped ()
12
13
let arg = [' aaabbb' , ' あいうえお漢字' ]
13
14
let expected =
14
15
\ ' aaabbb' . s: newline
15
16
\ . ' あいうえお漢字'
16
- call self . assert.equals (expected, previm#convert_to_content (arg))
17
+ call s: assert .equals (expected, previm#convert_to_content (arg))
17
18
endfunction
18
19
19
20
function ! s: t .exists_backslash ()
20
21
let arg = [' \(x -> x + 2)' , ' あいうえお漢字' ]
21
22
let expected =
22
23
\ ' \\(x -> x + 2)' . s: newline
23
24
\ . ' あいうえお漢字'
24
- call self . assert.equals (expected, previm#convert_to_content (arg))
25
+ call s: assert .equals (expected, previm#convert_to_content (arg))
25
26
endfunction
26
27
27
28
function ! s: t .exists_double_quotes ()
28
29
let arg = [' he said. "Hello, john"' , ' あいうえお漢字' ]
29
30
let expected =
30
31
\ ' he said. \"Hello, john\"' . s: newline
31
32
\ . ' あいうえお漢字'
32
- call self . assert.equals (expected, previm#convert_to_content (arg))
33
+ call s: assert .equals (expected, previm#convert_to_content (arg))
33
34
endfunction
34
35
" }}}
35
- let s: t = vimtest#new (' relative_to_absolute' ) " {{{
36
+ let s: t = themis#suite (' relative_to_absolute' ) " {{{
36
37
37
38
function ! s: t .nothing_when_empty ()
38
39
let arg_line = ' '
39
40
let expected = ' '
40
- call self . assert.equals (expected, previm#relative_to_absolute_imgpath (arg_line, ' ' ))
41
+ call s: assert .equals (expected, previm#relative_to_absolute_imgpath (arg_line, ' ' ))
41
42
endfunction
42
43
43
44
function ! s: t .nothing_when_not_href ()
44
45
let arg_line = ' previm.dummy.com/some/path/img.png'
45
46
let expected = ' previm.dummy.com/some/path/img.png'
46
- call self . assert.equals (expected, previm#relative_to_absolute_imgpath (arg_line, ' ' ))
47
+ call s: assert .equals (expected, previm#relative_to_absolute_imgpath (arg_line, ' ' ))
47
48
endfunction
48
49
49
50
function ! s: t .nothing_when_absolute_by_http ()
50
51
let arg_line = ' http://previm.dummy.com/some/path/img.png'
51
52
let expected = ' http://previm.dummy.com/some/path/img.png'
52
- call self . assert.equals (expected, previm#relative_to_absolute_imgpath (arg_line, ' ' ))
53
+ call s: assert .equals (expected, previm#relative_to_absolute_imgpath (arg_line, ' ' ))
53
54
endfunction
54
55
55
56
function ! s: t .nothing_when_absolute_by_https ()
56
57
let arg_line = ' https://previm.dummy.com/some/path/img.png'
57
58
let expected = ' https://previm.dummy.com/some/path/img.png'
58
- call self . assert.equals (expected, previm#relative_to_absolute_imgpath (arg_line, ' ' ))
59
+ call s: assert .equals (expected, previm#relative_to_absolute_imgpath (arg_line, ' ' ))
59
60
endfunction
60
61
61
62
function ! s: t .nothing_when_absolute_by_file ()
62
63
let arg_line = ' file://previm/some/path/img.png'
63
64
let expected = ' file://previm/some/path/img.png'
64
- call self . assert.equals (expected, previm#relative_to_absolute_imgpath (arg_line, ' ' ))
65
+ call s: assert .equals (expected, previm#relative_to_absolute_imgpath (arg_line, ' ' ))
65
66
endfunction
66
67
67
68
function ! s: t .replace_path_when_relative ()
68
69
let rel_path = ' previm/some/path/img.png'
69
70
let arg_line = printf (' ' , rel_path)
70
71
let arg_dir = ' /Users/foo/tmp'
71
72
let expected = printf (' ' , arg_dir, rel_path)
72
- call self . assert.equals (expected, previm#relative_to_absolute_imgpath (arg_line, arg_dir))
73
+ call s: assert .equals (expected, previm#relative_to_absolute_imgpath (arg_line, arg_dir))
73
74
endfunction
74
75
75
76
function ! s: t .urlencoded_path ()
76
77
let rel_path = ' previm\some\path\img.png'
77
78
let arg_line = printf (' ' , rel_path)
78
79
let arg_dir = ' C:\Documents and Settings\folder'
79
80
let expected = ' '
80
- call self . assert.equals (expected, previm#relative_to_absolute_imgpath (arg_line, arg_dir))
81
+ call s: assert .equals (expected, previm#relative_to_absolute_imgpath (arg_line, arg_dir))
81
82
endfunction
82
83
" }}}
83
- let s: t = vimtest#new (' fetch_imgpath_elements' ) " {{{
84
+ let s: t = themis#suite (' fetch_imgpath_elements' ) " {{{
84
85
85
86
function ! s: t .nothing_when_empty ()
86
87
let arg = ' '
87
88
let expected = s: empty_img_elements ()
88
- call self . assert.equals (expected, previm#fetch_imgpath_elements (arg))
89
+ call s: assert .equals (expected, previm#fetch_imgpath_elements (arg))
89
90
endfunction
90
91
91
92
function ! s: t .nothing_when_not_img_statement ()
92
93
let arg = ' ## hogeほげ'
93
94
let expected = s: empty_img_elements ()
94
- call self . assert.equals (expected, previm#fetch_imgpath_elements (arg))
95
+ call s: assert .equals (expected, previm#fetch_imgpath_elements (arg))
95
96
endfunction
96
97
97
98
function ! s: t .get_title_and_path ()
98
99
let arg = ' '
99
100
let expected = {' title' : ' IMG' , ' path' : ' path/img.png' }
100
- call self . assert.equals (expected, previm#fetch_imgpath_elements (arg))
101
+ call s: assert .equals (expected, previm#fetch_imgpath_elements (arg))
101
102
endfunction
102
103
103
104
function ! s: empty_img_elements ()
104
105
return {' title' : ' ' , ' path' : ' ' }
105
106
endfunction
106
107
" }}}
107
- let s: t = vimtest#new (' refresh_css' ) " {{{
108
+ let s: t = themis#suite (' refresh_css' ) " {{{
108
109
function ! s: t .setup ()
109
110
let self .exist_previm_disable_default_css = 0
110
111
if exists (' g:previm_disable_default_css' )
@@ -136,7 +137,7 @@ endfunction
136
137
function ! s: t .default_content_if_not_exists_setting ()
137
138
call previm#refresh_css ()
138
139
let actual = readfile (previm#make_preview_file_path (' css/previm.css' ))
139
- call self . assert.equals ([
140
+ call s: assert .equals ([
140
141
\ " @import url('origin.css');" ,
141
142
\ " @import url('lib/github.css');" ,
142
143
\ ], actual)
@@ -146,7 +147,7 @@ function! s:t.default_content_if_invalid_setting()
146
147
let g: previm_disable_default_css = 2
147
148
call previm#refresh_css ()
148
149
let actual = readfile (previm#make_preview_file_path (' css/previm.css' ))
149
- call self . assert.equals ([
150
+ call s: assert .equals ([
150
151
\ " @import url('origin.css');" ,
151
152
\ " @import url('lib/github.css');" ,
152
153
\ ], actual)
@@ -159,7 +160,7 @@ function! s:t.custom_content_if_exists_file()
159
160
call previm#refresh_css ()
160
161
161
162
let actual = readfile (previm#make_preview_file_path (' css/previm.css' ))
162
- call self . assert.equals ([" @import url('user_custom.css');" ], actual)
163
+ call s: assert .equals ([" @import url('user_custom.css');" ], actual)
163
164
endfunction
164
165
165
166
function ! s: t .empty_if_not_exists_file ()
@@ -168,6 +169,6 @@ function! s:t.empty_if_not_exists_file()
168
169
call previm#refresh_css ()
169
170
170
171
let actual = readfile (previm#make_preview_file_path (' css/previm.css' ))
171
- call self . assert.equals ([], actual)
172
+ call s: assert .equals ([], actual)
172
173
endfunction
173
174
" }}}
0 commit comments