Sha256: bd293d4500af7a5ce7b50028d04db217df2c47f51aca765af1891c1b12c0800e

Contents?: true

Size: 1.05 KB

Versions: 33

Compression:

Stored size: 1.05 KB

Contents

#####################################################################
# tc_binary.rb
# 
# Test case for the File.binary? method. You should run this test
# via the 'rake test_binary' task.
#####################################################################
require 'rubygems'
gem 'test-unit'

require 'test/unit'
require 'ptools'

class TC_Binary < Test::Unit::TestCase
   def self.startup
      Dir.chdir('test') if File.exists?('test')
      File.open('test_file1.txt', 'w'){ |fh| 10.times{ |n| fh.puts "line #{n}" } }
   end
   
   def setup
      @text_file = 'test_file1.txt'
   end

   def test_binary_basic
      assert_respond_to(File, :binary?)
      assert_nothing_raised{ File.binary?(@text_file) }
   end

   def test_binary_expected_results
      assert_equal(false, File.binary?(@text_file))
   end

   def test_binary_expected_errors
      assert_raise_kind_of(SystemCallError){ File.binary?('bogus') }
   end

   def teardown
      @text_file = nil
   end

   def self.shutdown
      File.delete('test_file1.txt') if File.exists?('test_file1.txt')
   end
end

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
depengine-0.0.11 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.10 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.9 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.8 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.7 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.5 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.4 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.3 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.2 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.1 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
ptools-1.2.1 test/test_binary.rb
ptools-1.1.9-x86-mingw32 test/test_binary.rb
ptools-1.1.9 test/test_binary.rb