@@ -6,21 +6,15 @@ function! s:suite.before() abort
6
6
endfunction
7
7
8
8
function ! s: suite .before_each () abort
9
- " Clean all created scratch files
10
- for i in range (0 , 100000 )
11
- let file = printf (g: scratch_buffer_tmp_file_pattern , i )
12
- if ! filereadable (expand (file ))
13
- return
14
- endif
15
- call delete (file )
16
- endfor
9
+ " Clean all created scratch files and buffers
10
+ ScratchBufferCleanAllOf md
17
11
endfunction
18
12
19
13
function ! s: suite .can_make_buffer () abort
20
14
ScratchBufferOpen md
21
15
22
16
const current_file_name = expand (' %:p' )
23
- const expected = printf (g: scratch_buffer_tmp_file_pattern , 0 )
17
+ const expected = printf (g: scratch_buffer_tmp_file_pattern , 0 ) .. ' .md '
24
18
call s: expect (current_file_name).to_equal (expected)
25
19
endfunction
26
20
@@ -30,7 +24,7 @@ function! s:suite.can_make_multiple_buffer() abort
30
24
ScratchBufferOpen md
31
25
32
26
const current_file_name = expand (' %:p' )
33
- const expected = printf (g: scratch_buffer_tmp_file_pattern , 3 )
27
+ const expected = printf (g: scratch_buffer_tmp_file_pattern , 2 ) .. ' .md '
34
28
call s: expect (current_file_name).to_equal (expected)
35
29
endfunction
36
30
@@ -43,3 +37,36 @@ function! s:suite.accept_buffer_size() abort
43
37
ScratchBufferOpen md sp 5
44
38
ScratchBufferOpen md vsp 50
45
39
endfunction
40
+
41
+ function ! s: suite .wipes_opened_files_and_buffer () abort
42
+ ScratchBufferOpen md
43
+ write
44
+ ScratchBufferOpen md
45
+
46
+ const all_buffer_names = scratch_buffer#helper#get_all_buffer_names ()
47
+
48
+ const first_file = printf (g: scratch_buffer_tmp_file_pattern , 0 ) .. ' .md'
49
+ call s: expect (filereadable (first_file)).to_equal (1 )
50
+ call s: expect (
51
+ \ all_buffer_names- >scratch_buffer#helper#contains (first_file),
52
+ \ ).not.to_equal (-1 )
53
+
54
+ const second_file = printf (g: scratch_buffer_tmp_file_pattern , 0 ) .. ' .md'
55
+ call s: expect (filereadable (second_file)).not.to_equal (1 )
56
+ call s: expect (
57
+ \ all_buffer_names- >scratch_buffer#helper#contains (second_file),
58
+ \ ).not.to_equal (-1 )
59
+
60
+ " Wipe all
61
+ ScratchBufferCleanAllOf
62
+ const new_all_buffer_names = scratch_buffer#helper#get_all_buffer_names ()
63
+
64
+ call s: expect (filereadable (first_file)).not.to_equal (1 )
65
+ call s: expect (
66
+ \ new_all_buffer_names- >scratch_buffer#helper#contains (first_file),
67
+ \ ).not.to_equal (-1 )
68
+
69
+ call s: expect (
70
+ \ new_all_buffer_names- >scratch_buffer#helper#contains (second_file),
71
+ \ ).not.to_equal (-1 )
72
+ endfunction
0 commit comments