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.31 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.30 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.29 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.28 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.27 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.26 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.25 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.24 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.23 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.22 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.21 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.20 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.19 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.18 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.17 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.16 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.15 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.14 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.13 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb
depengine-0.0.12 etc/isolate/ruby-1.8/gems/ptools-1.1.9/test/test_binary.rb