Permalink
Browse files

Added includes to the report

  • Loading branch information...
1 parent e55416f commit b190f1328e6b79a28662ee67816b5a2709be50a4 @drbrain drbrain committed Apr 6, 2012
Showing with 32 additions and 14 deletions.
  1. +14 −14 lib/rdoc/generator/spellcheck.rb
  2. +18 −0 test/test_rdoc_generator_spellcheck.rb
View
28 lib/rdoc/generator/spellcheck.rb
@@ -89,31 +89,31 @@ def generate files
report.concat misspellings_for(mod.definition, comment, location)
end
- mod.each_constant do |constant|
- comment = constant.comment
- location = constant.file
+ mod.each_include do |incl|
+ name = "#{incl.parent.full_name}.include #{incl.name}"
+ report.concat misspellings_for(name, incl.comment, incl.file)
+ end
+
+ mod.each_constant do |const|
# TODO add missing RDoc::Constant#full_name
- name = constant.parent ? constant.parent.full_name : '(unknown)'
- name = "#{name}::#{constant.name}"
+ name = const.parent ? const.parent.full_name : '(unknown)'
+ name = "#{name}::#{const.name}"
- report.concat misspellings_for(name, comment, location)
+ report.concat misspellings_for(name, const.comment, const.file)
end
mod.each_attribute do |attr|
- comment = attr.comment
- location = attr.file
-
name = "#{attr.parent.full_name}.#{attr.definition} :#{attr.name}"
- report.concat misspellings_for(name, comment, location)
+ report.concat misspellings_for(name, attr.comment, attr.file)
end
- mod.each_method do |method|
- comment = method.comment
- location = method.file
+ mod.each_method do |meth|
+ comment = meth.comment
+ location = meth.file
- report.concat misspellings_for(method.full_name, comment, location)
+ report.concat misspellings_for(meth.full_name, comment, location)
end
end
View
18 test/test_rdoc_generator_spellcheck.rb
@@ -120,6 +120,24 @@ def test_generate_correct
assert_equal "No misspellings found\n", out
end
+ def test_generate_include
+ klass = @top_level.add_class RDoc::NormalClass, 'Object'
+
+ incl = RDoc::Include.new 'INCLUDE', comment(@text)
+ incl.record_location @top_level
+
+ klass.add_include incl
+
+ out, err = capture_io do
+ @sc.generate [@top_level]
+ end
+
+ assert_empty err
+
+ assert_match %r%^Object\.include INCLUDE in file\.rb:%, out
+ assert_match %r%^"gud"%, out
+ end
+
def test_generate_method
klass = @top_level.add_class RDoc::NormalClass, 'Object'

0 comments on commit b190f13

Please sign in to comment.