dtas.git  about / heads / tags
duct tape audio suite for *nix
blob 761ccb13bbb6ea825fa2f20c816d81f361f59219 815 bytes (raw)
name: test/test_sink.rb 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
# frozen_string_literal: true
require './test/helper'
require 'dtas/sink'
require 'yaml'

class TestSink < Testcase
  def test_serialize_reload
    sink = DTAS::Sink.new
    sink.name = "DAC"
    hash = sink.to_hsh
    assert_kind_of Hash, hash
    refute_match(%r{ruby}i, hash.to_yaml, "ruby guts exposed: #{hash}")

    s2 = DTAS::Sink.load(hash)
    assert_equal sink.to_hsh, s2.to_hsh
    assert_equal hash, s2.to_hsh
  end

  def test_name
    sink = DTAS::Sink.new
    sink.name = "dac1"
    assert_equal({"name" => "dac1"}, sink.to_hsh)
  end

  def test_inactive_load
    orig = { "active" => false }.freeze
    tmp = orig.to_yaml
    assert_equal orig, YAML.load(tmp)
  end
end

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

git clone git://80x24.org/dtas.git
git clone https://80x24.org/dtas.git