Skip to content

Commit 56699bb

Browse files
committed
Implement rb_enc_sprintf()
1 parent 00b0956 commit 56699bb

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Compatibility:
1111
* `Integer#{ceil,floor,truncate}` now accept a precision and `Integer#round` accepts a rounding mode.
1212
* Added missing `Enumerable#filter` and `Enumerator::Lazy#filter` aliases to the respective `select` method (#1610).
1313
* Implement more `Ripper` methods as no-ops (#1694).
14+
* Implemented `rb_enc_sprintf` (#1702).
1415

1516
# 20.0.0 beta 1
1617

src/main/c/cext/ruby.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,14 @@ void rb_enc_raise(rb_encoding *enc, VALUE exc, const char *fmt, ...) {
13091309
}
13101310

13111311
VALUE rb_enc_sprintf(rb_encoding *enc, const char *format, ...) {
1312-
rb_tr_error("rb_enc_sprintf not implemented");
1312+
VALUE result;
1313+
va_list ap;
1314+
1315+
va_start(ap, format);
1316+
result = rb_enc_vsprintf(enc, format, ap);
1317+
va_end(ap);
1318+
1319+
return result;
13131320
}
13141321

13151322
int rb_enc_to_index(rb_encoding *enc) {

test/mri/excludes/Test_SPrintf.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,16 @@
22
exclude :"test_format_integer(% #+-00.d)", "needs investigation"
33
exclude :"test_format_integer(% #+-020d)", "needs investigation"
44
exclude :"test_format_integer(% #-00.d)", "needs investigation"
5-
exclude :"test_format_integer(% #-00d)", "needs investigation"
65
exclude :"test_format_integer(% #-020.d)", "needs investigation"
76
exclude :"test_format_integer(% #-020d)", "needs investigation"
87
exclude :"test_format_integer(% #0.d)", "needs investigation"
9-
exclude :"test_format_integer(% #20d)", "needs investigation"
108
exclude :"test_format_integer(% +-0.0d)", "needs investigation"
11-
exclude :"test_format_integer(% +-0d)", "needs investigation"
129
exclude :"test_format_integer(% +-20.0d)", "needs investigation"
13-
exclude :"test_format_integer(% +-20d)", "needs investigation"
1410
exclude :"test_format_integer(%#+0.d)", "needs investigation"
1511
exclude :"test_format_integer(%#+05.d)", "needs investigation"
16-
exclude :"test_format_integer(%#+05d)", "needs investigation"
17-
exclude :"test_format_integer(%#+0d)", "needs investigation"
1812
exclude :"test_format_integer(%+-05.0d)", "needs investigation"
19-
exclude :"test_format_integer(%+-0d)", "needs investigation"
2013
exclude :"test_format_integer(%.0d)", "needs investigation"
2114
exclude :"test_format_integer(%5.0d)", "needs investigation"
22-
exclude :"test_format_integer(%5d)", "needs investigation"
23-
exclude :"test_format_integer(%d)", "needs investigation"
24-
exclude :test_inspect, "needs investigation"
2515
exclude :test_quote, "needs investigation"
26-
exclude :test_string_prec, "needs investigation"
2716
exclude :test_taint, "needs investigation"
28-
exclude :test_to_str, "needs investigation"
2917
exclude :test_snprintf_count, "needs investigation"

0 commit comments

Comments
 (0)