Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed finding C enclosures from legacy RDoc stores

Legacy ri stores will not have in_files populated in classes.  This
would cause RDoc::Store#find_c_enclosure to raise an exception when
attempting to create a stub module for the C enclosure.  Now legacy
stores are handled by returning nil for the enclosure.

Bug reported by Santiago Pastorino
  • Loading branch information...
commit 0067710c4cb4358c63689b951d5604062e43756f 1 parent 7758064
@drbrain drbrain authored
Showing with 15 additions and 1 deletion.
  1. +3 −1 lib/rdoc/store.rb
  2. +12 −0 test/test_rdoc_store.rb
View
4 lib/rdoc/store.rb
@@ -354,7 +354,9 @@ def find_c_enclosure variable
loaded_mod = load_class_data name
file = loaded_mod.in_files.first
- # HACK may be nil
+
+ return unless file # legacy data source
+
file.store = self
mod = file.add_module RDoc::NormalModule, name
View
12 test/test_rdoc_store.rb
@@ -274,6 +274,18 @@ def test_find_c_enclosure_from_cache
assert_includes @s.c_enclosure_classes, 'cObject'
end
+ def test_find_c_enclosure_from_cache_legacy
+ @klass.in_files.clear
+ @s.save_class @klass
+ @s.classes_hash.clear
+
+ assert_nil @s.find_c_enclosure 'cObject'
+
+ @s.c_enclosure_names['cObject'] = 'Object'
+
+ assert_nil @s.find_c_enclosure('cObject')
+ end
+
def test_find_class_named
assert_equal @c1, @store.find_class_named('C1')
Please sign in to comment.
Something went wrong with that request. Please try again.