Sha256: 00e9dc60216719b14426b1d679dbb35b64a29067c9a1dfdb44cc9d7d4222ecce

Contents?: true

Size: 961 Bytes

Versions: 7

Compression:

Stored size: 961 Bytes

Contents

require 'helper.rb'

require 'yaml'

module BibTeX
  class TestString < Minitest::Unit::TestCase

    # def test_yaml_roundtrip
    #   b1 = BibTeX.open(Test.fixtures(:bibdesk))
    #   b2 = Bibliography.new(YAML.load(b1.to_yaml))
    #   assert_equal b1, b2
    # end

    def test_yaml
      bib = BibTeX::Bibliography.open(Test.fixtures(:bibdesk), :debug => false)
      yaml = YAML.load(bib.to_yaml)
      refute_nil(yaml)
      assert_equal(3, yaml.length)
      assert_equal(%w[ dragon pickaxe rails], yaml.map { |y| y[:key] }.sort)
      assert_equal('{The Facets of Ruby}', yaml[0][:series])
    end

    def test_json
      bib = BibTeX::Bibliography.open(Test.fixtures(:bibdesk), :debug => false)
      json = JSON.parse(bib.to_json)
      refute_nil(json)
      assert_equal(3, json.length)
      assert_equal(%w[ dragon pickaxe rails], json.map { |y| y['key'] }.sort)
      assert_equal('{The Facets of Ruby}', json[0]['series'])
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bibtex-ruby-3.1.6 test/test_export.rb
bibtex-ruby-3.1.5 test/test_export.rb
bibtex-ruby-3.1.4 test/test_export.rb
bibtex-ruby-3.1.3 test/test_export.rb
bibtex-ruby-3.1.2 test/test_export.rb
bibtex-ruby-3.1.1 test/test_export.rb
bibtex-ruby-3.1.0 test/test_export.rb