summaryrefslogtreecommitdiff
path: root/test/rdoc/test_rdoc_ri_store.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rdoc/test_rdoc_ri_store.rb')
-rw-r--r--test/rdoc/test_rdoc_ri_store.rb49
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