t/09-padding.rb in Spreadsheet-HTML-0.0.8 vs t/09-padding.rb in Spreadsheet-HTML-0.0.9
- old
+ new
@@ -48,12 +48,42 @@
gen.generate( 'fill' => '3x5' ),
"fill works with no data"
)
assert_equal(
+ '<table><tr><th>header1</th><th>header2</th></tr><tr><td>foo1</td><td>bar1</td></tr><tr><td>foo2</td><td>bar2</td></tr></table>',
+ gen.generate( 'fill' => '1x2', 'data' => data ),
+ "fill does not truncate larger data"
+ )
+
+ assert_equal(
'<table><tr><th> </th></tr></table>',
+ gen.generate( 'fill' => nil ),
+ "fill defaults to 1x1 with with invalid data (nil)"
+ )
+
+ assert_equal(
+ '<table><tr><th> </th></tr></table>',
+ gen.generate( 'fill' => '' ),
+ "fill defaults to 1x1 with with invalid data (empty)"
+ )
+
+ assert_equal(
+ '<table><tr><th> </th></tr></table>',
gen.generate( 'fill' => '0x0' ),
"fill defaults to 1x1 with with invalid data (zero)"
+ )
+
+ assert_equal(
+ '<table><tr><th> </th></tr></table>',
+ gen.generate( 'fill' => '-2x4' ),
+ "fill defaults to 1x1 with with invalid data (first negative)"
+ )
+
+ assert_equal(
+ '<table><tr><th> </th></tr></table>',
+ gen.generate( 'fill' => '1x-3' ),
+ "fill defaults to 1x1 with with invalid data (second negative)"
)
assert_equal(
'<table><tr><th> </th></tr></table>',
gen.generate( 'fill' => 'axb' ),