Sha256: 715a6477224fc7ad22eceda6e99f5bce1a4207a811e6f1fa8c0d992b5a9b8927

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require 'helper'

class TestAnvl < Test::Unit::TestCase
  def test_parse_empty
    h = ANVL.parse ''
    assert_equal(h, {})
  end

  def test_parse_comment
    h = ANVL.parse '#'
    assert_equal(h, {})
  end

  def test_first_draft
    h = ANVL.parse 'entry: 
# first draft 
who: Gilbert, W.S. | Sullivan, Arthur 
what: The Yeomen of
      the Guard 
when/created: 1888'
    assert_equal(h[:entry], "")
    assert_equal(h[:who], 'Gilbert, W.S. | Sullivan, Arthur')
    assert_equal(h[:what], "The Yeomen of the Guard")
    assert_equal(h[:"when/created"], "1888")
  end

  def test_fmt_empty
    str = ANVL.to_anvl({})
    assert_equal(str, '')
  end
  
  def test_fmt_first_draft
    str = ANVL.to_anvl({:entry => [""], :who => ['Gilbert, W.S. | Sullivan, Arthur'], :what => ["The Yeomen of the Guard"], :"when/created" => [1888]})
    assert_match(/entry:/, str)
    assert_match(/who: Gilbert, W.S. | Sullivan, Arthur/, str)
    assert_match(/what: The Yeomen of the Guard/, str)
    assert_match(/when\/created: 1888/, str)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
anvl-0.1.0 test/test_anvl.rb