ruby-changes:25779
From: knu <ko1@a...>
Date: Sun, 25 Nov 2012 02:14:21 +0900 (JST)
Subject: [ruby-changes:25779] knu:r37836 (trunk): Fix tests of rb_warning().
knu 2012-11-25 02:14:06 +0900 (Sun, 25 Nov 2012) New Revision: 37836 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37836 Log: Fix tests of rb_warning(). * test/ruby/envutil.rb (Test::Unit::Assertions#assert_warning) (Test::Unit::Assertions#assert_warn), test/ruby/envutil.rb, test/ruby/test_enumerator.rb, test/ruby/test_io_m17n.rb, test/ruby/test_regexp.rb, test/ruby/test_syntax.rb: assert_warn() and assert_warning() are reversed. Modified files: trunk/ChangeLog trunk/test/ruby/envutil.rb trunk/test/ruby/test_enumerator.rb trunk/test/ruby/test_io_m17n.rb trunk/test/ruby/test_regexp.rb trunk/test/ruby/test_syntax.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 37835) +++ ChangeLog (revision 37836) @@ -1,3 +1,11 @@ +Sun Nov 25 02:07:37 2012 Akinori MUSHA <knu@i...> + + * test/ruby/envutil.rb (Test::Unit::Assertions#assert_warning) + (Test::Unit::Assertions#assert_warn), test/ruby/envutil.rb, + test/ruby/test_enumerator.rb, test/ruby/test_io_m17n.rb, + test/ruby/test_regexp.rb, test/ruby/test_syntax.rb: + assert_warn() and assert_warning() are reversed. + Sat Nov 24 21:08:50 2012 Hiroshi Shirosaki <h.shirosaki@g...> * gc.c (wmap_final_func): rename variables to clarify the meaning. Index: test/ruby/test_enumerator.rb =================================================================== --- test/ruby/test_enumerator.rb (revision 37835) +++ test/ruby/test_enumerator.rb (revision 37836) @@ -367,8 +367,8 @@ def test_inspect_verbose bug6214 = '[ruby-dev:45449]' - assert_warn("", bug6214) { "".bytes.inspect } - assert_warn("", bug6214) { [].lazy.inspect } + assert_warning("", bug6214) { "".bytes.inspect } + assert_warning("", bug6214) { [].lazy.inspect } end def test_generator Index: test/ruby/test_io_m17n.rb =================================================================== --- test/ruby/test_io_m17n.rb (revision 37835) +++ test/ruby/test_io_m17n.rb (revision 37836) @@ -989,24 +989,24 @@ #bug5568 = '[ruby-core:40727]' bug6324 = '[ruby-core:44455]' open(__FILE__, "r") do |f| - assert_warn('', bug6324) { + assert_warning('', bug6324) { f.set_encoding("eucjp:euc-jp") } - assert_warn('', bug6324) { + assert_warning('', bug6324) { f.set_encoding("eucjp", "euc-jp") } - assert_warn('', bug6324) { + assert_warning('', bug6324) { f.set_encoding(Encoding::EUC_JP, "euc-jp") } - assert_warn('', bug6324) { + assert_warning('', bug6324) { f.set_encoding("eucjp", Encoding::EUC_JP) } - assert_warn('', bug6324) { + assert_warning('', bug6324) { f.set_encoding(Encoding::EUC_JP, Encoding::EUC_JP) } nonstr = Object.new def nonstr.to_str; "eucjp"; end - assert_warn('', bug6324) { + assert_warning('', bug6324) { f.set_encoding(nonstr, nonstr) } end Index: test/ruby/test_regexp.rb =================================================================== --- test/ruby/test_regexp.rb (revision 37835) +++ test/ruby/test_regexp.rb (revision 37836) @@ -888,18 +888,18 @@ end def test_dup_warn - assert_warn(/duplicated/) { Regexp.new('[\u3042\u3043\u3042]') } - assert_warn(/duplicated/) { Regexp.new('[\u3042\u3043\u3043]') } - assert_warn(/\A\z/) { Regexp.new('[\u3042\u3044\u3043]') } - assert_warn(/\A\z/) { Regexp.new('[\u3042\u3045\u3043]') } - assert_warn(/\A\z/) { Regexp.new('[\u3042\u3045\u3044]') } - assert_warn(/\A\z/) { Regexp.new('[\u3042\u3045\u3043-\u3044]') } - assert_warn(/duplicated/) { Regexp.new('[\u3042\u3045\u3042-\u3043]') } - assert_warn(/duplicated/) { Regexp.new('[\u3042\u3045\u3044-\u3045]') } - assert_warn(/\A\z/) { Regexp.new('[\u3042\u3046\u3044]') } - assert_warn(/duplicated/) { Regexp.new('[\u1000-\u2000\u3042-\u3046\u3044]') } - assert_warn(/duplicated/) { Regexp.new('[\u3044\u3041-\u3047]') } - assert_warn(/duplicated/) { Regexp.new('[\u3042\u3044\u3046\u3041-\u3047]') } + assert_warning(/duplicated/) { Regexp.new('[\u3042\u3043\u3042]') } + assert_warning(/duplicated/) { Regexp.new('[\u3042\u3043\u3043]') } + assert_warning(/\A\z/) { Regexp.new('[\u3042\u3044\u3043]') } + assert_warning(/\A\z/) { Regexp.new('[\u3042\u3045\u3043]') } + assert_warning(/\A\z/) { Regexp.new('[\u3042\u3045\u3044]') } + assert_warning(/\A\z/) { Regexp.new('[\u3042\u3045\u3043-\u3044]') } + assert_warning(/duplicated/) { Regexp.new('[\u3042\u3045\u3042-\u3043]') } + assert_warning(/duplicated/) { Regexp.new('[\u3042\u3045\u3044-\u3045]') } + assert_warning(/\A\z/) { Regexp.new('[\u3042\u3046\u3044]') } + assert_warning(/duplicated/) { Regexp.new('[\u1000-\u2000\u3042-\u3046\u3044]') } + assert_warning(/duplicated/) { Regexp.new('[\u3044\u3041-\u3047]') } + assert_warning(/duplicated/) { Regexp.new('[\u3042\u3044\u3046\u3041-\u3047]') } end def test_property_warn Index: test/ruby/test_syntax.rb =================================================================== --- test/ruby/test_syntax.rb (revision 37835) +++ test/ruby/test_syntax.rb (revision 37836) @@ -111,13 +111,13 @@ def test_warn_grouped_expression bug5214 = '[ruby-core:39050]' - assert_warn("", bug5214) do + assert_warning("", bug5214) do assert_valid_syntax("foo \\\n(\n true)", "test") {$VERBOSE = true} end end def test_warn_unreachable - assert_warn("test:3: warning: statement not reached\n") do + assert_warning("test:3: warning: statement not reached\n") do code = "loop do\n" "break\n" "foo\n" "end" assert_valid_syntax(code, "test") {$VERBOSE = true} end @@ -150,7 +150,7 @@ def test_duplicated_when w = 'warning: duplicated when clause is ignored' - assert_warn(/3: #{w}.+4: #{w}.+4: #{w}.+5: #{w}.+5: #{w}/m){ + assert_warning(/3: #{w}.+4: #{w}.+4: #{w}.+5: #{w}.+5: #{w}/m){ eval %q{ case 1 when 1, 1 @@ -159,7 +159,7 @@ end } } - assert_warn(/#{w}/){#/3: #{w}.+4: #{w}.+5: #{w}.+5: #{w}/m){ + assert_warning(/#{w}/){#/3: #{w}.+4: #{w}.+5: #{w}.+5: #{w}/m){ a = 1 eval %q{ case 1 Index: test/ruby/envutil.rb =================================================================== --- test/ruby/envutil.rb (revision 37835) +++ test/ruby/envutil.rb (revision 37836) @@ -187,15 +187,15 @@ assert(status.success?, m) end - def assert_warn(pat, message = nil) + def assert_warning(pat, message = nil) stderr = EnvUtil.verbose_warning { yield } message = ' "' + message + '"' if message msg = proc {"warning message #{stderr.inspect} is expected to match #{pat.inspect}#{message}"} assert(pat === stderr, msg) end - def assert_warning(*args) - assert_warn(*args) {$VERBOSE = false; yield} + def assert_warn(*args) + assert_warning(*args) {$VERBOSE = false; yield} end def assert_no_memory_leak(args, prepare, code, message=nil, limit: 1.5) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/