html-table 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,62 @@
1
+ ##############################################################################
2
+ # intermediate2.rb
3
+ #
4
+ # A slightly more advanced HTML Table. This time we'll add some attributes,
5
+ # add a few rows both implicitly and explicitly, then configure it
6
+ # after-the-fact. We'll also play with Captions and Headers and generally
7
+ # do things slightly different that intermdiate1.rb.
8
+ #
9
+ # You can run this via the "example:intermediate2" rake task.
10
+ ##############################################################################
11
+ require 'html/table'
12
+ include HTML
13
+
14
+ table = Table.new
15
+ table.border = 1
16
+ table.cellpadding = 5
17
+
18
+ caption = Table::Caption.new
19
+ caption.content = "This is a caption!"
20
+
21
+ row1 = Table::Row.new
22
+ row2 = Table::Row.new
23
+
24
+ row1.bgcolor = "red"
25
+ row2.bgcolor = "blue"
26
+
27
+ d1 = Table::Row::Data.new{ |d| d.content = "foo" }
28
+ d2 = Table::Row::Data.new{ |d| d.content = "bar" }
29
+ d3 = Table::Row::Data.new{ |d| d.content = "baz" }
30
+
31
+ row1[0..2] = d1, d2, d3
32
+
33
+ d4 = Table::Row::Data.new{ |d| d.content = "hello" }
34
+ d5 = Table::Row::Data.new{ |d| d.content = "world" }
35
+
36
+ h1 = Table::Row::Header.new
37
+ h1.content = "This is a header"
38
+ h1.colspan = 2
39
+
40
+ row2.unshift h1
41
+ row2.push d4, d5
42
+
43
+ table.push row1, row2
44
+ table.push caption # automatically bumped to row 0
45
+
46
+ puts table.html
47
+
48
+ =begin
49
+ <table border=1 cellpadding=5>
50
+ <caption>This is a caption!</caption>
51
+ <tr bgcolor='red'>
52
+ <td>foo</td>
53
+ <td>bar</td>
54
+ <td>baz</td>
55
+ </tr>
56
+ <tr bgcolor='blue'>
57
+ <th colspan=2>This is a header</th>
58
+ <td>hello</td>
59
+ <td>world</td>
60
+ </tr>
61
+ </table>
62
+ =end
@@ -0,0 +1,46 @@
1
+ #######################################################################
2
+ # intermediate3.rb
3
+ #
4
+ # This example demonstrates some intermediate features, including the
5
+ # DSL style syntax and physical tag handling.
6
+ #
7
+ # You can run this example via the "example:intermediate3" rake task.
8
+ #######################################################################
9
+ require 'html/table'
10
+ include HTML
11
+
12
+ # You can set physical tags inline using block syntax...
13
+ table = Table.new do
14
+ align 'left'
15
+ bgcolor 'red'
16
+ header [['header1', 'header2']]
17
+ content [['foo', 'bar']]
18
+ content [['baz', 'blah']] do
19
+ underline true
20
+ tt true
21
+ end
22
+ end
23
+
24
+ # Or you can do it this way
25
+ table[1][0].content.bold = true
26
+ table[1][1].content.italic = true
27
+
28
+ puts table.html
29
+
30
+ =begin
31
+ ### OUTPUT ###
32
+ <table align='left' bgcolor='red'>
33
+ <tr>
34
+ <th>header1</th>
35
+ <th>header2</th>
36
+ </tr>
37
+ <tr>
38
+ <td><b>foo</b></td>
39
+ <td><i>bar</i></td>
40
+ </tr>
41
+ <tr>
42
+ <td><tt><u>baz</u></tt></td>
43
+ <td><tt><u>blah</u></tt></td>
44
+ </tr>
45
+ </table>
46
+ =end
@@ -0,0 +1,39 @@
1
+ #######################################################################
2
+ # simple1.rb
3
+ #
4
+ # Very plain HTML Table with rows and data implicitly created.
5
+ #
6
+ # You can run this example via the "example:sample1" rake task.
7
+ #######################################################################
8
+ require 'html/table'
9
+ include HTML
10
+
11
+ table = Table.new{ |t|
12
+ t.content = [
13
+ %w/foo bar baz/,
14
+ %w/1 2 3/,
15
+ %w/hello world/
16
+ ]
17
+ }
18
+
19
+ puts table.html
20
+
21
+ =begin
22
+ ### OUTPUT ###
23
+ <table>
24
+ <tr>
25
+ <td>foo</td>
26
+ <td>bar</td>
27
+ <td>baz</td>
28
+ </tr>
29
+ <tr>
30
+ <td>1</td>
31
+ <td>2</td>
32
+ <td>3</td>
33
+ </tr>
34
+ <tr>
35
+ <td>hello</td>
36
+ <td>world</td>
37
+ </tr>
38
+ </table>
39
+ =end
@@ -0,0 +1,47 @@
1
+ #######################################################################
2
+ # simple2.rb
3
+ #
4
+ # Very plain HTML Table with rows explicitly created and data
5
+ # elements implicitly created. We also remove the end tags
6
+ # and capitalize the HTML tags and attributes.
7
+ #
8
+ # You can run this sample via the "example:simple2" rake task.
9
+ #######################################################################
10
+ require 'html/table'
11
+ include HTML
12
+
13
+ Table.html_case = "upper"
14
+ Table::Row.end_tags = false
15
+ Table::Row::Data.end_tags = false
16
+
17
+ table = Table.new
18
+ tr1 = Table::Row.new
19
+ tr2 = Table::Row.new
20
+ tr3 = Table::Row.new
21
+
22
+ tr1.content = "foo", "bar", "baz"
23
+ tr2.content = 1,2,3
24
+ tr3.content = %w/hello world/
25
+
26
+ table.push(tr1,tr2,tr3)
27
+
28
+ table[0][1].align = "left"
29
+
30
+ puts table.html
31
+
32
+ =begin
33
+ ### OUTPUT ###
34
+ <TABLE>
35
+ <TR>
36
+ <TD>foo
37
+ <TD ALIGN='LEFT'>bar
38
+ <TD>baz
39
+ <TR>
40
+ <TD>1
41
+ <TD>2
42
+ <TD>3
43
+ <TR>
44
+ <TD>hello
45
+ <TD>world
46
+ </TABLE>
47
+ =end
@@ -0,0 +1,41 @@
1
+ #######################################################################
2
+ # simple3.rb
3
+ #
4
+ # Very plain HTML Table with rows and data implicitly created. This
5
+ # script passes an argument to the constructor, which is automatically
6
+ # interpreted as content.
7
+ #
8
+ # You can run this script via the "example:simple3" rake task.
9
+ #######################################################################
10
+ require 'html/table'
11
+ include HTML
12
+
13
+ m = [
14
+ ['foo', 'bar', 'baz'],
15
+ [1, 2, 3],
16
+ ['hello', 'world']
17
+ ]
18
+
19
+ table = Table.new(m)
20
+
21
+ puts table.html
22
+
23
+ =begin
24
+ ### OUTPUT ###
25
+ <table>
26
+ <tr>
27
+ <td>foo</td>
28
+ <td>bar</td>
29
+ <td>baz</td>
30
+ </tr>
31
+ <tr>
32
+ <td>1</td>
33
+ <td>2</td>
34
+ <td>3</td>
35
+ </tr>
36
+ <tr>
37
+ <td>hello</td>
38
+ <td>world</td>
39
+ </tr>
40
+ </table>
41
+ =end
data/html-table.gemspec CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  spec = Gem::Specification.new do |gem|
4
4
  gem.name = 'html-table'
5
- gem.version = '1.3.2'
5
+ gem.version = '1.3.3'
6
6
  gem.author = 'Daniel J. Berger'
7
7
  gem.email = 'djberg96@gmail.com'
8
8
  gem.homepage = 'http://shards.rubyforge.org'
@@ -12,14 +12,16 @@ spec = Gem::Specification.new do |gem|
12
12
  gem.description = 'A Ruby interface for generating HTML tables'
13
13
  gem.test_files = Dir['test/*.rb']
14
14
  gem.has_rdoc = true
15
- gem.files = Dir['lib/html/*'] + Dir['[A-Z]*'] + Dir['test/*'] + Dir['doc/*']
15
+ gem.files = Dir['lib/html/*'] + Dir['[A-Z]*'] + Dir['examples/*.rb'] + Dir['test/*'] + Dir['doc/*']
16
16
  gem.files.reject! { |fn| fn.include? 'CVS' }
17
17
  gem.extra_rdoc_files = ['README', 'CHANGES'] + Dir['doc/*.rdoc']
18
18
  gem.require_path = 'lib'
19
19
  gem.add_dependency('strongtyping')
20
+ gem.add_dependency('test-unit')
21
+ gem.add_dependency('structured_warnings')
20
22
  end
21
23
 
22
24
  if $0 == __FILE__
23
- Gem.manage_gems
25
+ Gem.manage_gems if Gem::RubyGemsVersion.to_f < 1.0
24
26
  Gem::Builder.new(spec).build
25
27
  end
@@ -48,10 +48,8 @@ module AttributeHandler
48
48
 
49
49
  def background=(url)
50
50
  raise TypeError unless url.kind_of?(String)
51
- if $VERBOSE
52
- msg = "'background' is a non-standard extension"
53
- STDERR.puts msg
54
- end
51
+ msg = "'background' is a non-standard extension"
52
+ warn NonStandardExtensionWarning, msg
55
53
  @background = url
56
54
  modify_html("background", url)
57
55
  end
@@ -93,10 +91,8 @@ module AttributeHandler
93
91
 
94
92
  def bordercolor=(color)
95
93
  @bordercolor = color
96
- if $VERBOSE
97
- msg = "'bordercolor' is a non-standard extension"
98
- STDERR.puts msg
99
- end
94
+ msg = "'bordercolor' is a non-standard extension"
95
+ warn NonStandardExtensionWarning, msg
100
96
  modify_html("bordercolor", color)
101
97
  end
102
98
 
@@ -108,10 +104,8 @@ module AttributeHandler
108
104
 
109
105
  def bordercolordark=(color)
110
106
  @bordercolordark = color
111
- if $VERBOSE
112
- msg = "'bordercolordark' is a non-standard extension"
113
- STDERR.puts msg
114
- end
107
+ msg = "'bordercolordark' is a non-standard extension"
108
+ warn NonStandardExtensionWarning, msg
115
109
  modify_html("bordercolordark", color)
116
110
  end
117
111
 
@@ -123,10 +117,8 @@ module AttributeHandler
123
117
 
124
118
  def bordercolorlight=(color)
125
119
  @bordercolorlight = color
126
- if $VERBOSE
127
- msg = "'bordercolorlight' is a non-standard extension"
128
- STDERR.puts msg
129
- end
120
+ msg = "'bordercolorlight' is a non-standard extension"
121
+ warn NonStandardExtensionWarning, msg
130
122
  modify_html("bordercolorlight", @bordercolorlight)
131
123
  end
132
124
 
data/lib/html/table.rb CHANGED
@@ -3,21 +3,28 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
3
  require 'attribute_handler'
4
4
  require 'html_handler'
5
5
  require 'strongtyping'
6
+ require 'structured_warnings'
6
7
  include StrongTyping
7
8
 
9
+ # Warning raised if a non-standard extension is used.
10
+ class NonStandardExtensionWarning < Warning; end
11
+
12
+ # Please, think of the children before using the blink tag.
13
+ class BlinkWarning < Warning; end
14
+
8
15
  module HTML
9
16
  class Table < Array
10
17
  include AttributeHandler
11
18
  include HtmlHandler
12
19
 
13
20
  # The version of this library
14
- VERSION = '1.3.2'
21
+ VERSION = '1.3.3'
15
22
 
16
23
  # The indentation level for the <table> and </table> tags
17
- @indent_level = 0
24
+ @indent_level = 0
18
25
 
19
26
  # The default character case used for printing output
20
- @html_case = 'lower'
27
+ @html_case = 'lower'
21
28
 
22
29
  # Determines whether or not end tags will be included in printed output
23
30
  @@global_end_tags = true
@@ -150,7 +157,7 @@ module HTML
150
157
  # valid arguments to this method are 'upper' or 'lower'.
151
158
  #
152
159
  def self.html_case=(arg)
153
- expect(arg,String)
160
+ expect(arg, String)
154
161
  arg.downcase!
155
162
  unless arg == "upper" || arg == "lower"
156
163
  msg = "Argument to html_case() must be 'upper' or 'lower'"
@@ -35,9 +35,7 @@ module TagHandler
35
35
  end
36
36
 
37
37
  def blink=(bool)
38
- if $VERBOSE
39
- STDERR.puts("The 'blink' tag is very annoying. Please reconsider.")
40
- end
38
+ warn BlinkWarning, "The 'blink' tag is very annoying. Please reconsider."
41
39
  handle_physical_tag('blink', bool)
42
40
  @blink = bool
43
41
  end
@@ -1,30 +1,50 @@
1
1
  ############################################################################
2
- # tc_attribute_handler.rb
2
+ # test_attribute_handler.rb
3
3
  #
4
4
  # Test suite for the AttributeHandler module. For these tests, we'll use an
5
5
  # instance of the Table class where the module has been mixed in.
6
6
  ############################################################################
7
+ require 'rubygems'
8
+ gem 'test-unit'
9
+
7
10
  require 'test/unit'
8
11
  require 'html/table'
9
12
  include HTML
10
13
 
11
14
  class TC_AttributeHandler < Test::Unit::TestCase
15
+ def self.startup
16
+ NonStandardExtensionWarning.disable
17
+ end
18
+
12
19
  def setup
13
20
  @table = Table.new(['foo',1,'bar'])
14
21
  end
15
22
 
16
- def test_abbr
23
+ def test_abbr_basic
17
24
  assert_respond_to(@table, :abbr)
18
25
  assert_respond_to(@table, :abbr=)
26
+ end
27
+
28
+ def test_abbr
19
29
  assert_nothing_raised{ @table.abbr }
30
+ assert_nil(@table.abbr)
20
31
  assert_nothing_raised{ @table.abbr = 'foo' }
32
+ assert_equal('foo', @table.abbr)
21
33
  end
22
34
 
23
- def test_align
35
+ def test_align_basic
24
36
  assert_respond_to(@table, :align)
25
37
  assert_respond_to(@table, :align=)
38
+ end
39
+
40
+ def test_align
26
41
  assert_nothing_raised{ @table.align }
42
+ assert_nil(@table.align)
27
43
  assert_nothing_raised{ @table.align = 'center' }
44
+ assert_equal('center', @table.align)
45
+ end
46
+
47
+ def test_align_expected_errors
28
48
  assert_raises(ArgumentError){ @table.align = 'foo' }
29
49
  end
30
50
 
@@ -35,42 +55,68 @@ class TC_AttributeHandler < Test::Unit::TestCase
35
55
  assert_nothing_raised{ @table.axis = 'foo' }
36
56
  end
37
57
 
38
- def test_background
58
+ def test_background_basic
39
59
  assert_respond_to(@table, :background)
40
60
  assert_respond_to(@table, :background=)
61
+ end
62
+
63
+ def test_background
41
64
  assert_nothing_raised{ @table.background }
65
+ assert_nil(@table.background)
42
66
  assert_nothing_raised{ @table.background = 'foo' }
67
+ assert_equal('foo', @table.background)
68
+ end
69
+
70
+ def test_background_expected_errors
43
71
  assert_raises(TypeError){ @table.background = 1 }
44
72
  end
45
73
 
46
- def test_bgcolor
74
+ def test_bgcolor_basic
47
75
  assert_respond_to(@table, :bgcolor)
48
76
  assert_respond_to(@table, :bgcolor=)
77
+ end
78
+
79
+ def test_bgcolor
49
80
  assert_nothing_raised{ @table.bgcolor }
81
+ assert_nil(@table.bgcolor)
50
82
  assert_nothing_raised{ @table.bgcolor = 'foo' }
83
+ assert_equal('foo', @table.bgcolor)
51
84
  end
52
-
53
- def test_border
85
+
86
+ def test_border_basic
54
87
  assert_respond_to(@table, :border)
55
88
  assert_respond_to(@table, :border=)
89
+ end
90
+
91
+ def test_border
56
92
  assert_nothing_raised{ @table.border }
57
93
  assert_nothing_raised{ @table.border = 2 }
58
94
  assert_nothing_raised{ @table.border = true }
59
95
  assert_nothing_raised{ @table.border = false }
60
96
  end
61
97
 
62
- def test_bordercolor
98
+ def test_bordercolor_basic
63
99
  assert_respond_to(@table, :bordercolor)
64
100
  assert_respond_to(@table, :bordercolor=)
101
+ end
102
+
103
+ def test_bordercolor
65
104
  assert_nothing_raised{ @table.bordercolor }
105
+ assert_nil(@table.bordercolor)
66
106
  assert_nothing_raised{ @table.bordercolor = 'foo' }
107
+ assert_equal('foo', @table.bordercolor)
67
108
  end
68
109
 
69
- def test_bordercolordark
110
+ def test_bordercolordark_basic
70
111
  assert_respond_to(@table, :bordercolordark)
71
112
  assert_respond_to(@table, :bordercolordark=)
113
+ end
114
+
115
+ def test_bordercolordark
72
116
  assert_nothing_raised{ @table.bordercolordark }
117
+ assert_nil(@table.bordercolordark)
73
118
  assert_nothing_raised{ @table.bordercolordark = 'foo' }
119
+ assert_equal('foo', @table.bordercolordark)
74
120
  end
75
121
 
76
122
  def test_bordercolorlight
@@ -85,6 +131,9 @@ class TC_AttributeHandler < Test::Unit::TestCase
85
131
  assert_respond_to(@table, :cellpadding=)
86
132
  assert_nothing_raised{ @table.cellpadding }
87
133
  assert_nothing_raised{ @table.cellpadding = 1 }
134
+ end
135
+
136
+ def test_cellpadding_expected_errors
88
137
  assert_raises(ArgumentError){ @table.cellpadding = -1 }
89
138
  end
90
139
 
@@ -93,6 +142,9 @@ class TC_AttributeHandler < Test::Unit::TestCase
93
142
  assert_respond_to(@table, :cellspacing=)
94
143
  assert_nothing_raised{ @table.cellspacing }
95
144
  assert_nothing_raised{ @table.cellspacing = 1 }
145
+ end
146
+
147
+ def test_cellspacing_expected_errors
96
148
  assert_raises(ArgumentError){ @table.cellspacing = -1 }
97
149
  end
98
150
 
@@ -101,6 +153,9 @@ class TC_AttributeHandler < Test::Unit::TestCase
101
153
  assert_respond_to(@table, :char=)
102
154
  assert_nothing_raised{ @table.char }
103
155
  assert_nothing_raised{ @table.char = 'x' }
156
+ end
157
+
158
+ def test_char_expected_errors
104
159
  assert_raises(ArgumentError){ @table.char = 'xx' }
105
160
  end
106
161
 
@@ -109,6 +164,9 @@ class TC_AttributeHandler < Test::Unit::TestCase
109
164
  assert_respond_to(@table, :charoff=)
110
165
  assert_nothing_raised{ @table.charoff }
111
166
  assert_nothing_raised{ @table.charoff = 1 }
167
+ end
168
+
169
+ def test_charoff_expected_errors
112
170
  assert_raises(ArgumentError){ @table.charoff = -1 }
113
171
  end
114
172
 
@@ -124,6 +182,9 @@ class TC_AttributeHandler < Test::Unit::TestCase
124
182
  assert_respond_to(@table, :col=)
125
183
  assert_nothing_raised{ @table.col }
126
184
  assert_nothing_raised{ @table.col = 1 }
185
+ end
186
+
187
+ def test_col_expected_errors
127
188
  assert_raises(ArgumentError){ @table.col = -1 }
128
189
  end
129
190
 
@@ -132,6 +193,9 @@ class TC_AttributeHandler < Test::Unit::TestCase
132
193
  assert_respond_to(@table, :colspan=)
133
194
  assert_nothing_raised{ @table.colspan }
134
195
  assert_nothing_raised{ @table.colspan = 1 }
196
+ end
197
+
198
+ def test_colspan_expected_errors
135
199
  assert_raises(ArgumentError){ @table.colspan = -1 }
136
200
  end
137
201
 
@@ -139,6 +203,9 @@ class TC_AttributeHandler < Test::Unit::TestCase
139
203
  assert_respond_to(@table, :configure)
140
204
  assert_nothing_raised{ @table.configure(0){} }
141
205
  assert_nothing_raised{ @table.configure(0,0){} }
206
+ end
207
+
208
+ def test_configure_expected_errors
142
209
  assert_raises(ArgumentError){ @table.configure(0,0,0){} }
143
210
  end
144
211
 
@@ -166,6 +233,9 @@ class TC_AttributeHandler < Test::Unit::TestCase
166
233
  assert_respond_to(@table, :frame=)
167
234
  assert_nothing_raised{ @table.frame }
168
235
  assert_nothing_raised{ @table.frame = 'below' }
236
+ end
237
+
238
+ def test_frame_expected_errors
169
239
  assert_raises(ArgumentError){ @table.frame = 'foo' }
170
240
  end
171
241
 
@@ -174,6 +244,9 @@ class TC_AttributeHandler < Test::Unit::TestCase
174
244
  assert_respond_to(@table, :height=)
175
245
  assert_nothing_raised{ @table.height }
176
246
  assert_nothing_raised{ @table.height = 1 }
247
+ end
248
+
249
+ def test_height_expected_errors
177
250
  assert_raises(ArgumentError){ @table.height = -1 }
178
251
  end
179
252
 
@@ -182,6 +255,9 @@ class TC_AttributeHandler < Test::Unit::TestCase
182
255
  assert_respond_to(@table, :hspace=)
183
256
  assert_nothing_raised{ @table.hspace }
184
257
  assert_nothing_raised{ @table.hspace = 1 }
258
+ end
259
+
260
+ def test_hspace_expected_errors
185
261
  assert_raises(ArgumentError){ @table.hspace = -1 }
186
262
  end
187
263
 
@@ -190,6 +266,9 @@ class TC_AttributeHandler < Test::Unit::TestCase
190
266
  assert_respond_to(@table, :nowrap=)
191
267
  assert_nothing_raised{ @table.nowrap }
192
268
  assert_nothing_raised{ @table.nowrap = false }
269
+ end
270
+
271
+ def test_nowrap_expected_errors
193
272
  assert_raises(TypeError){ @table.nowrap = 'foo' }
194
273
  end
195
274
 
@@ -198,6 +277,9 @@ class TC_AttributeHandler < Test::Unit::TestCase
198
277
  assert_respond_to(@table, :rowspan=)
199
278
  assert_nothing_raised{ @table.rowspan }
200
279
  assert_nothing_raised{ @table.rowspan = 1 }
280
+ end
281
+
282
+ def test_rowspan_expected_errors
201
283
  assert_raises(ArgumentError){ @table.rowspan = -1 }
202
284
  end
203
285
 
@@ -206,6 +288,9 @@ class TC_AttributeHandler < Test::Unit::TestCase
206
288
  assert_respond_to(@table, :rules=)
207
289
  assert_nothing_raised{ @table.rules }
208
290
  assert_nothing_raised{ @table.rules = 'all' }
291
+ end
292
+
293
+ def test_rules_expected_errors
209
294
  assert_raises(ArgumentError){ @table.rules = 'foo' }
210
295
  end
211
296
 
@@ -214,6 +299,9 @@ class TC_AttributeHandler < Test::Unit::TestCase
214
299
  assert_respond_to(@table, :span=)
215
300
  assert_nothing_raised{ @table.span }
216
301
  assert_nothing_raised{ @table.span = 1 }
302
+ end
303
+
304
+ def test_span_expected_errors
217
305
  assert_raises(ArgumentError){ @table.span = -1 }
218
306
  end
219
307
 
@@ -237,6 +325,9 @@ class TC_AttributeHandler < Test::Unit::TestCase
237
325
  assert_respond_to(@table, :valign=)
238
326
  assert_nothing_raised{ @table.valign }
239
327
  assert_nothing_raised{ @table.valign = 'center' }
328
+ end
329
+
330
+ def test_valign_expected_errors
240
331
  assert_raises(ArgumentError){ @table.valign = 'foo' }
241
332
  end
242
333
 
@@ -245,6 +336,9 @@ class TC_AttributeHandler < Test::Unit::TestCase
245
336
  assert_respond_to(@table, :vspace=)
246
337
  assert_nothing_raised{ @table.vspace }
247
338
  assert_nothing_raised{ @table.vspace = 1 }
339
+ end
340
+
341
+ def test_vspace_expected_errors
248
342
  assert_raises(ArgumentError){ @table.vspace = -1 }
249
343
  end
250
344
 
@@ -254,10 +348,17 @@ class TC_AttributeHandler < Test::Unit::TestCase
254
348
  assert_nothing_raised{ @table.width}
255
349
  assert_nothing_raised{ @table.width = 10 }
256
350
  assert_nothing_raised{ @table.width = '5%' }
351
+ end
352
+
353
+ def test_width_expected_errors
257
354
  assert_raises(ArgumentError){ @table.width = -1 }
258
355
  end
259
356
 
260
357
  def teardown
261
358
  @table = nil
262
359
  end
360
+
361
+ def self.shutdown
362
+ NonStandardExtensionWarning.enable
363
+ end
263
364
  end