# tc_test.rb
# July 18, 2007
#

$:.unshift File.join(File.dirname(__FILE__),'..','lib')

require 'test/unit'
require "fileutils"

class TestTc_test < Test::Unit::TestCase
  
  def tear_down
    FileUtils.rm "t.txt"
  end
  
  def test_file 
    File.open 't.txt', 'w' do |f|
      f << "hello"
    end
    do_file_access
    assert true
  end
  
  def test_access
    begin
      do_file_access
      assert false, "waiting for an exception here, since the file doesn't exist"
    rescue
      assert true
    end
  end
  
  def do_file_access
    f = File.new 't.txt'
    f.flock(File::LOCK_EX)
    FileUtils.rm "t.txt"
  end
  
end

