Class: TestFachinfoDocParser13

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
ext/fiparse/test/test_fachinfo_doc_parser.rb

Defined Under Namespace

Classes: ReplHandler

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1226

def setup
  @filename = File.expand_path('data/doc/Lapidar_f.doc', 
    File.dirname(__FILE__))
  @text_handler = ODDB::FiParse::FachinfoTextHandler.new
  @parser = Rwv2.create_parser(@filename)
  @parser.set_text_handler(@text_handler)
  @table_handler = @text_handler.table_handler
  @parser.set_table_handler(@table_handler)
  @parser.set_inline_replacement_handler(ReplHandler.new)
  @parser.parse
  @text_handler.cutoff_fontsize = @text_handler.max_fontsize
  @parser.parse
end

- (Object) test_composition13



1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1244

def test_composition13
  writer = @text_handler.writers.first
  chapter = writer.composition
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Composition', chapter.heading)
  assert_equal(1, chapter.sections.size)
  section = chapter.sections.first
  assert_instance_of(ODDB::Text::Section, section)
  assert_equal(2, section.paragraphs.size)
  paragraph = section.paragraphs.first
  assert_instance_of(ODDB::Text::Paragraph, paragraph)
end

- (Object) test_date13



1286
1287
1288
1289
1290
1291
1292
1293
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1286

def test_date13
  writer = @text_handler.writers.first
  chapter = writer.date
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_match(/Mise .* jour de l.*information/, chapter.heading)
  paragraph = chapter.sections.first.paragraphs.first
  assert_equal("Mai 2006", paragraph.text)
end

- (Object) test_iksnrs13



1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1270

def test_iksnrs13
  writer = @text_handler.writers.first
  chapter = writer.iksnrs
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Estampille', chapter.heading)
  assert_equal(1, chapter.sections.size)
  assert_equal(1, chapter.sections.first.paragraphs.size)
  paragraph = chapter.sections.first.paragraphs.first
  assert_equal("10392 (Swissmedic)", paragraph.text)
end

- (Object) test_indications13



1256
1257
1258
1259
1260
1261
1262
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1256

def test_indications13
  writer = @text_handler.writers.first
  chapter = writer.indications
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_match(/Indications\/possibilit.*s d.*emploi/, chapter.heading)
  assert_equal(2, chapter.sections.size)
end

- (Object) test_name13



1239
1240
1241
1242
1243
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1239

def test_name13
  assert_equal(1, @text_handler.writers.size)
  writer = @text_handler.writers.first
  assert_match(/LAPIDAR .* 10\n/, writer.name)
end

- (Object) test_preclinic13



1263
1264
1265
1266
1267
1268
1269
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1263

def test_preclinic13
  writer = @text_handler.writers.first
  chapter = writer.preclinic
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_match(/Donn.*s pr.*cliniques/, chapter.heading)
  assert_equal(2, chapter.sections.size)
end

- (Object) test_registration_owner13



1280
1281
1282
1283
1284
1285
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1280

def test_registration_owner13
  writer = @text_handler.writers.first
  chapter = writer.registration_owner
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_match(/Titulaire de l.*autorisation/, chapter.heading)
end