diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-20 03:22:49 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-20 03:22:49 +0000 |
commit | 2ef9c50c6e405717d06362787c4549ca4f1c6485 (patch) | |
tree | ee99486567461dd5796f3d6edcc9e204187f2666 /test/rdoc/test_rdoc_ri_store.rb | |
parent | d7effd506f5b91a636f2e6452ef1946b923007c7 (diff) | |
download | ruby-2ef9c50c6e405717d06362787c4549ca4f1c6485.tar.gz |
Import RDoc 3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_ri_store.rb')
-rw-r--r-- | test/rdoc/test_rdoc_ri_store.rb | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/test/rdoc/test_rdoc_ri_store.rb b/test/rdoc/test_rdoc_ri_store.rb index 4a52ded989..7c9f4ec80b 100644 --- a/test/rdoc/test_rdoc_ri_store.rb +++ b/test/rdoc/test_rdoc_ri_store.rb @@ -65,6 +65,10 @@ class TestRDocRIStore < MiniTest::Unit::TestCase assert File.file?(path), "#{path} is not a file" end + def refute_file path + refute File.exist?(path), "#{path} exists" + end + def test_attributes @s.cache[:attributes]['Object'] = %w[attr] @@ -94,6 +98,14 @@ class TestRDocRIStore < MiniTest::Unit::TestCase @s.class_path('Object::SubClass') end + def test_dry_run + refute @s.dry_run + + @s.dry_run = true + + assert @s.dry_run + end + def test_friendly_path @s.path = @tmpdir @s.type = nil @@ -198,7 +210,7 @@ class TestRDocRIStore < MiniTest::Unit::TestCase :instance_methods => { 'Object' => %w[method] }, :modules => %w[Object Object::SubClass], :ancestors => { - 'Object' => %w[Object], + 'Object' => %w[], 'Object::SubClass' => %w[Incl Object], }, } @@ -210,6 +222,19 @@ class TestRDocRIStore < MiniTest::Unit::TestCase end end + def test_save_cache_dry_run + @s.dry_run = true + + @s.save_class @klass + @s.save_method @klass, @meth + @s.save_method @klass, @cmeth + @s.save_class @nest_klass + + @s.save_cache + + refute_file File.join(@tmpdir, 'cache.ri') + end + def test_save_cache_duplicate_methods @s.save_method @klass, @meth @s.save_method @klass, @meth @@ -226,7 +251,7 @@ class TestRDocRIStore < MiniTest::Unit::TestCase assert_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri') assert_cache({}, {}, { 'Object' => ['attr_accessor attr'] }, %w[Object], - 'Object' => %w[Object]) + 'Object' => %w[]) assert_equal @klass, @s.load_class('Object') end @@ -245,6 +270,15 @@ class TestRDocRIStore < MiniTest::Unit::TestCase assert_equal @klass, @s.load_class('Object') end + def test_save_class_dry_run + @s.dry_run = true + + @s.save_class @klass + + refute_file File.join(@tmpdir, 'Object') + refute_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri') + end + def test_save_class_merge @s.save_class @klass @@ -270,7 +304,7 @@ class TestRDocRIStore < MiniTest::Unit::TestCase assert_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri') assert_cache({}, {}, { 'Object' => ['attr_accessor attr'] }, %w[Object], - 'Object' => %w[Object]) + 'Object' => %w[]) assert_equal @klass, @s.load_class('Object') end @@ -296,6 +330,15 @@ class TestRDocRIStore < MiniTest::Unit::TestCase assert_equal @meth, @s.load_method('Object', '#method') end + def test_save_method_dry_run + @s.dry_run = true + + @s.save_method @klass, @meth + + refute_file File.join(@tmpdir, 'Object') + refute_file File.join(@tmpdir, 'Object', 'method-i.ri') + end + def test_save_method_nested @s.save_method @nest_klass, @nest_meth |