Sha256: 1522f6ee70a9ac0984b2cd5a49a1ba3fb5f65dee7cf475decddb7ae376b6daeb

Contents?: true

Size: 730 Bytes

Versions: 2

Compression:

Stored size: 730 Bytes

Contents

require "test/unit"
require "marc"
require "rubygems"

class TestMARCHASH < Test::Unit::TestCase
  def test_simple
    simple = {
      "type" => "marc-hash",
      "version" => [1, 0],
      "leader" => "LEADER",
      "fields" => [
        ["245", "1", "0",
          [
            ["a", "TITLE"],
            ["b", "SUBTITLE"]
          ]]
      ]
    }
    r = MARC::Record.new
    r.leader = "LEADER"
    f = MARC::DataField.new("245", "1", "0", ["a", "TITLE"], ["b", "SUBTITLE"])
    r << f
    assert_equal(r.to_marchash, simple)
  end

  def test_real
    reader = MARC::Reader.new("test/batch.dat")
    reader.each do |r|
      x = MARC::Record.new_from_marchash(r.to_marchash)
      assert_equal(r, x)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
marc-1.3.0 test/tc_marchash.rb
marc-1.2.0 test/tc_marchash.rb