Skip to content

Instantly share code, notes, and snippets.

@klauern
Created December 8, 2011 20:54
Show Gist options
  • Select an option

  • Save klauern/1448533 to your computer and use it in GitHub Desktop.

Select an option

Save klauern/1448533 to your computer and use it in GitHub Desktop.
ant test failure on test_file_url
run-junit-interpreted-short:
[echo] compile=OFF, jit.threshold=20, jit.maxsize=1000000000, jit.max=-1, objectspace=false threadpool=false reflection=false version=ruby1_8
[junit] Testsuite: org.jruby.test.ScriptTestSuite
[junit] Tests run: 32, Failures: 0, Errors: 0, Time elapsed: 13.844 sec
[junit]
[junit] Testsuite: org.jruby.test.JRubyTestSuite
[junit] Tests run: 35, Failures: 1, Errors: 0, Time elapsed: 28.656 sec
[junit]
[junit] Testcase: test_file(org.jruby.test.TestUnitTestSuite$ScriptTest): FAILED
[junit] Faults encountered running test\test_file, complete output follows:
[junit] Failure:
[junit] test_file_url(TestFile)
[junit] [./test/test_file.rb:1030:in `test_file_url'
[junit] org/jruby/RubyKernel.java:1939:in `send'
[junit] org/jruby/RubyArray.java:1609:in `each']:
[junit] <"# -*- coding: utf-8 -*-\nrequire 'test/unit'\nrequire 'rbconfig'\nrequire 'fileutils'\nrequire 'tempfile'"> expected but was
[junit] <"# -*- coding: utf-8 -*-\r\nrequire 'test/unit'\r\nrequire 'rbconfig'\r\nrequire 'fileutils'\r\nrequire 'tempf">.
[junit]
[junit] junit.framework.AssertionFailedError: Faults encountered running test\test_file, complete output follows:
[junit] Failure:
[junit] test_file_url(TestFile)
[junit] [./test/test_file.rb:1030:in `test_file_url'
[junit] org/jruby/RubyKernel.java:1939:in `send'
[junit] org/jruby/RubyArray.java:1609:in `each']:
[junit] <"# -*- coding: utf-8 -*-\nrequire 'test/unit'\nrequire 'rbconfig'\nrequire 'fileutils'\nrequire 'tempfile'"> expected but was
[junit] <"# -*- coding: utf-8 -*-\r\nrequire 't
# JRUBY-3634: File.read or File.open with a url to a file resource fails with StringIndexOutOfBounds exception
def test_file_url
path = File.expand_path(__FILE__)
expect = File.read(__FILE__)[0..100]
got = File.read("file:///#{path}")[0..100]
assert_equal(expect, got)
end
@klauern
Copy link
Copy Markdown
Author

klauern commented Dec 8, 2011

It looks like when reading from file:/// it reads the Windows \r\n, and the path does not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment