git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-12-06 23:51:45 +00:00
Родитель 33dab9cdc9
Коммит 297303107d
1 изменённых файлов: 16 добавлений и 12 удалений

Просмотреть файл

@ -89,13 +89,6 @@ class TestRDocGeneratorJsonIndex < RDoc::TestCase
end
def test_generate
now = Time.now
@g.generate
assert_file 'js/searcher.js'
assert_file 'js/navigation.js'
assert_file 'js/search_index.js'
srcdir = File.expand_path('lib/rdoc', @pwd)
if !File.directory? srcdir
# for Ruby core repository
@ -103,17 +96,28 @@ class TestRDocGeneratorJsonIndex < RDoc::TestCase
end
orig_file = Pathname(File.join srcdir, 'generator/template/json_index/js/navigation.js')
orig_time = orig_file.mtime
now = Time.now
@g.generate
assert_file 'js/searcher.js'
assert_file 'js/navigation.js'
assert_file 'js/search_index.js'
generated_file = Pathname(File.join @tmpdir, 'js/navigation.js')
# This is dirty hack on JRuby for MiniTest 4
assert orig_file.mtime.inspect == generated_file.mtime.inspect,
'.js files should be tha same timestamp of original'
assert generated_file.mtime < now,
".js files should be the same timestamp,\n" +
"path: #{generated_file.inspect},\n" +
"time: #{generated_file.mtime.inspect},\n" +
"now : #{now.inspect}"
assert generated_file.mtime < now, proc {t = Time.now; <<~INSPECT}
.js files should be the same timestamp,
path : #{generated_file}
mtime: #{generated_file.mtime}
orig : #{orig_time} -> #{orig_file.mtime}, #{orig_file.mtime-orig_time}
now : #{now} -> #{t}, #{t-now}
INSPECT
generated_search_index = Pathname(File.join @tmpdir, 'js/search_index.js')
assert generated_search_index.mtime > (now - 1), 'search_index.js should be generated timestamp'