Sha256: 304b0d34ba2f8a21c226be9b322af2f7afdbacd6a419b2ffbabb07e57199503a

Contents?: true

Size: 749 Bytes

Versions: 4

Compression:

Stored size: 749 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

4 entries across 4 versions & 1 rubygems

Version Path
tefil-0.1.5 test/test_indentconverter.rb
tefil-0.1.4 test/test_indentconverter.rb
tefil-0.1.3 test/test_indentconverter.rb
tefil-0.1.2 test/test_indentconverter.rb