summaryrefslogtreecommitdiff
path: root/test/visitors/test_yast_builder.rb
blob: 02f4c916c33f674b6243b8e90014b05fc7b8cfe1 (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'

module Psych
  module Visitors
    class TestYASTBuilder < MiniTest::Unit::TestCase
      def test_scalar
        v = Visitors::YASTBuilder.new
        v.accept 'foo'

        assert_equal 'foo', Psych.load(v.tree.to_yaml)
        assert_equal 'foo', Psych.load('foo'.to_yaml)
      end

      def test_binary
        string = [0, 123,22, 44, 9, 32, 34, 39].pack('C*')
        assert_equal string, Psych.load(string.to_yaml)
      end
    end
  end
end