Sha256: 691f6840231eb274a527001e76c05141dbe0523df0da39fa92aa1b48060c0156

Contents?: true

Size: 957 Bytes

Versions: 8

Compression:

Stored size: 957 Bytes

Contents

#!/usr/bin/env ruby
require 'test/unit'
require 'rbconfig'
load File.join(File.dirname(__FILE__), %w(.. .. bin trepan))

# Test bin/trepan Module methods
class TestBinTrepan < Test::Unit::TestCase

  include Trepanning

  def test_whence_file
    abs_path_me = File.expand_path(__FILE__)
    assert_equal(abs_path_me, whence_file(abs_path_me),
                 "whence_file should have just returned #{abs_path_me}")

    basename_me = File.basename(__FILE__)
    dirname_me  = File.dirname(__FILE__)

    # Add my directory onto the beginning of PATH
    path_dirs = ENV['PATH'].split(File::PATH_SEPARATOR)
    path_dirs.unshift(dirname_me)
    ENV['PATH'] = path_dirs.join(File::PATH_SEPARATOR)

    assert_equal(File.join(dirname_me, basename_me), 
                 whence_file(basename_me),
                 "whence_file should have found me")
    # Restore old path
    path_dirs.shift 
    ENV['PATH'] = path_dirs.join(File::PATH_SEPARATOR)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
trepanning-2.15.35 test/unit/test-bin-trepan.rb
trepanning-1.93.35 test/unit/test-bin-trepan.rb
trepanning-2.15.33 test/unit/test-bin-trepan.rb
trepanning-1.93.32 test/unit/test-bin-trepan.rb
trepanning-0.1.6 test/unit/test-bin-trepan.rb
trepanning-0.1.4 test/unit/test-bin-trepan.rb
trepanning-0.1.3 test/unit/test-bin-trepan.rb
trepanning-0.1.2 test/unit/test-bin-trepan.rb