ruby-changes:71781
From: Hiroshi <ko1@a...>
Date: Wed, 20 Apr 2022 14:13:33 +0900 (JST)
Subject: [ruby-changes:71781] c506ddac6c (master): Added assert_true and assert_false same as test-unit gem
https://git.ruby-lang.org/ruby.git/commit/?id=c506ddac6c From c506ddac6c88b14daf4a18bddf1c1e57be8d2225 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Wed, 20 Apr 2022 14:13:10 +0900 Subject: Added assert_true and assert_false same as test-unit gem --- tool/lib/test/unit/assertions.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tool/lib/test/unit/assertions.rb b/tool/lib/test/unit/assertions.rb index 6345a625c1..3244913a36 100644 --- a/tool/lib/test/unit/assertions.rb +++ b/tool/lib/test/unit/assertions.rb @@ -192,6 +192,22 @@ module Test https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit/assertions.rb#L192 assert obj.nil?, msg end + ## + # Fails unless +obj+ is true + + def assert_true obj, msg = nil + msg = message(msg) { "Expected #{mu_pp(obj)} to be true" } + assert obj == true, msg + end + + ## + # Fails unless +obj+ is false + + def assert_false obj, msg = nil + msg = message(msg) { "Expected #{mu_pp(obj)} to be false" } + assert obj == false, msg + end + ## # For testing with binary operators. # -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/