From eefce92d47b84cf1b61d6051edc742fa12db190b Mon Sep 17 00:00:00 2001 From: yugui Date: Sat, 31 Oct 2009 13:05:04 +0000 Subject: merges r24818 from trunk into ruby_1_9_1, with small modification. -- * test/ruby/test_require.rb (test_relative): tests for require_relative. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@25593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_require.rb | 20 +++++++++++++++++++- version.h | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb index 4bc44eff0..827cb228d 100644 --- a/test/ruby/test_require.rb +++ b/test/ruby/test_require.rb @@ -198,7 +198,7 @@ class TestRequire < Test::Unit::TestCase def test_tainted_loadpath t = Tempfile.new(["test_ruby_test_require", ".rb"]) - abs_dir, file = File.dirname(t.path), File.basename(t.path) + abs_dir, file = File.split(t.path) abs_dir = File.expand_path(abs_dir).untaint assert_in_out_err([], <<-INPUT, %w(:ok), []) @@ -241,4 +241,22 @@ class TestRequire < Test::Unit::TestCase p :ok INPUT end + + def test_relative + require 'tmpdir' + Dir.mktmpdir do |tmp| + Dir.chdir(tmp) do + Dir.mkdir('x') + File.open('x/t.rb', 'wb') {} + File.open('x/a.rb', 'wb') {|f| f.puts("require_relative('t.rb')")} + assert require('./x/t.rb') + assert !require('x/t.rb') + assert !require(File.expand_path('x/t.rb')) + assert_nothing_raised(LoadError) {require('./x/a.rb')} + File.unlink(*Dir.glob('x/*')) + Dir.rmdir("#{tmp}/x") + assert(!require('tmpdir')) + end + end + end end diff --git a/version.h b/version.h index ae09db154..d6a056513 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.1" -#define RUBY_PATCHLEVEL 318 +#define RUBY_PATCHLEVEL 319 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 -- cgit