2017-07-14 09:15:58 +03:00
|
|
|
# frozen_string_literal: true
|
2013-03-26 18:55:04 +04:00
|
|
|
require_relative 'helper'
|
2011-01-05 20:57:38 +03:00
|
|
|
|
|
|
|
module Psych
|
|
|
|
class TestNil < TestCase
|
|
|
|
def test_nil
|
|
|
|
yml = Psych.dump nil
|
2020-06-03 20:18:34 +03:00
|
|
|
assert_match(/---[ ]?\n(?:\.\.\.\n)?/, yml)
|
2011-06-21 22:04:41 +04:00
|
|
|
assert_nil Psych.load(yml)
|
2011-01-05 20:57:38 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_array_nil
|
|
|
|
yml = Psych.dump [nil]
|
2020-06-03 20:18:34 +03:00
|
|
|
assert_match(/---\n-[ ]?\n/, yml)
|
2011-01-05 20:57:38 +03:00
|
|
|
assert_equal [nil], Psych.load(yml)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|