@@ -218,27 +218,32 @@ defmodule IO.ANSI.DocsTest do
218
218
end
219
219
220
220
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"
223
223
end
224
224
225
225
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"
228
228
end
229
229
230
230
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
233
233
end
234
234
235
235
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"
238
238
end
239
239
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"
243
248
end
244
249
end
0 commit comments