@@ -24,65 +24,59 @@ describe('callout.md', function()
2424 it (' default' , function ()
2525 util .setup (' demo/callout.md' )
2626
27- local info = ' Info'
28- local ok = ' Success'
29- local hint = ' Hint'
30- local warn = ' Warn'
31- local error = ' Error'
32-
33- local expected = {}
27+ local expected , row = {}, util .row ()
3428
35- local note_start = 0
29+ local info = ' Info '
3630 vim .list_extend (expected , {
37- util .heading (note_start , 1 ),
38- util .quote (note_start + 2 , ' %s ' , info ),
39- callout (note_start + 2 , 2 , 9 , ' Note' , info ),
40- util .quote (note_start + 3 , ' %s' , info ),
41- util .quote (note_start + 4 , ' %s ' , info ),
42- util .quote (note_start + 5 , ' %s' , info ),
43- util .quote (note_start + 6 , ' %s ' , info ),
31+ util .heading (row : get () , 1 ),
32+ util .quote (row : increment ( 2 ) , ' %s ' , info ),
33+ callout (row : get () , 2 , 9 , ' Note' , info ),
34+ util .quote (row : increment () , ' %s' , info ),
35+ util .quote (row : increment () , ' %s ' , info ),
36+ util .quote (row : increment () , ' %s' , info ),
37+ util .quote (row : increment () , ' %s ' , info ),
4438 })
4539
46- local tip_start = 8
40+ local ok = ' Success '
4741 vim .list_extend (expected , {
48- util .heading (tip_start , 1 ),
49- util .quote (tip_start + 2 , ' %s ' , ok ),
50- callout (tip_start + 2 , 2 , 8 , ' Tip' , ok ),
51- util .quote (tip_start + 3 , ' %s' , ok ),
52- util .quote (tip_start + 4 , ' %s ' , ok ),
53- util .code_row (tip_start + 4 , 2 ),
54- util .code_language (tip_start + 4 , 5 , 8 , ' lua' ),
55- util .quote (tip_start + 5 , ' %s ' , ok ),
56- util .code_row (tip_start + 5 , 2 ),
57- util .quote (tip_start + 6 , ' %s ' , ok ),
58- util .code_below (tip_start + 6 , 2 ),
42+ util .heading (row : increment ( 2 ) , 1 ),
43+ util .quote (row : increment ( 2 ) , ' %s ' , ok ),
44+ callout (row : get () , 2 , 8 , ' Tip' , ok ),
45+ util .quote (row : increment () , ' %s' , ok ),
46+ util .quote (row : increment () , ' %s ' , ok ),
47+ util .code_row (row : get () , 2 ),
48+ util .code_language (row : get () , 5 , 8 , ' lua' ),
49+ util .quote (row : increment () , ' %s ' , ok ),
50+ util .code_row (row : get () , 2 ),
51+ util .quote (row : increment () , ' %s ' , ok ),
52+ util .code_below (row : get () , 2 ),
5953 })
6054
61- local important_start = 16
55+ local hint = ' Hint '
6256 vim .list_extend (expected , {
63- util .heading (important_start , 1 ),
64- util .quote (important_start + 2 , ' %s ' , hint ),
65- callout (important_start + 2 , 2 , 14 , ' Important' , hint ),
66- util .quote (important_start + 3 , ' %s ' , hint ),
57+ util .heading (row : increment ( 2 ) , 1 ),
58+ util .quote (row : increment ( 2 ) , ' %s ' , hint ),
59+ callout (row : get () , 2 , 14 , ' Important' , hint ),
60+ util .quote (row : increment ( 1 ) , ' %s ' , hint ),
6761 })
6862
69- local warning_start = 21
63+ local warn = ' Warn '
7064 vim .list_extend (expected , {
71- util .heading (warning_start , 1 ),
72- util .quote (warning_start + 2 , ' %s ' , warn ),
73- callout (warning_start + 2 , 2 , 12 , ' Custom Title' , warn , ' ' ),
74- util .quote (warning_start + 3 , ' %s ' , warn ),
65+ util .heading (row : increment ( 2 ) , 1 ),
66+ util .quote (row : increment ( 2 ) , ' %s ' , warn ),
67+ callout (row : get () , 2 , 12 , ' Custom Title' , warn , ' ' ),
68+ util .quote (row : increment () , ' %s ' , warn ),
7569 })
7670
77- local caution_start = 26
71+ local error = ' Error '
7872 vim .list_extend (expected , {
79- util .heading (caution_start , 1 ),
80- util .quote (caution_start + 2 , ' %s ' , error ),
81- callout (caution_start + 2 , 2 , 12 , ' Caution' , error ),
82- util .quote (caution_start + 3 , ' %s ' , error ),
73+ util .heading (row : increment ( 2 ) , 1 ),
74+ util .quote (row : increment ( 2 ) , ' %s ' , error ),
75+ callout (row : get () , 2 , 12 , ' Caution' , error ),
76+ util .quote (row : increment () , ' %s ' , error ),
8377 })
8478
85- vim .list_extend (expected , util .heading (31 , 1 ))
79+ vim .list_extend (expected , util .heading (row : increment ( 2 ) , 1 ))
8680
8781 local actual = util .get_actual_marks ()
8882 util .marks_are_equal (expected , actual )
0 commit comments