Skip to content

Commit 7b130b9

Browse files
committed
patch 8.2.2105: sound test is a bit flaky
Problem: Sound test is a bit flaky. Solution: Use WaitForAssert(). (Dominique Pellé, closes #7429)
1 parent d5a986f commit 7b130b9

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/testdir/test_sound.vim

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
" Tests for the sound feature
22

3+
source shared.vim
4+
35
if !has('sound')
46
throw 'Skipped: sound feature not available'
57
endif
@@ -13,15 +15,15 @@ func Test_play_event()
1315
if has('win32')
1416
throw 'Skipped: Playing event with callback is not supported on Windows'
1517
endif
18+
let g:id = 0
1619
let id = 'bell'->sound_playevent('PlayCallback')
1720
if id == 0
1821
throw 'Skipped: bell event not available'
1922
endif
2023
" Stop it quickly, avoid annoying the user.
2124
sleep 20m
2225
eval id->sound_stop()
23-
sleep 30m
24-
call assert_equal(id, g:id)
26+
call WaitForAssert({-> assert_equal(id, g:id)})
2527
call assert_equal(1, g:result) " sound was aborted
2628
endfunc
2729

@@ -37,17 +39,15 @@ func Test_play_silent()
3739
" play until the end
3840
let id2 = fname->sound_playfile('PlayCallback')
3941
call assert_true(id2 > 0)
40-
sleep 500m
41-
call assert_equal(id2, g:id)
42+
call WaitForAssert({-> assert_equal(id2, g:id)})
4243
call assert_equal(0, g:result)
4344

4445
let id2 = sound_playfile(fname, 'PlayCallback')
4546
call assert_true(id2 > 0)
4647
sleep 20m
4748
call sound_clear()
48-
sleep 30m
49-
call assert_equal(id2, g:id)
50-
call assert_equal(1, g:result)
49+
call WaitForAssert({-> assert_equal(id2, g:id)})
50+
call assert_equal(1, g:result) " sound was aborted
5151

5252
" recursive use was causing a crash
5353
func PlayAgain(id, fname)
@@ -59,8 +59,7 @@ func Test_play_silent()
5959
call assert_true(id3 > 0)
6060
sleep 50m
6161
call sound_clear()
62-
sleep 30m
63-
call assert_true(g:id_again > 0)
62+
call WaitForAssert({-> assert_true(g:id > 0)})
6463
endfunc
6564

6665
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2105,
753755
/**/
754756
2104,
755757
/**/

0 commit comments

Comments
 (0)