marc 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +30 -0
  3. data/.github/workflows/ruby.yml +24 -0
  4. data/.gitignore +17 -0
  5. data/.standard.yml +1 -0
  6. data/{Changes → CHANGELOG.md} +102 -30
  7. data/Gemfile +15 -0
  8. data/README.md +239 -46
  9. data/Rakefile +14 -14
  10. data/bin/marc +14 -0
  11. data/bin/marc2xml +17 -0
  12. data/examples/xml2marc.rb +10 -0
  13. data/lib/marc/constants.rb +3 -3
  14. data/lib/marc/controlfield.rb +35 -23
  15. data/lib/marc/datafield.rb +70 -63
  16. data/lib/marc/dublincore.rb +59 -41
  17. data/lib/marc/exception.rb +9 -1
  18. data/lib/marc/jsonl_reader.rb +33 -0
  19. data/lib/marc/jsonl_writer.rb +44 -0
  20. data/lib/marc/marc8/map_to_unicode.rb +16417 -16420
  21. data/lib/marc/marc8/to_unicode.rb +80 -86
  22. data/lib/marc/reader.rb +117 -123
  23. data/lib/marc/record.rb +72 -62
  24. data/lib/marc/subfield.rb +12 -10
  25. data/lib/marc/unsafe_xmlwriter.rb +93 -0
  26. data/lib/marc/version.rb +1 -1
  27. data/lib/marc/writer.rb +27 -30
  28. data/lib/marc/xml_parsers.rb +222 -197
  29. data/lib/marc/xmlreader.rb +131 -114
  30. data/lib/marc/xmlwriter.rb +93 -82
  31. data/lib/marc.rb +20 -18
  32. data/marc.gemspec +23 -0
  33. data/test/marc8/tc_marc8_mapping.rb +3 -3
  34. data/test/marc8/tc_to_unicode.rb +28 -32
  35. data/test/messed_up_leader.xml +9 -0
  36. data/test/tc_controlfield.rb +37 -34
  37. data/test/tc_datafield.rb +65 -60
  38. data/test/tc_dublincore.rb +9 -11
  39. data/test/tc_hash.rb +10 -13
  40. data/test/tc_jsonl.rb +19 -0
  41. data/test/tc_marchash.rb +17 -21
  42. data/test/tc_parsers.rb +108 -144
  43. data/test/tc_reader.rb +35 -36
  44. data/test/tc_reader_char_encodings.rb +149 -169
  45. data/test/tc_record.rb +143 -148
  46. data/test/tc_subfield.rb +14 -13
  47. data/test/tc_unsafe_xml.rb +95 -0
  48. data/test/tc_writer.rb +101 -108
  49. data/test/tc_xml.rb +101 -94
  50. data/test/tc_xml_error_handling.rb +7 -8
  51. data/test/ts_marc.rb +8 -8
  52. metadata +80 -9
data/test/tc_parsers.rb CHANGED
@@ -1,180 +1,154 @@
1
- require 'test/unit'
2
- require 'marc'
1
+ require "test/unit"
2
+ require "marc"
3
+ require "warning"
3
4
 
4
5
  class ParsersTest < Test::Unit::TestCase
6
+ LOADABLE_PARSERS = {
7
+ libxml: "xml",
8
+ nokogiri: "nokogiri",
9
+ }
10
+
11
+ @@parsers = LOADABLE_PARSERS.keys.each_with_object({}) do |label, h|
12
+ begin
13
+ require LOADABLE_PARSERS[label]
14
+ h[label] = true
15
+ rescue LoadError
16
+ warn "#{label} unavailable: skipping its tests"
17
+ end
18
+ end
19
+
20
+ def self.jstax_available?
21
+ require "java"
22
+ java.lang.Class.forName("javax.xml.stream.XMLInputFactory")
23
+ true
24
+ rescue LoadError, java.lang.ClassNotFoundException
25
+ warn "jstax unavailable: skipping its tests"
26
+ false
27
+ end
28
+
29
+ @@parsers[:jstax] = jstax_available?
30
+
5
31
  def test_parser_default
6
32
  assert_equal("rexml", MARC::XMLReader.parser)
7
- reader = MARC::XMLReader.new('test/one.xml')
33
+ reader = MARC::XMLReader.new("test/one.xml")
8
34
  assert_kind_of(REXML::Parsers::PullParser, reader.parser)
9
35
  end
10
-
36
+
11
37
  def test_set_nokogiri
12
- begin
13
- require 'nokogiri'
14
- assert_equal("rexml", MARC::XMLReader.parser)
15
- reader = MARC::XMLReader.new('test/one.xml')
16
- assert_kind_of(REXML::Parsers::PullParser, reader.parser)
17
- reader = MARC::XMLReader.new('test/one.xml', :parser=>MARC::XMLReader::USE_NOKOGIRI)
18
- assert_kind_of(Nokogiri::XML::SAX::Parser, reader.parser)
19
- assert_equal("rexml", MARC::XMLReader.parser)
20
- reader = MARC::XMLReader.new('test/one.xml', :parser=>'nokogiri')
21
- assert_kind_of(Nokogiri::XML::SAX::Parser, reader.parser)
22
- assert_equal("rexml", MARC::XMLReader.parser)
23
- MARC::XMLReader.parser=MARC::XMLReader::USE_NOKOGIRI
24
- assert_equal("nokogiri", MARC::XMLReader.parser)
25
- reader = MARC::XMLReader.new('test/one.xml')
26
- assert_kind_of(Nokogiri::XML::SAX::Parser, reader.parser)
27
- MARC::XMLReader.parser="nokogiri"
28
- assert_equal("nokogiri", MARC::XMLReader.parser)
29
- reader = MARC::XMLReader.new('test/one.xml')
30
- assert_kind_of(Nokogiri::XML::SAX::Parser, reader.parser)
31
- rescue LoadError
32
- puts "\nNokogiri not available, skipping 'test_set_nokogiri'.\n"
33
- end
38
+ return unless @@parsers[:nokogiri]
39
+ assert_equal("rexml", MARC::XMLReader.parser)
40
+ reader = MARC::XMLReader.new("test/one.xml")
41
+ assert_kind_of(REXML::Parsers::PullParser, reader.parser)
42
+ reader = MARC::XMLReader.new("test/one.xml", parser: MARC::XMLReader::USE_NOKOGIRI)
43
+ assert_kind_of(Nokogiri::XML::SAX::Parser, reader.parser)
44
+ assert_equal("rexml", MARC::XMLReader.parser)
45
+ reader = MARC::XMLReader.new("test/one.xml", parser: "nokogiri")
46
+ assert_kind_of(Nokogiri::XML::SAX::Parser, reader.parser)
47
+ assert_equal("rexml", MARC::XMLReader.parser)
48
+ MARC::XMLReader.parser = MARC::XMLReader::USE_NOKOGIRI
49
+ assert_equal("nokogiri", MARC::XMLReader.parser)
50
+ reader = MARC::XMLReader.new("test/one.xml")
51
+ assert_kind_of(Nokogiri::XML::SAX::Parser, reader.parser)
52
+ MARC::XMLReader.parser = "nokogiri"
53
+ assert_equal("nokogiri", MARC::XMLReader.parser)
54
+ reader = MARC::XMLReader.new("test/one.xml")
55
+ assert_kind_of(Nokogiri::XML::SAX::Parser, reader.parser)
34
56
  end
35
-
36
- def test_set_jrexml
37
- if defined? JRUBY_VERSION
38
- begin
39
- require 'jrexml'
40
- reader = MARC::XMLReader.new('test/one.xml', :parser=>MARC::XMLReader::USE_JREXML)
41
- assert_kind_of(REXML::Parsers::PullParser, reader.parser)
42
- assert_equal("rexml", MARC::XMLReader.parser)
43
- reader = MARC::XMLReader.new('test/one.xml', :parser=>'jrexml')
44
- assert_kind_of(REXML::Parsers::PullParser, reader.parser)
45
- assert_equal("rexml", MARC::XMLReader.parser)
46
- MARC::XMLReader.parser=MARC::XMLReader::USE_JREXML
47
- assert_equal("jrexml", MARC::XMLReader.parser)
48
- reader = MARC::XMLReader.new('test/one.xml')
49
- assert_kind_of(REXML::Parsers::PullParser, reader.parser)
50
- MARC::XMLReader.parser="jrexml"
51
- assert_equal("jrexml", MARC::XMLReader.parser)
52
- reader = MARC::XMLReader.new('test/one.xml')
53
- assert_kind_of(REXML::Parsers::PullParser, reader.parser)
54
- rescue LoadError
55
- puts "\njrexml not available, skipping 'test_set_jrexml'.\n"
56
- end
57
- else
58
- puts "\nTest not being run from JRuby, skipping 'test_set_jrexml'.\n"
59
- end
60
- end
61
-
62
- def test_set_jstax
63
- if defined? JRUBY_VERSION
64
- begin
65
- assert_equal("rexml", MARC::XMLReader.parser)
66
- reader = MARC::XMLReader.new('test/one.xml')
67
- assert_kind_of(REXML::Parsers::PullParser, reader.parser)
68
-
69
- reader = MARC::XMLReader.new('test/one.xml', :parser=>MARC::XMLReader::USE_JSTAX)
70
- assert_kind_of(Java::ComSunOrgApacheXercesInternalImpl::XMLStreamReaderImpl, reader.parser)
71
- assert_equal("rexml", MARC::XMLReader.parser)
72
- reader = MARC::XMLReader.new('test/one.xml', :parser=>'jstax')
73
- assert_kind_of(Java::ComSunOrgApacheXercesInternalImpl::XMLStreamReaderImpl, reader.parser)
74
- assert_equal("rexml", MARC::XMLReader.parser)
75
- MARC::XMLReader.parser=MARC::XMLReader::USE_JSTAX
76
- assert_equal("jstax", MARC::XMLReader.parser)
77
- reader = MARC::XMLReader.new('test/one.xml')
78
- assert_kind_of(Java::ComSunOrgApacheXercesInternalImpl::XMLStreamReaderImpl, reader.parser)
79
- MARC::XMLReader.parser="jstax"
80
- assert_equal("jstax", MARC::XMLReader.parser)
81
- reader = MARC::XMLReader.new('test/one.xml')
82
- assert_kind_of(Java::ComSunOrgApacheXercesInternalImpl::XMLStreamReaderImpl, reader.parser)
83
- rescue java.lang.ClassNotFoundException
84
- puts "\njavax.xml.stream not available, skipping 'test_set_jstax'.\n"
85
- end
86
- else
87
- puts "\nTest not being run from JRuby, skipping 'test_set_jstax'.\n"
57
+
58
+ def test_set_jstax
59
+ return unless @@parsers[:jstax]
60
+ assert_equal("rexml", MARC::XMLReader.parser)
61
+ reader = MARC::XMLReader.new("test/one.xml")
62
+ assert_kind_of(REXML::Parsers::PullParser, reader.parser)
63
+
64
+ reader = MARC::XMLReader.new("test/one.xml", parser: MARC::XMLReader::USE_JSTAX)
65
+ assert_kind_of(Java::ComSunOrgApacheXercesInternalImpl::XMLStreamReaderImpl, reader.parser)
66
+ assert_equal("rexml", MARC::XMLReader.parser)
67
+ reader = MARC::XMLReader.new("test/one.xml", parser: "jstax")
68
+ assert_kind_of(Java::ComSunOrgApacheXercesInternalImpl::XMLStreamReaderImpl, reader.parser)
69
+ assert_equal("rexml", MARC::XMLReader.parser)
70
+ MARC::XMLReader.parser = MARC::XMLReader::USE_JSTAX
71
+ assert_equal("jstax", MARC::XMLReader.parser)
72
+ reader = MARC::XMLReader.new("test/one.xml")
73
+ assert_kind_of(Java::ComSunOrgApacheXercesInternalImpl::XMLStreamReaderImpl, reader.parser)
74
+ MARC::XMLReader.parser = "jstax"
75
+ assert_equal("jstax", MARC::XMLReader.parser)
76
+ reader = MARC::XMLReader.new("test/one.xml")
77
+ assert_kind_of(Java::ComSunOrgApacheXercesInternalImpl::XMLStreamReaderImpl, reader.parser)
88
78
  end
89
- end
90
-
79
+
91
80
  def test_set_rexml
92
- reader = MARC::XMLReader.new('test/one.xml', :parser=>MARC::XMLReader::USE_REXML)
81
+ reader = MARC::XMLReader.new("test/one.xml", parser: MARC::XMLReader::USE_REXML)
93
82
  assert_kind_of(REXML::Parsers::PullParser, reader.parser)
94
83
  assert_equal("rexml", MARC::XMLReader.parser)
95
- reader = MARC::XMLReader.new('test/one.xml', :parser=>'rexml')
84
+ reader = MARC::XMLReader.new("test/one.xml", parser: "rexml")
96
85
  assert_kind_of(REXML::Parsers::PullParser, reader.parser)
97
- assert_equal("rexml", MARC::XMLReader.parser)
98
- MARC::XMLReader.parser=MARC::XMLReader::USE_REXML
99
86
  assert_equal("rexml", MARC::XMLReader.parser)
100
- reader = MARC::XMLReader.new('test/one.xml')
87
+ MARC::XMLReader.parser = MARC::XMLReader::USE_REXML
88
+ assert_equal("rexml", MARC::XMLReader.parser)
89
+ reader = MARC::XMLReader.new("test/one.xml")
101
90
  assert_kind_of(REXML::Parsers::PullParser, reader.parser)
102
- MARC::XMLReader.parser="rexml"
91
+ MARC::XMLReader.parser = "rexml"
103
92
  assert_equal("rexml", MARC::XMLReader.parser)
104
- reader = MARC::XMLReader.new('test/one.xml')
105
- assert_kind_of(REXML::Parsers::PullParser, reader.parser)
93
+ reader = MARC::XMLReader.new("test/one.xml")
94
+ assert_kind_of(REXML::Parsers::PullParser, reader.parser)
106
95
  end
107
-
96
+
108
97
  def test_set_magic
109
98
  best = choose_best_available_parser
110
99
  magic_parser = best[:parser]
111
- puts "\nTesting 'test_set_magic' for parser: #{magic_parser}"
112
- reader = MARC::XMLReader.new('test/one.xml', :parser=>MARC::XMLReader::USE_BEST_AVAILABLE)
100
+ reader = MARC::XMLReader.new("test/one.xml", parser: MARC::XMLReader::USE_BEST_AVAILABLE)
113
101
  assert_kind_of(magic_parser, reader.parser)
114
102
  assert_equal("rexml", MARC::XMLReader.parser)
115
- reader = MARC::XMLReader.new('test/one.xml', :parser=>'magic')
103
+ reader = MARC::XMLReader.new("test/one.xml", parser: "magic")
116
104
  assert_kind_of(magic_parser, reader.parser)
117
- assert_equal("rexml", MARC::XMLReader.parser)
118
- MARC::XMLReader.parser=MARC::XMLReader::USE_BEST_AVAILABLE
105
+ assert_equal("rexml", MARC::XMLReader.parser)
106
+ MARC::XMLReader.parser = MARC::XMLReader::USE_BEST_AVAILABLE
119
107
  assert_equal("magic", MARC::XMLReader.parser)
120
- reader = MARC::XMLReader.new('test/one.xml')
108
+ reader = MARC::XMLReader.new("test/one.xml")
121
109
  assert_kind_of(magic_parser, reader.parser)
122
- MARC::XMLReader.parser="magic"
110
+ MARC::XMLReader.parser = "magic"
123
111
  assert_equal("magic", MARC::XMLReader.parser)
124
- reader = MARC::XMLReader.new('test/one.xml')
125
- assert_kind_of(magic_parser, reader.parser)
126
- end
127
-
112
+ reader = MARC::XMLReader.new("test/one.xml")
113
+ assert_kind_of(magic_parser, reader.parser)
114
+ end
115
+
128
116
  def test_parser_set_convenience_methods
129
117
  best = choose_best_available_parser
130
118
  parser = best[:parser]
131
119
  parser_name = best[:parser_name]
132
120
  assert_equal(parser_name, MARC::XMLReader.best_available)
133
121
  MARC::XMLReader.best_available!
134
- reader = MARC::XMLReader.new('test/one.xml')
122
+ reader = MARC::XMLReader.new("test/one.xml")
135
123
  assert_kind_of(parser, reader.parser)
136
124
  MARC::XMLReader.rexml!
137
- reader = MARC::XMLReader.new('test/one.xml')
138
- assert_kind_of(REXML::Parsers::PullParser, reader.parser)
139
- if parser_name == 'nokogiri'
125
+ reader = MARC::XMLReader.new("test/one.xml")
126
+ assert_kind_of(REXML::Parsers::PullParser, reader.parser)
127
+ if parser_name == "nokogiri"
140
128
  MARC::XMLReader.nokogiri!
141
- reader = MARC::XMLReader.new('test/one.xml')
142
- assert_kind_of(Nokogiri::XML::SAX::Parser, reader.parser)
143
- else
144
- puts "\nNokogiri not loaded, skipping convenience method test.\n"
145
- end
146
- if defined? JRUBY_VERSION
147
- begin
148
- require 'jrexml'
149
- MARC::XMLReader.jrexml!
150
- reader = MARC::XMLReader.new('test/one.xml')
151
- assert_kind_of(REXML::Parsers::PullParser, reader.parser)
152
- rescue LoadError
153
- puts "\njrexml not available, skipping convenience method test.\n"
154
- end
155
- else
156
- puts "\nTest not being run from JRuby, skipping jrexml convenience method test.\n"
129
+ reader = MARC::XMLReader.new("test/one.xml")
130
+ assert_kind_of(Nokogiri::XML::SAX::Parser, reader.parser)
157
131
  end
158
132
  end
159
-
133
+
160
134
  def teardown
161
- MARC::XMLReader.parser=MARC::XMLReader::USE_REXML
135
+ MARC::XMLReader.parser = MARC::XMLReader::USE_REXML
162
136
  end
163
-
137
+
164
138
  def choose_best_available_parser
165
139
  parser_name = nil
166
140
  parser = nil
167
- unless parser
141
+ unless parser
168
142
  begin
169
- require 'nokogiri'
170
- parser_name = 'nokogiri'
143
+ require "nokogiri"
144
+ parser_name = "nokogiri"
171
145
  parser = Nokogiri::XML::SAX::Parser
172
146
  rescue LoadError
173
147
  end
174
148
  end
175
149
  unless parser
176
150
  if defined? JRUBY_VERSION
177
- require 'java'
151
+ require "java"
178
152
  begin
179
153
  java.lang.Class.forName("javax.xml.stream.XMLInputFactory")
180
154
  parser_name = "jstax"
@@ -186,27 +160,17 @@ end
186
160
  unless parser
187
161
  if !defined? JRUBY_VERSION
188
162
  begin
189
- require 'xml'
190
- parser_name = 'libxml'
163
+ require "xml"
164
+ parser_name = "libxml"
191
165
  parser = LibXML::XML::Reader
192
166
  rescue LoadError
193
167
  end
194
- else
195
- if defined? JRUBY_VERSION
196
- begin
197
- require 'jrexml'
198
- parser_name = 'jrexml'
199
- parser = REXML::Parsers::PullParser
200
- rescue LoadError
201
- end
202
- end
203
168
  end
204
169
  unless parser
205
170
  parser = REXML::Parsers::PullParser
206
- parser_name = 'rexml'
171
+ parser_name = "rexml"
207
172
  end
208
- end
209
- return {:parser=>parser, :parser_name=>parser_name}
173
+ end
174
+ {parser: parser, parser_name: parser_name}
210
175
  end
211
-
212
- end
176
+ end
data/test/tc_reader.rb CHANGED
@@ -1,92 +1,92 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- require 'test/unit'
4
- require 'marc'
1
+ require "test/unit"
2
+ require "marc"
5
3
 
6
4
  class ReaderTest < Test::Unit::TestCase
7
-
8
5
  def test_batch
9
- reader = MARC::Reader.new('test/batch.dat')
6
+ reader = MARC::Reader.new("test/batch.dat")
10
7
  count = 0
11
8
  reader.each { count += 1 }
12
9
  assert_equal(count, 10)
13
10
  end
14
11
 
15
12
  def test_loose
16
- reader = MARC::ForgivingReader.new('test/batch.dat')
13
+ reader = MARC::ForgivingReader.new("test/batch.dat")
17
14
  count = 0
18
15
  reader.each { count += 1 }
19
16
  assert_equal(10, count)
20
17
  end
21
-
18
+
22
19
  def test_loose_utf8
23
- # This isn't actually a corrupt file, but it is utf8,
20
+ # This isn't actually a corrupt file, but it is utf8,
24
21
  # and I have some reason to believe forgiving reader isn't
25
- # working properly with UTF8 in ruby 1.9, so testing it.
26
- reader = MARC::ForgivingReader.new('test/utf8.marc')
22
+ # working properly with UTF8 in ruby 1.9, so testing it.
23
+ reader = MARC::ForgivingReader.new("test/utf8.marc")
27
24
  count = 0
28
25
  reader.each { count += 1 }
29
26
  assert_equal(1, count)
30
27
  end
31
-
28
+
32
29
  def test_loose_unimarc
33
- # Unimarc might use a different record seperator? Let's make sure it works.
34
- reader = MARC::Reader.new(File.open('test/cp866_unimarc.marc', 'r:cp866'))
30
+ # Unimarc might use a different record seperator? Let's make sure it works.
31
+ reader = MARC::Reader.new(File.open("test/cp866_unimarc.marc", "r:cp866"))
35
32
  count = 0
36
- reader.each {|a| count += 1 }
33
+ reader.each { |a| count += 1 }
37
34
  assert_equal(1, count)
38
35
  end
39
36
 
40
37
  def test_non_numeric_tags
41
- reader = MARC::Reader.new('test/non-numeric.dat')
38
+ reader = MARC::Reader.new("test/non-numeric.dat")
42
39
  count = 0
43
40
  record = nil
44
- reader.each do | rec |
41
+ reader.each do |rec|
45
42
  count += 1
46
43
  record = rec
47
44
  end
48
45
  assert_equal(1, count)
49
- assert_equal('9780061317842', record['ISB']['a'])
50
- assert_equal('1', record['LOC']['9'])
46
+ assert_equal("9780061317842", record["ISB"]["a"])
47
+ assert_equal("1", record["LOC"]["9"])
51
48
  end
52
49
 
53
50
  def test_bad_marc
54
- reader = MARC::Reader.new('test/tc_reader.rb')
55
- assert_raises(MARC::Exception) {reader.entries[0]}
51
+ reader = MARC::Reader.new("test/tc_reader.rb")
52
+ assert_raises(MARC::Exception) { reader.entries[0] }
56
53
  end
57
54
 
58
55
  def test_search
59
- reader = MARC::Reader.new('test/batch.dat')
56
+ reader = MARC::Reader.new("test/batch.dat")
60
57
  records = reader.find_all { |r| r =~ /Perl/ }
61
58
  assert_equal(10, records.length)
62
59
 
63
- reader = MARC::Reader.new('test/batch.dat')
64
- records = reader.find_all { |r| r['245'] =~ /Perl/ }
60
+ reader = MARC::Reader.new("test/batch.dat")
61
+ records = reader.find_all { |r| r["245"] =~ /Perl/ }
65
62
  assert_equal(10, records.length)
66
63
 
67
- reader = MARC::Reader.new('test/batch.dat')
68
- records = reader.find_all { |r| r['245']['a'] =~ /Perl/ }
64
+ reader = MARC::Reader.new("test/batch.dat")
65
+ records = reader.find_all { |r| r["245"]["a"] =~ /Perl/ }
69
66
  assert_equal(10, records.length)
70
67
 
71
- reader = MARC::Reader.new('test/batch.dat')
68
+ reader = MARC::Reader.new("test/batch.dat")
72
69
  records = reader.find_all { |r| r =~ /Foo/ }
73
70
  assert_equal(0, records.length)
74
71
  end
75
-
72
+
76
73
  def test_binary_enumerator
77
- reader = MARC::Reader.new('test/batch.dat')
74
+ reader = MARC::Reader.new("test/batch.dat")
78
75
  iter = reader.each
79
76
  r = iter.next
80
77
  assert_instance_of(MARC::Record, r)
81
- 9.times {iter.next} # total of ten records
82
- assert_raises(StopIteration) { iter.next }
78
+ 9.times { iter.next } # total of ten records
79
+ assert_raises(StopIteration) { iter.next }
83
80
  end
84
81
 
85
82
  def test_each_raw
86
- reader = MARC::Reader.new('test/batch.dat')
83
+ reader = MARC::Reader.new("test/batch.dat")
87
84
  count = 0
88
85
  raw = nil
89
- reader.each_raw { |r| count += 1; raw = r }
86
+ reader.each_raw { |r|
87
+ count += 1
88
+ raw = r
89
+ }
90
90
  assert_equal(count, 10)
91
91
  assert_instance_of(String, raw)
92
92
 
@@ -95,7 +95,7 @@ class ReaderTest < Test::Unit::TestCase
95
95
  end
96
96
 
97
97
  def test_each_raw_enum
98
- reader = MARC::Reader.new('test/batch.dat')
98
+ reader = MARC::Reader.new("test/batch.dat")
99
99
  enum = reader.each_raw
100
100
  r = enum.next
101
101
  assert_instance_of(String, r)
@@ -103,8 +103,7 @@ class ReaderTest < Test::Unit::TestCase
103
103
  record = MARC::Reader.decode(r)
104
104
  assert_instance_of(MARC::Record, record)
105
105
 
106
- 9.times {enum.next} # total of ten records
106
+ 9.times { enum.next } # total of ten records
107
107
  assert_raises(StopIteration) { enum.next }
108
108
  end
109
-
110
109
  end