summaryrefslogtreecommitdiff
path: root/test/psych/test_nil.rb
blob: bcbbcb9c939782e2ebd188335df33ea12230f6a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true
require_relative 'helper'

module Psych
  class TestNil < TestCase
    def test_nil
      yml = Psych.dump nil
      assert_match(/---[ ]?\n(?:\.\.\.\n)?/, yml)
      assert_nil Psych.load(yml)
    end

    def test_array_nil
      yml = Psych.dump [nil]
      assert_match(/---\n-[ ]?\n/, yml)
      assert_equal [nil], Psych.load(yml)
    end

  end
end