@@ -135,5 +135,37 @@ r0SZNYouvk7tY6rDz0Z62WRwOtrBx0D/5T0E9kT3rpnB
135135 baz buzz''' );
136136 expect (doc.sections[0 ].headline.keyword? .value, 'TODO' );
137137 });
138+ group ('whitespace-only content' , () {
139+ test ('document containing only spaces' , () {
140+ final result = parser.parse (' ' );
141+ expect (result, isA <Success <dynamic >>());
142+ final document = result.value as OrgDocument ;
143+ final paragraph = document.content! .children.single as OrgParagraph ;
144+ expect (paragraph.indent, ' ' );
145+ expect (paragraph.body.children, isEmpty);
146+ expect (paragraph.trailing, '' );
147+ });
148+
149+ test ('document containing only tabs' , () {
150+ final result = parser.parse ('\t ' );
151+ expect (result, isA <Success <dynamic >>());
152+ final document = result.value as OrgDocument ;
153+ final paragraph = document.content! .children.single as OrgParagraph ;
154+ expect (paragraph.indent, '\t ' );
155+ expect (paragraph.body.children, isEmpty);
156+ expect (paragraph.trailing, '' );
157+ });
158+
159+ test ('section content ending with spaces only' , () {
160+ final result = parser.parse ('* x\n ' );
161+ expect (result, isA <Success <dynamic >>());
162+ final document = result.value as OrgDocument ;
163+ final paragraph = document.sections.single.content! .children.single
164+ as OrgParagraph ;
165+ expect (paragraph.indent, ' ' );
166+ expect (paragraph.body.children, isEmpty);
167+ expect (paragraph.trailing, '' );
168+ });
169+ });
138170 });
139171}
0 commit comments