Faulty interaction between Dir.chdir, File.chmod and Test::Unit
---------------------------------------------------------------

                 Key: JRUBY-3300
                 URL: http://jira.codehaus.org/browse/JRUBY-3300
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.1.6
         Environment: JRuby 1.1.6, OS X, Java 1.5
            Reporter: Daniel Berger
            Assignee: Thomas E Enebo


Somehow, someway, the File.chmod method is failing when interacting with 
Dir.chdir and Test::Unit This sample program demonstrates the problem:
{noformat}
# test.rb
#
# Create this file as 'test/test.rb'
# Run from the parent directory, e.g. jruby test/test.rb
#
require 'test/unit'

class TC_Writable < Test::Unit::TestCase
   def setup
      Dir.chdir('test') # Comment this out and it works
      @file = 'foo.doc'
      File.open(@file, 'w'){}
   end

   def test_filetest
      File.chmod(0644, @file)
      assert_equal(true, File.writable?(@file))

      File.chmod(0444, @file)
      assert_equal(false, File.writable?(@file))
   end

   def teardown
      File.delete(@file) if File.exists?(@file)
      @file = nil
   end
end
{noformat}
When I run standalone programs, however, it works fine. This leads me to 
believe there's some sort of interaction going on with Test::Unit, but I 
couldn' tell you what.

Regards,

Dan

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to