Skip to content

Commit d74f90e

Browse files
committed
StringIO: fix escaping of % with %% in #printf
1 parent 3b51ece commit d74f90e

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

lib/truffle/stringio.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,7 @@ def print(*args)
8787
def printf(*args)
8888
check_writable
8989

90-
if args.size > 1
91-
write(args.shift % args)
92-
else
93-
write(args.first)
94-
end
90+
write(sprintf(*args))
9591

9692
nil
9793
end
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
fails:StringIO#printf formatting other formats s does not try to convert with to_str
2-
fails:StringIO#printf formatting other formats % is escaped by %
32
fails:StringIO#printf formatting flags # applies to format o does nothing for negative argument
43
fails:StringIO#printf formatting flags # applies to formats bBxX does nothing for zero argument
5-
fails:StringIO#printf formatting other formats % alone raises an ArgumentError

0 commit comments

Comments
 (0)