Sha256: 4863d13b71dd116e918d97c81df4a74d93984a72ef534b178959407334e5f00c

Contents?: true

Size: 1.13 KB

Versions: 9

Compression:

Stored size: 1.13 KB

Contents

require 'simplecov'
# require deps
require 'tmpdir'
require 'fileutils'
require 'minitest/autorun'
require 'shoulda'
require 'fileutils'
require 'timeout'
require 'logger'
require 'date'
require 'webmock/minitest'

# require gem files
require 'roo'

TESTDIR =  File.join(File.dirname(__FILE__), 'files')

# very simple diff implementation
# output is an empty string if the files are equal
# otherwise differences a printen (not compatible to
# the diff command)
def file_diff(fn1,fn2)
  result = ''
  File.open(fn1) do |f1|
    File.open(fn2) do |f2|
      while f1.eof? == false and f2.eof? == false
        line1 = f1.gets.chomp
        line2 = f2.gets.chomp
        result << "<#{line1}\n>#{line2}\n" if line1 != line2
      end
      if f1.eof? == false
        while f1.eof? == false
          line1 = f1.gets
          result << "<#{line1}\n"
        end
      end
      if f2.eof? == false
        while f2.eof? == false
          line2 = f2.gets
          result << ">#{line2}\n"
        end
      end
    end
  end
  result
end

class File
  def File.delete_if_exist(filename)
    if File.exist?(filename)
      File.delete(filename)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
roo-2.6.0 test/test_helper.rb
roo-2.5.1 test/test_helper.rb
roo-2.5.0 test/test_helper.rb
roo-2.4.0 test/test_helper.rb
roo-2.3.2 test/test_helper.rb
roo-2.3.1 test/test_helper.rb
roo-2.3.0 test/test_helper.rb
roo-2.2.0 test/test_helper.rb
roo-2.1.1 test/test_helper.rb