@@ -92,6 +92,32 @@ def test_parse_arguments_multiline
9292 assert_equal expected , @TD . parse ( text )
9393 end
9494
95+ def test_parse_arguments_nested
96+ text = <<-TEXT
97+ Do some stuff
98+
99+ foo - A comment goes here
100+ :bar - bar documentation
101+ TEXT
102+
103+ expected =
104+ @RM ::Document . new (
105+ @RM ::Paragraph . new ( 'Do some stuff' ) ,
106+ @RM ::BlankLine . new ,
107+ @RM ::List . new (
108+ :LABEL ,
109+ @RM ::ListItem . new (
110+ 'foo' ,
111+ @RM ::Paragraph . new ( 'A comment goes here' ) ,
112+ @RM ::List . new (
113+ :LABEL ,
114+ @RM ::ListItem . new (
115+ ':bar' ,
116+ @RM ::Paragraph . new ( 'bar documentation' ) ) ) ) ) )
117+
118+ assert_equal expected , @TD . parse ( text )
119+ end
120+
95121 def test_parse_examples
96122 text = <<-TEXT
97123Do some stuff
@@ -201,6 +227,29 @@ def test_tokenize_arguments_multiline
201227 assert_equal expected , @td . tokens
202228 end
203229
230+ def test_tokenize_arguments_nested
231+ @td . tokenize <<-TEXT
232+ Do some stuff
233+
234+ foo - A comment goes here
235+ :bar - bar documentation
236+ TEXT
237+
238+ expected = [
239+ [ :TEXT , "Do some stuff" , 0 , 0 ] ,
240+ [ :NEWLINE , "\n " , 13 , 0 ] ,
241+ [ :NEWLINE , "\n " , 0 , 1 ] ,
242+ [ :LABEL , "foo" , 0 , 2 ] ,
243+ [ :TEXT , "A comment goes here" , 6 , 2 ] ,
244+ [ :NEWLINE , "\n " , 25 , 2 ] ,
245+ [ :LABEL , ":bar" , 6 , 3 ] ,
246+ [ :TEXT , "bar documentation" , 13 , 3 ] ,
247+ [ :NEWLINE , "\n " , 30 , 3 ] ,
248+ ]
249+
250+ assert_equal expected , @td . tokens
251+ end
252+
204253 def test_tokenize_examples
205254 @td . tokenize <<-TEXT
206255Do some stuff
0 commit comments