Skip to content

Commit e69ff81

Browse files
committed
Changes based on review.
1 parent a126e8a commit e69ff81

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

spec/ruby/optional/capi/string_spec.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,10 +891,20 @@ def inspect
891891
@s.rb_sprintf3(ToSOrInspect.new).should == s
892892
end
893893

894-
it "formats a string VALUE using to inspect if sign specified in format" do
894+
it "formats a string VALUE using inspect if sign specified in format" do
895895
s = 'Result: A different string.'
896896
@s.rb_sprintf4(ToSOrInspect.new).should == s
897897
end
898+
899+
it "formats a TrueClass VALUE as `TrueClass` if sign not specified in format" do
900+
s = 'Result: TrueClass.'
901+
@s.rb_sprintf3(true.class).should == s
902+
end
903+
904+
it "formats a TrueClass VALUE as 'true' if sign specified in format" do
905+
s = 'Result: true.'
906+
@s.rb_sprintf4(true.class).should == s
907+
end
898908
end
899909

900910
describe "rb_vsprintf" do

src/main/c/cext/ruby.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ void* rb_tr_true;
3232
void* rb_tr_false;
3333
void* rb_tr_nil;
3434

35-
// Run when loading C-extension support
36-
3735
#ifdef __APPLE__
3836
static printf_domain_t printf_domain;
3937

@@ -70,10 +68,6 @@ static int rb_tr_fprintf_value(FILE *stream,
7068
if (RB_TYPE_P(v, T_CLASS)) {
7169
if (v == rb_cNilClass) {
7270
cstr = "nil";
73-
} else if (v == rb_cInteger) {
74-
cstr = "Integer";
75-
} else if (v == rb_cSymbol) {
76-
cstr = "Symbol";
7771
} else if (v == rb_cTrueClass) {
7872
cstr = "true";
7973
} else if (v == rb_cFalseClass) {
@@ -94,6 +88,8 @@ static int rb_tr_fprintf_value(FILE *stream,
9488
return len;
9589
}
9690

91+
// Run when loading C-extension support
92+
9793
void rb_tr_init(void *ruby_cext) {
9894
truffle_assign_managed(&rb_tr_cext, ruby_cext);
9995
truffle_assign_managed(&rb_tr_undef, rb_tr_get_undef());

0 commit comments

Comments
 (0)