@@ -218,27 +218,32 @@ defmodule IO.ANSI.DocsTest do
218218 end
219219
220220 test "lone thing that looks like a table line isn't" do
221- result = format ( "one\n 2 | 3\n two\n " )
222- assert result == "one 2 | 3 two\n \e [0m"
221+ assert format ( "one\n 2 | 3\n two\n " ) ==
222+ "one 2 | 3 two\n \e [0m"
223223 end
224224
225225 test "lone table line at end of input isn't" do
226- result = format ( "one\n 2 | 3" )
227- assert result == "one 2 | 3\n \e [0m"
226+ assert format ( "one\n 2 | 3" ) ==
227+ "one 2 | 3\n \e [0m"
228228 end
229229
230230 test "two successive table lines are a table" do
231- result = format ( "a | b\n one | two\n " )
232- assert result == "a | b \n one | two\n \e [0m" # note spacing
231+ assert format ( "a | b\n one | two\n " ) ==
232+ "a | b \n one | two\n \e [0m" # note spacing
233233 end
234234
235235 test "table with heading" do
236- result = format ( "column 1 | and 2\n -- | --\n a | b\n one | two\n " )
237- assert result == "\e [7mcolumn 1 | and 2\e [0m\n a | b \n one | two \n \e [0m"
236+ assert format ( "column 1 | and 2\n -- | --\n a | b\n one | two\n " ) ==
237+ "\e [7mcolumn 1 | and 2\e [0m\n a | b \n one | two \n \e [0m"
238238 end
239239
240- test "formatting in a table cell works" do
241- result = format ( "`a` | _b_\n c | d" )
242- assert result == "\e [36ma\e [0m | \e [4mb\e [0m\n c | d\n \e [0m"
240+ test "table with formatting in cells" do
241+ assert format ( "`a` | _b_\n c | d" ) ==
242+ "\e [36ma\e [0m | \e [4mb\e [0m\n c | d\n \e [0m"
243+ end
244+
245+ test "table with variable number of columns" do
246+ assert format ( "a | b | c\n d | e" ) ==
247+ "a | b | c\n d | e | \n \e [0m"
243248 end
244249end
0 commit comments