[前][次][番号順一覧][スレッド一覧]

ruby-changes:39805

From: kosaki <ko1@a...>
Date: Thu, 17 Sep 2015 12:21:30 +0900 (JST)
Subject: [ruby-changes:39805] kosaki:r51886 (trunk): * test/ruby/test_dir.rb (TestDir#test_fileno): s/?x/"x"/. Don't

kosaki	2015-09-17 12:21:15 +0900 (Thu, 17 Sep 2015)

  New Revision: 51886

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51886

  Log:
    * test/ruby/test_dir.rb (TestDir#test_fileno): s/?x/"x"/. Don't
      use tricky code, please.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_dir.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51885)
+++ ChangeLog	(revision 51886)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Sep 17 12:05:54 2015  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* 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@n...>
 
 	* encindex.h: fix typo of last #endif comment. [ci skip]
Index: test/ruby/test_dir.rb
===================================================================
--- test/ruby/test_dir.rb	(revision 51885)
+++ test/ruby/test_dir.rb	(revision 51886)
@@ -10,7 +10,7 @@ class TestDir < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_dir.rb#L10
     $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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_dir.rb#L131
   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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_dir.rb#L149
     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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_dir.rb#L180
 
   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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_dir.rb#L220
 
   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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_dir.rb#L228
       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
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]