yard 0.2.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of yard might be problematic. Click here for more details.
- data/.yardopts +12 -10
- data/ChangeLog +5686 -0
- data/{README.markdown → README.md} +65 -11
- data/Rakefile +25 -13
- data/benchmarks/concat_vs_join.rb +12 -0
- data/benchmarks/erb_vs_erubis.rb +14 -14
- data/benchmarks/marshal_vs_dbm.rb +1 -1
- data/benchmarks/pathname_vs_string.rb +50 -0
- data/benchmarks/template_erb.rb +22 -0
- data/benchmarks/template_format.rb +6 -0
- data/benchmarks/template_profile.rb +17 -0
- data/bin/yri +16 -7
- data/docs/{CODE_OBJECTS.markdown → CodeObjects.md} +0 -0
- data/docs/{GETTING_STARTED.markdown → GettingStarted.md} +49 -11
- data/docs/{GLOSSARY.markdown → Glossary.md} +0 -0
- data/docs/{HANDLERS.markdown → Handlers.md} +5 -5
- data/docs/{OVERVIEW.markdown → Overview.md} +9 -13
- data/docs/{PARSER.markdown → Parser.md} +1 -1
- data/docs/{TAGS.markdown → Tags.md} +1 -1
- data/docs/Templates.md +286 -0
- data/docs/{WHATSNEW.markdown → WhatsNew.md} +82 -2
- data/lib/rubygems_plugin.rb +17 -20
- data/lib/yard.rb +47 -1
- data/lib/yard/autoload.rb +38 -47
- data/lib/yard/cli/yard_graph.rb +36 -13
- data/lib/yard/cli/yardoc.rb +74 -12
- data/lib/yard/code_objects/base.rb +182 -14
- data/lib/yard/code_objects/class_object.rb +39 -2
- data/lib/yard/code_objects/class_variable_object.rb +4 -0
- data/lib/yard/code_objects/constant_object.rb +8 -0
- data/lib/yard/code_objects/extended_method_object.rb +14 -0
- data/lib/yard/code_objects/method_object.rb +60 -2
- data/lib/yard/code_objects/module_object.rb +6 -0
- data/lib/yard/code_objects/namespace_object.rb +99 -2
- data/lib/yard/code_objects/proxy.rb +53 -6
- data/lib/yard/code_objects/root_object.rb +2 -0
- data/lib/yard/core_ext/array.rb +61 -0
- data/lib/yard/core_ext/file.rb +21 -4
- data/lib/yard/core_ext/module.rb +11 -1
- data/lib/yard/core_ext/string.rb +13 -2
- data/lib/yard/core_ext/symbol_hash.rb +51 -3
- data/lib/yard/docstring.rb +68 -19
- data/lib/yard/globals.rb +5 -2
- data/lib/yard/handlers/base.rb +13 -3
- data/lib/yard/handlers/processor.rb +64 -2
- data/lib/yard/handlers/ruby/class_handler.rb +1 -1
- data/lib/yard/handlers/ruby/class_variable_handler.rb +5 -1
- data/lib/yard/handlers/ruby/constant_handler.rb +38 -4
- data/lib/yard/handlers/ruby/exception_handler.rb +1 -0
- data/lib/yard/handlers/ruby/legacy/base.rb +2 -2
- data/lib/yard/handlers/ruby/legacy/class_variable_handler.rb +6 -3
- data/lib/yard/handlers/ruby/legacy/constant_handler.rb +21 -2
- data/lib/yard/handlers/ruby/legacy/method_handler.rb +10 -0
- data/lib/yard/handlers/ruby/legacy/yield_handler.rb +2 -1
- data/lib/yard/handlers/ruby/method_handler.rb +10 -0
- data/lib/yard/handlers/ruby/yield_handler.rb +2 -1
- data/lib/yard/logging.rb +17 -0
- data/lib/yard/parser/ruby/ast_node.rb +101 -0
- data/lib/yard/parser/ruby/legacy/ruby_lex.rb +2 -2
- data/lib/yard/parser/ruby/legacy/statement_list.rb +10 -9
- data/lib/yard/parser/ruby/ruby_parser.rb +32 -3
- data/lib/yard/parser/source_parser.rb +82 -5
- data/lib/yard/rake/yardoc_task.rb +38 -3
- data/lib/yard/registry.rb +112 -2
- data/lib/yard/serializers/base.rb +48 -1
- data/lib/yard/serializers/file_system_serializer.rb +23 -2
- data/lib/yard/serializers/process_serializer.rb +10 -0
- data/lib/yard/serializers/stdout_serializer.rb +11 -0
- data/lib/yard/tags/library.rb +4 -1
- data/lib/yard/tags/overload_tag.rb +3 -12
- data/lib/yard/templates/engine.rb +162 -0
- data/lib/yard/{generators → templates}/helpers/base_helper.rb +14 -13
- data/lib/yard/{generators → templates}/helpers/filter_helper.rb +1 -1
- data/lib/yard/templates/helpers/html_helper.rb +287 -0
- data/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +29 -0
- data/lib/yard/templates/helpers/html_syntax_highlight_helper18.rb +27 -0
- data/lib/yard/{generators → templates}/helpers/markup_helper.rb +15 -11
- data/lib/yard/{generators → templates}/helpers/method_helper.rb +8 -1
- data/lib/yard/templates/helpers/module_helper.rb +15 -0
- data/lib/yard/templates/helpers/text_helper.rb +60 -0
- data/lib/yard/templates/helpers/uml_helper.rb +33 -0
- data/lib/yard/templates/template.rb +355 -0
- data/lib/yard/verifier.rb +110 -0
- data/spec/cli/yardoc_spec.rb +23 -1
- data/spec/code_objects/base_spec.rb +8 -0
- data/spec/code_objects/class_object_spec.rb +166 -156
- data/spec/code_objects/method_object_spec.rb +2 -2
- data/spec/code_objects/module_object_spec.rb +112 -110
- data/spec/code_objects/proxy_spec.rb +9 -0
- data/spec/core_ext/array_spec.rb +33 -0
- data/spec/core_ext/file_spec.rb +40 -12
- data/spec/core_ext/module_spec.rb +15 -0
- data/spec/core_ext/string_spec.rb +10 -2
- data/spec/docstring_spec.rb +157 -135
- data/spec/handlers/class_handler_spec.rb +3 -0
- data/spec/handlers/class_variable_handler_spec.rb +3 -1
- data/spec/handlers/constant_handler_spec.rb +38 -0
- data/spec/handlers/examples/class_handler_001.rb.txt +14 -1
- data/spec/handlers/examples/class_variable_handler_001.rb.txt +1 -0
- data/spec/handlers/examples/constant_handler_001.rb.txt +10 -1
- data/spec/handlers/examples/exception_handler_001.rb.txt +5 -0
- data/spec/handlers/examples/method_handler_001.rb.txt +15 -0
- data/spec/handlers/examples/mixin_handler_001.rb.txt +13 -0
- data/spec/handlers/exception_handler_spec.rb +4 -0
- data/spec/handlers/method_handler_spec.rb +22 -0
- data/spec/handlers/mixin_handler_spec.rb +5 -3
- data/spec/handlers/yield_handler_spec.rb +1 -1
- data/spec/parser/ruby/ast_node_spec.rb +16 -0
- data/spec/parser/ruby/legacy/statement_list_spec.rb +36 -0
- data/spec/parser/ruby/ruby_parser_spec.rb +80 -0
- data/spec/parser/source_parser_spec.rb +48 -2
- data/spec/rake/yardoc_task_spec.rb +62 -25
- data/spec/serializers/file_system_serializer_spec.rb +1 -1
- data/spec/templates/class_spec.rb +34 -0
- data/spec/templates/engine_spec.rb +121 -0
- data/spec/templates/examples/class001.html +271 -0
- data/spec/templates/examples/class001.txt +31 -0
- data/spec/templates/examples/method001.html +96 -0
- data/spec/templates/examples/method001.txt +28 -0
- data/spec/templates/examples/method002.html +81 -0
- data/spec/templates/examples/method002.txt +20 -0
- data/spec/templates/examples/method003.html +137 -0
- data/spec/templates/examples/method003.txt +45 -0
- data/spec/templates/examples/module001.dot +31 -0
- data/spec/templates/examples/module001.html +294 -0
- data/spec/templates/examples/module001.txt +33 -0
- data/spec/templates/examples/tag001.txt +82 -0
- data/spec/templates/helpers/base_helper_spec.rb +129 -0
- data/spec/{generators → templates}/helpers/html_helper_spec.rb +73 -16
- data/spec/templates/helpers/html_syntax_highlight_helper_spec.rb +39 -0
- data/spec/{generators → templates}/helpers/markup_helper_spec.rb +6 -7
- data/spec/templates/method_spec.rb +75 -0
- data/spec/templates/module_spec.rb +50 -0
- data/spec/templates/spec_helper.rb +33 -0
- data/spec/templates/tag_spec.rb +39 -0
- data/spec/templates/template_spec.rb +398 -0
- data/spec/verifier_spec.rb +51 -0
- data/spec/yard_spec.rb +46 -0
- data/templates/default/class/dot/setup.rb +6 -0
- data/templates/default/class/dot/superklass.erb +3 -0
- data/templates/default/class/html/constructor_details.erb +8 -0
- data/templates/default/class/html/setup.rb +1 -0
- data/templates/default/class/html/subclasses.erb +4 -0
- data/templates/default/class/setup.rb +29 -0
- data/templates/default/class/text/setup.rb +11 -0
- data/templates/default/class/text/subclasses.erb +5 -0
- data/templates/default/docstring/html/abstract.erb +4 -0
- data/templates/default/docstring/html/deprecated.erb +1 -0
- data/templates/default/docstring/html/index.erb +5 -0
- data/templates/default/docstring/html/note.erb +6 -0
- data/templates/default/docstring/html/text.erb +1 -0
- data/templates/default/docstring/html/todo.erb +6 -0
- data/templates/default/docstring/setup.rb +39 -0
- data/templates/default/docstring/text/abstract.erb +2 -0
- data/templates/default/docstring/text/deprecated.erb +2 -0
- data/templates/default/docstring/text/index.erb +2 -0
- data/templates/default/docstring/text/note.erb +4 -0
- data/templates/default/docstring/text/text.erb +1 -0
- data/templates/default/docstring/text/todo.erb +4 -0
- data/templates/default/fulldoc/html/css/common.css +1 -0
- data/templates/default/fulldoc/html/css/full_list.css +23 -0
- data/templates/default/fulldoc/html/css/style.css +261 -0
- data/templates/default/fulldoc/html/full_list.erb +36 -0
- data/templates/default/fulldoc/html/js/app.js +91 -0
- data/templates/default/fulldoc/html/js/full_list.js +39 -0
- data/templates/default/fulldoc/html/js/jquery.js +19 -0
- data/templates/default/fulldoc/html/setup.rb +86 -0
- data/templates/default/{uml → layout}/dot/header.erb +2 -2
- data/templates/default/layout/dot/setup.rb +14 -0
- data/templates/default/layout/html/breadcrumb.erb +11 -0
- data/templates/default/layout/html/footer.erb +5 -0
- data/templates/default/layout/html/headers.erb +13 -0
- data/templates/default/layout/html/index.erb +49 -0
- data/templates/default/layout/html/layout.erb +20 -0
- data/templates/default/layout/html/search.erb +5 -0
- data/templates/default/layout/html/setup.rb +58 -0
- data/templates/default/method/html/header.erb +14 -3
- data/templates/default/method/setup.rb +3 -0
- data/templates/default/method/text/header.erb +1 -1
- data/templates/default/method_details/html/header.erb +3 -0
- data/templates/default/method_details/html/method_signature.erb +17 -0
- data/templates/default/method_details/html/source.erb +10 -0
- data/templates/default/method_details/setup.rb +8 -0
- data/templates/default/method_details/text/header.erb +10 -0
- data/templates/default/method_details/text/method_signature.erb +12 -0
- data/templates/default/method_details/text/setup.rb +10 -0
- data/templates/default/module/dot/child.erb +1 -0
- data/templates/default/module/dot/dependencies.erb +3 -0
- data/templates/default/{uml/dot/subgraph.erb → module/dot/header.erb} +3 -3
- data/templates/default/{uml → module}/dot/info.erb +4 -4
- data/templates/default/module/dot/setup.rb +14 -0
- data/templates/default/module/html/attribute_details.erb +11 -0
- data/templates/default/module/html/attribute_summary.erb +8 -0
- data/templates/default/module/html/box_info.erb +32 -0
- data/templates/default/module/html/children.erb +8 -0
- data/templates/default/module/html/constant_summary.erb +13 -0
- data/templates/default/module/html/defines.erb +3 -0
- data/templates/default/module/html/header.erb +4 -4
- data/templates/default/module/html/inherited_constants.erb +8 -0
- data/templates/default/module/html/inherited_methods.erb +9 -0
- data/templates/default/module/html/item_summary.erb +20 -0
- data/templates/default/module/html/method_details_list.erb +8 -0
- data/templates/default/module/html/method_summary.erb +8 -0
- data/templates/default/module/html/methodmissing.erb +12 -0
- data/templates/default/module/html/pre_docstring.erb +1 -0
- data/templates/default/module/setup.rb +83 -0
- data/templates/default/module/text/children.erb +10 -0
- data/templates/default/module/text/class_meths_list.erb +8 -0
- data/templates/default/module/text/extends.erb +8 -0
- data/templates/default/module/text/header.erb +7 -0
- data/templates/default/module/text/includes.erb +8 -0
- data/templates/default/module/text/instance_meths_list.erb +8 -0
- data/templates/default/module/text/setup.rb +12 -0
- data/templates/default/root/dot/child.erb +3 -0
- data/templates/default/root/dot/setup.rb +5 -0
- data/templates/default/tags/html/example.erb +5 -16
- data/templates/default/tags/html/index.erb +3 -0
- data/templates/default/tags/html/option.erb +17 -20
- data/templates/default/tags/html/overload.erb +13 -0
- data/templates/default/tags/html/see.erb +5 -10
- data/templates/default/tags/html/tag.erb +20 -0
- data/templates/default/tags/setup.rb +50 -0
- data/templates/default/tags/text/example.erb +8 -10
- data/templates/default/tags/text/index.erb +1 -0
- data/templates/default/tags/text/option.erb +18 -3
- data/templates/default/tags/text/overload.erb +19 -0
- data/templates/default/tags/text/see.erb +8 -2
- data/templates/default/tags/text/tag.erb +13 -0
- metadata +142 -158
- data/bin/view_generator +0 -17
- data/docs/FAQ.markdown +0 -34
- data/docs/GENERATORS.markdown +0 -211
- data/lib/yard/generators/attributes_generator.rb +0 -22
- data/lib/yard/generators/base.rb +0 -305
- data/lib/yard/generators/class_generator.rb +0 -27
- data/lib/yard/generators/constants_generator.rb +0 -74
- data/lib/yard/generators/constructor_generator.rb +0 -25
- data/lib/yard/generators/deprecated_generator.rb +0 -15
- data/lib/yard/generators/docstring_generator.rb +0 -15
- data/lib/yard/generators/full_doc_generator.rb +0 -127
- data/lib/yard/generators/helpers/html_helper.rb +0 -196
- data/lib/yard/generators/helpers/html_syntax_highlight_helper.rb +0 -49
- data/lib/yard/generators/helpers/uml_helper.rb +0 -16
- data/lib/yard/generators/inheritance_generator.rb +0 -16
- data/lib/yard/generators/method_details_generator.rb +0 -18
- data/lib/yard/generators/method_generator.rb +0 -43
- data/lib/yard/generators/method_listing_generator.rb +0 -105
- data/lib/yard/generators/method_missing_generator.rb +0 -25
- data/lib/yard/generators/method_signature_generator.rb +0 -19
- data/lib/yard/generators/method_summary_generator.rb +0 -21
- data/lib/yard/generators/mixins_generator.rb +0 -21
- data/lib/yard/generators/module_generator.rb +0 -23
- data/lib/yard/generators/overloads_generator.rb +0 -20
- data/lib/yard/generators/quick_doc_generator.rb +0 -25
- data/lib/yard/generators/root_generator.rb +0 -32
- data/lib/yard/generators/source_generator.rb +0 -11
- data/lib/yard/generators/tags_generator.rb +0 -99
- data/lib/yard/generators/uml_generator.rb +0 -102
- data/lib/yard/generators/visibility_group_generator.rb +0 -26
- data/spec/generators/base_spec.rb +0 -64
- data/spec/generators/full_doc_generator_spec.rb +0 -29
- data/spec/generators/helpers/base_helper_spec.rb +0 -15
- data/spec/generators/quick_doc_generator_spec.rb +0 -13
- data/templates/default/attributes/html/header.erb +0 -47
- data/templates/default/attributes/text/header.erb +0 -10
- data/templates/default/class/html/header.erb +0 -4
- data/templates/default/constants/html/constants.erb +0 -9
- data/templates/default/constants/html/header.erb +0 -3
- data/templates/default/constants/html/included.erb +0 -9
- data/templates/default/constants/html/inherited.erb +0 -9
- data/templates/default/constructor/html/header.erb +0 -10
- data/templates/default/deprecated/html/main.erb +0 -6
- data/templates/default/deprecated/text/main.erb +0 -3
- data/templates/default/docstring/html/main.erb +0 -3
- data/templates/default/docstring/text/main.erb +0 -3
- data/templates/default/fulldoc/html/all_files.erb +0 -19
- data/templates/default/fulldoc/html/all_methods.erb +0 -26
- data/templates/default/fulldoc/html/all_namespaces.erb +0 -22
- data/templates/default/fulldoc/html/app.js +0 -18
- data/templates/default/fulldoc/html/custom.css +0 -1
- data/templates/default/fulldoc/html/file.erb +0 -16
- data/templates/default/fulldoc/html/footer.erb +0 -5
- data/templates/default/fulldoc/html/header.erb +0 -16
- data/templates/default/fulldoc/html/html_head.erb +0 -4
- data/templates/default/fulldoc/html/index.erb +0 -19
- data/templates/default/fulldoc/html/jquery.js +0 -11
- data/templates/default/fulldoc/html/style.css +0 -81
- data/templates/default/fulldoc/html/syntax_highlight.css +0 -24
- data/templates/default/inheritance/html/header.erb +0 -8
- data/templates/default/inheritance/text/header.erb +0 -3
- data/templates/default/method/html/aliases.erb +0 -6
- data/templates/default/method/html/title.erb +0 -3
- data/templates/default/method/text/title.erb +0 -1
- data/templates/default/methoddetails/html/header.erb +0 -8
- data/templates/default/methoddetails/html/method_header.erb +0 -3
- data/templates/default/methodmissing/html/header.erb +0 -12
- data/templates/default/methodsignature/html/main.erb +0 -10
- data/templates/default/methodsignature/text/main.erb +0 -8
- data/templates/default/methodsummary/html/header.erb +0 -5
- data/templates/default/methodsummary/html/included.erb +0 -9
- data/templates/default/methodsummary/html/inherited.erb +0 -9
- data/templates/default/methodsummary/html/summary.erb +0 -29
- data/templates/default/methodsummary/text/header.erb +0 -5
- data/templates/default/methodsummary/text/included.erb +0 -0
- data/templates/default/methodsummary/text/inherited.erb +0 -0
- data/templates/default/methodsummary/text/summary.erb +0 -6
- data/templates/default/mixins/html/header.erb +0 -4
- data/templates/default/overloads/html/header.erb +0 -8
- data/templates/default/overloads/text/header.erb +0 -8
- data/templates/default/quickdoc/html/header.erb +0 -15
- data/templates/default/quickdoc/text/header.erb +0 -12
- data/templates/default/root/html/header.erb +0 -4
- data/templates/default/source/html/main.erb +0 -15
- data/templates/default/source/text/main.erb +0 -4
- data/templates/default/tags/html/header.erb +0 -4
- data/templates/default/tags/html/param.erb +0 -21
- data/templates/default/tags/html/tags.erb +0 -23
- data/templates/default/tags/html/todo.erb +0 -8
- data/templates/default/tags/text/header.erb +0 -3
- data/templates/default/tags/text/param.erb +0 -9
- data/templates/default/tags/text/tags.erb +0 -7
- data/templates/default/uml/dot/child.erb +0 -1
- data/templates/default/uml/dot/dependencies.erb +0 -10
- data/templates/default/uml/dot/superclasses.erb +0 -9
- data/templates/default/uml/dot/unknown.erb +0 -3
- data/templates/default/uml/dot/unknown_child.erb +0 -1
- data/templates/default/visibilitygroup/html/header.erb +0 -6
- data/templates/javadoc/attributes/html/header.erb +0 -16
- data/templates/javadoc/class/html/header.erb +0 -4
- data/templates/javadoc/constants/html/constants.erb +0 -9
- data/templates/javadoc/constants/html/header.erb +0 -3
- data/templates/javadoc/constants/html/included.erb +0 -12
- data/templates/javadoc/constants/html/inherited.erb +0 -12
- data/templates/javadoc/constructor/html/header.erb +0 -10
- data/templates/javadoc/deprecated/html/main.erb +0 -0
- data/templates/javadoc/docstring/html/main.erb +0 -6
- data/templates/javadoc/fulldoc/html/all_methods.erb +0 -25
- data/templates/javadoc/fulldoc/html/all_namespaces.erb +0 -19
- data/templates/javadoc/fulldoc/html/app.js +0 -18
- data/templates/javadoc/fulldoc/html/header.erb +0 -15
- data/templates/javadoc/fulldoc/html/html_head.erb +0 -3
- data/templates/javadoc/fulldoc/html/index.erb +0 -18
- data/templates/javadoc/fulldoc/html/jquery.js +0 -11
- data/templates/javadoc/fulldoc/html/readme.erb +0 -15
- data/templates/javadoc/fulldoc/html/style.css +0 -22
- data/templates/javadoc/fulldoc/html/syntax_highlight.css +0 -21
- data/templates/javadoc/inheritance/html/header.erb +0 -6
- data/templates/javadoc/method/html/aliases.erb +0 -6
- data/templates/javadoc/method/html/header.erb +0 -4
- data/templates/javadoc/method/html/title.erb +0 -4
- data/templates/javadoc/methoddetails/html/header.erb +0 -8
- data/templates/javadoc/methoddetails/html/method_header.erb +0 -0
- data/templates/javadoc/methodmissing/html/header.erb +0 -12
- data/templates/javadoc/methodsignature/html/main.erb +0 -8
- data/templates/javadoc/methodsummary/html/header.erb +0 -5
- data/templates/javadoc/methodsummary/html/included.erb +0 -12
- data/templates/javadoc/methodsummary/html/inherited.erb +0 -12
- data/templates/javadoc/methodsummary/html/summary.erb +0 -25
- data/templates/javadoc/mixins/html/header.erb +0 -5
- data/templates/javadoc/module/html/header.erb +0 -4
- data/templates/javadoc/source/html/main.erb +0 -15
- data/templates/javadoc/tags/html/header.erb +0 -5
- data/templates/javadoc/tags/html/see.erb +0 -8
- data/templates/javadoc/tags/html/tags.erb +0 -19
- data/templates/javadoc/visibilitygroup/html/header.erb +0 -5
@@ -46,13 +46,13 @@ describe YARD::CodeObjects::MethodObject do
|
|
46
46
|
describe '#name' do
|
47
47
|
it "should show a prefix for an instance method when prefix=true" do
|
48
48
|
obj = MethodObject.new(nil, :something)
|
49
|
-
obj.name(true).should ==
|
49
|
+
obj.name(true).should == "#something"
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should never show a prefix for a class method" do
|
53
53
|
obj = MethodObject.new(nil, :something, :class)
|
54
54
|
obj.name.should == :"something"
|
55
|
-
obj.name(true).should ==
|
55
|
+
obj.name(true).should == "something"
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -1,131 +1,133 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper'
|
2
2
|
|
3
|
-
describe YARD::CodeObjects::ModuleObject
|
4
|
-
|
5
|
-
|
3
|
+
describe YARD::CodeObjects::ModuleObject do
|
4
|
+
describe "#meths" do
|
5
|
+
before do
|
6
|
+
Registry.clear
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
8
|
+
# setup the object space:
|
9
|
+
#
|
10
|
+
# YARD:module
|
11
|
+
# YARD#foo:method
|
12
|
+
# YARD#foo2:method
|
13
|
+
# YARD#xyz:method
|
14
|
+
# YARD.bar:method
|
15
|
+
# SomeMod#mixmethod
|
16
|
+
# SomeMod#xyz:method
|
17
|
+
#
|
18
|
+
@yard = ModuleObject.new(:root, :YARD)
|
19
|
+
MethodObject.new(@yard, :foo)
|
20
|
+
MethodObject.new(@yard, :xyz)
|
21
|
+
MethodObject.new(@yard, :foo2) do |o|
|
22
|
+
o.visibility = :protected
|
23
|
+
end
|
24
|
+
MethodObject.new(@yard, :bar, :class) do |o|
|
25
|
+
o.visibility = :private
|
26
|
+
end
|
27
|
+
@other = ModuleObject.new(:root, :SomeMod)
|
28
|
+
MethodObject.new(@other, :mixmethod)
|
29
|
+
MethodObject.new(@other, :xyz)
|
30
|
+
MethodObject.new(@other, :baz, :class)
|
31
|
+
@another = ModuleObject.new(:root, :AnotherMod)
|
32
|
+
MethodObject.new(@another, :fizz)
|
33
|
+
MethodObject.new(@another, :bar)
|
34
|
+
MethodObject.new(@another, :fazz, :class)
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
@yard.instance_mixins << @other
|
37
|
+
@yard.class_mixins << @another
|
38
|
+
end
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
40
|
+
it "should list all methods (including mixin methods) via #meths" do
|
41
|
+
meths = @yard.meths
|
42
|
+
meths.should include(P("YARD#foo"))
|
43
|
+
meths.should include(P("YARD#foo2"))
|
44
|
+
meths.should include(P("YARD.bar"))
|
45
|
+
meths.should include(P("SomeMod#mixmethod"))
|
46
|
+
meths.should include(P("AnotherMod#fizz"))
|
47
|
+
end
|
47
48
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
49
|
+
it "should allow :visibility to be set" do
|
50
|
+
meths = @yard.meths(:visibility => :public)
|
51
|
+
meths.should_not include(P("YARD.bar"))
|
52
|
+
meths = @yard.meths(:visibility => [:public, :private])
|
53
|
+
meths.should include(P("YARD#foo"))
|
54
|
+
meths.should include(P("YARD.bar"))
|
55
|
+
meths.should_not include(P("YARD#foo2"))
|
56
|
+
end
|
56
57
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
58
|
+
it "should only display class methods for :scope => :class" do
|
59
|
+
meths = @yard.meths(:scope => :class)
|
60
|
+
meths.should_not include(P("YARD#foo"))
|
61
|
+
meths.should_not include(P("YARD#foo2"))
|
62
|
+
meths.should_not include(P("SomeMod#mixmethod"))
|
63
|
+
meths.should_not include(P("SomeMod.baz"))
|
64
|
+
meths.should_not include(P("AnotherMod#fazz"))
|
65
|
+
meths.should include(P("YARD.bar"))
|
66
|
+
meths.should include(P("AnotherMod#fizz"))
|
67
|
+
end
|
67
68
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
69
|
+
it "should only display instance methods for :scope => :class" do
|
70
|
+
meths = @yard.meths(:scope => :instance)
|
71
|
+
meths.should include(P("YARD#foo"))
|
72
|
+
meths.should include(P("YARD#foo2"))
|
73
|
+
meths.should include(P("SomeMod#mixmethod"))
|
74
|
+
meths.should_not include(P("YARD.bar"))
|
75
|
+
meths.should_not include(P("AnotherMod#fizz"))
|
76
|
+
end
|
76
77
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
78
|
+
it "should allow :included to be set" do
|
79
|
+
meths = @yard.meths(:included => false)
|
80
|
+
meths.should_not include(P("SomeMod#mixmethod"))
|
81
|
+
meths.should_not include(P("AnotherMod#fizz"))
|
82
|
+
meths.should include(P("YARD#foo"))
|
83
|
+
meths.should include(P("YARD#foo2"))
|
84
|
+
meths.should include(P("YARD.bar"))
|
85
|
+
end
|
85
86
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
87
|
+
it "should choose the method defined in the class over an included module" do
|
88
|
+
meths = @yard.meths
|
89
|
+
meths.should_not include(P("SomeMod#xyz"))
|
90
|
+
meths.should include(P("YARD#xyz"))
|
91
|
+
meths.should_not include(P("AnotherMod#bar"))
|
92
|
+
meths.should include(P("YARD.bar"))
|
92
93
|
|
93
|
-
|
94
|
-
|
94
|
+
meths = @other.meths
|
95
|
+
meths.should include(P("SomeMod#xyz"))
|
95
96
|
|
96
|
-
|
97
|
-
|
97
|
+
meths = @another.meths
|
98
|
+
meths.should include(P("AnotherMod#bar"))
|
99
|
+
end
|
98
100
|
end
|
99
|
-
end
|
100
101
|
|
101
|
-
describe
|
102
|
-
|
103
|
-
|
102
|
+
describe "#inheritance_tree" do
|
103
|
+
before do
|
104
|
+
Registry.clear
|
104
105
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
106
|
+
@mod1 = ModuleObject.new(:root, :Mod1)
|
107
|
+
@mod2 = ModuleObject.new(:root, :Mod2)
|
108
|
+
@mod3 = ModuleObject.new(:root, :Mod3)
|
109
|
+
@mod4 = ModuleObject.new(:root, :Mod4)
|
110
|
+
@mod5 = ModuleObject.new(:root, :Mod5)
|
110
111
|
|
111
|
-
|
112
|
-
|
113
|
-
|
112
|
+
@mod1.instance_mixins << @mod2
|
113
|
+
@mod2.instance_mixins << @mod3
|
114
|
+
@mod1.instance_mixins << @mod4
|
114
115
|
|
115
|
-
|
116
|
-
|
117
|
-
|
116
|
+
@proxy = P(:SomeProxyClass)
|
117
|
+
@mod5.instance_mixins << @proxy
|
118
|
+
end
|
118
119
|
|
119
|
-
|
120
|
-
|
121
|
-
|
120
|
+
it "should show only itself for an inheritance tree without included modules" do
|
121
|
+
@mod1.inheritance_tree.should == [@mod1]
|
122
|
+
end
|
122
123
|
|
123
|
-
|
124
|
-
|
125
|
-
|
124
|
+
it "should show proper inheritance three when modules are included" do
|
125
|
+
@mod1.inheritance_tree(true).should == [@mod1, @mod2, @mod3, @mod4]
|
126
|
+
end
|
126
127
|
|
127
|
-
|
128
|
-
|
129
|
-
|
128
|
+
it "should not list inheritance tree of proxy objects in inheritance tree" do
|
129
|
+
@proxy.should_not_receive(:inheritance_tree)
|
130
|
+
@mod5.instance_mixins.should == [@proxy]
|
131
|
+
end
|
130
132
|
end
|
131
|
-
end
|
133
|
+
end
|
@@ -88,4 +88,13 @@ describe YARD::CodeObjects::Proxy do
|
|
88
88
|
P("MYPROXY").should_not == Registry.root
|
89
89
|
P("X::A").should_not == Registry.root
|
90
90
|
end
|
91
|
+
|
92
|
+
it "should reset namespace and name when object is resolved" do
|
93
|
+
obj1 = ModuleObject.new(:root, :YARD)
|
94
|
+
obj2 = ModuleObject.new(:root, :NOTYARD)
|
95
|
+
resolved = Proxy.new(obj2, :YARD)
|
96
|
+
resolved.should == obj1
|
97
|
+
resolved.namespace.should == Registry.root
|
98
|
+
resolved.name.should == :YARD
|
99
|
+
end
|
91
100
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe Array do
|
4
|
+
describe '#place' do
|
5
|
+
it "should create an Insertion object" do
|
6
|
+
[].place('x').should be_kind_of(Insertion)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe Insertion do
|
12
|
+
describe '#before' do
|
13
|
+
it "should place an object before another" do
|
14
|
+
[1, 2].place(3).before(2).should == [1, 3, 2]
|
15
|
+
[1, 2].place(3).before(1).should == [3, 1, 2]
|
16
|
+
[1, [4], 2].place(3).before(2).should == [1, [4], 3, 2]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#after' do
|
21
|
+
it "should place an object after another" do
|
22
|
+
[1, 2].place(3).after(2).should == [1, 2, 3]
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should place an object after another and its subsections" do
|
26
|
+
[1, [2]].place(3).after(1).should == [1, [2], 3]
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should not not ignore subsections if ignore_subections=false" do
|
30
|
+
[1, [2]].place(3).after(1, false).should == [1, 3, [2]]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/spec/core_ext/file_spec.rb
CHANGED
@@ -1,20 +1,48 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
2
|
|
3
|
-
describe File
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
describe File do
|
4
|
+
describe ".relative_path" do
|
5
|
+
it "should return the relative path between two files" do
|
6
|
+
File.relative_path('a/b/c/d.html', 'a/b/d/q.html').should == '../d/q.html'
|
7
|
+
end
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
it "should return the relative path between two directories" do
|
10
|
+
File.relative_path('a/b/c/d/', 'a/b/d/').should == '../d'
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should return only the to file if from file is in the same directory as the to file" do
|
14
|
+
File.relative_path('a/b/c/d', 'a/b/c/e').should == 'e'
|
15
|
+
end
|
11
16
|
|
12
|
-
|
13
|
-
|
17
|
+
it "should handle non-normalized paths" do
|
18
|
+
File.relative_path('Hello/./I/Am/Fred', 'Hello/Fred').should == '../../Fred'
|
19
|
+
File.relative_path('A//B/C', 'Q/X').should == '../../Q/X'
|
20
|
+
end
|
14
21
|
end
|
15
22
|
|
16
|
-
|
17
|
-
|
18
|
-
|
23
|
+
describe '.cleanpath' do
|
24
|
+
it "should clean double brackets" do
|
25
|
+
File.cleanpath('A//B/C').should == "A/B/C"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should clean a path with ." do
|
29
|
+
File.cleanpath('Hello/./I/.Am/Fred').should == "Hello/I/.Am/Fred"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should clean a path with .." do
|
33
|
+
File.cleanpath('Hello/../World').should == "World"
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should clean a path with multiple .." do
|
37
|
+
File.cleanpath('A/B/C/../../D').should == "A/D"
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should clean a path ending in .." do
|
41
|
+
File.cleanpath('A/B/C/D/..').should == "A/B/C"
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should not pass the initial directory" do
|
45
|
+
File.cleanpath('C/../../D').should == "../D"
|
46
|
+
end
|
19
47
|
end
|
20
48
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe Module do
|
4
|
+
describe '#class_name' do
|
5
|
+
it "should return just the name of the class/module" do
|
6
|
+
YARD::CodeObjects::Base.class_name.should == "Base"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#namespace' do
|
11
|
+
it "should return everything before the class name" do
|
12
|
+
YARD::CodeObjects::Base.namespace.should == "YARD::CodeObjects"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -3,14 +3,22 @@ require File.dirname(__FILE__) + '/../spec_helper'
|
|
3
3
|
#described_in_docs String, '#camelcase'
|
4
4
|
#described_in_docs String, '#underscore'
|
5
5
|
|
6
|
-
describe String, '#
|
6
|
+
describe String, '#underscore' do
|
7
7
|
it 'should turn HelloWorld into hello_world' do
|
8
8
|
"HelloWorld".underscore.should == "hello_world"
|
9
9
|
end
|
10
|
+
|
11
|
+
it "should turn Hello::World into hello/world" do
|
12
|
+
"Hello::World".underscore.should == "hello/world"
|
13
|
+
end
|
10
14
|
end
|
11
15
|
|
12
|
-
describe String, '#
|
16
|
+
describe String, '#camelcase' do
|
13
17
|
it 'should turn hello_world into HelloWorld' do
|
14
18
|
"hello_world".camelcase.should == "HelloWorld"
|
15
19
|
end
|
20
|
+
|
21
|
+
it "should turn hello/world into Hello::World" do
|
22
|
+
"Hello::World".underscore.should == "hello/world"
|
23
|
+
end
|
16
24
|
end
|
data/spec/docstring_spec.rb
CHANGED
@@ -3,166 +3,188 @@ require File.dirname(__FILE__) + '/spec_helper'
|
|
3
3
|
describe YARD::Docstring do
|
4
4
|
before { YARD::Registry.clear }
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
describe '#initialize' do
|
7
|
+
it "should parse comments into tags" do
|
8
|
+
doc = Docstring.new(<<-eof)
|
9
|
+
@param name Hello world
|
10
|
+
how are you?
|
11
|
+
@param name2
|
12
|
+
this is a new line
|
13
|
+
@param name3 and this
|
14
|
+
is a new paragraph:
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
16
|
+
right here.
|
17
|
+
eof
|
18
|
+
doc.tags("param").each do |tag|
|
19
|
+
if tag.name == "name"
|
20
|
+
tag.text.should == "Hello world how are you?"
|
21
|
+
elsif tag.name == "name2"
|
22
|
+
tag.text.should == "this is a new line"
|
23
|
+
elsif tag.name == "name3"
|
24
|
+
tag.text.should == "and this is a new paragraph:\n\nright here."
|
25
|
+
end
|
24
26
|
end
|
25
27
|
end
|
26
|
-
end
|
27
28
|
|
28
|
-
|
29
|
-
|
29
|
+
it "should handle docstrings with empty newlines" do
|
30
|
+
Docstring.new("\n\n").should == ""
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should only parse tags with charset [A-Za-z_]" do
|
34
|
+
doc = Docstring.new
|
35
|
+
valid = %w( @testing @valid @is_a @is_A @__ )
|
36
|
+
invalid = %w( @ @return@ @param, @x.y @x-y )
|
37
|
+
|
38
|
+
log.enter_level(Logger::FATAL) do
|
39
|
+
{valid => 1, invalid => 0}.each do |tags, size|
|
40
|
+
tags.each do |tag|
|
41
|
+
class << doc
|
42
|
+
def create_tag(tag_name, *args)
|
43
|
+
add_tag Tags::Tag.new(tag_name, *args)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
doc.all = tag
|
47
|
+
doc.tags(tag[1..-1]).size.should == size
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
30
52
|
end
|
31
53
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
54
|
+
describe '#summary' do
|
55
|
+
it "should handle empty docstrings" do
|
56
|
+
o1 = Docstring.new
|
57
|
+
o1.summary.should == ""
|
58
|
+
end
|
36
59
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
60
|
+
it "should handle multiple calls" do
|
61
|
+
o1 = Docstring.new("Hello. world")
|
62
|
+
5.times { o1.summary.should == "Hello." }
|
63
|
+
end
|
41
64
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
65
|
+
it "should return the first sentence" do
|
66
|
+
o = Docstring.new("DOCSTRING. Another sentence")
|
67
|
+
o.summary.should == "DOCSTRING."
|
68
|
+
end
|
46
69
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
70
|
+
it "should return the first paragraph" do
|
71
|
+
o = Docstring.new("DOCSTRING, and other stuff\n\nAnother sentence.")
|
72
|
+
o.summary.should == "DOCSTRING, and other stuff."
|
73
|
+
end
|
51
74
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
75
|
+
it "should return proper summary when docstring is changed" do
|
76
|
+
o = Docstring.new "DOCSTRING, and other stuff\n\nAnother sentence."
|
77
|
+
o.summary.should == "DOCSTRING, and other stuff."
|
78
|
+
o = Docstring.new "DOCSTRING."
|
79
|
+
o.summary.should == "DOCSTRING."
|
80
|
+
end
|
58
81
|
|
59
|
-
|
60
|
-
|
61
|
-
|
82
|
+
it "should not double the ending period" do
|
83
|
+
o = Docstring.new("Returns a list of tags specified by +name+ or all tags if +name+ is not specified.\n\nTest")
|
84
|
+
o.summary.should == "Returns a list of tags specified by +name+ or all tags if +name+ is not specified."
|
62
85
|
|
63
|
-
|
86
|
+
doc = Docstring.new(<<-eof)
|
64
87
|
|
65
|
-
|
88
|
+
Returns a list of tags specified by +name+ or all tags if +name+ is not specified.
|
66
89
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
90
|
+
@param name the tag name to return data for, or nil for all tags
|
91
|
+
@return [Array<Tags::Tag>] the list of tags by the specified tag name
|
92
|
+
eof
|
93
|
+
doc.summary.should == "Returns a list of tags specified by +name+ or all tags if +name+ is not specified."
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should handle references embedded in summary" do
|
97
|
+
Docstring.new("Aliasing {Test.test}. Done.").summary.should == "Aliasing {Test.test}."
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should only end first sentence when outside parentheses" do
|
101
|
+
Docstring.new("Hello (the best.) world. Foo bar.").summary.should == "Hello (the best.) world."
|
102
|
+
Docstring.new("A[b.]c.").summary.should == "A[b.]c."
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should only see '.' as period if whitespace (or eof) follows" do
|
106
|
+
Docstring.new("hello 1.5 times.").summary.should == "hello 1.5 times."
|
107
|
+
Docstring.new("hello... me").summary.should == "hello..."
|
108
|
+
Docstring.new("hello.").summary.should == "hello."
|
109
|
+
end
|
71
110
|
end
|
72
111
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
tags.each do |tag|
|
81
|
-
class << doc
|
82
|
-
def create_tag(tag_name, *args)
|
83
|
-
add_tag Tags::Tag.new(tag_name, *args)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
doc.all = tag
|
87
|
-
doc.tags(tag[1..-1]).size.should == size
|
88
|
-
end
|
89
|
-
end
|
112
|
+
describe '#ref_tags' do
|
113
|
+
it "should parse reference tag into ref_tags" do
|
114
|
+
doc = Docstring.new("@return (see Foo#bar)")
|
115
|
+
doc.ref_tags.size.should == 1
|
116
|
+
doc.ref_tags.first.owner.should == P("Foo#bar")
|
117
|
+
doc.ref_tags.first.tag_name.should == "return"
|
118
|
+
doc.ref_tags.first.name.should be_nil
|
90
119
|
end
|
91
|
-
end
|
92
|
-
|
93
|
-
it "should parse reference tag into ref_tags" do
|
94
|
-
doc = Docstring.new("@return (see Foo#bar)")
|
95
|
-
doc.ref_tags.size.should == 1
|
96
|
-
doc.ref_tags.first.owner.should == P("Foo#bar")
|
97
|
-
doc.ref_tags.first.tag_name.should == "return"
|
98
|
-
doc.ref_tags.first.name.should be_nil
|
99
|
-
end
|
100
120
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
121
|
+
it "should parse named reference tag into ref_tags" do
|
122
|
+
doc = Docstring.new("@param blah \n (see Foo#bar )")
|
123
|
+
doc.ref_tags.size.should == 1
|
124
|
+
doc.ref_tags.first.owner.should == P("Foo#bar")
|
125
|
+
doc.ref_tags.first.tag_name.should == "param"
|
126
|
+
doc.ref_tags.first.name.should == "blah"
|
127
|
+
end
|
108
128
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
129
|
+
it "should fail to parse named reference tag into ref_tags" do
|
130
|
+
doc = Docstring.new("@param blah THIS_BREAKS_REFTAG (see Foo#bar)")
|
131
|
+
doc.ref_tags.size.should == 0
|
132
|
+
end
|
113
133
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
134
|
+
it "should return all valid reference tags along with #tags" do
|
135
|
+
o = CodeObjects::MethodObject.new(:root, 'Foo#bar')
|
136
|
+
o.docstring.add_tag Tags::Tag.new('return', 'testing')
|
137
|
+
doc = Docstring.new("@return (see Foo#bar)")
|
138
|
+
tags = doc.tags
|
139
|
+
tags.size.should == 1
|
140
|
+
tags.first.text.should == 'testing'
|
141
|
+
tags.first.should be_kind_of(Tags::RefTag)
|
142
|
+
tags.first.owner.should == o
|
143
|
+
end
|
124
144
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
it "should ignore invalid reference tags" do
|
138
|
-
doc = Docstring.new("@param *args (see INVALID::TAG#tag)")
|
139
|
-
tags = doc.tags('param')
|
140
|
-
tags.size.should == 0
|
141
|
-
end
|
145
|
+
it "should return all valid named reference tags along with #tags(name)" do
|
146
|
+
o = CodeObjects::MethodObject.new(:root, 'Foo#bar')
|
147
|
+
o.docstring.add_tag Tags::Tag.new('param', 'testing', nil, '*args')
|
148
|
+
o.docstring.add_tag Tags::Tag.new('param', 'NOTtesting', nil, 'notargs')
|
149
|
+
doc = Docstring.new("@param *args (see Foo#bar)")
|
150
|
+
tags = doc.tags('param')
|
151
|
+
tags.size.should == 1
|
152
|
+
tags.first.text.should == 'testing'
|
153
|
+
tags.first.should be_kind_of(Tags::RefTag)
|
154
|
+
tags.first.owner.should == o
|
155
|
+
end
|
142
156
|
|
143
|
-
|
144
|
-
|
145
|
-
|
157
|
+
it "should ignore invalid reference tags" do
|
158
|
+
doc = Docstring.new("@param *args (see INVALID::TAG#tag)")
|
159
|
+
tags = doc.tags('param')
|
160
|
+
tags.size.should == 0
|
161
|
+
end
|
146
162
|
end
|
163
|
+
|
164
|
+
describe '#empty?/#blank?' do
|
165
|
+
it "should be blank and empty if it has no content and no tags" do
|
166
|
+
Docstring.new.should be_blank
|
167
|
+
Docstring.new.should be_empty
|
168
|
+
end
|
147
169
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
170
|
+
it "shouldn't be empty or blank if it has content" do
|
171
|
+
d = Docstring.new("foo bar")
|
172
|
+
d.should_not be_empty
|
173
|
+
d.should_not be_blank
|
174
|
+
end
|
153
175
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
176
|
+
it "should be empty but not blank if it has tags" do
|
177
|
+
d = Docstring.new("@param foo")
|
178
|
+
d.should be_empty
|
179
|
+
d.should_not be_blank
|
180
|
+
end
|
159
181
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
182
|
+
it "should be empty but not blank if it has ref tags" do
|
183
|
+
o = CodeObjects::MethodObject.new(:root, 'Foo#bar')
|
184
|
+
o.docstring.add_tag Tags::Tag.new('return', 'testing')
|
185
|
+
d = Docstring.new("@return (see Foo#bar)")
|
186
|
+
d.should be_empty
|
187
|
+
d.should_not be_blank
|
188
|
+
end
|
166
189
|
end
|
167
|
-
|
168
190
|
end
|