[前][次][番号順一覧][スレッド一覧]

ruby-changes:66834

From: Nobuyoshi <ko1@a...>
Date: Sun, 18 Jul 2021 21:56:45 +0900 (JST)
Subject: [ruby-changes:66834] 8a6ef5ef8f (master): Make boolean expected messages more consitent

https://git.ruby-lang.org/ruby.git/commit/?id=8a6ef5ef8f

From 8a6ef5ef8f4f14f1679bbab3a85fa05217e49a43 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 18 Jul 2021 20:51:30 +0900
Subject: Make boolean expected messages more consitent

---
 error.c  | 3 +--
 object.c | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/error.c b/error.c
index 97f8c22..c01e887 100644
--- a/error.c
+++ b/error.c
@@ -1271,8 +1271,7 @@ exc_full_message(int argc, VALUE *argv, VALUE exc) https://github.com/ruby/ruby/blob/trunk/error.c#L1271
 	rb_get_kwargs(opt, kw, 0, kw_max_, args);
 	switch (args[kw_highlight]) {
 	  default:
-	    rb_raise(rb_eArgError, "expected true or false as "
-		     "highlight: %+"PRIsVALUE, args[kw_highlight]);
+            rb_bool_expected(args[kw_highlight], "highlight");
 	  case Qundef: args[kw_highlight] = Qnil; break;
 	  case Qtrue: case Qfalse: case Qnil: break;
 	}
diff --git a/object.c b/object.c
index 350cef0..4667c18 100644
--- a/object.c
+++ b/object.c
@@ -3388,7 +3388,7 @@ rb_bool_expected(VALUE obj, const char *flagname) https://github.com/ruby/ruby/blob/trunk/object.c#L3388
       case Qtrue: case Qfalse:
         break;
       default:
-        rb_raise(rb_eArgError, "true or false is expected as %s: %+"PRIsVALUE,
+        rb_raise(rb_eArgError, "expected true or false as %s: %+"PRIsVALUE,
                  flagname, obj);
     }
     return obj != Qfalse;
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]