Skip to content

Commit

Permalink
Showing 4 changed files with 8 additions and 10 deletions.
7 changes: 0 additions & 7 deletions spec/truffle/tags/core/string/modulo_tags.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
fails:String#% formats single % characters before a newline or NULL as literal %s
fails:String#% raises an ArgumentError for unused arguments when $DEBUG is true
fails:String#% always allows unused arguments when positional argument style is used
fails:String#% replaces trailing absolute argument specifier without type with percent sign
fails:String#% raises an ArgumentError when multiple positional argument tokens are given for one format specifier
fails:String#% raises an ArgumentError when absolute and relative argument numbers are mixed
fails:String#% allows reuse of the one argument multiple via absolute argument numbers
fails:String#% allows positional arguments for width star and precision star arguments
fails:String#% allows negative width to imply '-' flag
fails:String#% ignores negative precision
fails:String#% allows a star to take an argument number to use as the width
fails:String#% calls to_int on width star and precision star tokens
fails:String#% does not call #to_a to convert the argument
fails:String#% calls #to_ary to convert the argument
fails:String#% wraps the object in an Array if #to_ary returns nil
fails:String#% raises a TypeError if #to_ary does not return an Array
fails:String#% tries to convert the argument to Array by calling #to_ary
fails:String#% doesn't return subclass instances when called on a subclass
fails:String#% always taints the result when the format string is tainted
fails:String#% supports character formats using %c
@@ -46,7 +40,6 @@ fails:String#% supports hex formats using %x for positive numbers
fails:String#% supports hex formats using %x for negative numbers
fails:String#% supports hex formats using %X for positive numbers
fails:String#% supports hex formats using %X for negative numbers
fails:String#% tries to convert the passed argument to an Array using #to_ary
fails:String#% behaves as if calling Kernel#Float for %e arguments, when the passed argument does not respond to #to_ary
fails:String#% behaves as if calling Kernel#Float for %e arguments, when the passed argument is hexadecimal string
fails:String#% behaves as if calling Kernel#Float for %E arguments, when the passed argument does not respond to #to_ary
2 changes: 1 addition & 1 deletion tool/jt.rb
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ def self.find_graal_javacmd_and_options
else
mx_options = ''
end
command_line = `mx -v #{mx_options} -p #{graal_home} vm -version 2>/dev/null`.lines.last
command_line = `mx -v #{mx_options} -p #{graal_home} vm -version 2>/dev/null`.lines.to_a.last
vm_args = command_line.split
vm_args.pop # Drop "-version"
javacmd = vm_args.shift
Original file line number Diff line number Diff line change
@@ -155,7 +155,7 @@ public void exitFormat(PrintfParser.FormatContext ctx) {
final String conversionMethodName = type == 's' ? "to_s" : "inspect";
final FormatNode conversionNode;

if (ctx.ANGLE_KEY() == null) {
if (ctx.ANGLE_KEY() == null && absoluteArgumentIndex == DEFAULT) {
conversionNode = ReadStringNodeGen.create(context, true, conversionMethodName, false, EMPTY_BYTES, new SourceNode());
} else {
conversionNode = ToStringNodeGen.create(context, true, conversionMethodName, false, EMPTY_BYTES, valueNode);
7 changes: 6 additions & 1 deletion truffle/src/main/ruby/core/string.rb
Original file line number Diff line number Diff line change
@@ -1641,7 +1641,12 @@ def %(args)
if args.is_a? Hash
sprintf(self, args)
else
sprintf(self, *args)
result = Rubinius::Type.check_convert_type args, Array, :to_ary
if result.nil?
sprintf(self, *args)
else
sprintf(self, *result)
end
end
end

0 comments on commit c0a73cf

Please sign in to comment.