yard 0.7.5 → 0.8.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 +10 -2
- data/ChangeLog +1263 -38
- data/LEGAL +5 -5
- data/LICENSE +1 -1
- data/README.md +91 -82
- data/Rakefile +6 -6
- data/benchmarks/builtins_vs_eval.rb +1 -1
- data/benchmarks/erb_vs_erubis.rb +4 -4
- data/benchmarks/generation.rb +5 -5
- data/benchmarks/parsing.rb +2 -2
- data/benchmarks/registry_store_types.rb +48 -0
- data/bin/yard +9 -1
- data/bin/yardoc +9 -1
- data/bin/yri +10 -2
- data/docs/CodeObjects.md +10 -10
- data/docs/GettingStarted.md +85 -83
- data/docs/Handlers.md +21 -21
- data/docs/Overview.md +7 -7
- data/docs/Parser.md +30 -30
- data/docs/Tags.md +250 -554
- data/docs/TagsArch.md +123 -0
- data/docs/Templates.md +58 -80
- data/docs/WhatsNew.md +378 -133
- data/docs/templates/default/fulldoc/html/full_list_tag.erb +7 -0
- data/docs/templates/default/fulldoc/html/setup.rb +6 -0
- data/docs/templates/default/layout/html/setup.rb +8 -0
- data/docs/templates/default/layout/html/tag_list.erb +11 -0
- data/docs/templates/default/yard_tags/html/list.erb +18 -0
- data/docs/templates/default/yard_tags/html/setup.rb +27 -0
- data/docs/templates/plugin.rb +65 -0
- data/lib/yard.rb +1 -10
- data/lib/yard/autoload.rb +75 -27
- data/lib/yard/cli/command.rb +5 -2
- data/lib/yard/cli/command_parser.rb +3 -2
- data/lib/yard/cli/diff.rb +1 -1
- data/lib/yard/cli/i18n.rb +69 -0
- data/lib/yard/cli/list.rb +1 -1
- data/lib/yard/cli/server.rb +30 -7
- data/lib/yard/cli/stats.rb +5 -6
- data/lib/yard/cli/yardoc.rb +95 -45
- data/lib/yard/cli/yri.rb +24 -3
- data/lib/yard/code_objects/base.rb +35 -4
- data/lib/yard/code_objects/extra_file_object.rb +1 -1
- data/lib/yard/code_objects/macro_object.rb +56 -99
- data/lib/yard/code_objects/method_object.rb +44 -6
- data/lib/yard/config.rb +18 -8
- data/lib/yard/core_ext/symbol_hash.rb +1 -1
- data/lib/yard/docstring.rb +45 -85
- data/lib/yard/docstring_parser.rb +269 -0
- data/lib/yard/handlers/base.rb +129 -118
- data/lib/yard/handlers/c/alias_handler.rb +15 -0
- data/lib/yard/handlers/c/attribute_handler.rb +13 -0
- data/lib/yard/handlers/c/base.rb +110 -0
- data/lib/yard/handlers/c/class_handler.rb +26 -0
- data/lib/yard/handlers/c/constant_handler.rb +12 -0
- data/lib/yard/handlers/c/handler_methods.rb +165 -0
- data/lib/yard/handlers/c/init_handler.rb +16 -0
- data/lib/yard/handlers/c/method_handler.rb +35 -0
- data/lib/yard/handlers/c/mixin_handler.rb +13 -0
- data/lib/yard/handlers/c/module_handler.rb +16 -0
- data/lib/yard/handlers/c/override_comment_handler.rb +22 -0
- data/lib/yard/handlers/c/path_handler.rb +10 -0
- data/lib/yard/handlers/c/struct_handler.rb +12 -0
- data/lib/yard/handlers/c/symbol_handler.rb +7 -0
- data/lib/yard/handlers/processor.rb +41 -30
- data/lib/yard/handlers/ruby/alias_handler.rb +0 -2
- data/lib/yard/handlers/ruby/attribute_handler.rb +16 -17
- data/lib/yard/handlers/ruby/base.rb +10 -6
- data/lib/yard/handlers/ruby/comment_handler.rb +9 -0
- data/lib/yard/handlers/ruby/dsl_handler.rb +14 -0
- data/lib/yard/handlers/ruby/dsl_handler_methods.rb +71 -0
- data/lib/yard/handlers/ruby/legacy/alias_handler.rb +0 -3
- data/lib/yard/handlers/ruby/legacy/attribute_handler.rb +16 -17
- data/lib/yard/handlers/ruby/legacy/base.rb +28 -6
- data/lib/yard/handlers/ruby/legacy/comment_handler.rb +9 -0
- data/lib/yard/handlers/ruby/legacy/dsl_handler.rb +16 -0
- data/lib/yard/handlers/ruby/legacy/method_handler.rb +0 -2
- data/lib/yard/handlers/ruby/legacy/mixin_handler.rb +1 -1
- data/lib/yard/handlers/ruby/legacy/module_function_handler.rb +18 -0
- data/lib/yard/handlers/ruby/method_handler.rb +10 -15
- data/lib/yard/handlers/ruby/mixin_handler.rb +1 -1
- data/lib/yard/handlers/ruby/module_function_handler.rb +26 -0
- data/lib/yard/handlers/ruby/struct_handler_methods.rb +3 -2
- data/lib/yard/i18n/pot_generator.rb +281 -0
- data/lib/yard/i18n/text.rb +72 -0
- data/lib/yard/logging.rb +3 -7
- data/lib/yard/options.rb +216 -0
- data/lib/yard/parser/c/c_parser.rb +225 -0
- data/lib/yard/parser/c/comment_parser.rb +131 -0
- data/lib/yard/parser/c/statement.rb +63 -0
- data/lib/yard/parser/ruby/ast_node.rb +91 -1
- data/lib/yard/parser/ruby/legacy/ruby_parser.rb +1 -0
- data/lib/yard/parser/ruby/legacy/statement.rb +7 -2
- data/lib/yard/parser/ruby/legacy/statement_list.rb +13 -22
- data/lib/yard/parser/ruby/ruby_parser.rb +87 -26
- data/lib/yard/parser/source_parser.rb +89 -88
- data/lib/yard/rake/yardoc_task.rb +1 -1
- data/lib/yard/registry.rb +21 -10
- data/lib/yard/registry_store.rb +48 -0
- data/lib/yard/serializers/file_system_serializer.rb +18 -20
- data/lib/yard/serializers/yardoc_serializer.rb +1 -0
- data/lib/yard/server/adapter.rb +2 -2
- data/lib/yard/server/commands/base.rb +1 -1
- data/lib/yard/server/commands/display_object_command.rb +13 -6
- data/lib/yard/server/commands/frames_command.rb +4 -21
- data/lib/yard/server/commands/library_command.rb +57 -11
- data/lib/yard/server/commands/list_command.rb +10 -34
- data/lib/yard/server/commands/search_command.rb +8 -2
- data/lib/yard/server/doc_server_helper.rb +34 -0
- data/lib/yard/server/rack_adapter.rb +5 -1
- data/lib/yard/server/router.rb +4 -10
- data/lib/yard/server/static_caching.rb +2 -2
- data/lib/yard/server/templates/default/fulldoc/html/css/custom.css +2 -2
- data/lib/yard/server/templates/default/fulldoc/html/js/live.js +0 -15
- data/lib/yard/server/templates/default/layout/html/breadcrumb.erb +3 -3
- data/lib/yard/server/templates/default/layout/html/script_setup.erb +8 -0
- data/lib/yard/server/templates/doc_server/processing/html/processing.erb +1 -1
- data/lib/yard/server/templates/doc_server/search/html/setup.rb +1 -1
- data/lib/yard/tags/default_factory.rb +31 -4
- data/lib/yard/tags/directives.rb +593 -0
- data/lib/yard/tags/library.rb +437 -35
- data/lib/yard/templates/engine.rb +17 -12
- data/lib/yard/templates/helpers/base_helper.rb +8 -2
- data/lib/yard/templates/helpers/html_helper.rb +57 -14
- data/lib/yard/templates/helpers/markup/rdoc_markup.rb +1 -1
- data/lib/yard/templates/helpers/markup_helper.rb +9 -9
- data/lib/yard/templates/helpers/text_helper.rb +2 -2
- data/lib/yard/templates/template.rb +42 -13
- data/lib/yard/templates/template_options.rb +81 -0
- data/spec/cli/command_parser_spec.rb +4 -4
- data/spec/cli/command_spec.rb +3 -3
- data/spec/cli/config_spec.rb +13 -13
- data/spec/cli/diff_spec.rb +13 -10
- data/spec/cli/gems_spec.rb +12 -12
- data/spec/cli/help_spec.rb +2 -2
- data/spec/cli/i18n_spec.rb +111 -0
- data/spec/cli/server_spec.rb +66 -18
- data/spec/cli/stats_spec.rb +15 -15
- data/spec/cli/yardoc_spec.rb +124 -97
- data/spec/cli/yri_spec.rb +14 -12
- data/spec/code_objects/base_spec.rb +104 -46
- data/spec/code_objects/class_object_spec.rb +33 -33
- data/spec/code_objects/code_object_list_spec.rb +5 -5
- data/spec/code_objects/constants_spec.rb +4 -3
- data/spec/code_objects/extra_file_object_spec.rb +19 -19
- data/spec/code_objects/macro_object_spec.rb +31 -37
- data/spec/code_objects/method_object_spec.rb +46 -23
- data/spec/code_objects/module_object_spec.rb +16 -16
- data/spec/code_objects/namespace_object_spec.rb +6 -6
- data/spec/code_objects/proxy_spec.rb +19 -19
- data/spec/config_spec.rb +33 -24
- data/spec/core_ext/array_spec.rb +1 -1
- data/spec/core_ext/file_spec.rb +8 -8
- data/spec/core_ext/hash_spec.rb +1 -1
- data/spec/core_ext/insertion_spec.rb +3 -3
- data/spec/core_ext/module_spec.rb +1 -1
- data/spec/core_ext/string_spec.rb +6 -6
- data/spec/core_ext/symbol_hash_spec.rb +11 -11
- data/spec/docstring_parser_spec.rb +207 -0
- data/spec/docstring_spec.rb +33 -146
- data/spec/handlers/alias_handler_spec.rb +14 -14
- data/spec/handlers/attribute_handler_spec.rb +20 -20
- data/spec/handlers/base_spec.rb +16 -16
- data/spec/handlers/c/alias_handler_spec.rb +33 -0
- data/spec/handlers/c/attribute_handler_spec.rb +40 -0
- data/spec/handlers/c/class_handler_spec.rb +64 -0
- data/spec/handlers/c/constant_handler_spec.rb +68 -0
- data/spec/handlers/c/init_handler_spec.rb +36 -0
- data/spec/handlers/c/method_handler_spec.rb +228 -0
- data/spec/handlers/c/mixin_handler_spec.rb +27 -0
- data/spec/handlers/c/module_handler_spec.rb +38 -0
- data/spec/handlers/c/override_comment_handler_spec.rb +43 -0
- data/spec/handlers/c/path_handler_spec.rb +35 -0
- data/spec/handlers/c/spec_helper.rb +11 -0
- data/spec/handlers/c/struct_handler_spec.rb +15 -0
- data/spec/handlers/class_condition_handler_spec.rb +10 -10
- data/spec/handlers/class_handler_spec.rb +38 -38
- data/spec/handlers/class_variable_handler_spec.rb +1 -1
- data/spec/handlers/constant_handler_spec.rb +7 -7
- data/spec/handlers/{macro_handler_spec.rb → dsl_handler_spec.rb} +72 -53
- data/spec/handlers/examples/alias_handler_001.rb.txt +5 -5
- data/spec/handlers/examples/class_condition_handler_001.rb.txt +9 -9
- data/spec/handlers/examples/class_handler_001.rb.txt +1 -1
- data/spec/handlers/examples/dsl_handler_001.rb.txt +110 -0
- data/spec/handlers/examples/exception_handler_001.rb.txt +14 -14
- data/spec/handlers/examples/method_condition_handler_001.rb.txt +2 -2
- data/spec/handlers/examples/method_handler_001.rb.txt +16 -16
- data/spec/handlers/examples/mixin_handler_001.rb.txt +8 -4
- data/spec/handlers/examples/private_constant_handler_001.rb.txt +1 -1
- data/spec/handlers/examples/visibility_handler_001.rb.txt +3 -3
- data/spec/handlers/examples/yield_handler_001.rb.txt +13 -14
- data/spec/handlers/exception_handler_spec.rb +9 -9
- data/spec/handlers/extend_handler_spec.rb +2 -2
- data/spec/handlers/legacy_base_spec.rb +34 -34
- data/spec/handlers/method_condition_handler_spec.rb +2 -2
- data/spec/handlers/method_handler_spec.rb +33 -33
- data/spec/handlers/mixin_handler_spec.rb +13 -9
- data/spec/handlers/module_function_handler_spec.rb +82 -0
- data/spec/handlers/module_handler_spec.rb +6 -6
- data/spec/handlers/private_constant_handler_spec.rb +3 -3
- data/spec/handlers/processor_spec.rb +5 -5
- data/spec/handlers/ruby/base_spec.rb +10 -6
- data/spec/handlers/ruby/legacy/base_spec.rb +11 -7
- data/spec/handlers/spec_helper.rb +2 -3
- data/spec/handlers/visibility_handler_spec.rb +6 -6
- data/spec/handlers/yield_handler_spec.rb +8 -8
- data/spec/i18n/pot_generator_spec.rb +244 -0
- data/spec/i18n/text_spec.rb +69 -0
- data/spec/options_spec.rb +160 -0
- data/spec/parser/base_spec.rb +3 -3
- data/spec/parser/c_parser_spec.rb +31 -257
- data/spec/parser/examples/array.c.txt +187 -187
- data/spec/parser/examples/extrafile.c.txt +1 -1
- data/spec/parser/examples/override.c.txt +1 -1
- data/spec/parser/ruby/ast_node_spec.rb +1 -1
- data/spec/parser/ruby/legacy/statement_list_spec.rb +24 -24
- data/spec/parser/ruby/legacy/token_list_spec.rb +7 -7
- data/spec/parser/ruby/ruby_parser_spec.rb +56 -34
- data/spec/parser/source_parser_spec.rb +125 -65
- data/spec/parser/tag_parsing_spec.rb +4 -4
- data/spec/rake/yardoc_task_spec.rb +10 -8
- data/spec/registry_spec.rb +65 -36
- data/spec/registry_store_spec.rb +90 -40
- data/spec/serializers/file_system_serializer_spec.rb +12 -12
- data/spec/serializers/yardoc_serializer_spec.rb +2 -2
- data/spec/server/adapter_spec.rb +3 -3
- data/spec/server/commands/base_spec.rb +8 -8
- data/spec/server/commands/library_command_spec.rb +3 -3
- data/spec/server/commands/static_file_command_spec.rb +7 -7
- data/spec/server/doc_server_helper_spec.rb +1 -1
- data/spec/server/doc_server_serializer_spec.rb +6 -6
- data/spec/server/rack_adapter_spec.rb +3 -3
- data/spec/server/router_spec.rb +19 -19
- data/spec/server/static_caching_spec.rb +4 -4
- data/spec/spec_helper.rb +7 -7
- data/spec/tags/default_factory_spec.rb +24 -16
- data/spec/tags/directives_spec.rb +422 -0
- data/spec/tags/library_spec.rb +15 -4
- data/spec/tags/overload_tag_spec.rb +6 -6
- data/spec/tags/ref_tag_list_spec.rb +8 -8
- data/spec/templates/class_spec.rb +7 -7
- data/spec/templates/constant_spec.rb +7 -7
- data/spec/templates/engine_spec.rb +28 -36
- data/spec/templates/examples/class001.html +108 -108
- data/spec/templates/examples/class002.html +17 -17
- data/spec/templates/examples/constant001.txt +1 -1
- data/spec/templates/examples/method001.html +45 -45
- data/spec/templates/examples/method002.html +25 -25
- data/spec/templates/examples/method003.html +60 -60
- data/spec/templates/examples/method004.html +7 -7
- data/spec/templates/examples/method005.html +28 -28
- data/spec/templates/examples/module001.html +321 -321
- data/spec/templates/examples/module001.txt +1 -1
- data/spec/templates/examples/module002.html +130 -130
- data/spec/templates/examples/module003.html +74 -74
- data/spec/templates/examples/module004.html +388 -0
- data/spec/templates/helpers/base_helper_spec.rb +32 -32
- data/spec/templates/helpers/html_helper_spec.rb +87 -68
- data/spec/templates/helpers/html_syntax_highlight_helper_spec.rb +9 -9
- data/spec/templates/helpers/markup/rdoc_markup_spec.rb +16 -16
- data/spec/templates/helpers/markup_helper_spec.rb +31 -28
- data/spec/templates/helpers/method_helper_spec.rb +7 -7
- data/spec/templates/helpers/shared_signature_examples.rb +9 -7
- data/spec/templates/helpers/text_helper_spec.rb +3 -3
- data/spec/templates/method_spec.rb +13 -13
- data/spec/templates/module_spec.rb +70 -24
- data/spec/templates/onefile_spec.rb +32 -15
- data/spec/templates/section_spec.rb +23 -23
- data/spec/templates/spec_helper.rb +31 -1
- data/spec/templates/tag_spec.rb +5 -5
- data/spec/templates/template_spec.rb +54 -46
- data/spec/verifier_spec.rb +5 -5
- data/templates/default/class/setup.rb +2 -2
- data/templates/default/docstring/html/abstract.erb +1 -1
- data/templates/default/docstring/html/note.erb +1 -1
- data/templates/default/docstring/html/private.erb +1 -1
- data/templates/default/docstring/html/todo.erb +1 -1
- data/templates/default/docstring/setup.rb +2 -2
- data/templates/default/fulldoc/html/css/full_list.css +4 -2
- data/templates/default/fulldoc/html/css/style.css +50 -44
- data/templates/default/fulldoc/html/frames.erb +21 -6
- data/templates/default/fulldoc/html/full_list.erb +5 -3
- data/templates/default/fulldoc/html/{full_list_files.erb → full_list_file.erb} +0 -0
- data/templates/default/fulldoc/html/js/app.js +29 -26
- data/templates/default/fulldoc/html/js/full_list.js +9 -9
- data/templates/default/fulldoc/html/js/jquery.js +4 -16
- data/templates/default/fulldoc/html/setup.rb +42 -38
- data/templates/default/layout/dot/header.erb +1 -1
- data/templates/default/layout/html/breadcrumb.erb +6 -6
- data/templates/default/layout/html/files.erb +1 -1
- data/templates/default/layout/html/footer.erb +1 -1
- data/templates/default/layout/html/headers.erb +3 -6
- data/templates/default/layout/html/index.erb +1 -1
- data/templates/default/layout/html/layout.erb +3 -7
- data/templates/default/layout/html/objects.erb +1 -1
- data/templates/default/layout/html/script_setup.erb +5 -0
- data/templates/default/layout/html/search.erb +4 -1
- data/templates/default/layout/html/setup.rb +8 -8
- data/templates/default/method_details/html/method_signature.erb +10 -3
- data/templates/default/method_details/setup.rb +1 -0
- data/templates/default/module/dot/info.erb +1 -1
- data/templates/default/module/dot/setup.rb +2 -2
- data/templates/default/module/html/attribute_details.erb +1 -1
- data/templates/default/module/html/children.erb +1 -1
- data/templates/default/module/html/defines.erb +1 -1
- data/templates/default/module/html/inherited_methods.erb +5 -4
- data/templates/default/module/html/item_summary.erb +15 -5
- data/templates/default/module/html/method_details_list.erb +2 -2
- data/templates/default/module/setup.rb +25 -12
- data/templates/default/module/text/setup.rb +1 -1
- data/templates/default/onefile/html/layout.erb +1 -1
- data/templates/default/onefile/html/setup.rb +2 -2
- data/templates/default/tags/html/example.erb +4 -2
- data/templates/default/tags/html/option.erb +1 -1
- data/templates/default/tags/html/overload.erb +1 -1
- data/templates/default/tags/html/see.erb +1 -1
- data/templates/default/tags/html/tag.erb +1 -1
- data/templates/default/tags/setup.rb +4 -3
- data/templates/guide/fulldoc/html/css/style.css +8 -8
- data/templates/guide/fulldoc/html/js/app.js +6 -6
- data/templates/guide/fulldoc/html/setup.rb +12 -12
- data/templates/guide/layout/html/layout.erb +11 -11
- data/templates/guide/layout/html/setup.rb +9 -9
- data/templates/guide/method/html/header.erb +2 -2
- data/templates/guide/method/html/setup.rb +1 -1
- metadata +68 -18
- data/bin/yard-graph +0 -4
- data/bin/yard-server +0 -4
- data/docs/Glossary.md +0 -12
- data/lib/yard/handlers/ruby/legacy/macro_handler.rb +0 -39
- data/lib/yard/handlers/ruby/macro_handler.rb +0 -40
- data/lib/yard/handlers/ruby/macro_handler_methods.rb +0 -131
- data/lib/yard/parser/c_parser.rb +0 -497
- data/lib/yard/server/templates/default/layout/html/headers.erb +0 -16
- data/lib/yard/server/templates/doc_server/frames/html/frames.erb +0 -13
- data/lib/yard/server/templates/doc_server/frames/html/setup.rb +0 -3
- data/lib/yard/server/templates/doc_server/full_list/html/full_list.erb +0 -34
- data/lib/yard/server/templates/doc_server/full_list/html/setup.rb +0 -20
- data/spec/handlers/examples/macro_handler_001.rb.txt +0 -83
data/spec/config_spec.rb
CHANGED
@@ -5,7 +5,7 @@ require 'yaml'
|
|
5
5
|
describe YARD::Config do
|
6
6
|
describe '.load' do
|
7
7
|
before do
|
8
|
-
File.should_receive(:file?).with(CLI::Yardoc::DEFAULT_YARDOPTS_FILE).and_return(false)
|
8
|
+
File.should_receive(:file?).twice.with(CLI::Yardoc::DEFAULT_YARDOPTS_FILE).and_return(false)
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should use default options if no ~/.yard/config is found" do
|
@@ -14,7 +14,7 @@ describe YARD::Config do
|
|
14
14
|
YARD::Config.load
|
15
15
|
YARD::Config.options.should == YARD::Config::DEFAULT_CONFIG_OPTIONS
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
it "should overwrite options with data in ~/.yard/config" do
|
19
19
|
File.should_receive(:file?).with(YARD::Config::CONFIG_FILE).and_return(true)
|
20
20
|
File.should_receive(:file?).with(YARD::Config::IGNORED_PLUGINS).and_return(false)
|
@@ -22,7 +22,7 @@ describe YARD::Config do
|
|
22
22
|
YARD::Config.load
|
23
23
|
YARD::Config.options[:test].should be_true
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
it "should ignore any plugins specified in '~/.yard/ignored_plugins'" do
|
27
27
|
File.should_receive(:file?).with(YARD::Config::CONFIG_FILE).and_return(false)
|
28
28
|
File.should_receive(:file?).with(YARD::Config::IGNORED_PLUGINS).and_return(true)
|
@@ -32,8 +32,17 @@ describe YARD::Config do
|
|
32
32
|
YARD::Config.should_not_receive(:require).with('yard-plugin2')
|
33
33
|
YARD::Config.load_plugin('yard-plugin2').should == false
|
34
34
|
end
|
35
|
+
|
36
|
+
it "should load safe_mode setting from --safe command line option" do
|
37
|
+
File.should_receive(:file?).with(YARD::Config::IGNORED_PLUGINS).and_return(false)
|
38
|
+
File.should_receive(:file?).with(YARD::Config::CONFIG_FILE).and_return(false)
|
39
|
+
ARGV.replace(['--safe'])
|
40
|
+
YARD::Config.load
|
41
|
+
YARD::Config.options[:safe_mode].should be_true
|
42
|
+
ARGV.replace([''])
|
43
|
+
end
|
35
44
|
end
|
36
|
-
|
45
|
+
|
37
46
|
describe '.save' do
|
38
47
|
it "should save options to config file" do
|
39
48
|
YARD::Config.stub!(:options).and_return(:a => 1, :b => %w(a b c))
|
@@ -43,51 +52,51 @@ describe YARD::Config do
|
|
43
52
|
YARD::Config.save
|
44
53
|
end
|
45
54
|
end
|
46
|
-
|
55
|
+
|
47
56
|
describe '.load_plugin' do
|
48
57
|
it "should load a plugin by 'name' as 'yard-name'" do
|
49
58
|
YARD::Config.should_receive(:require).with('yard-foo')
|
50
59
|
log.should_receive(:debug).with(/Loading plugin 'yard-foo'/).once
|
51
60
|
YARD::Config.load_plugin('foo').should == true
|
52
61
|
end
|
53
|
-
|
62
|
+
|
54
63
|
it "should not load plugins like 'doc-*'" do
|
55
64
|
YARD::Config.should_not_receive(:require).with('yard-doc-core')
|
56
65
|
YARD::Config.load_plugin('doc-core')
|
57
66
|
YARD::Config.load_plugin('yard-doc-core')
|
58
67
|
end
|
59
|
-
|
68
|
+
|
60
69
|
it "should load plugin by 'yard-name' as 'yard-name'" do
|
61
70
|
YARD::Config.should_receive(:require).with('yard-foo')
|
62
71
|
log.should_receive(:debug).with(/Loading plugin 'yard-foo'/).once
|
63
72
|
YARD::Config.load_plugin('yard-foo').should == true
|
64
73
|
end
|
65
|
-
|
74
|
+
|
66
75
|
it "should load plugin by 'yard_name' as 'yard_name'" do
|
67
76
|
YARD::Config.should_receive(:require).with('yard_foo')
|
68
77
|
log.should_receive(:debug).with(/Loading plugin 'yard_foo'/).once
|
69
78
|
log.show_backtraces = false
|
70
79
|
YARD::Config.load_plugin('yard_foo').should == true
|
71
80
|
end
|
72
|
-
|
81
|
+
|
73
82
|
it "should log error if plugin is not found" do
|
74
83
|
YARD::Config.should_receive(:require).with('yard-foo').and_raise(LoadError)
|
75
84
|
log.should_receive(:warn).with(/Error loading plugin 'yard-foo'/).once
|
76
85
|
YARD::Config.load_plugin('yard-foo').should == false
|
77
86
|
end
|
78
|
-
|
87
|
+
|
79
88
|
it "should sanitize plugin name (remove /'s)" do
|
80
89
|
YARD::Config.should_receive(:require).with('yard-foofoo')
|
81
90
|
YARD::Config.load_plugin('foo/foo').should == true
|
82
91
|
end
|
83
|
-
|
92
|
+
|
84
93
|
it "should ignore plugins in :ignore_plugins" do
|
85
94
|
YARD::Config.stub!(:options).and_return(:ignored_plugins => ['yard-foo', 'yard-bar'])
|
86
95
|
YARD::Config.load_plugin('foo').should == false
|
87
96
|
YARD::Config.load_plugin('bar').should == false
|
88
97
|
end
|
89
98
|
end
|
90
|
-
|
99
|
+
|
91
100
|
describe '.load_plugins' do
|
92
101
|
it "should load gem plugins if :load_plugins is true" do
|
93
102
|
YARD::Config.stub!(:options).and_return(:load_plugins => true, :ignored_plugins => [], :autoload_plugins => [])
|
@@ -95,42 +104,42 @@ describe YARD::Config do
|
|
95
104
|
YARD::Config.should_receive(:require).with('rubygems')
|
96
105
|
YARD::Config.load_plugins
|
97
106
|
end
|
98
|
-
|
107
|
+
|
99
108
|
it "should ignore gem loading if RubyGems cannot load" do
|
100
109
|
YARD::Config.stub!(:options).and_return(:load_plugins => true, :ignored_plugins => [], :autoload_plugins => [])
|
101
110
|
YARD::Config.should_receive(:require).with('rubygems').and_raise(LoadError)
|
102
111
|
YARD::Config.load_plugins.should == false
|
103
112
|
end
|
104
|
-
|
113
|
+
|
105
114
|
it "should load certain plugins automatically when specified in :autoload_plugins" do
|
106
115
|
File.should_receive(:file?).with(CLI::Yardoc::DEFAULT_YARDOPTS_FILE).and_return(false)
|
107
116
|
YARD::Config.stub!(:options).and_return(:load_plugins => false, :ignored_plugins => [], :autoload_plugins => ['yard-plugin'])
|
108
117
|
YARD::Config.should_receive(:require).with('yard-plugin').and_return(true)
|
109
118
|
YARD::Config.load_plugins.should == true
|
110
119
|
end
|
111
|
-
|
120
|
+
|
112
121
|
it "should parse --plugin from command line arguments" do
|
113
122
|
YARD::Config.should_receive(:arguments).at_least(1).times.and_return(%w(--plugin foo --plugin bar a b c))
|
114
123
|
YARD::Config.should_receive(:load_plugin).with('foo').and_return(true)
|
115
124
|
YARD::Config.should_receive(:load_plugin).with('bar').and_return(true)
|
116
125
|
YARD::Config.load_plugins.should == true
|
117
126
|
end
|
118
|
-
|
127
|
+
|
119
128
|
it "should load --plugin arguments from .yardopts" do
|
120
|
-
File.should_receive(:file?).with(CLI::Yardoc::DEFAULT_YARDOPTS_FILE).
|
129
|
+
File.should_receive(:file?).with(CLI::Yardoc::DEFAULT_YARDOPTS_FILE).twice.and_return(true)
|
121
130
|
File.should_receive(:file?).with(YARD::Config::CONFIG_FILE).and_return(false)
|
122
131
|
File.should_receive(:file?).with(YARD::Config::IGNORED_PLUGINS).and_return(false)
|
123
|
-
File.should_receive(:read_binary).with(CLI::Yardoc::DEFAULT_YARDOPTS_FILE).
|
132
|
+
File.should_receive(:read_binary).with(CLI::Yardoc::DEFAULT_YARDOPTS_FILE).twice.and_return('--plugin foo')
|
124
133
|
YARD::Config.should_receive(:load_plugin).with('foo')
|
125
134
|
YARD::Config.load
|
126
135
|
end
|
127
|
-
|
136
|
+
|
128
137
|
it "should load any gem plugins starting with 'yard_' or 'yard-'" do
|
129
138
|
File.should_receive(:file?).with(CLI::Yardoc::DEFAULT_YARDOPTS_FILE).and_return(false)
|
130
139
|
YARD::Config.stub!(:options).and_return(:load_plugins => true, :ignored_plugins => ['yard_plugin'], :autoload_plugins => [])
|
131
140
|
plugins = {
|
132
|
-
'yard' => mock('yard'),
|
133
|
-
'yard_plugin' => mock('yard_plugin'),
|
141
|
+
'yard' => mock('yard'),
|
142
|
+
'yard_plugin' => mock('yard_plugin'),
|
134
143
|
'yard-plugin' => mock('yard-plugin'),
|
135
144
|
'my-yard-plugin' => mock('yard-plugin'),
|
136
145
|
'rspec' => mock('rspec'),
|
@@ -138,7 +147,7 @@ describe YARD::Config do
|
|
138
147
|
plugins.each do |k, v|
|
139
148
|
v.should_receive(:name).at_least(1).times.and_return(k)
|
140
149
|
end
|
141
|
-
|
150
|
+
|
142
151
|
source_mock = mock(:source_index)
|
143
152
|
source_mock.should_receive(:find_name).with('').and_return(plugins.values)
|
144
153
|
Gem.should_receive(:source_index).and_return(source_mock)
|
@@ -146,7 +155,7 @@ describe YARD::Config do
|
|
146
155
|
YARD::Config.should_receive(:load_plugin).with('yard-plugin').and_return(true)
|
147
156
|
YARD::Config.load_plugins.should == true
|
148
157
|
end
|
149
|
-
|
158
|
+
|
150
159
|
it "should log an error if a gem raises an error" do
|
151
160
|
YARD::Config.stub!(:options).and_return(:load_plugins => true, :ignored_plugins => [], :autoload_plugins => [])
|
152
161
|
plugins = {
|
@@ -155,7 +164,7 @@ describe YARD::Config do
|
|
155
164
|
plugins.each do |k, v|
|
156
165
|
v.should_receive(:name).at_least(1).times.and_return(k)
|
157
166
|
end
|
158
|
-
|
167
|
+
|
159
168
|
source_mock = mock(:source_index)
|
160
169
|
source_mock.should_receive(:find_name).with('').and_return(plugins.values)
|
161
170
|
Gem.should_receive(:source_index).and_return(source_mock)
|
data/spec/core_ext/array_spec.rb
CHANGED
data/spec/core_ext/file_spec.rb
CHANGED
@@ -5,26 +5,26 @@ describe File do
|
|
5
5
|
it "should return the relative path between two files" do
|
6
6
|
File.relative_path('a/b/c/d.html', 'a/b/d/q.html').should == '../d/q.html'
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
it "should return the relative path between two directories" do
|
10
10
|
File.relative_path('a/b/c/d/', 'a/b/d/').should == '../d'
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
it "should return only the to file if from file is in the same directory as the to file" do
|
14
14
|
File.relative_path('a/b/c/d', 'a/b/c/e').should == 'e'
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it "should handle non-normalized paths" do
|
18
18
|
File.relative_path('Hello/./I/Am/Fred', 'Hello/Fred').should == '../../Fred'
|
19
19
|
File.relative_path('A//B/C', 'Q/X').should == '../../Q/X'
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
describe '.cleanpath' do
|
24
24
|
it "should clean double brackets" do
|
25
25
|
File.cleanpath('A//B/C').should == "A/B/C"
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
it "should clean a path with ." do
|
29
29
|
File.cleanpath('Hello/./I/.Am/Fred').should == "Hello/I/.Am/Fred"
|
30
30
|
end
|
@@ -40,16 +40,16 @@ describe File do
|
|
40
40
|
it "should clean a path ending in .." do
|
41
41
|
File.cleanpath('A/B/C/D/..').should == "A/B/C"
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
it "should pass the initial directory" do
|
45
45
|
File.cleanpath('C/../../D').should == "../D"
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
it "should not remove multiple '../' at the beginning" do
|
49
49
|
File.cleanpath('../../A/B').should == '../../A/B'
|
50
50
|
end
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
describe '.open!' do
|
54
54
|
it "should create the path before opening" do
|
55
55
|
File.should_receive(:directory?).with('/path/to').and_return(false)
|
data/spec/core_ext/hash_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe Insertion do
|
|
8
8
|
[1, [4], 2].place(3).before(2).should == [1, [4], 3, 2]
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
describe '#after' do
|
13
13
|
it "should place an object after another" do
|
14
14
|
[1, 2].place(3).after(2).should == [1, 2, 3]
|
@@ -17,12 +17,12 @@ describe Insertion do
|
|
17
17
|
it "should no longer place an object after another and its subsections (0.6)" do
|
18
18
|
[1, [2]].place(3).after(1).should == [1, 3, [2]]
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
it "should place an array after an object" do
|
22
22
|
[1, 2, 3].place([4]).after(1).should == [1, [4], 2, 3]
|
23
23
|
end
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
describe '#before_any' do
|
27
27
|
it "should place an object before another anywhere inside list (including sublists)" do
|
28
28
|
[1, 2, [3]].place(4).before_any(3).should == [1, 2, [4, 3]]
|
@@ -8,27 +8,27 @@ describe String do
|
|
8
8
|
it "should split simple non-quoted text" do
|
9
9
|
"a b c".shell_split.should == %w(a b c)
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
it "should split double quoted text into single token" do
|
13
13
|
'a "b c d" e'.shell_split.should == ["a", "b c d", "e"]
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
it "should split single quoted text into single token" do
|
17
17
|
"a 'b c d' e".shell_split.should == ["a", "b c d", "e"]
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
it "should handle escaped quotations in quotes" do
|
21
21
|
"'a \\' b'".shell_split.should == ["a ' b"]
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
it "should handle escaped quotations outside quotes" do
|
25
25
|
"\\'a 'b'".shell_split.should == %w('a b)
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
it "should handle escaped backslash" do
|
29
29
|
"\\\\'a b c'".shell_split.should == ['\a b c']
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
it "should handle any whitespace as space" do
|
33
33
|
text = "foo\tbar\nbaz\r\nfoo2 bar2"
|
34
34
|
text.shell_split.should == %w(foo bar baz foo2 bar2)
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
2
|
|
3
3
|
describe SymbolHash do
|
4
|
-
|
4
|
+
|
5
5
|
it "should allow access to keys as String or Symbol" do
|
6
6
|
h = SymbolHash.new(false)
|
7
7
|
h['test'] = true
|
8
8
|
h[:test].should == true
|
9
9
|
h['test'].should == true
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
it "should #delete by key as String or Symbol" do
|
13
13
|
h = SymbolHash.new
|
14
14
|
h.keys.length.should == 0
|
@@ -25,36 +25,36 @@ describe SymbolHash do
|
|
25
25
|
h.delete('test')
|
26
26
|
h.keys.length.should == 0
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
it "should return same #has_key? for key as String or Symbol" do
|
30
30
|
h = SymbolHash.new
|
31
31
|
h[:test] = 1
|
32
32
|
h.has_key?(:test).should == true
|
33
33
|
h.has_key?('test').should == true
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
it "should symbolize value if it is a String (and only a string)" do
|
37
37
|
class Substring < String; end
|
38
|
-
|
38
|
+
|
39
39
|
h = SymbolHash.new
|
40
40
|
h['test1'] = "hello"
|
41
41
|
h['test2'] = Substring.new("hello")
|
42
42
|
h['test1'].should == :hello
|
43
43
|
h['test2'].should == "hello"
|
44
|
-
end
|
45
|
-
|
44
|
+
end
|
45
|
+
|
46
46
|
it "should not symbolize value if SymbolHash.new(false) is created" do
|
47
47
|
h = SymbolHash.new(false)
|
48
48
|
h['test'] = "hello"
|
49
49
|
h[:test].should == "hello"
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
it "should not symbolize value if it is not a String" do
|
53
53
|
h = SymbolHash.new
|
54
54
|
h['test'] = [1,2,3]
|
55
55
|
h['test'].should == [1,2,3]
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
it "should support symbolization using #update or #merge!" do
|
59
59
|
h = SymbolHash.new
|
60
60
|
h.update('test' => 'value')
|
@@ -68,13 +68,13 @@ describe SymbolHash do
|
|
68
68
|
h.merge('test' => 'value')[:test].should == :value
|
69
69
|
h.should == SymbolHash.new
|
70
70
|
end
|
71
|
-
|
71
|
+
|
72
72
|
it "should support #initializing of a hash" do
|
73
73
|
h = SymbolHash[:test => 1]
|
74
74
|
h[:test].should == 1
|
75
75
|
h[:somethingelse].should be_nil
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
it "should support reverse merge syntax" do
|
79
79
|
opts = {}
|
80
80
|
opts = SymbolHash[
|
@@ -0,0 +1,207 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper"
|
2
|
+
|
3
|
+
describe YARD::DocstringParser do
|
4
|
+
def parse(content, object = nil, handler = nil)
|
5
|
+
@library ||= Tags::Library.instance
|
6
|
+
@parser = DocstringParser.new(@library)
|
7
|
+
@parser.parse(content, object, handler)
|
8
|
+
@parser
|
9
|
+
end
|
10
|
+
|
11
|
+
def docstring(content, object = nil, handler = nil)
|
12
|
+
parse(content, object, handler).to_docstring
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#parse' do
|
16
|
+
it "should parse comments into tags" do
|
17
|
+
doc = docstring(<<-eof)
|
18
|
+
@param name Hello world
|
19
|
+
how are you?
|
20
|
+
@param name2
|
21
|
+
this is a new line
|
22
|
+
@param name3 and this
|
23
|
+
is a new paragraph:
|
24
|
+
|
25
|
+
right here.
|
26
|
+
eof
|
27
|
+
tags = doc.tags(:param)
|
28
|
+
tags[0].name.should == "name"
|
29
|
+
tags[0].text.should == "Hello world\nhow are you?"
|
30
|
+
tags[1].name.should == "name2"
|
31
|
+
tags[1].text.should == "this is a new line"
|
32
|
+
tags[2].name.should == "name3"
|
33
|
+
tags[2].text.should == "and this\nis a new paragraph:\n\nright here."
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should end parsing a tag on de-dent" do
|
37
|
+
doc = docstring(<<-eof)
|
38
|
+
@note test
|
39
|
+
one two three
|
40
|
+
rest of docstring
|
41
|
+
eof
|
42
|
+
doc.tag(:note).text.should == "test\none two three"
|
43
|
+
doc.should == "rest of docstring"
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should parse examples embedded in doc" do
|
47
|
+
doc = docstring(<<-eof)
|
48
|
+
test string here
|
49
|
+
@example code
|
50
|
+
|
51
|
+
def foo(x, y, z)
|
52
|
+
end
|
53
|
+
|
54
|
+
class A; end
|
55
|
+
|
56
|
+
more stuff
|
57
|
+
eof
|
58
|
+
doc.should == "test string here\nmore stuff"
|
59
|
+
doc.tag(:example).text.should == "\ndef foo(x, y, z)\nend\n\nclass A; end"
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should remove only original indentation from beginning of line in tags" do
|
63
|
+
doc = docstring(<<-eof)
|
64
|
+
@param name
|
65
|
+
some value
|
66
|
+
foo bar
|
67
|
+
baz
|
68
|
+
eof
|
69
|
+
doc.tag(:param).text.should == "some value\nfoo bar\n baz"
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should allow numbers in tags" do
|
73
|
+
Tags::Library.define_tag(nil, :foo1)
|
74
|
+
Tags::Library.define_tag(nil, :foo2)
|
75
|
+
Tags::Library.define_tag(nil, :foo3)
|
76
|
+
doc = docstring(<<-eof)
|
77
|
+
@foo1 bar1
|
78
|
+
@foo2 bar2
|
79
|
+
@foo3 bar3
|
80
|
+
eof
|
81
|
+
doc.tag(:foo1).text.should == "bar1"
|
82
|
+
doc.tag(:foo2).text.should == "bar2"
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should end tag on newline if next line is not indented" do
|
86
|
+
doc = docstring(<<-eof)
|
87
|
+
@author bar1
|
88
|
+
@api bar2
|
89
|
+
Hello world
|
90
|
+
eof
|
91
|
+
doc.tag(:author).text.should == "bar1"
|
92
|
+
doc.tag(:api).text.should == "bar2"
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should warn about unknown tag" do
|
96
|
+
log.should_receive(:warn).with(/Unknown tag @hello$/)
|
97
|
+
docstring("@hello world")
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should not add trailing whitespace to freeform tags" do
|
101
|
+
doc = docstring("@api private \t ")
|
102
|
+
doc.tag(:api).text.should == "private"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe '#parse with custom tag library' do
|
107
|
+
class TestLibrary < Tags::Library; end
|
108
|
+
|
109
|
+
before { @library = TestLibrary.new }
|
110
|
+
|
111
|
+
it "should accept valid tags" do
|
112
|
+
valid = %w( testing valid is_a is_A __ )
|
113
|
+
valid.each do |tag|
|
114
|
+
TestLibrary.define_tag("Tag", tag)
|
115
|
+
doc = docstring('@' + tag + ' foo bar')
|
116
|
+
doc.tag(tag).text.should == 'foo bar'
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should not parse invalid tag names" do
|
121
|
+
invalid = %w( @ @return@ @param, @x-y @.x.y.z )
|
122
|
+
invalid.each do |tag|
|
123
|
+
docstring(tag + ' foo bar').should == tag + ' foo bar'
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should allow namespaced tags in the form @x.y.z" do
|
128
|
+
TestLibrary.define_tag("Tag", 'x.y.z')
|
129
|
+
doc = docstring("@x.y.z foo bar")
|
130
|
+
doc.tag('x.y.z').text.should == 'foo bar'
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should ignore new directives without @! prefix syntax" do
|
134
|
+
TestLibrary.define_directive('dir1', Tags::ScopeDirective)
|
135
|
+
log.should_receive(:warn).with(/@dir1/)
|
136
|
+
docstring("@dir1")
|
137
|
+
end
|
138
|
+
|
139
|
+
%w(attribute endgroup group macro method scope visibility).each do |tag|
|
140
|
+
it "should handle non prefixed @#{tag} syntax as directive, not tag" do
|
141
|
+
TestLibrary.define_directive(tag, Tags::ScopeDirective)
|
142
|
+
parse("@#{tag}")
|
143
|
+
@parser.directives.first.should be_a(Tags::ScopeDirective)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
it "should handle directives with @! prefix syntax" do
|
148
|
+
TestLibrary.define_directive('dir1', Tags::ScopeDirective)
|
149
|
+
docstring("@!dir1 class")
|
150
|
+
@parser.state.scope.should == :class
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
describe '#text' do
|
155
|
+
it "should only return text data" do
|
156
|
+
parse("Foo\n@param foo x y z\nBar")
|
157
|
+
@parser.text.should == "Foo\nBar"
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
describe '#raw_text' do
|
162
|
+
it "should return the entire original data" do
|
163
|
+
data = "Foo\n@param foo x y z\nBar"
|
164
|
+
parse(data)
|
165
|
+
@parser.raw_text.should == data
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
describe '#tags' do
|
170
|
+
it "should return the parsed tags" do
|
171
|
+
data = "Foo\n@param foo x y z\nBar"
|
172
|
+
parse(data)
|
173
|
+
@parser.tags.size.should == 1
|
174
|
+
@parser.tags.first.tag_name.should == 'param'
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
describe '#directives' do
|
179
|
+
it "should group all processed directives" do
|
180
|
+
data = "Foo\n@!scope class\n@!visibility private\nBar"
|
181
|
+
parse(data)
|
182
|
+
dirs = @parser.directives
|
183
|
+
dirs.size == 2
|
184
|
+
dirs[0].should be_a(Tags::ScopeDirective)
|
185
|
+
dirs[0].tag.text.should == 'class'
|
186
|
+
dirs[1].should be_a(Tags::VisibilityDirective)
|
187
|
+
dirs[1].tag.text.should == 'private'
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
describe '#state' do
|
192
|
+
it "should handle modified state" do
|
193
|
+
parse("@!scope class")
|
194
|
+
@parser.state.scope.should == :class
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
describe 'after_parse' do
|
199
|
+
it "should allow specifying of callbacks" do
|
200
|
+
parser = DocstringParser.new
|
201
|
+
the_yielded_obj = nil
|
202
|
+
DocstringParser.after_parse {|obj| the_yielded_obj = obj }
|
203
|
+
parser.parse("Some text")
|
204
|
+
the_yielded_obj.should == parser
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|