зеркало из https://github.com/github/ruby.git
* 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
This commit is contained in:
Родитель
76da19cfb1
Коммит
ae05ae33c1
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче