ruby-changes:57557
From: David <ko1@a...>
Date: Thu, 5 Sep 2019 21:05:10 +0900 (JST)
Subject: [ruby-changes:57557] 1c4af1a77f (master): Add tests for `File.absolute_path?`
https://git.ruby-lang.org/ruby.git/commit/?id=1c4af1a77f From 1c4af1a77fb2dad27d523fe5d97ea4a27b145e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Thu, 23 May 2019 11:40:27 +0200 Subject: Add tests for `File.absolute_path?` [Feature #15868] diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb index ecca8d3..f0a8d67 100644 --- a/test/ruby/test_file.rb +++ b/test/ruby/test_file.rb @@ -519,4 +519,22 @@ class TestFile < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file.rb#L519 end end if File::Constants.const_defined?(:TMPFILE) + def test_absolute_path? + assert_file.absolute_path?(File.absolute_path(__FILE__)) + assert_file.absolute_path?("//foo/bar\\baz") + assert_file.not_absolute_path?(File.basename(__FILE__)) + assert_file.not_absolute_path?("C:foo\\bar") + assert_file.not_absolute_path?("~") + assert_file.not_absolute_path?("~user") + + if /mswin|mingw/ =~ RUBY_PLATFORM + assert_file.absolute_path?("C:\\foo\\bar") + assert_file.absolute_path?("C:/foo/bar") + assert_file.not_absolute_path?("/foo/bar\\baz") + else + assert_file.not_absolute_path?("C:\\foo\\bar") + assert_file.not_absolute_path?("C:/foo/bar") + assert_file.absolute_path?("/foo/bar\\baz") + end + end end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/