From ae05ae33c1194c6ad40730096b5d110e4de50222 Mon Sep 17 00:00:00 2001 From: kosaki Date: Thu, 17 Sep 2015 03:21:15 +0000 Subject: [PATCH] * test/ruby/test_dir.rb (TestDir#test_fileno): s/?x/"x"/. Don't use tricky code, please. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ test/ruby/test_dir.rb | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 06cfbe51f9..8fb4389369 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Sep 17 12:05:54 2015 KOSAKI Motohiro + + * test/ruby/test_dir.rb (TestDir#test_fileno): s/?x/"x"/. Don't + use tricky code, please. + Wed Sep 16 20:49:56 2015 Masaki Suketa * encindex.h: fix typo of last #endif comment. [ci skip] diff --git a/test/ruby/test_dir.rb b/test/ruby/test_dir.rb index 33d83cbca3..d7a09c65d8 100644 --- a/test/ruby/test_dir.rb +++ b/test/ruby/test_dir.rb @@ -10,7 +10,7 @@ class TestDir < Test::Unit::TestCase $VERBOSE = nil @root = File.realpath(Dir.mktmpdir('__test_dir__')) @nodir = File.join(@root, "dummy") - for i in ?a..?z + for i in "a".."z" if i.ord % 2 == 0 FileUtils.touch(File.join(@root, i)) else @@ -131,14 +131,14 @@ class TestDir < Test::Unit::TestCase end def test_glob - assert_equal((%w(. ..) + (?a..?z).to_a).map{|f| File.join(@root, f) }, + assert_equal((%w(. ..) + ("a".."z").to_a).map{|f| File.join(@root, f) }, Dir.glob(File.join(@root, "*"), File::FNM_DOTMATCH).sort) - assert_equal([@root] + (?a..?z).map {|f| File.join(@root, f) }.sort, + assert_equal([@root] + ("a".."z").map {|f| File.join(@root, f) }.sort, Dir.glob([@root, File.join(@root, "*")]).sort) - assert_equal([@root] + (?a..?z).map {|f| File.join(@root, f) }.sort, + assert_equal([@root] + ("a".."z").map {|f| File.join(@root, f) }.sort, Dir.glob(@root + "\0\0\0" + File.join(@root, "*")).sort) - assert_equal((?a..?z).step(2).map {|f| File.join(File.join(@root, f), "") }.sort, + assert_equal(("a".."z").step(2).map {|f| File.join(File.join(@root, f), "") }.sort, Dir.glob(File.join(@root, "*/")).sort) assert_equal([File.join(@root, '//a')], Dir.glob(@root + '//a')) @@ -149,7 +149,7 @@ class TestDir < Test::Unit::TestCase assert_equal([], Dir.glob(File.join(@root, '[a-\\'))) assert_equal([File.join(@root, "a")], Dir.glob(File.join(@root, 'a\\'))) - assert_equal((?a..?f).map {|f| File.join(@root, f) }.sort, Dir.glob(File.join(@root, '[abc/def]')).sort) + assert_equal(("a".."f").map {|f| File.join(@root, f) }.sort, Dir.glob(File.join(@root, '[abc/def]')).sort) end def test_glob_recursive @@ -180,7 +180,7 @@ class TestDir < Test::Unit::TestCase def assert_entries(entries) entries.sort! - assert_equal(%w(. ..) + (?a..?z).to_a, entries) + assert_equal(%w(. ..) + ("a".."z").to_a, entries) end def test_entries @@ -220,7 +220,7 @@ class TestDir < Test::Unit::TestCase def test_symlink begin - ["dummy", *?a..?z].each do |f| + ["dummy", *"a".."z"].each do |f| File.symlink(File.join(@root, f), File.join(@root, "symlink-#{ f }")) end @@ -228,10 +228,10 @@ class TestDir < Test::Unit::TestCase return end - assert_equal([*?a..?z, *"symlink-a".."symlink-z"].each_slice(2).map {|f, _| File.join(@root, f + "/") }.sort, + assert_equal([*"a".."z", *"symlink-a".."symlink-z"].each_slice(2).map {|f, _| File.join(@root, f + "/") }.sort, Dir.glob(File.join(@root, "*/")).sort) - assert_equal([@root + "/", *[*?a..?z].each_slice(2).map {|f, _| File.join(@root, f + "/") }.sort], + assert_equal([@root + "/", *[*"a".."z"].each_slice(2).map {|f, _| File.join(@root, f + "/") }.sort], Dir.glob(File.join(@root, "**/")).sort) end