Sha256: c41a6933c955499701b3a57d7e4709fcdf3fd1a4e5c92ca4b83f8d2b94d2faab

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 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 File.dirname(__FILE__) + '/../lib/roo-xls'

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

ONLINE = false
LONG_RUN = false

# 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 && 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 self.delete_if_exist(filename)
    if File.exist?(filename)
      File.delete(filename)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
roo-xls-1.2.0 test/test_helper.rb
roo-xls-1.1.0 test/test_helper.rb
roo-xls-1.0.0 test/test_helper.rb