All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Tests atx and setext folding, and :Toc.
4 source ../after/ftplugin/markdown.vim
8 setlocal foldmethod=manual
20 # this is another comment
71 AssertEqual foldlevel(1), 0, '# chap 1'
72 AssertEqual foldlevel(3), 1, 'hello'
73 AssertEqual foldlevel(6), 1, '```bash'
74 AssertEqual foldlevel(7), 1, '# some bash scripting'
75 AssertEqual foldlevel(15), 1, '## chap 1.1'
76 AssertEqual foldlevel(21), 2, 'mkdir foo'
77 AssertEqual foldlevel(25), 2, '### chap 1.1.1'
78 AssertEqual foldlevel(27), 3, '- dragons'
79 AssertEqual foldlevel(30), 1, '# chap 2'
80 AssertEqual foldlevel(32), 1, 'another'
81 AssertEqual foldlevel(34), 1, '# chap 2.1'
82 AssertEqual foldlevel(37), 2, '- japan'
83 AssertEqual foldlevel(41), 1, '# chap 3'
84 AssertEqual foldlevel(45), 1, 'chap 4\n======'
85 AssertEqual foldlevel(48), 1, 'setext are evil'
86 AssertEqual foldlevel(50), 2, 'chap 4.1\n------'
87 " BUG: for lines 30, 41, 45, the foldlevel should be 0.
88 " The folding behavior itself is correct, but the level number isn't.
90 Execute (fold text result):
91 AssertEqual foldtextresult(2), '+-- 28 lines: hello'
92 AssertEqual foldtextresult(31), '+-- 10 lines: another'
93 AssertEqual foldtextresult(42), '+-- 3 lines: nothing here'
94 AssertEqual foldtextresult(45), '+-- 14 lines: chap 4'
95 " BUG: for line 45, vim shows and calling foldtextresult even echoes 15 lines.
100 let res = getloclist(0)
102 AssertEqual elem.lnum, 1
103 AssertEqual elem.text, '# chap 1'
105 AssertEqual elem.lnum, 15
106 AssertEqual elem.text, '## chap 1.1'
108 AssertEqual elem.lnum, 25
109 AssertEqual elem.text, '### chap 1.1.1'
111 AssertEqual elem.lnum, 30
112 AssertEqual elem.text, '# chap 2'
114 AssertEqual elem.lnum, 34
115 AssertEqual elem.text, '## chap 2.1'
117 AssertEqual elem.lnum, 41
118 AssertEqual elem.text, '# chap 3'
120 AssertEqual elem.lnum, 45
121 AssertEqual elem.text, 'chap 4'
123 AssertEqual elem.lnum, 50
124 AssertEqual elem.text, 'chap 4.1'