summaryrefslogtreecommitdiff
path: root/test/test_psych.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-03-22 19:41:47 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-03-22 19:41:47 -0700
commit4110ae48f57b1eaa6e8caeffaf5a70f1e32f6973 (patch)
tree9b28bf07915a51128778787007961dfdf83761dd /test/test_psych.rb
parent9c46c5b60e9554da08109887684704fc8b7b3a4e (diff)
downloadpsych-4110ae48f57b1eaa6e8caeffaf5a70f1e32f6973.zip
testing parse_file
Diffstat (limited to 'test/test_psych.rb')
-rw-r--r--test/test_psych.rb56
1 files changed, 0 insertions, 56 deletions
diff --git a/test/test_psych.rb b/test/test_psych.rb
deleted file mode 100644
index f8700c8..0000000
--- a/test/test_psych.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-require 'minitest/autorun'
-require 'psych'
-require 'tempfile'
-
-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
-
- def test_add_builtin_type
- got = nil
- Psych.add_builtin_type 'omap', do |type, val|
- got = val
- end
- Psych.load('--- !omap hello')
- assert_equal 'hello', got
- ensure
- Psych.remove_type 'omap'
- end
-
- def test_domain_types
- got = nil
- Psych.add_domain_type 'foo.bar,2002', 'foo' do |type, val|
- got = val
- end
-
- Psych.load('--- !foo.bar,2002/foo hello')
- assert_equal 'hello', got
-
- Psych.load("--- !foo.bar,2002/foo\n- hello\n- world")
- assert_equal %w{ hello world }, got
-
- Psych.load("--- !foo.bar,2002/foo\nhello: world")
- assert_equal({ 'hello' => 'world' }, got)
- end
-
- def test_load_file
- name = File.join(Dir.tmpdir, 'yikes.yml')
- File.open(name, 'wb') { |f| f.write('--- hello world') }
-
- assert_equal 'hello world', Psych.load_file(name)
- end
-end