Sha256: 57a8566fd9e97f0f290e429216f0b81ddc45b8dd06fa18ca40531a2affcbd401

Contents?: true

Size: 968 Bytes

Versions: 9

Compression:

Stored size: 968 Bytes

Contents

#!/usr/local/bin/ruby
if $0 == __FILE__
  Dir.chdir File.dirname(__FILE__)+'/../'
  $:.unshift File.expand_path('../lib/')
end

require 'rio'
require 'tc/testcase'
class TC_sub < Test::RIO::TestCase
  @@once = false
  def self.once
    @@once = true
    rio('a').rmtree.mkpath
    rio('b').rmtree.mkpath
    make_lines_file(3,'a/f0')
    make_lines_file(2,'a/f1')
  end
  def setup
    super
    self.class.once unless @@once

    @l = []; @f = []; @d = []
    @d[0] = rio('a')
    @d[1] = rio('b')
    @f[0] = rio('a/f0')
    @f[1] = rio('a/f1')
    @l[0] = @f[0].readlines
    @l[1] = @f[1].readlines
    @d[1] < @d[0]
    @d[1] < @d[0].files[]
  end
  def test_basic
    ario = rio('apath')
    p ario

    ans = ario.sub(/^a/,'b')
    assert_kind_of(RIO::Rio,ans)
    assert_not_same(ario,ans)
    assert_equal(rio('bpath'),ans)

    ans = ario.sub!(/^a/,'b')
    assert_kind_of(RIO::Rio,ans)
    assert_same(ario,ans)
    assert_equal(rio('bpath'),ans)
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
rio-0.6.0 test/tc/sub.rb
wishdev-rio-0.4.3.1 test/tc/sub.rb
rio-0.5.1 test/tc/sub.rb
rio-0.3.9 test/tc/sub.rb
rio-0.3.7 test/tc/sub.rb
rio-0.3.8 test/tc/sub.rb
rio-0.4.1 test/tc/sub.rb
rio-0.4.0 test/tc/sub.rb
rio-0.4.2 test/tc/sub.rb