Sha256: 8d730e5d7b07f43a4561141055e24cd11c2d5934d2dc4629d62280f01d263ddc

Contents?: true

Size: 1.79 KB

Versions: 420

Compression:

Stored size: 1.79 KB

Contents

require File.expand_path('../helper', __FILE__)

class TestRakeWin32 < Rake::TestCase

  Win32 = Rake::Win32

  def test_win32_system_dir_uses_home_if_defined
    ENV['HOME'] = 'C:\\HP'

    assert_equal "C:/HP/Rake", Win32.win32_system_dir
  end

  def test_win32_system_dir_uses_homedrive_homepath_when_no_home_defined
    ENV['HOME']      = nil
    ENV['HOMEDRIVE'] = 'C:'
    ENV['HOMEPATH']  = '\\HP'

    assert_equal "C:/HP/Rake", Win32.win32_system_dir
  end

  def test_win32_system_dir_uses_appdata_when_no_home_or_home_combo
    ENV['APPDATA']   = "C:\\Documents and Settings\\HP\\Application Data"
    ENV['HOME']      = nil
    ENV['HOMEDRIVE'] = nil
    ENV['HOMEPATH']  = nil

    assert_equal "C:/Documents and Settings/HP/Application Data/Rake",
                 Win32.win32_system_dir
  end

  def test_win32_system_dir_fallback_to_userprofile_otherwise
    ENV['HOME']        = nil
    ENV['HOMEDRIVE']   = nil
    ENV['HOMEPATH']    = nil
    ENV['APPDATA']     = nil
    ENV['USERPROFILE'] = "C:\\Documents and Settings\\HP"

    assert_equal "C:/Documents and Settings/HP/Rake", Win32.win32_system_dir
  end

  def test_win32_system_dir_nil_of_no_env_vars
    ENV['APPDATA']     = nil
    ENV['HOME']        = nil
    ENV['HOMEDRIVE']   = nil
    ENV['HOMEPATH']    = nil
    ENV['RAKE_SYSTEM'] = nil
    ENV['USERPROFILE'] = nil

    assert_raises(Rake::Win32::Win32HomeError) do
      Win32.win32_system_dir
    end
  end

  def test_win32_backtrace_with_different_case
    ex = nil
    begin
     raise 'test exception'
    rescue => ex
    end

    ex.set_backtrace ['abc', 'rakefile']

    rake = Rake::Application.new
    rake.options.trace = true
    rake.instance_variable_set(:@rakefile, 'Rakefile')

    _, err = capture_io { rake.display_error_message(ex) }

    assert_match(/rakefile/, err)
  end

end

Version data entries

420 entries across 363 versions & 111 rubygems

Version Path
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
spec_fill-0.1.2 vendor/bundle/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
spec_fill-0.1.1 vendor/bundle/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
spec_fill-0.1.0 vendor/bundle/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
saikouda-0.1.0 vendor/bundle/gems/rake-10.5.0/test/test_rake_win32.rb
nabea2-0.1.2 vendor/bundle/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
nabea2-0.1.1 vendor/bundle/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
nabea2-0.1.0 vendor/bundle/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
hatena_bookmark_client_for_ruby-0.1.3 vendor/bundle/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
hatena_bookmark_client_for_ruby-0.1.2 vendor/bundle/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb
hatena_bookmark_client_for_ruby-0.1.0 vendor/bundle/ruby/2.6.0/gems/rake-10.5.0/test/test_rake_win32.rb