ruby-changes:22883
From: nobu <ko1@a...>
Date: Tue, 6 Mar 2012 18:56:21 +0900 (JST)
Subject: [ruby-changes:22883] nobu:r34932 (ruby_1_9_3): merge revision(s) 33251,33259,33424:
nobu 2012-03-06 18:56:04 +0900 (Tue, 06 Mar 2012) New Revision: 34932 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34932 Log: merge revision(s) 33251,33259,33424: * lib/test/unit/assertions.rb (assert_send): make arguments in the default message clearer. * lib/test/unit/assertions.rb (assert_send, assert_not_send): parenthesize non-empty arguments. Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/lib/test/unit/assertions.rb branches/ruby_1_9_3/version.h Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 34931) +++ ruby_1_9_3/ChangeLog (revision 34932) @@ -1,3 +1,13 @@ +Tue Mar 6 18:55:37 2012 Nobuyoshi Nakada <nobu@r...> + + * lib/test/unit/assertions.rb (assert_send, assert_not_send): + parenthesize non-empty arguments. + +Tue Mar 6 18:55:37 2012 Nobuyoshi Nakada <nobu@r...> + + * lib/test/unit/assertions.rb (assert_send): make arguments in + the default message clearer. + Tue Mar 6 12:48:08 2012 Nobuyoshi Nakada <nobu@r...> * ext/io/console/console.c (set_rawmode): clear ECHOE and ECHOK Index: ruby_1_9_3/lib/test/unit/assertions.rb =================================================================== --- ruby_1_9_3/lib/test/unit/assertions.rb (revision 34931) +++ ruby_1_9_3/lib/test/unit/assertions.rb (revision 34932) @@ -255,6 +255,58 @@ super if !caller[0].rindex(MINI_DIR, 0) || !obj.respond_to?(meth) end + # :call-seq: + # assert_send( +send_array+, failure_message = nil ) + # + # Passes if the method send returns a true value. + # + # +send_array+ is composed of: + # * A receiver + # * A method + # * Arguments to the method + # + # Example: + # assert_send([[1, 2], :member?, 1]) # -> pass + # assert_send([[1, 2], :member?, 4]) # -> fail + def assert_send send_ary, m = nil + recv, msg, *args = send_ary + m = message(m) { + if args.empty? + argsstr = "" + else + (argsstr = mu_pp(args)).sub!(/\A\[(.*)\]\z/m, '(\1)') + end + "Expected #{mu_pp(recv)}.#{msg}#{argsstr} to return true" + } + assert recv.__send__(msg, *args), m + end + + # :call-seq: + # assert_not_send( +send_array+, failure_message = nil ) + # + # Passes if the method send doesn't return a true value. + # + # +send_array+ is composed of: + # * A receiver + # * A method + # * Arguments to the method + # + # Example: + # assert_not_send([[1, 2], :member?, 1]) # -> fail + # assert_not_send([[1, 2], :member?, 4]) # -> pass + def assert_not_send send_ary, m = nil + recv, msg, *args = send_ary + m = message(m) { + if args.empty? + argsstr = "" + else + (argsstr = mu_pp(args)).sub!(/\A\[(.*)\]\z/m, '(\1)') + end + "Expected #{mu_pp(recv)}.#{msg}#{argsstr} to return false" + } + assert !recv.__send__(msg, *args), m + end + ms = instance_methods(true).map {|sym| sym.to_s } ms.grep(/\Arefute_/) do |m| mname = ('assert_not_' << m.to_s[/.*?_(.*)/, 1]) Index: ruby_1_9_3/version.h =================================================================== --- ruby_1_9_3/version.h (revision 34931) +++ ruby_1_9_3/version.h (revision 34932) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 162 +#define RUBY_PATCHLEVEL 163 #define RUBY_RELEASE_DATE "2012-03-06" #define RUBY_RELEASE_YEAR 2012 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/