Sha256: bccc61e68e7fc185b907079e690909f293d77c6b2762a3da99f434dc2bdb65d8

Contents?: true

Size: 748 Bytes

Versions: 2

Compression:

Stored size: 748 Bytes

Contents

#! /usr/bin/env ruby
# coding: utf-8

require "helper"
require "stringio"

class Tefil::IndentConverter
  public :process_stream
end

class TC_IndentConverter < Test::Unit::TestCase
  def setup
    @ic00 = Tefil::IndentConverter.new(' ', 2, ' ', 4, {})
  end

  def test_process_stream
    # stdin -> stdout
    $stdin = StringIO.new
    $stdin.puts "a"
    $stdin.puts "  b"
    $stdin.puts "    c"
    $stdin.puts "  d"
    $stdin.puts "    e"
    $stdin.puts "    f"
    $stdin.rewind
    str = capture_stdout{}
    result = capture_stdout{ @ic00.filter([])}
    correct =
      "a\n" +
      "    b\n" +
      "        c\n" + 
      "    d\n" +     
      "        e\n" + 
      "        f\n"
    assert_equal(correct, result)
  end
end







Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tefil-0.1.1 test/test_indentconverter.rb
tefil-0.1.0 test/test_indentconverter.rb