summaryrefslogtreecommitdiff
path: root/test/ruby/test_time.rb
AgeCommit message (Collapse)Author
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-09-28preserve encodings in error messagesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-22* time.c: zone encoding should be US-ASCII if all 7-bits. Fix r46907.eregon
* test/ruby/test_time.rb, test/ruby/test_time_tz.rb: Update tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-15* test/ruby/test_time.rb: Add test for getlocal(nil). Seeheadius
jruby/jruby#2310. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15add an assertion.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13* test/lib/envutil.rb: Moved from test/ruby/.akr
* test/lib/find_executable.rb: Ditto. * test/lib/memory_status.rb: Ditto. * test/lib/test/unit.rb: require envutil. * test/: Don't require envutil in test files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-21* time.c: raise exception when minutes of utc_offset is out of 00-59.glass
patch is from Kenichi Kamiya. [ruby-dev:47539] [Bug #8679] * test/ruby/test_time.rb: test for above. patch is from Kenichi Kamiya. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-26* time.c (rb_time_unmagnify_to_float): Avoid double rounding.akr
Reported by Tsuyoshi Sawada. https://bugs.ruby-lang.org/issues/10135#note-1 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-23time.c: unnecessary encodingnobu
* time.c (time_zone_name): remove unnecessary encoding and conversion if it is 7bit-ascii only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-23test_time.rb: encoding of Time#zonenobu
* test/ruby/test_time.rb (assert_zone_encoding): encoding of Time#zone is not locale, but the default internal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-02time.c: fix underflow of unsigned integersnobu
* time.c (vtm_add_offset): get rid of underflow of unsigned integers. fix up r45155. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25* test/ruby/test_time.rb: extended the timeout span and reduce the loop count.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25* test/ruby/test_time.rb: use portable time zone. see [ruby-core:61671] [Bug ↵usa
#9652] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-24test_time.rb: arguments ordernobu
* test/ruby/test_time.rb (TestTime#test_marshal_zone_gc): fix the order of arguments. expected value should come first. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-24Asia/Tokyo is more portable value for ENV["TZ"] [Bug #9652]naruse
FreeBSD doesn't accept "Japan". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-19time.c: freeze and preserve marshal-loaded time zonenormal
We need to prevent vtm.zone from pointing to a GC-ed string buffer. The rb_copy_generic_ivar call misses it because get_attr deleted it. Thanks to nobu for the rb_str_new_frozen suggestion. * time.c (time_mload): freeze and preserve marshal-loaded time zone * test/ruby/test_time.rb: add test for GC on loaded object [Bug #9652] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-05* test/ruby: get rid of warnings.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45273 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-08-17* test/ruby/test_time.rb: use the in_timezone() helpereregon
and define it at the top with other helpers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-17* test/ruby/test_time.rb (#in_timezone): fix typo of r42596eregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-17time.c: ignore invalid datanobu
* time.c (time_mload): ignore invalid offset and zone. [ruby-core:56648] [Bug #8795] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12* safe.c (rb_set_safe_level, safe_setter): raise an ArgumentErrorshugo
when $SAFE is set to 4. $SAFE=4 is now obsolete. [ruby-core:55222] [Feature #8468] * object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust): Kernel#untrusted?, untrust, and trust are now deprecated. Their behavior is same as tainted?, taint, and untaint, respectively. * include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED() and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(), respectively. * array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c, ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c, ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c, ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c, ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c, ext/socket/socket.c, ext/socket/udpsocket.c, ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c, ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c, load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c, safe.c, string.c, thread.c, transcode.c, variable.c, vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for $SAFE=4. * test/dl/test_dl2.rb, test/erb/test_erb.rb, test/readline/test_readline.rb, test/readline/test_readline_history.rb, test/ruby/test_alias.rb, test/ruby/test_array.rb, test/ruby/test_dir.rb, test/ruby/test_encoding.rb, test/ruby/test_env.rb, test/ruby/test_eval.rb, test/ruby/test_exception.rb, test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb, test/ruby/test_io.rb, test/ruby/test_method.rb, test/ruby/test_module.rb, test/ruby/test_object.rb, test/ruby/test_pack.rb, test/ruby/test_rand.rb, test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb, test/ruby/test_struct.rb, test/ruby/test_thread.rb, test/ruby/test_time.rb: remove tests for $SAFE=4. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-27* time.c (num_exact): use to_r method only if to_int method isakr
available. [ruby-core:53764] [Bug #8173] reported by Hiro Asari. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-15time.c: check re-initializenobu
* time.c (GetTimeval): check if already initialized instance. * time.c (GetNewTimeval): check if newly created instance. * time.c (time_init_0, time_init_1, time_init_copy, time_mload): must be newly created instance. [ruby-core:53436] [Bug #8099] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-07Use more portable value for ENV['TZ']naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-07* time.c (time_mdump): dump timezone string to private instance variablenaruse
on marshaling. * time.c (time_mload): load timezone string from private instance variable named 'zone'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-11update tests.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-30utc offset in secondsnobu
* time.c (utc_offset_arg): utc offset can be precision in seconds. e.g. old Europe/Lisbon (c.f. [ruby-dev:40066]) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-29strftime.c: triple colons modifiernobu
partially borrowed from ext/date. * strftime.c (rb_strftime_with_timespec): support GNU extension triple colons modifier. [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-29strftime.c: fix locale modifiernobu
partially borrowed from ext/date. * strftime.c (rb_strftime_with_timespec): check conversion with locale modifier. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-29strftime.c: fix colon modifier.nobu
partially borrowed from ext/date. * strftime.c (rb_strftime_with_timespec): colons are valid only for 'z' and must come just before it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-15test/ruby/test_time.rb: split a big testnobu
* test/ruby/test_time.rb (TestTime#test_strftime): split a big test by subjects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-19* strftime.c (rb_strftime_with_timespec): fix carrir-up bug andnobu
overwrite '+' with '-' if negative offset less than a hour. [ruby-core:44447][Bug #6323] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-17* strftime.c (rb_strftime_with_timespec): fix padding of time zonenobu
offset. [ruby-dev:43287][Bug #4458] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-24* time.c (time_init_1): Time.new will accept seconds as string ornobu
int. [ruby-core:43569][Bug #6193] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-19* time.c (TIME_COPY_GMT): copy vtm.utc_offset and vtm.zone too.akr
patch by Tomoyuki Chikanaga. [ruby-dev:44827] [Bug #5586] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-27* strftime.c (rb_strftime_with_timespec): get enc argument to specifynaruse
the encoding of the format. On Windows (at least Japanese Windows), Time#strftime("%Z") includes non ASCII in locale encoding (CP932). So convert locale to default internal. [ruby-core:39092] [Bug #5226] * strftime.c (rb_strftime): ditto. * strftime.c (rb_strftime_timespec): ditto. * internal.h (rb_strftime_timespec): follow above. * time.c (rb_strftime_alloc): ditto. * time.c (strftimev): ditto. * time.c (time_strftime): ditto. * time.c (time_to_s): the resulted string of Time#to_s is always ascii only, so this should be US-ASCII. * time.c (time_asctime): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-25* time.c (strftimev): Make Time#to_s default to US-ASCII encoding buttenderlove
respect Encoding.default_internal. [ruby-core:39092] * test/ruby/test_time.rb (class TestTime): Corresponding test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-07* time.c (rb_strftime_alloc): raise ERANGE if width is too large.kosaki
Patch by Nobuyoshi Nakada. [Bug #4457] [ruby-dev:43285] * test/ruby/test_time.rb (class TestTime): add a test for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-17* error.c (rb_check_trusted): new function to check an object isnobu
trusted. * struct.c (rb_struct_modify), time.c (time_modify): check by the above function to show proper class names. [Bug #5036] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-15* time.c (time_dup): used rb_obj_class() instead of CLASS_OF().kosaki
The patch is made by Kazuki Tsujimoto. [Bug #5012] [ruby-dev:44071] * test/ruby/test_time.rb (TestTime#test_getlocal_dont_share_eigenclass): added a new test for eigenclass of time object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-15* remove trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-30* strftime.c (rb_strftime_with_timespec): %G produces 4 digits.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-30* vsnprintf.c (BSD__uqtoa): Fix overflow when long != quad_t.naruse
patched by Peter Weldon <peter.weldon AT null.net> [ruby-core:33985] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-27* time.c (leap_year_v_p): fixed typo. [ruby-dev:42631]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-22* time.c (time_zone): use rb_locale_str_new_cstr to set encodingnaruse
as locale and convert its content to internal encoding. [ruby-core:33278] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-06add tests.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-31* time.c (rb_big_abs_find_minbit): fix handling the last word.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-31* time.c: less bignum allocations.akr
* strftime.c (rb_strftime_timespec): defined to avoid rational for nano second resolution time. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-27* time.c: fix previos commit.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e