[前][次][番号順一覧][スレッド一覧]

ruby-changes:13795

From: yugui <ko1@a...>
Date: Sat, 31 Oct 2009 22:16:24 +0900 (JST)
Subject: [ruby-changes:13795] Ruby:r25593 (ruby_1_9_1): merges r24818 from trunk into ruby_1_9_1, with small modification.

yugui	2009-10-31 22:05:04 +0900 (Sat, 31 Oct 2009)

  New Revision: 25593

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25593

  Log:
    merges r24818 from trunk into ruby_1_9_1, with small modification.
    --
    * test/ruby/test_require.rb (test_relative): tests for require_relative.

  Modified files:
    branches/ruby_1_9_1/test/ruby/test_require.rb
    branches/ruby_1_9_1/version.h

Index: ruby_1_9_1/version.h
===================================================================
--- ruby_1_9_1/version.h	(revision 25592)
+++ ruby_1_9_1/version.h	(revision 25593)
@@ -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
Index: ruby_1_9_1/test/ruby/test_require.rb
===================================================================
--- ruby_1_9_1/test/ruby/test_require.rb	(revision 25592)
+++ ruby_1_9_1/test/ruby/test_require.rb	(revision 25593)
@@ -198,7 +198,7 @@
 
   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 @@
       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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]