diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-17 03:21:15 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-17 03:21:15 +0000 |
commit | e4a9839713057c4057f24418066ec734e6035037 (patch) | |
tree | 2c28a22683eff9c0d3cb32122074222db2e9d985 | |
parent | 71f73d93cf9414228eec509479534db4789e63f5 (diff) | |
download | ruby-e4a9839713057c4057f24418066ec734e6035037.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | test/ruby/test_dir.rb | 20 |
2 files changed, 15 insertions, 10 deletions
@@ -1,3 +1,8 @@ +Thu Sep 17 12:05:54 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com> + + * 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 <masaki.suketa@nifty.ne.jp> * 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 |