1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
pry--pry/spec/helpers
Kyrylo Silin 9074613927 Helpers::tablify: fix FloatDomainError
Before this commit the following snippet didn't work:

  pry(main)> Pry::Helpers.tablify(['foobar', 'baz'], 5)
  #=> FloatDomainError

There was a divison by zero in `Helpers::Table#_recolumn`.

The problem is incorrectly written `until` loop condition. Note that the
longest element in the array has 6 characters. But the second argument
tells `::tablify` that the line width is only 5 characters long.

This commit changes the condition. Now, if you run the same snippet, you
would see that the elements form one column (and the code doesn't blow
up your program).

Possibly, in the described case, the table has unwanted blanks. However,
I'm not very competent in the code, so I'd better not touch it, because
it works.
2013-01-27 06:12:35 +02:00
..
bacon.rb Move some testing code into spec/helpers/ 2012-12-08 17:14:25 -08:00
mock_pry.rb Remove more rep() from spec/pry_spec.rb 2012-12-18 00:11:08 -08:00
repl_tester.rb Tidier test for BasicObject support 2012-12-28 14:19:38 -08:00
table_spec.rb Helpers::tablify: fix FloatDomainError 2013-01-27 06:12:35 +02:00