summaryrefslogtreecommitdiffhomepage
path: root/spec/handlers/c/source/module_handler_spec.rb
diff options
context:
space:
mode:
authorSeba Gamboa <[email protected]>2015-09-25 18:01:14 -0300
committerSeba Gamboa <[email protected]>2015-09-25 18:01:14 -0300
commit3a60c88a3b3dbd334e4769a6283fb90c0495c25b (patch)
treede3d8ec187771d6e2d5f42da864c19ee6d69d890 /spec/handlers/c/source/module_handler_spec.rb
parent82e906d74dcc943d737ced7a6ebfee1e71a74aaf (diff)
downloadyard-mruby-3a60c88a3b3dbd334e4769a6283fb90c0495c25b.tar.gz
yard-mruby-3a60c88a3b3dbd334e4769a6283fb90c0495c25b.zip
Sorting tons of stuff around
Diffstat (limited to 'spec/handlers/c/source/module_handler_spec.rb')
-rw-r--r--spec/handlers/c/source/module_handler_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/handlers/c/source/module_handler_spec.rb b/spec/handlers/c/source/module_handler_spec.rb
new file mode 100644
index 0000000..fd08ae6
--- /dev/null
+++ b/spec/handlers/c/source/module_handler_spec.rb
@@ -0,0 +1,30 @@
+require_relative 'spec_helper'
+
+describe YARD::MRuby::Handlers::C::Source::ModuleHandler do
+ it "should register modules" do
+ parse_init 'mFoo = mrb_define_module(mrb, "Foo");'
+ expect(Registry.at('Foo').type).to be :module
+ end
+
+ it "should register modules under namespaces" do
+ parse_init 'mFoo = mrb_define_module_under(mrb, mBar, "Foo");'
+ expect(Registry.at('Bar::Foo').type).to be :module
+ end
+
+ it "should remember symbol defined with module" do
+ parse_init(<<-eof)
+ cXYZ = mrb_define_module(mrb, "Foo");
+ mrb_define_method(mrb, cXYZ, "bar", bar, 0);
+ eof
+ expect(Registry.at('Foo').type).to be :module
+ expect(Registry.at('Foo#bar')).not_to be_nil
+ end
+
+ it "should associate declaration comments as module docstring" do
+ parse_init(<<-eof)
+ /* Docstring! */
+ mFoo = mrb_define_module(mrb, "Foo");
+ eof
+ expect(Registry.at('Foo').docstring).not_to be_blank
+ end
+end