~ubuntu-branches/ubuntu/natty/ruby1.8/natty-updates

« back to all changes in this revision

Viewing changes to test/ruby/test_require.rb

  • Committer: Package Import Robot
  • Author(s): Daigo Moriwaki
  • Date: 2010-06-27 22:16:44 UTC
  • mfrom: (22.1.12 sid)
  • Revision ID: package-import@ubuntu.com-20100627221644-7n8891uzqc17nvyq
Tags: 1.8.7.299-1
* New upstream release
* Removed patches that the upstrem has applied:
  - debian/patches/100312_timeout-fix.dpatch
  - debian/patches/100620_fix_pathname_warning.dpatch
  - debian/patches/100620_fix_super_called_outside_of_method.dpatch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
require 'test/unit'
 
2
 
 
3
require 'tempfile'
 
4
require File.expand_path('../envutil', __FILE__)
 
5
require 'tmpdir'
 
6
 
 
7
class TestRequire < Test::Unit::TestCase
 
8
  def test_home_path
 
9
    home = ENV["HOME"]
 
10
    bug3171 = '[ruby-core:29610]'
 
11
    Dir.mktmpdir do |tmp|
 
12
      ENV["HOME"] = tmp
 
13
      name = "loadtest#{$$}-1"
 
14
      path = File.join(tmp, name) << ".rb"
 
15
      open(path, "w") {}
 
16
      require "~/#{name}"
 
17
      assert_equal(path, $"[-1], bug3171)
 
18
      name.succ!
 
19
      path = File.join(tmp, name << ".rb")
 
20
      open(path, "w") {}
 
21
      require "~/#{name}"
 
22
      assert_equal(path, $"[-1], bug3171)
 
23
    end
 
24
  ensure
 
25
    ENV["HOME"] = home
 
26
  end
 
27
end