Sha256: 6e8f83afcc6c24e8bf667c9190d6a16867869d896891fd3b8341f802ec35c7b2

Contents?: true

Size: 543 Bytes

Versions: 9

Compression:

Stored size: 543 Bytes

Contents

require 'test/unit'
require 'marc'

class TestField < Test::Unit::TestCase

  def test_control
    control = MARC::ControlField.new('005', 'foobarbaz')
    assert_equal(control.to_s, '005 foobarbaz')
  end

  def test_field_as_control
    assert_raise(MARC::Exception) do
      # can't have a field with a tag < 010
      field = MARC::DataField.new('007') 
    end
  end

  def test_control_as_field
    assert_raise(MARC::Exception) do
      # can't have a control with a tag > 009
      f = MARC::ControlField.new('245')
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
marc-0.2.2 test/tc_controlfield.rb
marc-0.2.0 test/tc_controlfield.rb
marc-0.1.4 test/tc_controlfield.rb
marc-0.1.5 test/tc_controlfield.rb
marc-0.1.6 test/tc_controlfield.rb
marc-0.1.8 test/tc_controlfield.rb
marc-0.1.7 test/tc_controlfield.rb
marc-0.1.9 test/tc_controlfield.rb
marc-0.2.1 test/tc_controlfield.rb