File: test_fileutils_which.rb

package info (click to toggle)
ruby-facets 2.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 9,824 kB
  • sloc: ruby: 25,483; xml: 90; makefile: 20
file content (45 lines) | stat: -rw-r--r-- 911 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45


# TODO FileUtils#which This test needs a mock File.

=begin #no test yet

  require 'test/unit'
  require 'rbconfig'

  class TC_FileUtils_Which < Test::Unit::TestCase
    include Config

    def setup
      @workdir = Dir.getwd
      @thisdir = $TESTDIR

      @expected_ruby_exe = File.join( CONFIG['bindir'], CONFIG['ruby_install_name'] )
      if File::ALT_SEPARATOR
          @expected_ruby_exe.gsub!(/\//,'\\')
          @expected_ruby_exe += ".exe"
      end
    end

    def test_method
      assert_respond_to( FileUtils, :which )
    end

    # which

    def test_which
      Dir.chdir @thisdir
      begin
        ruby_exe = nil
        assert_nothing_raised { ruby_exe = FileUtils.which(CONFIG['ruby_install_name']) }
        assert_equal(@expected_ruby_exe, ruby_exe)
        assert_equal(nil, FileUtils.which("blahblah"))
      ensure
        Dir.chdir @workdir
      end
    end

  end

=end