summaryrefslogtreecommitdiff
path: root/test/ruby/test_sprintf.rb
AgeCommit message (Collapse)Author
2018-09-15test_sprintf.rb: test for %pnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-08test/ruby (*no_hidden_garbage): disable GC and skip if multi-threadednormal
Any single object allocation can reduce object count, and object counts are global, so multi-threading leads to unpredictable results. See also similar commits: r60699 and r62608 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-18error.c: KeyError#receiver and KeyError#keynobu
* error.c: new method KeyError#receiver and KeyError#key. [Feature #12063] * hash.c: make KeyError object with receiver and key. * sprintf.c: ditto. Author: ksss <co000ri@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-31Improve error messagekazu
ref [Bug #13761] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-23sprintf.c: width too bignobu
* sprintf.c (rb_str_format): explicitly reject too big negative width, instead of an empty string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-25Raise ArgumentError if sprintf format string ends with %eregon
* Add tests and specs. See ruby/spec#401. Patch by Yuta Iwama and Shintaro Morikawa. [ruby-core:80153] [Bug #13315] [Fix GH-1560] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-23Fix space flag when Inf/NaN and width==3nobu
* sprintf.c (rb_str_format): while `"% 2f"` and `"% 4f"` result in `" Inf"` and `" Inf"` respectively, `"% 3f"` results in `"Inf"` (no space). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-31sprintf.c: avoid garbage in common (no exception) casenormal
Format strings which are dynamically-generated will benefit from this. This won't cover exceptions, but exceptions for sprintf should be too uncommon to care about (unlike IO) * sprintf.c (rb_str_format): use rb_str_tmp_frozen_{acquire,release} * test/ruby/test_sprintf.rb (test_no_hidden_garbage): new test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-17sprintf.c: fix width underflownobu
* sprintf.c (rb_str_format): fix memory corruption by width underflow. https://github.com/mruby/mruby/issues/3347 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-04util.c: round to evennobu
* util.c (ruby_dtoa): round to even, instead of rounding to nearest. [ruby-core:77864] [Bug #12889] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-10util.c: round nearly middle valuenobu
* util.c (ruby_dtoa): [EXPERIMENTAL] adjust the case that the Float value is close to the exact but unrepresentable middle value of two values in the given precision, as r55604. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-27sprintf.c: fix buffer overflownobu
* 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
2016-02-19test/ruby: suppress parser warningsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-14sprintf.c: exact numbernobu
* 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
2016-01-14test_sprintf.rb: simplifynobu
* 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
2015-12-16Add frozen_string_literal: false for all filesnaruse
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
2015-12-03sprintf.c: fix garbage inserted with Rationalnobu
* 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
2015-11-11sprintf.c: nil value is validnobu
* 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
2015-11-11sprintf.c: hash default valuenobu
* 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
2014-12-15comment out for x86 extended precisionnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-14sprintf.c: improve rational 'f' formatnobu
* 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
2014-08-19sprintf.c: fix conditionnobu
* 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
2014-08-18sprintf.c: rational 'f' formatnobu
* 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
2014-06-26sprintf.c: unnumbered asterisk with numbered argumentnobu
* 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
2014-06-26sprintf.c: remove extra parenthesesnobu
* 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
2013-12-28test_sprintf.rb: sprintf with a hash as parameternobu
* 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
2013-12-13test/ruby: better assertionsnobu
* 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
2013-10-09test/unit/assertions.rb: return exceptionnobu
* 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
2012-04-11* parse.y (rb_check_id_cstr): new function to check if ID isnobu
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
2012-04-11* sprintf.c (rb_str_format): fix exception message encoding.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-11* test/ruby/test_sprintf.rb (test_named_untyped, test_named_typed):nobu
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
2012-04-11* sprintf.c (rb_str_format): fix error message.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-22* vsnprintf.c (BSD_vfprintf): don't output floating pointnaruse
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
2010-11-09Fix wrong test.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-09* util.c (ruby_strtod): this code uses FPU's rounding system.naruse
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
2010-11-08* vsnprintf.c (BSD_vfprintf): fix precision specifier doesn'tnaruse
work well on %f. [ruby-dev:42552] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-24* vsnprintf.c (BSD_vfprintf): prec digits fractal part should benobu
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
2010-10-20* vsnprintf.c (BSD_vfprintf): print floating point on "%#a".naruse
[ruby-dev:42431] Bug#3965 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19* vsnprintf.c (BSD_vfprintf): clear ALT flag for %a.naruse
[ruby-core:32841] [ruby-core:32848] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19* test/ruby/test_sprintf.rb: fix ML ref. [ruby-core:32848]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19* vsnprintf.c (BSD_vfprintf): fix over-count of field size.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-18* vsnprintf.c (BSD_vfprintf): use HEXPREFIX flag for prefix of %a.nobu
[ruby-core:32841] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-18Fix wrong test.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-18* sprintf.c (BSD_vfprintf): wrong padding arround prefix andnaruse
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
2010-10-15Revert "* sprintf.c (rb_str_format): fix: sprintf with hex format and"naruse
This reverts commit a160986d90cf90a86e01d60eddb04ffe0e584c36. Revert wrong commit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-15* sprintf.c (rb_str_format): fix: sprintf with hex format andnaruse
precision includes wrong dots. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-21* sprintf.c: add short documentation about named reference.naruse
[ruby-core:31294] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-29* lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):nobu
use more descriptive assertions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-02Remove platform dependent test.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-01Add test for sprintf with Infinity and NaN.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e