ruby-changes:27075
From: nobu <ko1@a...>
Date: Thu, 7 Feb 2013 15:33:14 +0900 (JST)
Subject: [ruby-changes:27075] nobu:r39127 (trunk): test_libs.rb: new test
nobu 2013-02-07 15:32:12 +0900 (Thu, 07 Feb 2013) New Revision: 39127 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39127 Log: test_libs.rb: new test * test/mkmf/test_libs.rb (TestMkmf:TestLibs): tests for $libs operations. Added files: trunk/test/mkmf/test_libs.rb Index: test/mkmf/test_libs.rb =================================================================== --- test/mkmf/test_libs.rb (revision 0) +++ test/mkmf/test_libs.rb (revision 39127) @@ -0,0 +1,69 @@ https://github.com/ruby/ruby/blob/trunk/test/mkmf/test_libs.rb#L1 +require_relative 'base' + +class TestMkmf + class TestLibs < TestMkmf + def test_split_libs + assert_equal(%w[-lfoo -lbar], split_libs("-lfoo -lbar")) + assert_equal(%w[-ObjC -framework\ Ruby], split_libs("-ObjC -framework Ruby"), 'Bug #6987') + end + + def assert_in_order(array, x, y, mesg = nil) + mesg = "#{x} must proceed to #{y}#{': ' if mesg}#{mesg}" + assert_operator(array.index(x), :<, array.rindex(y), mesg) + end + + def test_merge_simple + bug = '[ruby-dev:21765]' + assert_equal([], merge_libs(%w[])) + assert_equal(%w[a b], merge_libs(%w[a], %w[b])) + array = merge_libs(%w[a c], %w[b]) + assert_in_order(array, "a", "c", bug) + end + + def test_merge_seq + bug = '[ruby-dev:21765]' + array = merge_libs(%w[a c d], %w[c b e]) + assert_in_order(array, "a", "c", bug) + assert_in_order(array, "c", "d", bug) + assert_in_order(array, "c", "b", bug) + assert_in_order(array, "b", "e", bug) + end + + def test_merge_seq_pre + bug = '[ruby-dev:21765]' + array = merge_libs(%w[a c d], %w[b c d e]) + assert_in_order(array, "a", "c", bug) + assert_in_order(array, "c", "d", bug) + assert_in_order(array, "b", "c", bug) + assert_in_order(array, "d", "e", bug) + end + + def test_merge_cyclic + bug = '[ruby-dev:21765]' + array = merge_libs(%w[a c d], %w[b c b]) + assert_in_order(array, "a", "c", bug) + assert_in_order(array, "c", "d", bug) + assert_in_order(array, "b", "c", bug) + assert_in_order(array, "c", "b", bug) + end + + def test_merge_cyclic_2 + bug = '[ruby-dev:21765]' + array = merge_libs(%w[a c a d], %w[b c b]) + assert_in_order(array, "a", "c", bug) + assert_in_order(array, "c", "a", bug) + assert_in_order(array, "c", "d", bug) + assert_in_order(array, "a", "d", bug) + assert_in_order(array, "b", "c", bug) + assert_in_order(array, "c", "b", bug) + end + + def test_merge_reversal + bug = '[ruby-dev:22440]' + array = merge_libs(%w[a b c], %w[c d a]) + assert_in_order(array, "a", "b" , bug) + assert_in_order(array, "c", "d" , bug) + ## assume that a and c have no dependency + end + end +end if RUBY_ENGINE == "ruby" Property changes on: test/mkmf/test_libs.rb ___________________________________________________________________ Added: svn:eol-style + LF -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/