зеркало из https://github.com/github/gem-builder.git
made base glob dir more specific
sped up gem_eval_test
This commit is contained in:
Родитель
5049bd8914
Коммит
bafaaf3b71
|
@ -11,7 +11,16 @@ class GemEvalTest < Test::Unit::TestCase
|
|||
def setup
|
||||
system("mv git_mock git")
|
||||
@pid = fork { exec("PATH=.:$PATH ruby gem_eval.rb #{' > /dev/null 2>&1' unless OUTPUT}") }
|
||||
sleep 0.5
|
||||
|
||||
# wait for server to start
|
||||
Timeout::timeout(3) do
|
||||
begin
|
||||
TCPSocket.open('localhost', 4567){}
|
||||
server_started = true
|
||||
rescue Errno::ECONNREFUSED
|
||||
server_started = false
|
||||
end until server_started
|
||||
end
|
||||
end
|
||||
|
||||
def teardown
|
||||
|
|
|
@ -11,7 +11,7 @@ class LazyDir < Array
|
|||
files = OrigDir.send(@method, *@args, &@block)
|
||||
|
||||
# only return files within the current directory
|
||||
cur_dir = File.expand_path('.')
|
||||
cur_dir = File.expand_path('.') + File::SEPARATOR
|
||||
files.reject do |f|
|
||||
File.expand_path(f) !~ %r{^#{cur_dir}}
|
||||
end
|
||||
|
|
|
@ -51,12 +51,12 @@ class LazyDirTest < Test::Unit::TestCase
|
|||
assert LazyDir['../../*'].to_a.empty?
|
||||
|
||||
puts "\nbig glob test... this may take a while"
|
||||
orig = OrigDir['*.rb'].map {|f| File.expand_path(f) }
|
||||
lazy = LazyDir['../**/*.rb'].to_a.map {|f| File.expand_path(f) }
|
||||
orig = OrigDir['./**/*'].map {|f| File.expand_path(f) }
|
||||
lazy = LazyDir['../**/*'].to_a.map {|f| File.expand_path(f) }
|
||||
assert_equal orig, lazy
|
||||
end
|
||||
|
||||
def test_call_original_dir_methods
|
||||
def test_lazy_dir_delegates_original_dir_methods
|
||||
assert Dir.pwd
|
||||
dir = 'asfasdfsaf'
|
||||
assert Dir.mkdir(dir)
|
||||
|
|
Загрузка…
Ссылка в новой задаче