Sha256: 8ed6d49b5fa07fb97641836967eb085f1af1500c29e2c398a30b9de20d463ba1
Contents?: true
Size: 1.88 KB
Versions: 104
Compression:
Stored size: 1.88 KB
Contents
require 'rdoc/test_case' class TestRDocGeneratorRI < RDoc::TestCase def setup super @options = RDoc::Options.new @options.encoding = Encoding::UTF_8 if Object.const_defined? :Encoding @tmpdir = File.join Dir.tmpdir, "test_rdoc_generator_ri_#{$$}" FileUtils.mkdir_p @tmpdir @g = RDoc::Generator::RI.new @options @top_level = RDoc::TopLevel.new 'file.rb' @klass = @top_level.add_class RDoc::NormalClass, 'Object' @meth = RDoc::AnyMethod.new nil, 'method' @meth.record_location @top_level @meth_bang = RDoc::AnyMethod.new nil, 'method!' @meth_bang.record_location @top_level @attr = RDoc::Attr.new nil, 'attr', 'RW', '' @attr.record_location @top_level @klass.add_method @meth @klass.add_method @meth_bang @klass.add_attribute @attr Dir.chdir @tmpdir end def teardown super Dir.chdir @pwd FileUtils.rm_rf @tmpdir end def assert_file path assert File.file?(path), "#{path} is not a file" end def refute_file path refute File.exist?(path), "#{path} exists" end def test_generate @g.generate nil assert_file File.join(@tmpdir, 'cache.ri') assert_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri') assert_file File.join(@tmpdir, 'Object', 'attr-i.ri') assert_file File.join(@tmpdir, 'Object', 'method-i.ri') assert_file File.join(@tmpdir, 'Object', 'method%21-i.ri') store = RDoc::RI::Store.new @tmpdir store.load_cache encoding = Object.const_defined?(:Encoding) ? Encoding::UTF_8 : nil assert_equal encoding, store.encoding end def test_generate_dry_run @options.dry_run = true @g = RDoc::Generator::RI.new @options top_level = RDoc::TopLevel.new 'file.rb' top_level.add_class @klass.class, @klass.name @g.generate nil refute_file File.join(@tmpdir, 'cache.ri') refute_file File.join(@tmpdir, 'Object') end end
Version data entries
104 entries across 82 versions & 22 rubygems