@@ -488,6 +488,15 @@ static VALUE string_spec_rb_sprintf7(VALUE self, VALUE str, VALUE obj) {
488
488
return results ;
489
489
}
490
490
491
+ static VALUE string_spec_rb_sprintf8 (VALUE self , VALUE str , VALUE num ) {
492
+ VALUE results = rb_ary_new ();
493
+ rb_ary_push (results , rb_sprintf (RSTRING_PTR (str ), FIX2LONG (num )));
494
+ char cstr [256 ];
495
+ int len = snprintf (cstr , 256 , RSTRING_PTR (str ), FIX2LONG (num ));
496
+ rb_ary_push (results , rb_str_new (cstr , len ));
497
+ return results ;
498
+ }
499
+
491
500
PRINTF_ARGS (static VALUE string_spec_rb_vsprintf_worker (char * fmt , ...), 1 , 2 );
492
501
static VALUE string_spec_rb_vsprintf_worker (char * fmt , ...) {
493
502
va_list varargs ;
@@ -648,6 +657,7 @@ void Init_string_spec(void) {
648
657
rb_define_method (cls , "rb_sprintf5" , string_spec_rb_sprintf5 , 3 );
649
658
rb_define_method (cls , "rb_sprintf6" , string_spec_rb_sprintf6 , 3 );
650
659
rb_define_method (cls , "rb_sprintf7" , string_spec_rb_sprintf7 , 2 );
660
+ rb_define_method (cls , "rb_sprintf8" , string_spec_rb_sprintf8 , 2 );
651
661
rb_define_method (cls , "rb_vsprintf" , string_spec_rb_vsprintf , 4 );
652
662
rb_define_method (cls , "rb_str_equal" , string_spec_rb_str_equal , 2 );
653
663
rb_define_method (cls , "rb_usascii_str_new" , string_spec_rb_usascii_str_new , 2 );
0 commit comments