ruby-changes:73945
From: Nobuyoshi <ko1@a...>
Date: Mon, 10 Oct 2022 13:42:02 +0900 (JST)
Subject: [ruby-changes:73945] 6c5a8c2043 (master): Ignore excessive precisions
https://git.ruby-lang.org/ruby.git/commit/?id=6c5a8c2043 From 6c5a8c20439ea8932863627e477f18a7e77cf47e Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 10 Oct 2022 11:43:34 +0900 Subject: Ignore excessive precisions --- spec/ruby/core/file/atime_spec.rb | 2 +- spec/ruby/core/file/ctime_spec.rb | 2 +- spec/ruby/core/file/mtime_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/ruby/core/file/atime_spec.rb b/spec/ruby/core/file/atime_spec.rb index cef07ba010..3dc00fea21 100644 --- a/spec/ruby/core/file/atime_spec.rb +++ b/spec/ruby/core/file/atime_spec.rb @@ -19,7 +19,7 @@ describe "File.atime" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/file/atime_spec.rb#L19 platform_is_not :"powerpc64le-linux" do # https://bugs.ruby-lang.org/issues/17926 ## NOTE also that some Linux systems disable atime (e.g. via mount params) for better filesystem speed. it "returns the last access time for the named file with microseconds" do - supports_subseconds = Integer(`stat -c%x '#{__FILE__}'`[/\.(\d+)/, 1], 10) + supports_subseconds = Integer(`stat -c%x '#{__FILE__}'`[/\.(\d{1,6})/, 1], 10) if supports_subseconds != 0 expected_time = Time.at(Time.now.to_i + 0.123456) File.utime expected_time, 0, @file diff --git a/spec/ruby/core/file/ctime_spec.rb b/spec/ruby/core/file/ctime_spec.rb index b16eb13c1e..d17ba1a77f 100644 --- a/spec/ruby/core/file/ctime_spec.rb +++ b/spec/ruby/core/file/ctime_spec.rb @@ -16,7 +16,7 @@ describe "File.ctime" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/file/ctime_spec.rb#L16 platform_is :linux, :windows do it "returns the change time for the named file (the time at which directory information about the file was changed, not the file itself) with microseconds." do - supports_subseconds = Integer(`stat -c%z '#{__FILE__}'`[/\.(\d+)/, 1], 10) + supports_subseconds = Integer(`stat -c%z '#{__FILE__}'`[/\.(\d{1,6})/, 1], 10) if supports_subseconds != 0 File.ctime(__FILE__).usec.should > 0 else diff --git a/spec/ruby/core/file/mtime_spec.rb b/spec/ruby/core/file/mtime_spec.rb index 8d47d3021a..f89ee5d7f9 100644 --- a/spec/ruby/core/file/mtime_spec.rb +++ b/spec/ruby/core/file/mtime_spec.rb @@ -17,7 +17,7 @@ describe "File.mtime" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/file/mtime_spec.rb#L17 platform_is :linux, :windows do it "returns the modification Time of the file with microseconds" do - supports_subseconds = Integer(`stat -c%y '#{__FILE__}'`[/\.(\d+)/, 1], 10) + supports_subseconds = Integer(`stat -c%y '#{__FILE__}'`[/\.(\d{1,6})/, 1], 10) if supports_subseconds != 0 expected_time = Time.at(Time.now.to_i + 0.123456) File.utime 0, expected_time, @filename -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/