Module: KorOutputTsvTest

Defined in:
lib/kor/output/tsv_test.rb

Instance Method Summary collapse

Instance Method Details

#test_head(t) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/kor/output/tsv_test.rb', line 5

def test_head(t)
  io = StringIO.new
  tsv = Kor::Output::Tsv.new(io)
  tsv.head(["foo", "bar", "baz\tqux", nil])
  expect = %Q{foo\tbar\t"baz\tqux"\t\n}
  if io.string != expect
    t.error("expect output #{expect.inspect} got #{io.string.inspect}")
  end
end

#test_puts(t) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/kor/output/tsv_test.rb', line 15

def test_puts(t)
  io = StringIO.new
  tsv = Kor::Output::Tsv.new(io)
  tsv.puts([nil, "aaa", "bbb\tccc", "ddd"])
  expect = %Q{\taaa\t"bbb\tccc"\tddd\n}
  if io.string != expect
    t.error("expect output #{expect.inspect} got #{io.string.inspect}")
  end
end