roo 2.7.0 → 2.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,28 +1,47 @@
1
1
  # encoding: utf-8
2
- require 'simplecov'
3
- # require deps
4
- require 'tmpdir'
5
- require 'fileutils'
6
- require 'minitest/autorun'
7
- require 'shoulda'
8
- require 'timeout'
9
- require 'logger'
10
- require 'date'
2
+ require "simplecov"
3
+ require "tmpdir"
4
+ require "fileutils"
5
+ require "minitest/autorun"
6
+ require "shoulda"
7
+ require "timeout"
8
+ require "logger"
9
+ require "date"
11
10
 
12
11
  # require gem files
13
- require 'roo'
12
+ require "roo"
14
13
  require "minitest/reporters"
15
- Minitest::Reporters.use!([Minitest::Reporters::DefaultReporter.new,
16
- Minitest::Reporters::SpecReporter.new]) unless defined? JRUBY_VERSION
14
+ if ENV["USE_REPORTERS"]
15
+ Minitest::Reporters.use!(
16
+ [
17
+ Minitest::Reporters::DefaultReporter.new,
18
+ Minitest::Reporters::SpecReporter.new
19
+ ]
20
+ )
21
+ end
22
+
23
+ TESTDIR = File.join(File.dirname(__FILE__), "files")
24
+ ROO_FORMATS = [
25
+ :excelx,
26
+ :excelxm,
27
+ :openoffice,
28
+ :libreoffice
29
+ ]
30
+
31
+ require "helpers/test_accessing_files"
32
+ require "helpers/test_comments"
33
+ require "helpers/test_formulas"
34
+ require "helpers/test_labels"
35
+ require "helpers/test_sheets"
36
+ require "helpers/test_styles"
17
37
 
18
- TESTDIR = File.join(File.dirname(__FILE__), 'files')
19
38
 
20
39
  # very simple diff implementation
21
40
  # output is an empty string if the files are equal
22
41
  # otherwise differences a printen (not compatible to
23
42
  # the diff command)
24
43
  def file_diff(fn1,fn2)
25
- result = ''
44
+ result = ""
26
45
  File.open(fn1) do |f1|
27
46
  File.open(fn2) do |f2|
28
47
  while f1.eof? == false and f2.eof? == false
@@ -73,7 +92,7 @@ def start_local_server(filename, port = nil)
73
92
  ]
74
93
  end
75
94
 
76
- t = Thread.new { Rack::Handler::WEBrick.run web_server, Host: '0.0.0.0', Port: port , Logger: WEBrick::BasicLog.new(nil,1) }
95
+ t = Thread.new { Rack::Handler::WEBrick.run web_server, Host: "0.0.0.0", Port: port , Logger: WEBrick::BasicLog.new(nil,1) }
77
96
  # give the app a chance to startup
78
97
  sleep(0.2)
79
98
 
@@ -82,13 +101,6 @@ ensure
82
101
  t.kill
83
102
  end
84
103
 
85
- ROO_FORMATS = [
86
- :excelx,
87
- :excelxm,
88
- :openoffice,
89
- :libreoffice
90
- ]
91
-
92
104
  # call a block of code for each spreadsheet type
93
105
  # and yield a reference to the roo object
94
106
  def with_each_spreadsheet(options)
@@ -111,6 +123,15 @@ def with_each_spreadsheet(options)
111
123
  end
112
124
  end
113
125
 
126
+ def get_extension(oo)
127
+ case oo
128
+ when Roo::OpenOffice
129
+ ".ods"
130
+ when Roo::Excelx
131
+ ".xlsx"
132
+ end
133
+ end
134
+
114
135
  def fixture_filename(name, format)
115
136
  case format
116
137
  when :excelx
@@ -123,3 +144,13 @@ def fixture_filename(name, format)
123
144
  raise ArgumentError, "unexpected format #{format}"
124
145
  end
125
146
  end
147
+
148
+ def skip_long_test
149
+ msg = "This is very slow, test use `LONG_RUN=true bundle exec rake` to run it"
150
+ skip(msg) unless ENV["LONG_RUN"]
151
+ end
152
+
153
+ def skip_jruby_incompatible_test
154
+ msg = "This test uses a feature incompatible with JRuby"
155
+ skip(msg) if defined?(JRUBY_VERSION)
156
+ end
@@ -10,20 +10,14 @@ require 'test_helper'
10
10
  require 'stringio'
11
11
 
12
12
  class TestRoo < Minitest::Test
13
- LONG_RUN = ENV["LONG_RUN"] ? true : false
14
-
15
- def test_sheets
16
- with_each_spreadsheet(:name=>'numbers1') do |oo|
17
- assert_equal ["Tabelle1","Name of Sheet 2","Sheet3","Sheet4","Sheet5"], oo.sheets
18
- assert_raises(RangeError) { oo.default_sheet = "no_sheet" }
19
- assert_raises(TypeError) { oo.default_sheet = [1,2,3] }
20
- oo.sheets.each { |sh|
21
- oo.default_sheet = sh
22
- assert_equal sh, oo.default_sheet
23
- }
24
- end
25
- end
26
-
13
+ include TestSheets
14
+ include TestAccesingFiles
15
+ include TestFormulas
16
+ include TestComments
17
+ include TestLabels
18
+ include TestStyles
19
+
20
+ # Cell related tests
27
21
  def test_cells
28
22
  with_each_spreadsheet(:name=>'numbers1') do |oo|
29
23
  # warum ist Auswaehlen erstes sheet hier nicht
@@ -62,12 +56,6 @@ class TestRoo < Minitest::Test
62
56
  end
63
57
  end
64
58
 
65
- def test_celltype
66
- with_each_spreadsheet(:name=>'numbers1') do |oo|
67
- assert_equal :string, oo.celltype(2,6)
68
- end
69
- end
70
-
71
59
  def test_cell_address
72
60
  with_each_spreadsheet(:name=>'numbers1') do |oo|
73
61
  assert_equal "tata", oo.cell(6,1)
@@ -87,46 +75,6 @@ class TestRoo < Minitest::Test
87
75
  end
88
76
  end
89
77
 
90
- def test_office_version
91
- with_each_spreadsheet(:name=>'numbers1', :format=>:openoffice) do |oo|
92
- assert_equal "1.0", oo.officeversion
93
- end
94
- end
95
-
96
- def test_sheetname
97
- with_each_spreadsheet(:name=>'numbers1') do |oo|
98
- oo.default_sheet = "Name of Sheet 2"
99
- assert_equal 'I am sheet 2', oo.cell('C',5)
100
- assert_raises(RangeError) { oo.default_sheet = "non existing sheet name" }
101
- assert_raises(RangeError) { oo.default_sheet = "non existing sheet name" }
102
- assert_raises(RangeError) { oo.cell('C',5,"non existing sheet name")}
103
- assert_raises(RangeError) { oo.celltype('C',5,"non existing sheet name")}
104
- assert_raises(RangeError) { oo.empty?('C',5,"non existing sheet name")}
105
- assert_raises(RangeError) { oo.formula?('C',5,"non existing sheet name")}
106
- assert_raises(RangeError) { oo.formula('C',5,"non existing sheet name")}
107
- assert_raises(RangeError) { oo.set('C',5,42,"non existing sheet name")}
108
- assert_raises(RangeError) { oo.formulas("non existing sheet name")}
109
- assert_raises(RangeError) { oo.to_yaml({},1,1,1,1,"non existing sheet name")}
110
- end
111
- end
112
-
113
- def test_argument_error
114
- with_each_spreadsheet(:name=>'numbers1') do |oo|
115
- oo.default_sheet = "Tabelle1"
116
- end
117
- end
118
-
119
- def test_bug_contiguous_cells
120
- with_each_spreadsheet(:name=>'numbers1', :format=>:openoffice) do |oo|
121
- oo.default_sheet = "Sheet4"
122
- assert_equal Date.new(2007,06,16), oo.cell('a',1)
123
- assert_equal 10, oo.cell('b',1)
124
- assert_equal 10, oo.cell('c',1)
125
- assert_equal 10, oo.cell('d',1)
126
- assert_equal 10, oo.cell('e',1)
127
- end
128
- end
129
-
130
78
  def test_bug_italo_ve
131
79
  with_each_spreadsheet(:name=>'numbers1') do |oo|
132
80
  oo.default_sheet = "Sheet5"
@@ -138,127 +86,15 @@ class TestRoo < Minitest::Test
138
86
  end
139
87
  end
140
88
 
141
- def test_italo_table
142
- with_each_spreadsheet(:name=>'simple_spreadsheet_from_italo', :format=>:openoffice) do |oo|
143
- assert_equal '1', oo.cell('A',1)
144
- assert_equal '1', oo.cell('B',1)
145
- assert_equal '1', oo.cell('C',1)
146
- assert_equal 1, oo.cell('A',2).to_i
147
- assert_equal 2, oo.cell('B',2).to_i
148
- assert_equal 1, oo.cell('C',2).to_i
149
- assert_equal 1, oo.cell('A',3)
150
- assert_equal 3, oo.cell('B',3)
151
- assert_equal 1, oo.cell('C',3)
152
- assert_equal 'A', oo.cell('A',4)
153
- assert_equal 'A', oo.cell('B',4)
154
- assert_equal 'A', oo.cell('C',4)
155
- assert_equal 0.01, oo.cell('A',5)
156
- assert_equal 0.01, oo.cell('B',5)
157
- assert_equal 0.01, oo.cell('C',5)
158
- assert_equal 0.03, oo.cell('a',5)+oo.cell('b',5)+oo.cell('c',5)
159
-
160
- # Cells values in row 1:
161
- assert_equal "1:string", oo.cell(1, 1)+":"+oo.celltype(1, 1).to_s
162
- assert_equal "1:string",oo.cell(1, 2)+":"+oo.celltype(1, 2).to_s
163
- assert_equal "1:string",oo.cell(1, 3)+":"+oo.celltype(1, 3).to_s
164
-
165
- # Cells values in row 2:
166
- assert_equal "1:string",oo.cell(2, 1)+":"+oo.celltype(2, 1).to_s
167
- assert_equal "2:string",oo.cell(2, 2)+":"+oo.celltype(2, 2).to_s
168
- assert_equal "1:string",oo.cell(2, 3)+":"+oo.celltype(2, 3).to_s
169
-
170
- # Cells values in row 3:
171
- assert_equal "1:float",oo.cell(3, 1).to_s+":"+oo.celltype(3, 1).to_s
172
- assert_equal "3:float",oo.cell(3, 2).to_s+":"+oo.celltype(3, 2).to_s
173
- assert_equal "1:float",oo.cell(3, 3).to_s+":"+oo.celltype(3, 3).to_s
174
-
175
- # Cells values in row 4:
176
- assert_equal "A:string",oo.cell(4, 1)+":"+oo.celltype(4, 1).to_s
177
- assert_equal "A:string",oo.cell(4, 2)+":"+oo.celltype(4, 2).to_s
178
- assert_equal "A:string",oo.cell(4, 3)+":"+oo.celltype(4, 3).to_s
179
-
180
- # Cells values in row 5:
181
- if oo.class == Roo::OpenOffice
182
- assert_equal "0.01:percentage",oo.cell(5, 1).to_s+":"+oo.celltype(5, 1).to_s
183
- assert_equal "0.01:percentage",oo.cell(5, 2).to_s+":"+oo.celltype(5, 2).to_s
184
- assert_equal "0.01:percentage",oo.cell(5, 3).to_s+":"+oo.celltype(5, 3).to_s
185
- else
186
- assert_equal "0.01:float",oo.cell(5, 1).to_s+":"+oo.celltype(5, 1).to_s
187
- assert_equal "0.01:float",oo.cell(5, 2).to_s+":"+oo.celltype(5, 2).to_s
188
- assert_equal "0.01:float",oo.cell(5, 3).to_s+":"+oo.celltype(5, 3).to_s
189
- end
190
- end
191
- end
192
-
193
- def test_formula_openoffice
194
- with_each_spreadsheet(:name=>'formula', :format=>:openoffice) do |oo|
195
- assert_equal 1, oo.cell('A',1)
196
- assert_equal 2, oo.cell('A',2)
197
- assert_equal 3, oo.cell('A',3)
198
- assert_equal 4, oo.cell('A',4)
199
- assert_equal 5, oo.cell('A',5)
200
- assert_equal 6, oo.cell('A',6)
201
- assert_equal 21, oo.cell('A',7)
202
- assert_equal :formula, oo.celltype('A',7)
203
- assert_equal "=[Sheet2.A1]", oo.formula('C',7)
204
- assert_nil oo.formula('A',6)
205
- assert_equal [[7, 1, "=SUM([.A1:.A6])"],
206
- [7, 2, "=SUM([.$A$1:.B6])"],
207
- [7, 3, "=[Sheet2.A1]"],
208
- [8, 2, "=SUM([.$A$1:.B7])"],
209
- ], oo.formulas(oo.sheets.first)
210
-
211
- # setting a cell
212
- oo.set('A',15, 41)
213
- assert_equal 41, oo.cell('A',15)
214
- oo.set('A',16, "41")
215
- assert_equal "41", oo.cell('A',16)
216
- oo.set('A',17, 42.5)
217
- assert_equal 42.5, oo.cell('A',17)
218
- end
219
- end
220
-
221
- def test_header_with_brackets_excelx
222
- with_each_spreadsheet(:name => 'advanced_header', :format => :openoffice) do |oo|
223
- parsed_head = oo.parse(:headers => true)
224
- assert_equal "Date(yyyy-mm-dd)", oo.cell('A',1)
225
- assert_equal parsed_head[0].keys, ["Date(yyyy-mm-dd)"]
226
- assert_equal parsed_head[0].values, ["Date(yyyy-mm-dd)"]
89
+ def test_celltype
90
+ with_each_spreadsheet(:name=>'numbers1') do |oo|
91
+ assert_equal :string, oo.celltype(2,6)
227
92
  end
228
93
  end
229
94
 
230
- def test_formula_excelx
231
- with_each_spreadsheet(:name=>'formula', :format=>:excelx) do |oo|
232
- assert_equal 1, oo.cell('A',1)
233
- assert_equal 2, oo.cell('A',2)
234
- assert_equal 3, oo.cell('A',3)
235
- assert_equal 4, oo.cell('A',4)
236
- assert_equal 5, oo.cell('A',5)
237
- assert_equal 6, oo.cell('A',6)
238
- assert_equal 21, oo.cell('A',7)
239
- assert_equal :formula, oo.celltype('A',7)
240
- #steht nicht in Datei, oder?
241
- #nein, diesen Bezug habe ich nur in der OpenOffice-Datei
242
- #assert_equal "=[Sheet2.A1]", oo.formula('C',7)
243
- assert_nil oo.formula('A',6)
244
- # assert_equal [[7, 1, "=SUM([.A1:.A6])"],
245
- # [7, 2, "=SUM([.$A$1:.B6])"],
246
- #[7, 3, "=[Sheet2.A1]"],
247
- #[8, 2, "=SUM([.$A$1:.B7])"],
248
- #], oo.formulas(oo.sheets.first)
249
- assert_equal [[7, 1, 'SUM(A1:A6)'],
250
- [7, 2, 'SUM($A$1:B6)'],
251
- # [7, 3, "=[Sheet2.A1]"],
252
- # [8, 2, "=SUM([.$A$1:.B7])"],
253
- ], oo.formulas(oo.sheets.first)
254
-
255
- # setting a cell
256
- oo.set('A',15, 41)
257
- assert_equal 41, oo.cell('A',15)
258
- oo.set('A',16, "41")
259
- assert_equal "41", oo.cell('A',16)
260
- oo.set('A',17, 42.5)
261
- assert_equal 42.5, oo.cell('A',17)
95
+ def test_argument_error
96
+ with_each_spreadsheet(:name=>'numbers1') do |oo|
97
+ oo.default_sheet = "Tabelle1"
262
98
  end
263
99
  end
264
100
 
@@ -296,57 +132,6 @@ class TestRoo < Minitest::Test
296
132
  end
297
133
  end
298
134
 
299
- def test_bug_ric
300
- with_each_spreadsheet(:name=>'ric', :format=>:openoffice) do |oo|
301
- assert oo.empty?('A',1)
302
- assert oo.empty?('B',1)
303
- assert oo.empty?('C',1)
304
- assert oo.empty?('D',1)
305
- expected = 1
306
- letter = 'e'
307
- while letter <= 'u'
308
- assert_equal expected, oo.cell(letter,1)
309
- letter.succ!
310
- expected += 1
311
- end
312
- assert_equal 'J', oo.cell('v',1)
313
- assert_equal 'P', oo.cell('w',1)
314
- assert_equal 'B', oo.cell('x',1)
315
- assert_equal 'All', oo.cell('y',1)
316
- assert_equal 0, oo.cell('a',2)
317
- assert oo.empty?('b',2)
318
- assert oo.empty?('c',2)
319
- assert oo.empty?('d',2)
320
- assert_equal 'B', oo.cell('e',2)
321
- assert_equal 'B', oo.cell('f',2)
322
- assert_equal 'B', oo.cell('g',2)
323
- assert_equal 'B', oo.cell('h',2)
324
- assert_equal 'B', oo.cell('i',2)
325
- assert_equal 'B', oo.cell('j',2)
326
- assert_equal 'B', oo.cell('k',2)
327
- assert_equal 'B', oo.cell('l',2)
328
- assert_equal 'B', oo.cell('m',2)
329
- assert_equal 'B', oo.cell('n',2)
330
- assert_equal 'B', oo.cell('o',2)
331
- assert_equal 'B', oo.cell('p',2)
332
- assert_equal 'B', oo.cell('q',2)
333
- assert_equal 'B', oo.cell('r',2)
334
- assert_equal 'B', oo.cell('s',2)
335
- assert oo.empty?('t',2)
336
- assert oo.empty?('u',2)
337
- assert_equal 0 , oo.cell('v',2)
338
- assert_equal 0 , oo.cell('w',2)
339
- assert_equal 15 , oo.cell('x',2)
340
- assert_equal 15 , oo.cell('y',2)
341
- end
342
- end
343
-
344
- def test_mehrteilig
345
- with_each_spreadsheet(:name=>'Bibelbund1', :format=>:openoffice) do |oo|
346
- assert_equal "Tagebuch des Sekret\303\244rs. Letzte Tagung 15./16.11.75 Schweiz", oo.cell(45,'A')
347
- end
348
- end
349
-
350
135
  def test_bug_mehrere_datum
351
136
  with_each_spreadsheet(:name=>'numbers1') do |oo|
352
137
  oo.default_sheet = 'Sheet5'
@@ -426,271 +211,7 @@ class TestRoo < Minitest::Test
426
211
  end
427
212
  end
428
213
 
429
- def test_find_by_row_huge_document
430
- if LONG_RUN
431
- with_each_spreadsheet(:name=>'Bibelbund', :format=>[:openoffice, :excelx]) do |oo|
432
- oo.default_sheet = oo.sheets.first
433
- rec = oo.find 20
434
- assert rec
435
- # assert_equal "Brief aus dem Sekretariat", rec[0]
436
- #p rec
437
- assert_equal "Brief aus dem Sekretariat", rec[0]['TITEL']
438
- rec = oo.find 22
439
- assert rec
440
- # assert_equal "Brief aus dem Skretariat. Tagung in Amberg/Opf.",rec[0]
441
- assert_equal "Brief aus dem Skretariat. Tagung in Amberg/Opf.",rec[0]['TITEL']
442
- end
443
- end
444
- end
445
-
446
- def test_find_by_row
447
- with_each_spreadsheet(:name=>'numbers1') do |oo|
448
- oo.header_line = nil
449
- rec = oo.find 16
450
- assert rec
451
- assert_nil oo.header_line
452
- # keine Headerlines in diesem Beispiel definiert
453
- assert_equal "einundvierzig", rec[0]
454
- #assert_equal false, rec
455
- rec = oo.find 15
456
- assert rec
457
- assert_equal 41,rec[0]
458
- end
459
- end
460
-
461
- def test_find_by_row_if_header_line_is_not_nil
462
- with_each_spreadsheet(:name=>'numbers1') do |oo|
463
- oo.header_line = 2
464
- refute_nil oo.header_line
465
- rec = oo.find 1
466
- assert rec
467
- assert_equal 5, rec[0]
468
- assert_equal 6, rec[1]
469
- rec = oo.find 15
470
- assert rec
471
- assert_equal "einundvierzig", rec[0]
472
- end
473
- end
474
-
475
- def test_find_by_conditions
476
- if LONG_RUN
477
- with_each_spreadsheet(:name=>'Bibelbund', :format=>[:openoffice,
478
- :excelx]) do |oo|
479
- #-----------------------------------------------------------------
480
- zeilen = oo.find(:all, :conditions => {
481
- 'TITEL' => 'Brief aus dem Sekretariat'
482
- }
483
- )
484
- assert_equal 2, zeilen.size
485
- assert_equal [{"VERFASSER"=>"Almassy, Annelene von",
486
- "INTERNET"=>nil,
487
- "SEITE"=>316.0,
488
- "KENNUNG"=>"Aus dem Bibelbund",
489
- "OBJEKT"=>"Bibel+Gem",
490
- "PC"=>"#C:\\Bibelbund\\reprint\\BuG1982-3.pdf#",
491
- "NUMMER"=>"1982-3",
492
- "TITEL"=>"Brief aus dem Sekretariat"},
493
- {"VERFASSER"=>"Almassy, Annelene von",
494
- "INTERNET"=>nil,
495
- "SEITE"=>222.0,
496
- "KENNUNG"=>"Aus dem Bibelbund",
497
- "OBJEKT"=>"Bibel+Gem",
498
- "PC"=>"#C:\\Bibelbund\\reprint\\BuG1983-2.pdf#",
499
- "NUMMER"=>"1983-2",
500
- "TITEL"=>"Brief aus dem Sekretariat"}] , zeilen
501
-
502
- #----------------------------------------------------------
503
- zeilen = oo.find(:all,
504
- :conditions => { 'VERFASSER' => 'Almassy, Annelene von' }
505
- )
506
- assert_equal 13, zeilen.size
507
- #----------------------------------------------------------
508
- zeilen = oo.find(:all, :conditions => {
509
- 'TITEL' => 'Brief aus dem Sekretariat',
510
- 'VERFASSER' => 'Almassy, Annelene von',
511
- }
512
- )
513
- assert_equal 2, zeilen.size
514
- assert_equal [{"VERFASSER"=>"Almassy, Annelene von",
515
- "INTERNET"=>nil,
516
- "SEITE"=>316.0,
517
- "KENNUNG"=>"Aus dem Bibelbund",
518
- "OBJEKT"=>"Bibel+Gem",
519
- "PC"=>"#C:\\Bibelbund\\reprint\\BuG1982-3.pdf#",
520
- "NUMMER"=>"1982-3",
521
- "TITEL"=>"Brief aus dem Sekretariat"},
522
- {"VERFASSER"=>"Almassy, Annelene von",
523
- "INTERNET"=>nil,
524
- "SEITE"=>222.0,
525
- "KENNUNG"=>"Aus dem Bibelbund",
526
- "OBJEKT"=>"Bibel+Gem",
527
- "PC"=>"#C:\\Bibelbund\\reprint\\BuG1983-2.pdf#",
528
- "NUMMER"=>"1983-2",
529
- "TITEL"=>"Brief aus dem Sekretariat"}] , zeilen
530
-
531
- # Result as an array
532
- zeilen = oo.find(:all,
533
- :conditions => {
534
- 'TITEL' => 'Brief aus dem Sekretariat',
535
- 'VERFASSER' => 'Almassy, Annelene von',
536
- }, :array => true)
537
- assert_equal 2, zeilen.size
538
- assert_equal [
539
- [
540
- "Brief aus dem Sekretariat",
541
- "Almassy, Annelene von",
542
- "Bibel+Gem",
543
- "1982-3",
544
- 316.0,
545
- nil,
546
- "#C:\\Bibelbund\\reprint\\BuG1982-3.pdf#",
547
- "Aus dem Bibelbund",
548
- ],
549
- [
550
- "Brief aus dem Sekretariat",
551
- "Almassy, Annelene von",
552
- "Bibel+Gem",
553
- "1983-2",
554
- 222.0,
555
- nil,
556
- "#C:\\Bibelbund\\reprint\\BuG1983-2.pdf#",
557
- "Aus dem Bibelbund",
558
- ]] , zeilen
559
- end
560
- end
561
- end
562
-
563
- #TODO: temporaerer Test
564
- def test_seiten_als_date
565
- if LONG_RUN
566
- with_each_spreadsheet(:name=>'Bibelbund', :format=>:excelx) do |oo|
567
- assert_equal 'Bericht aus dem Sekretariat', oo.cell(13,1)
568
- assert_equal '1981-4', oo.cell(13,'D')
569
- assert_equal String, oo.excelx_type(13,'E')[1].class
570
- assert_equal [:numeric_or_formula,"General"], oo.excelx_type(13,'E')
571
- assert_equal '428', oo.excelx_value(13,'E')
572
- assert_equal 428.0, oo.cell(13,'E')
573
- end
574
- end
575
- end
576
-
577
- def test_column
578
- with_each_spreadsheet(:name=>'numbers1') do |oo|
579
- expected = [1.0,5.0,nil,10.0,Date.new(1961,11,21),'tata',nil,nil,nil,nil,'thisisa11',41.0,nil,nil,41.0,'einundvierzig',nil,Date.new(2007,5,31)]
580
- assert_equal expected, oo.column(1)
581
- assert_equal expected, oo.column('a')
582
- end
583
- end
584
-
585
- def test_column_huge_document
586
- if LONG_RUN
587
- with_each_spreadsheet(:name=>'Bibelbund', :format=>[:openoffice,
588
- :excelx]) do |oo|
589
- oo.default_sheet = oo.sheets.first
590
- assert_equal 3735, oo.column('a').size
591
- #assert_equal 499, oo.column('a').size
592
- end
593
- end
594
- end
595
-
596
- def test_simple_spreadsheet_find_by_condition
597
- with_each_spreadsheet(:name=>'simple_spreadsheet') do |oo|
598
- oo.header_line = 3
599
- # oo.date_format = '%m/%d/%Y' if oo.class == Google
600
- erg = oo.find(:all, :conditions => {'Comment' => 'Task 1'})
601
- assert_equal Date.new(2007,05,07), erg[1]['Date']
602
- assert_equal 10.75 , erg[1]['Start time']
603
- assert_equal 12.50 , erg[1]['End time']
604
- assert_equal 0 , erg[1]['Pause']
605
- assert_equal 1.75 , erg[1]['Sum']
606
- assert_equal "Task 1" , erg[1]['Comment']
607
- end
608
- end
609
-
610
- def get_extension(oo)
611
- case oo
612
- when Roo::OpenOffice
613
- ".ods"
614
- when Roo::Excelx
615
- ".xlsx"
616
- end
617
- end
618
-
619
- def test_info
620
- expected_templ = "File: numbers1%s\n"+
621
- "Number of sheets: 5\n"+
622
- "Sheets: Tabelle1, Name of Sheet 2, Sheet3, Sheet4, Sheet5\n"+
623
- "Sheet 1:\n"+
624
- " First row: 1\n"+
625
- " Last row: 18\n"+
626
- " First column: A\n"+
627
- " Last column: G\n"+
628
- "Sheet 2:\n"+
629
- " First row: 5\n"+
630
- " Last row: 14\n"+
631
- " First column: B\n"+
632
- " Last column: E\n"+
633
- "Sheet 3:\n"+
634
- " First row: 1\n"+
635
- " Last row: 1\n"+
636
- " First column: A\n"+
637
- " Last column: BA\n"+
638
- "Sheet 4:\n"+
639
- " First row: 1\n"+
640
- " Last row: 1\n"+
641
- " First column: A\n"+
642
- " Last column: E\n"+
643
- "Sheet 5:\n"+
644
- " First row: 1\n"+
645
- " Last row: 6\n"+
646
- " First column: A\n"+
647
- " Last column: E"
648
- with_each_spreadsheet(:name=>'numbers1') do |oo|
649
- ext = get_extension(oo)
650
- expected = sprintf(expected_templ,ext)
651
- begin
652
- if oo.class == Google
653
- assert_equal expected.gsub(/numbers1/,key_of("numbers1")), oo.info
654
- else
655
- assert_equal expected, oo.info
656
- end
657
- rescue NameError
658
- #
659
- end
660
- end
661
- end
662
-
663
- def test_info_doesnt_set_default_sheet
664
- with_each_spreadsheet(:name=>'numbers1') do |oo|
665
- oo.default_sheet = 'Sheet3'
666
- oo.info
667
- assert_equal 'Sheet3', oo.default_sheet
668
- end
669
- end
670
-
671
- def test_bug_bbu
672
- with_each_spreadsheet(:name=>'bbu', :format=>[:openoffice, :excelx]) do |oo|
673
- assert_equal "File: bbu#{get_extension(oo)}
674
- Number of sheets: 3
675
- Sheets: 2007_12, Tabelle2, Tabelle3
676
- Sheet 1:
677
- First row: 1
678
- Last row: 4
679
- First column: A
680
- Last column: F
681
- Sheet 2:
682
- - empty -
683
- Sheet 3:
684
- - empty -", oo.info
685
-
686
- oo.default_sheet = oo.sheets[1] # empty sheet
687
- assert_nil oo.first_row
688
- assert_nil oo.last_row
689
- assert_nil oo.first_column
690
- assert_nil oo.last_column
691
- end
692
- end
693
-
214
+ # Tests for Specific Cell types (time, etc)
694
215
 
695
216
  def test_bug_time_nil
696
217
  with_each_spreadsheet(:name=>'time-test') do |oo|
@@ -703,54 +224,6 @@ Sheet 3:
703
224
  end
704
225
  end
705
226
 
706
- def test_bug_simple_spreadsheet_time_bug
707
- # really a bug? are cells really of type time?
708
- # No! :float must be the correct type
709
- with_each_spreadsheet(:name=>'simple_spreadsheet', :format=>:excelx) do |oo|
710
- # puts oo.cell('B',5).to_s
711
- # assert_equal :time, oo.celltype('B',5)
712
- assert_equal :float, oo.celltype('B',5)
713
- assert_equal 10.75, oo.cell('B',5)
714
- assert_equal 12.50, oo.cell('C',5)
715
- assert_equal 0, oo.cell('D',5)
716
- assert_equal 1.75, oo.cell('E',5)
717
- assert_equal 'Task 1', oo.cell('F',5)
718
- assert_equal Date.new(2007,5,7), oo.cell('A',5)
719
- end
720
- end
721
-
722
- def test_simple2_excelx
723
- with_each_spreadsheet(:name=>'simple_spreadsheet', :format=>:excelx) do |oo|
724
- assert_equal [:numeric_or_formula, "yyyy\\-mm\\-dd"], oo.excelx_type('A',4)
725
- assert_equal [:numeric_or_formula, "#,##0.00"], oo.excelx_type('B',4)
726
- assert_equal [:numeric_or_formula, "#,##0.00"], oo.excelx_type('c',4)
727
- assert_equal [:numeric_or_formula, "General"], oo.excelx_type('d',4)
728
- assert_equal [:numeric_or_formula, "General"], oo.excelx_type('e',4)
729
- assert_equal :string, oo.excelx_type('f',4)
730
-
731
- assert_equal "39209", oo.excelx_value('a',4)
732
- assert_equal "yyyy\\-mm\\-dd", oo.excelx_format('a',4)
733
- assert_equal "9.25", oo.excelx_value('b',4)
734
- assert_equal "10.25", oo.excelx_value('c',4)
735
- assert_equal "0", oo.excelx_value('d',4)
736
- #... Sum-Spalte
737
- # assert_equal "Task 1", oo.excelx_value('f',4)
738
- assert_equal "Task 1", oo.cell('f',4)
739
- assert_equal Date.new(2007,05,07), oo.cell('a',4)
740
- assert_equal "9.25", oo.excelx_value('b',4)
741
- assert_equal "#,##0.00", oo.excelx_format('b',4)
742
- assert_equal 9.25, oo.cell('b',4)
743
- assert_equal :float, oo.celltype('b',4)
744
- assert_equal :float, oo.celltype('d',4)
745
- assert_equal 0, oo.cell('d',4)
746
- assert_equal :formula, oo.celltype('e',4)
747
- assert_equal 1, oo.cell('e',4)
748
- assert_equal 'C4-B4-D4', oo.formula('e',4)
749
- assert_equal :string, oo.celltype('f',4)
750
- assert_equal "Task 1", oo.cell('f',4)
751
- end
752
- end
753
-
754
227
  def test_datetime
755
228
  with_each_spreadsheet(:name=>'datetime') do |oo|
756
229
  val = oo.cell('c',3)
@@ -783,17 +256,6 @@ Sheet 3:
783
256
  end
784
257
  end
785
258
 
786
- def test_cell_openoffice_html_escape
787
- with_each_spreadsheet(:name=>'html-escape', :format=>:openoffice) do |oo|
788
- assert_equal "'", oo.cell(1,1)
789
- assert_equal "&", oo.cell(2,1)
790
- assert_equal ">", oo.cell(3,1)
791
- assert_equal "<", oo.cell(4,1)
792
- assert_equal "`", oo.cell(5,1)
793
- # test_openoffice_zipped will catch issues with &quot;
794
- end
795
- end
796
-
797
259
  def test_cell_boolean
798
260
  with_each_spreadsheet(:name=>'boolean', :format=>[:openoffice, :excelx]) do |oo|
799
261
  if oo.class == Roo::Excelx
@@ -820,72 +282,9 @@ Sheet 3:
820
282
  end
821
283
  end
822
284
 
823
- def test_cell_styles
824
- # styles only valid in excel spreadsheets?
825
- # TODO: what todo with other spreadsheet types
826
- with_each_spreadsheet(:name=>'style', :format=>[# :openoffice,
827
- :excelx
828
- ]) do |oo|
829
- # bold
830
- assert_equal true, oo.font(1,1).bold?
831
- assert_equal false, oo.font(1,1).italic?
832
- assert_equal false, oo.font(1,1).underline?
833
-
834
- # italic
835
- assert_equal false, oo.font(2,1).bold?
836
- assert_equal true, oo.font(2,1).italic?
837
- assert_equal false, oo.font(2,1).underline?
838
-
839
- # normal
840
- assert_equal false, oo.font(3,1).bold?
841
- assert_equal false, oo.font(3,1).italic?
842
- assert_equal false, oo.font(3,1).underline?
843
-
844
- # underline
845
- assert_equal false, oo.font(4,1).bold?
846
- assert_equal false, oo.font(4,1).italic?
847
- assert_equal true, oo.font(4,1).underline?
848
-
849
- # bold italic
850
- assert_equal true, oo.font(5,1).bold?
851
- assert_equal true, oo.font(5,1).italic?
852
- assert_equal false, oo.font(5,1).underline?
853
-
854
- # bold underline
855
- assert_equal true, oo.font(6,1).bold?
856
- assert_equal false, oo.font(6,1).italic?
857
- assert_equal true, oo.font(6,1).underline?
858
-
859
- # italic underline
860
- assert_equal false, oo.font(7,1).bold?
861
- assert_equal true, oo.font(7,1).italic?
862
- assert_equal true, oo.font(7,1).underline?
863
-
864
- # bolded row
865
- assert_equal true, oo.font(8,1).bold?
866
- assert_equal false, oo.font(8,1).italic?
867
- assert_equal false, oo.font(8,1).underline?
868
-
869
- # bolded col
870
- assert_equal true, oo.font(9,2).bold?
871
- assert_equal false, oo.font(9,2).italic?
872
- assert_equal false, oo.font(9,2).underline?
873
-
874
- # bolded row, italic col
875
- assert_equal true, oo.font(10,3).bold?
876
- assert_equal true, oo.font(10,3).italic?
877
- assert_equal false, oo.font(10,3).underline?
878
-
879
- # normal
880
- assert_equal false, oo.font(11,4).bold?
881
- assert_equal false, oo.font(11,4).italic?
882
- assert_equal false, oo.font(11,4).underline?
883
- end
884
- end
885
-
886
- # Need to extend to other formats
887
285
  def test_row_whitespace
888
286
  # auf dieses Dokument habe ich keinen Zugriff TODO:
287
+ # TODO: No access to document whitespace?
889
288
  with_each_spreadsheet(:name=>'whitespace') do |oo|
890
289
  oo.default_sheet = "Sheet1"
891
290
  assert_equal [nil, nil, nil, nil, nil, nil], oo.row(1)
@@ -921,26 +320,6 @@ Sheet 3:
921
320
  end
922
321
  end
923
322
 
924
- def test_excelx_links
925
- with_each_spreadsheet(:name=>'link', :format=>:excelx) do |oo|
926
- assert_equal 'Google', oo.cell(1,1)
927
- assert_equal 'http://www.google.com', oo.cell(1,1).href
928
- end
929
- end
930
-
931
- # Excel has two base date formats one from 1900 and the other from 1904.
932
- # see #test_base_dates_in_excel
933
- def test_base_dates_in_excelx
934
- with_each_spreadsheet(:name=>'1900_base', :format=>:excelx) do |oo|
935
- assert_equal Date.new(2009,06,15), oo.cell(1,1)
936
- assert_equal :date, oo.celltype(1,1)
937
- end
938
- with_each_spreadsheet(:name=>'1904_base', :format=>:excelx) do |oo|
939
- assert_equal Date.new(2009,06,15), oo.cell(1,1)
940
- assert_equal :date, oo.celltype(1,1)
941
- end
942
- end
943
-
944
323
  def test_cell_methods
945
324
  with_each_spreadsheet(:name=>'numbers1') do |oo|
946
325
  assert_equal 10, oo.a4 # cell(4,'A')
@@ -961,251 +340,23 @@ Sheet 3:
961
340
  # compare large spreadsheets
962
341
  def test_compare_large_spreadsheets
963
342
  # problematisch, weil Formeln in Excel nicht unterstützt werden
964
- if LONG_RUN
965
- qq = Roo::OpenOffice.new(File.join('test',"Bibelbund.ods"))
966
- with_each_spreadsheet(:name=>'Bibelbund') do |oo|
967
- # p "comparing Bibelbund.ods with #{oo.class}"
968
- oo.sheets.each do |sh|
969
- oo.first_row.upto(oo.last_row) do |row|
970
- oo.first_column.upto(oo.last_column) do |col|
971
- c1 = qq.cell(row,col,sh)
972
- c1.force_encoding("UTF-8") if c1.class == String
973
- c2 = oo.cell(row,col,sh)
974
- c2.force_encoding("UTF-8") if c2.class == String
975
- assert_equal c1, c2, "diff in #{sh}/#{row}/#{col}}"
976
- assert_equal qq.celltype(row,col,sh), oo.celltype(row,col,sh)
977
- assert_equal qq.formula?(row,col,sh), oo.formula?(row,col,sh) if oo.class != Roo::Excel
978
- end
343
+ skip_long_test
344
+ qq = Roo::OpenOffice.new(File.join('test',"Bibelbund.ods"))
345
+ with_each_spreadsheet(:name=>'Bibelbund') do |oo|
346
+ # p "comparing Bibelbund.ods with #{oo.class}"
347
+ oo.sheets.each do |sh|
348
+ oo.first_row.upto(oo.last_row) do |row|
349
+ oo.first_column.upto(oo.last_column) do |col|
350
+ c1 = qq.cell(row,col,sh)
351
+ c1.force_encoding("UTF-8") if c1.class == String
352
+ c2 = oo.cell(row,col,sh)
353
+ c2.force_encoding("UTF-8") if c2.class == String
354
+ assert_equal c1, c2, "diff in #{sh}/#{row}/#{col}}"
355
+ assert_equal qq.celltype(row,col,sh), oo.celltype(row,col,sh)
356
+ assert_equal qq.formula?(row,col,sh), oo.formula?(row,col,sh) if oo.class != Roo::Excel
979
357
  end
980
358
  end
981
359
  end
982
- end # LONG_RUN
983
- end
984
-
985
- def test_label
986
- with_each_spreadsheet(:name=>'named_cells', :format=>[:openoffice,:excelx,:libreoffice]) do |oo|
987
- # oo.default_sheet = oo.sheets.first
988
- begin
989
- row,col = oo.label('anton')
990
- rescue ArgumentError
991
- puts "labels error at #{oo.class}"
992
- raise
993
- end
994
- assert_equal 5, row, "error with label in class #{oo.class}"
995
- assert_equal 3, col, "error with label in class #{oo.class}"
996
-
997
- row,col = oo.label('anton')
998
- assert_equal 'Anton', oo.cell(row,col), "error with label in class #{oo.class}"
999
-
1000
- row,col = oo.label('berta')
1001
- assert_equal 'Bertha', oo.cell(row,col), "error with label in class #{oo.class}"
1002
-
1003
- row,col = oo.label('caesar')
1004
- assert_equal 'Cäsar', oo.cell(row,col),"error with label in class #{oo.class}"
1005
-
1006
- row,col = oo.label('never')
1007
- assert_nil row
1008
- assert_nil col
1009
-
1010
- row,col,sheet = oo.label('anton')
1011
- assert_equal 5, row
1012
- assert_equal 3, col
1013
- assert_equal "Sheet1", sheet
1014
- end
1015
- end
1016
-
1017
- def test_method_missing_anton
1018
- with_each_spreadsheet(:name=>'named_cells', :format=>[:openoffice,:excelx,:libreoffice]) do |oo|
1019
- # oo.default_sheet = oo.sheets.first
1020
- assert_equal "Anton", oo.anton
1021
- assert_raises(NoMethodError) {
1022
- oo.never
1023
- }
1024
- end
1025
- end
1026
-
1027
- def test_labels
1028
- with_each_spreadsheet(:name=>'named_cells', :format=>[:openoffice,:excelx,:libreoffice]) do |oo|
1029
- # oo.default_sheet = oo.sheets.first
1030
- assert_equal [
1031
- ['anton',[5,3,'Sheet1']],
1032
- ['berta',[4,2,'Sheet1']],
1033
- ['caesar',[7,2,'Sheet1']],
1034
- ], oo.labels, "error with labels array in class #{oo.class}"
1035
360
  end
1036
361
  end
1037
-
1038
- def test_labeled_cells
1039
- with_each_spreadsheet(:name=>'named_cells', :format=>[:openoffice,:excelx,:libreoffice]) do |oo|
1040
- oo.default_sheet = oo.sheets.first
1041
- begin
1042
- row,col = oo.label('anton')
1043
- rescue ArgumentError
1044
- puts "labels error at #{oo.class}"
1045
- raise
1046
- end
1047
- assert_equal 5, row
1048
- assert_equal 3, col
1049
-
1050
- row,col = oo.label('anton')
1051
- assert_equal 'Anton', oo.cell(row,col)
1052
-
1053
- row,col = oo.label('berta')
1054
- assert_equal 'Bertha', oo.cell(row,col)
1055
-
1056
- row,col = oo.label('caesar')
1057
- assert_equal 'Cäsar', oo.cell(row,col)
1058
-
1059
- row,col = oo.label('never')
1060
- assert_nil row
1061
- assert_nil col
1062
-
1063
- row,col,sheet = oo.label('anton')
1064
- assert_equal 5, row
1065
- assert_equal 3, col
1066
- assert_equal "Sheet1", sheet
1067
-
1068
- assert_equal "Anton", oo.anton
1069
- assert_raises(NoMethodError) {
1070
- row,col = oo.never
1071
- }
1072
-
1073
- # Reihenfolge row,col,sheet analog zu #label
1074
- assert_equal [
1075
- ['anton',[5,3,'Sheet1']],
1076
- ['berta',[4,2,'Sheet1']],
1077
- ['caesar',[7,2,'Sheet1']],
1078
- ], oo.labels, "error with labels array in class #{oo.class}"
1079
- end
1080
- end
1081
-
1082
- # #formulas of an empty sheet should return an empty array and not result in
1083
- # an error message
1084
- # 2011-06-24
1085
- def test_bug_formulas_empty_sheet
1086
- with_each_spreadsheet(:name =>'emptysheets',
1087
- :format=>[:openoffice,:excelx]) do |oo|
1088
- oo.default_sheet = oo.sheets.first
1089
- oo.formulas
1090
- assert_equal([], oo.formulas)
1091
- end
1092
- end
1093
-
1094
- def test_bug_pfand_from_windows_phone_xlsx
1095
- return if defined? JRUBY_VERSION
1096
- with_each_spreadsheet(:name=>'Pfand_from_windows_phone', :format=>:excelx) do |oo|
1097
- oo.default_sheet = oo.sheets.first
1098
- assert_equal ['Blatt1','Blatt2','Blatt3'], oo.sheets
1099
- assert_equal 'Summe', oo.cell('b',1)
1100
-
1101
- assert_equal Date.new(2011,9,14), oo.cell('a',2)
1102
- assert_equal :date, oo.celltype('a',2)
1103
- assert_equal Date.new(2011,9,15), oo.cell('a',3)
1104
- assert_equal :date, oo.celltype('a',3)
1105
-
1106
- assert_equal 3.81, oo.cell('b',2)
1107
- assert_equal "SUM(C2:L2)", oo.formula('b',2)
1108
- assert_equal 0.7, oo.cell('c',2)
1109
- end # each
1110
- end
1111
-
1112
- def test_comment
1113
- with_each_spreadsheet(:name=>'comments', :format=>[:openoffice,:libreoffice,
1114
- :excelx]) do |oo|
1115
- oo.default_sheet = oo.sheets.first
1116
- assert_equal 'Kommentar fuer B4',oo.comment('b',4)
1117
- assert_equal 'Kommentar fuer B5',oo.comment('b',5)
1118
- assert_nil oo.comment('b',99)
1119
- # no comment at the second page
1120
- oo.default_sheet = oo.sheets[1]
1121
- assert_nil oo.comment('b',4)
1122
- end
1123
- end
1124
-
1125
- def test_comments
1126
- with_each_spreadsheet(:name=>'comments', :format=>[:openoffice,:libreoffice,
1127
- :excelx]) do |oo|
1128
- oo.default_sheet = oo.sheets.first
1129
- assert_equal [
1130
- [4, 2, "Kommentar fuer B4"],
1131
- [5, 2, "Kommentar fuer B5"],
1132
- ], oo.comments(oo.sheets.first), "comments error in class #{oo.class}"
1133
- # no comments at the second page
1134
- oo.default_sheet = oo.sheets[1]
1135
- assert_equal [], oo.comments, "comments error in class #{oo.class}"
1136
- end
1137
-
1138
- with_each_spreadsheet(:name=>'comments-google', :format=>[:excelx]) do |oo|
1139
- oo.default_sheet = oo.sheets.first
1140
- assert_equal [[1, 1, "this is a comment\n\t-Steven Daniels"]], oo.comments(oo.sheets.first), "comments error in class #{oo.class}"
1141
- end
1142
- end
1143
-
1144
- def common_possible_bug_snowboard_cells(ss)
1145
- assert_equal "A.", ss.cell(13,'A'), ss.class
1146
- assert_equal 147, ss.cell(13,'f'), ss.class
1147
- assert_equal 152, ss.cell(13,'g'), ss.class
1148
- assert_equal 156, ss.cell(13,'h'), ss.class
1149
- assert_equal 158, ss.cell(13,'i'), ss.class
1150
- assert_equal 160, ss.cell(13,'j'), ss.class
1151
- assert_equal 164, ss.cell(13,'k'), ss.class
1152
- assert_equal 168, ss.cell(13,'l'), ss.class
1153
- assert_equal :string, ss.celltype(13,'m'), ss.class
1154
- assert_equal "159W", ss.cell(13,'m'), ss.class
1155
- assert_equal "164W", ss.cell(13,'n'), ss.class
1156
- assert_equal "168W", ss.cell(13,'o'), ss.class
1157
- end
1158
-
1159
- def test_bug_numbered_sheet_names
1160
- with_each_spreadsheet(:name=>'bug-numbered-sheet-names', :format=>:excelx) do |oo|
1161
- oo.each_with_pagename { }
1162
- end
1163
- end
1164
-
1165
- def test_close
1166
- with_each_spreadsheet(:name=>'numbers1') do |oo|
1167
- next unless (tempdir = oo.instance_variable_get('@tmpdir'))
1168
- oo.close
1169
- assert !File.exists?(tempdir), "Expected #{tempdir} to be cleaned up, but it still exists"
1170
- end
1171
- end
1172
-
1173
- # NOTE: Ruby 2.4.0 changed the way GC works. The last Roo object created by
1174
- # with_each_spreadsheet wasn't getting GC'd until after the process
1175
- # ended.
1176
- #
1177
- # That behavior change broke this test. In order to fix it, I forked the
1178
- # process and passed the temp directories from the forked process in
1179
- # order to check if they were removed properly.
1180
- def test_finalize
1181
- skip if defined? JRUBY_VERSION
1182
-
1183
- read, write = IO.pipe
1184
- pid = Process.fork do
1185
- with_each_spreadsheet(name: "numbers1") do |oo|
1186
- write.puts oo.instance_variable_get("@tmpdir")
1187
- end
1188
- end
1189
-
1190
- Process.wait(pid)
1191
- write.close
1192
- tempdirs = read.read.split("\n")
1193
- read.close
1194
-
1195
- refute tempdirs.empty?
1196
- tempdirs.each do |tempdir|
1197
- refute File.exist?(tempdir), "Expected #{tempdir} to be cleaned up, but it still exists"
1198
- end
1199
- end
1200
-
1201
- def test_cleanup_on_error
1202
- old_temp_files = Dir.open(Dir.tmpdir).to_a
1203
- with_each_spreadsheet(:name=>'non_existent_file', :ignore_errors=>true) do |oo|; end
1204
- assert_equal Dir.open(Dir.tmpdir).to_a, old_temp_files
1205
- end
1206
-
1207
- def test_name_with_leading_slash
1208
- xlsx = Roo::Excelx.new(File.join(TESTDIR,'name_with_leading_slash.xlsx'))
1209
- assert_equal 1, xlsx.sheets.count
1210
- end
1211
- end # class
362
+ end