summaryrefslogtreecommitdiff
path: root/test/test_psych.rb
blob: 690bf23909a469430213267ea7ee267c6c123fc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'minitest/autorun'
require 'psych'

class TestPsych < MiniTest::Unit::TestCase
  def test_simple
    assert_equal 'foo', Psych.load("--- foo\n")
  end

  def test_libyaml_version
    assert Psych.libyaml_version
    assert_equal Psych.libyaml_version.join('.'), Psych::LIBYAML_VERSION
  end

  def test_load_documents
    docs = []
    Psych.load_documents("--- foo\n...\n--- bar\n...") { |doc|
      docs << doc
    }
    assert_equal %w{ foo bar }, docs
  end
end