aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_sprintf.rb
Commit message (Collapse)AuthorAgeFilesLines
* sprintf.c: fix buffer overflownobu2016-03-271-0/+4
| | | | | | | | * sprintf.c (rb_str_format): fix buffer overflow, length must be greater than precision. reported by William Bowling <will AT wbowling.info>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby: suppress parser warningsnobu2016-02-191-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: exact numbernobu2016-01-141-0/+5
| | | | | | * sprintf.c (rb_str_format): format exact number more exactly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_sprintf.rb: simplifynobu2016-01-141-3/+3
| | | | | | | * test/ruby/test_sprintf.rb (test_rational): enumerate formatted flags and simplify. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: fix garbage inserted with Rationalnobu2015-12-031-0/+3
| | | | | | | | * sprintf.c (rb_str_format): fix wrong shifting position in Rational conversion when not at the beginning of the result. [ruby-core:71806] [Bug #11766] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: nil value is validnobu2015-11-111-0/+5
| | | | | | | | * sprintf.c (rb_str_format): look up the key, then get default value and raise KeyError if the returned value is nil. [ruby-dev:49338] [Ruby trunk - Bug #11677] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: hash default valuenobu2015-11-111-0/+6
| | | | | | | | * sprintf.c (rb_str_format): respect default value of a hash. no longer raises KeyError unless the default value of the hash is nil. [ruby-core:71354] [Bug #11661] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* comment out for x86 extended precisionnaruse2014-12-151-2/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: improve rational 'f' formatnobu2014-09-141-0/+14
| | | | | | | * sprintf.c (rb_str_format): rational 'f' format works for more values. [fix GH-717] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: fix conditionnobu2014-08-191-0/+1
| | | | | | | * sprintf.c (rb_str_format): fix condition to round. [ruby-core:64454] [Bug #10151] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: rational 'f' formatnobu2014-08-181-0/+5
| | | | | | | * sprintf.c (rb_str_format): support rational 'f' format. [ruby-core:64382] [Bug #10136] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: unnumbered asterisk with numbered argumentnobu2014-06-261-0/+4
| | | | | | | | * sprintf.c (GETASTER): should not use the numbered argument to be formatted, raise ArgumentError instead. [ruby-dev:48330] [Bug #9982] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: remove extra parenthesesnobu2014-06-261-0/+6
| | | | | | | * sprintf.c (GETASTER): remove extra parentheses from the second argument so that the error message does not contain them. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_sprintf.rb: sprintf with a hash as parameternobu2013-12-281-0/+5
| | | | | | | * test/ruby/test_sprintf.rb (test_hash): Added tests for sprintf with a hash as parameter. [Fixes GH-491] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby: better assertionsnobu2013-12-131-1/+1
| | | | | | * test/ruby: use better assertions instead of mere assert. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/unit/assertions.rb: return exceptionnobu2013-10-091-36/+18
| | | | | | | | | * lib/test/unit/assertions.rb (assert_raise_with_message): return raised exception same as assert_raise. * test/ruby, test/-ext-: use assert_raise_with_message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (rb_check_id_cstr): new function to check if ID isnobu2012-04-111-0/+10
| | | | | | | registered with NUL-terminated C string. * sprintf.c (rb_str_format): avoid inadvertent symbol creation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * sprintf.c (rb_str_format): fix exception message encoding.nobu2012-04-111-0/+38
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_sprintf.rb (test_named_untyped, test_named_typed):nobu2012-04-111-1/+8
| | | | | | | split and add assertions for exception when named parameter after unnumbered. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * sprintf.c (rb_str_format): fix error message.nobu2012-04-111-3/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vsnprintf.c (BSD_vfprintf): don't output floating pointnaruse2010-11-221-1/+1
| | | | | | when the precision is 0. [ruby-dev:42615] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix wrong test.naruse2010-11-091-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * util.c (ruby_strtod): this code uses FPU's rounding system.naruse2010-11-091-0/+2
| | | | | | | | | | But x86's FPU calculates double precision floating-point numbers in 80bit precision, so it fails to round the value. So ensure the value is assigned a variable. [ruby-dev:42551] see also [ruby-math:00802] http://www.shudo.net/java-grandprix99/strictfp/ git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vsnprintf.c (BSD_vfprintf): fix precision specifier doesn'tnaruse2010-11-081-0/+1
| | | | | | work well on %f. [ruby-dev:42552] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vsnprintf.c (BSD_vfprintf): prec digits fractal part should benobu2010-10-241-0/+4
| | | | | | appended to 0 if prec is given. [ruby-dev:42453] #3979 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vsnprintf.c (BSD_vfprintf): print floating point on "%#a".naruse2010-10-201-2/+7
| | | | | | [ruby-dev:42431] Bug#3965 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vsnprintf.c (BSD_vfprintf): clear ALT flag for %a.naruse2010-10-191-0/+2
| | | | | | [ruby-core:32841] [ruby-core:32848] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_sprintf.rb: fix ML ref. [ruby-core:32848]nobu2010-10-191-2/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vsnprintf.c (BSD_vfprintf): fix over-count of field size.nobu2010-10-191-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vsnprintf.c (BSD_vfprintf): use HEXPREFIX flag for prefix of %a.nobu2010-10-181-0/+8
| | | | | | [ruby-core:32841] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix wrong test.naruse2010-10-181-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * sprintf.c (BSD_vfprintf): wrong padding arround prefix andnaruse2010-10-181-0/+7
| | | | | | floating point with %a. [ruby-dev:42403] Bug #3956 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert "* sprintf.c (rb_str_format): fix: sprintf with hex format and"naruse2010-10-151-6/+4
| | | | | | | This reverts commit a160986d90cf90a86e01d60eddb04ffe0e584c36. Revert wrong commit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * sprintf.c (rb_str_format): fix: sprintf with hex format andnaruse2010-10-151-4/+6
| | | | | | precision includes wrong dots. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * sprintf.c: add short documentation about named reference.naruse2010-07-211-0/+3
| | | | | | [ruby-core:31294] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):nobu2010-04-291-1/+2
| | | | | | use more descriptive assertions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Remove platform dependent test.naruse2010-04-021-2/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add test for sprintf with Infinity and NaN.naruse2010-04-011-0/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * sprintf.c (rb_str_format): support %a format. [ruby-dev:40650]naruse2010-04-011-0/+13
| | | | | | | | | | | | | * missing/vsnprintf.c (BSD_vfprintf): ditto. * missing/vsnprintf.c (cvt): ditto. * util.c (BSD__hdtoa): added. This is 2-clause BSDL licensed by David Schultz and from FreeBSD. * LEGAL: add about hdtoa() in util.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * sprintf.c (rb_str_format): checks if named argument given twice.nobu2009-03-271-0/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_sprintf.rb (test_invalid): suppress warning.nobu2008-12-281-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bootstraptest/test_knownbug.rb: move solved tests.ko12008-05-191-0/+1
| | | | | | | | | | | * bootstraptest/test_eval.rb, test_literal.rb, test_syntax.rb, test_thread.rb: ditto. * test/ruby/test_m17n.rb, test_proc.rb, test_sprintf.rb, test_string.rb, test/ruby/test_struct.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test_sprintf.rb (test_integer): add some cases.usa2008-03-061-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add a test for [ruby-dev:34002].akr2008-03-061-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * sprintf.c (rb_str_format): ignore 0 flag for NaN and Inf.nobu2008-03-061-12/+12
| | | | | | | [ruby-dev:33994] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/test_{string,sprintf}.rb: updated.matz2008-03-011-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * sprintf.c (remove_sign_bits): returns pointer to the first char tonobu2008-01-241-6/+6
| | | | | | | | | | be used, instead of copying. * sprintf.c (rb_str_format): negative indicator dots should come before sign digits always. [ruby-dev:33224] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add a test for [ruby-dev:33224].akr2008-01-241-0/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_struct.rb: add tests to achieve over 90% testmame2008-01-231-0/+78
| | | | | | | | | coverage of struct.c. * test/ruby/test_sprintf.rb: ditto for sprintf.c. * test/ruby/test_math.rb: ditto for math.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e