mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	It supports to enable frozen string literal and add `--norc` option for
  disable to `.gemrc` configuration.
  See 2.5.2 release notes for other fixes and enhancements.
  a8aa3bac72/History.txt (L3)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
		
	
			
		
			
				
	
	
		
			40 lines
		
	
	
	
		
			916 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
	
		
			916 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
# frozen_string_literal: true
 | 
						|
require 'rubygems/test_case'
 | 
						|
require 'rubygems/util'
 | 
						|
 | 
						|
class TestGemUtil < Gem::TestCase
 | 
						|
 | 
						|
  def test_class_popen
 | 
						|
    assert_equal "0\n", Gem::Util.popen(Gem.ruby, '-e', 'p 0')
 | 
						|
 | 
						|
    assert_raises Errno::ECHILD do
 | 
						|
      Process.wait(-1)
 | 
						|
    end
 | 
						|
  end
 | 
						|
 | 
						|
  def test_silent_system
 | 
						|
    assert_silent do
 | 
						|
      Gem::Util.silent_system Gem.ruby, '-e', 'puts "hello"; warn "hello"'
 | 
						|
    end
 | 
						|
  end
 | 
						|
 | 
						|
  def test_traverse_parents
 | 
						|
    FileUtils.mkdir_p 'a/b/c'
 | 
						|
 | 
						|
    enum = Gem::Util.traverse_parents 'a/b/c'
 | 
						|
 | 
						|
    assert_equal File.join(@tempdir, 'a/b/c'), enum.next
 | 
						|
    assert_equal File.join(@tempdir, 'a/b'),   enum.next
 | 
						|
    assert_equal File.join(@tempdir, 'a'),     enum.next
 | 
						|
  end
 | 
						|
 | 
						|
  def test_linked_list_find
 | 
						|
    list = [1,2,3,4,5].inject(Gem::List.new(0)) { |m,o|
 | 
						|
      Gem::List.new o, m
 | 
						|
    }
 | 
						|
    assert_equal 5, list.find { |x| x == 5 }
 | 
						|
    assert_equal 4, list.find { |x| x == 4 }
 | 
						|
  end
 | 
						|
 | 
						|
end
 | 
						|
 |