bitclust-core 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +16 -0
  3. data/Gemfile +1 -7
  4. data/data/bitclust/template/class +14 -0
  5. data/data/bitclust/template/doc +1 -1
  6. data/data/bitclust/template/layout +1 -1
  7. data/data/bitclust/template.epub/class +101 -0
  8. data/data/bitclust/template.epub/class-index +28 -0
  9. data/data/bitclust/template.epub/container.xml +6 -0
  10. data/data/bitclust/template.epub/contents +23 -0
  11. data/data/bitclust/template.epub/doc +13 -0
  12. data/data/bitclust/template.epub/function +22 -0
  13. data/data/bitclust/template.epub/function-index +24 -0
  14. data/data/bitclust/template.epub/layout +19 -0
  15. data/data/bitclust/template.epub/library +75 -0
  16. data/data/bitclust/template.epub/library-index +47 -0
  17. data/data/bitclust/template.epub/method +21 -0
  18. data/data/bitclust/template.epub/mimetype +1 -0
  19. data/data/bitclust/template.epub/nav.xhtml +6 -0
  20. data/data/bitclust/template.epub/rd_file +6 -0
  21. data/data/bitclust/template.lillia/class +17 -0
  22. data/data/bitclust/template.lillia/doc +1 -1
  23. data/data/bitclust/template.lillia/layout +1 -1
  24. data/data/bitclust/template.offline/class +14 -0
  25. data/data/bitclust/template.offline/doc +1 -1
  26. data/data/bitclust/template.offline/layout +1 -1
  27. data/lib/bitclust/classentry.rb +31 -11
  28. data/lib/bitclust/docentry.rb +2 -2
  29. data/lib/bitclust/entry.rb +1 -0
  30. data/lib/bitclust/exception.rb +1 -0
  31. data/lib/bitclust/functionreferenceparser.rb +4 -3
  32. data/lib/bitclust/generators/epub.rb +118 -0
  33. data/lib/bitclust/libraryentry.rb +4 -6
  34. data/lib/bitclust/methodsignature.rb +1 -1
  35. data/lib/bitclust/nameutils.rb +12 -1
  36. data/lib/bitclust/rdcompiler.rb +101 -57
  37. data/lib/bitclust/rrdparser.rb +20 -6
  38. data/lib/bitclust/runner.rb +2 -0
  39. data/lib/bitclust/screen.rb +10 -2
  40. data/lib/bitclust/searcher.rb +4 -0
  41. data/lib/bitclust/subcommands/epub_command.rb +68 -0
  42. data/lib/bitclust/subcommands/methods_command.rb +13 -0
  43. data/lib/bitclust/subcommands/setup_command.rb +2 -2
  44. data/lib/bitclust/subcommands/statichtml_command.rb +54 -32
  45. data/lib/bitclust/version.rb +1 -1
  46. data/test/run_test.rb +0 -0
  47. data/test/test_functiondatabase.rb +3 -3
  48. data/test/test_functionreferenceparser.rb +51 -0
  49. data/test/test_methoddatabase.rb +33 -0
  50. data/test/test_nameutils.rb +13 -0
  51. data/test/test_rdcompiler.rb +176 -13
  52. data/test/test_refsdatabase.rb +8 -0
  53. metadata +41 -23
@@ -180,10 +180,10 @@ module BitClust
180
180
  f.skip_blank_lines
181
181
  read_extends f
182
182
  f.skip_blank_lines
183
- @context.klass.source = f.break(/\A=|\A---/).join('').rstrip
183
+ @context.klass.source = f.break(/\A==?[^=]|\A---/).join('').rstrip
184
184
  @context.visibility = :public
185
185
  @context.type = :singleton_method
186
- read_entries f
186
+ read_level2_blocks f
187
187
  end
188
188
 
189
189
  def read_aliases(f)
@@ -194,15 +194,21 @@ module BitClust
194
194
 
195
195
  def read_includes(f, reopen = false)
196
196
  f.while_match(/\Ainclude\s/) do |line|
197
- tty_warn "#{line.location}: dynamic include is not implemented yet" if reopen
198
- @context.include line.split[1] unless reopen # FIXME
197
+ if reopen
198
+ @context.dynamic_include(line.split[1])
199
+ else
200
+ @context.include(line.split[1])
201
+ end
199
202
  end
200
203
  end
201
204
 
202
205
  def read_extends(f, reopen = false)
203
206
  f.while_match(/\Aextend\s/) do |line|
204
- tty_warn "#{line.location}: dynamic extend is not implemented yet" if reopen
205
- @context.extend line.split[1] unless reopen # FIXME
207
+ if reopen
208
+ @context.dynamic_extend(line.split[1])
209
+ else
210
+ @context.extend(line.split[1])
211
+ end
206
212
  end
207
213
  end
208
214
 
@@ -403,6 +409,14 @@ module BitClust
403
409
  @klass.extend @db.get_class(name)
404
410
  end
405
411
 
412
+ def dynamic_include(name)
413
+ @klass.dynamic_include(@db.get_class(name), @library)
414
+ end
415
+
416
+ def dynamic_extend(name)
417
+ @klass.dynamic_extend(@db.get_class(name), @library)
418
+ end
419
+
406
420
  # Add a alias +name+ to the alias list.
407
421
  def alias(name)
408
422
  @db.open_class(name) do |c|
@@ -62,6 +62,7 @@ Subcommands(for developers):
62
62
 
63
63
  Subcommands(for packagers):
64
64
  statichtml Generate static HTML files.
65
+ epub Generate EPUB file.
65
66
  chm Generate static HTML files for CHM.
66
67
 
67
68
  Global Options:
@@ -96,6 +97,7 @@ Global Options:
96
97
  'statichtml' => BitClust::Subcommands::StatichtmlCommand.new,
97
98
  'htmlfile' => BitClust::Subcommands::HtmlfileCommand.new,
98
99
  'chm' => BitClust::Subcommands::ChmCommand.new,
100
+ 'epub' => BitClust::Subcommands::EPUBCommand.new,
99
101
  'ancestors' => BitClust::Subcommands::AncestorsCommand.new,
100
102
  'preproc' => BitClust::Subcommands::PreprocCommand.new,
101
103
  'extract' => BitClust::Subcommands::ExtractCommand.new,
@@ -392,8 +392,8 @@ module BitClust
392
392
  rdcompiler().compile_method(m, opt)
393
393
  end
394
394
 
395
- def compile_function(f)
396
- compile_rd(f.source)
395
+ def compile_function(f, opt = nil)
396
+ rdcompiler().compile_function(f, opt)
397
397
  end
398
398
 
399
399
  def compile_rd(src)
@@ -565,6 +565,14 @@ module BitClust
565
565
 
566
566
  class DocScreen < EntryBoundScreen
567
567
 
568
+ def breadcrumb_title
569
+ if /ascii/ =~ @conf[:encoding]
570
+ @entry.name
571
+ else
572
+ @entry.title
573
+ end
574
+ end
575
+
568
576
  def body
569
577
  run_template('doc')
570
578
  end
@@ -98,6 +98,10 @@ module BitClust
98
98
  end
99
99
  end
100
100
 
101
+ def help
102
+ @parser.help
103
+ end
104
+
101
105
  private
102
106
 
103
107
  def server_mode_check(argv)
@@ -0,0 +1,68 @@
1
+ require 'fileutils'
2
+ require 'date'
3
+
4
+ require 'bitclust'
5
+ require 'bitclust/subcommand'
6
+ require 'bitclust/generators/epub'
7
+
8
+ module BitClust
9
+ module Subcommands
10
+ class EPUBCommand < Subcommand
11
+ def initialize
12
+ super
13
+ @verbose = true
14
+ @catalogdir = nil
15
+ @templatedir = srcdir_root + "data/bitclust/template.epub"
16
+ @themedir = srcdir_root + "theme/default"
17
+ @filename = "rurema-#{Date.today}.epub"
18
+ @keep = false
19
+ @parser.banner = "Usage: #{File.basename($0, '.*')} epub [options]"
20
+ @parser.on('-o', '--outputdir=PATH', 'Output directory') do |path|
21
+ begin
22
+ @outputdir = Pathname.new(path).realpath
23
+ rescue Errno::ENOENT
24
+ FileUtils.mkdir_p(path, :verbose => @verbose)
25
+ retry
26
+ end
27
+ end
28
+ @parser.on('-f', '--filename=FILENAME',
29
+ "Filename of generated EPUB file [#{@filename}]") do |filename|
30
+ @filename = filename
31
+ end
32
+ @parser.on('--[no-]keep', 'Keep all generated files (for debug) [false]') do |keep|
33
+ @keep = keep
34
+ end
35
+ @parser.on('--catalog=PATH', 'Catalog directory') do |path|
36
+ @catalogdir = Pathname.new(path).realpath
37
+ end
38
+ @parser.on('--templatedir=PATH', 'Template directory') do |path|
39
+ @templatedir = Pathname.new(path).realpath
40
+ end
41
+ @parser.on('--themedir=PATH', 'Theme directory') do |path|
42
+ @themedir = Pathname.new(path).realpath
43
+ end
44
+ @parser.on('--fs-casesensitive', 'Filesystem is case-sensitive') do
45
+ @fs_casesensitive = true
46
+ end
47
+ @parser.on('--[no-]quiet', 'Be quiet') do |quiet|
48
+ @verbose = !quiet
49
+ end
50
+ end
51
+
52
+ def exec(argv, options)
53
+ generator = BitClust::Generators::EPUB.new(:prefix => options[:prefix],
54
+ :capi => options[:capi],
55
+ :outputdir => @outputdir,
56
+ :catalog => @catalog,
57
+ :templatedir => @templatedir,
58
+ :themedir => @themedir,
59
+ :fs_casesensitive => @fs_casesensitive,
60
+ :verbose => @verbose,
61
+ :keep => @keep,
62
+ :filename => @filename)
63
+ generator.generate
64
+ end
65
+ end
66
+ end
67
+
68
+ end
@@ -137,6 +137,19 @@ module BitClust
137
137
  puts "#{classname}\#{m}"
138
138
  end
139
139
  SCRIPT
140
+ when 'ARGF'
141
+ script = <<-SCRIPT
142
+ c = #{classname}.class
143
+ c.singleton_methods(false).each do |m|
144
+ puts "\#{c.to_s}.\#{m}"
145
+ end
146
+ c.instance_methods(false).each do |m|
147
+ puts "\#{c.to_s}\\#\#{m}"
148
+ end
149
+ c.ancestors.map {|mod| mod.constants }.inject {|r,n| r - n }.each do |m|
150
+ puts "\#{c.to_s}::\#{m}"
151
+ end
152
+ SCRIPT
140
153
  else
141
154
  script = <<-SCRIPT
142
155
  #{avoid_tracer}
@@ -19,7 +19,7 @@ module BitClust
19
19
  @prepare = nil
20
20
  @cleanup = nil
21
21
  @purge = nil
22
- @versions = ["1.8.7", "1.9.3", "2.0.0"]
22
+ @versions = ["2.0.0", "2.1.0", "2.2.0"]
23
23
  @parser.banner = "Usage: #{File.basename($0, '.*')} setup [options]"
24
24
  @parser.on('--prepare', 'Prepare config file and checkout repository. Do not create database.') {
25
25
  @prepare = true
@@ -64,7 +64,7 @@ module BitClust
64
64
  end
65
65
 
66
66
  def prepare
67
- home_directory = Pathname(ENV["HOME"])
67
+ home_directory = Pathname(ENV["HOME"]).expand_path
68
68
  config_dir = home_directory + ".bitclust"
69
69
  config_dir.mkpath
70
70
  config_path = config_dir + "config"
@@ -7,6 +7,7 @@
7
7
  require 'fileutils'
8
8
 
9
9
  require 'bitclust'
10
+ require 'bitclust/nameutils'
10
11
  require 'bitclust/subcommand'
11
12
  require 'bitclust/progress_bar'
12
13
  require 'bitclust/silent_progress_bar'
@@ -14,54 +15,69 @@ require 'bitclust/silent_progress_bar'
14
15
  module BitClust
15
16
  module Subcommands
16
17
  class StatichtmlCommand < Subcommand
18
+ include NameUtils
19
+
17
20
  class URLMapperEx < URLMapper
21
+ include NameUtils
22
+
23
+ attr_accessor :bitclust_html_base
24
+
25
+ def initialize(h)
26
+ super
27
+ @bitclust_html_base = ""
28
+ @suffix = h[:suffix]
29
+ end
30
+
18
31
  def library_url(name)
19
32
  if name == '/'
20
- $bitclust_html_base + "/library/index.html"
33
+ @bitclust_html_base + "/library/#{html_filename("index", @suffix)}"
21
34
  else
22
- $bitclust_html_base + "/library/#{encodename_package(name)}.html"
35
+ @bitclust_html_base + "/library/#{html_filename(encodename_package(name), @suffix)}"
23
36
  end
24
37
  end
25
38
 
26
39
  def class_url(name)
27
- $bitclust_html_base + "/class/#{encodename_package(name)}.html"
40
+ @bitclust_html_base + "/class/#{html_filename(encodename_package(name), @suffix)}"
28
41
  end
29
42
 
30
43
  def method_url(spec)
31
44
  cname, tmark, mname = *split_method_spec(spec)
32
- $bitclust_html_base +
33
- "/method/#{encodename_package(cname)}/#{typemark2char(tmark)}/#{encodename_package(mname)}.html"
45
+ filename = html_filename(encodename_package(mname), @suffix)
46
+ @bitclust_html_base +
47
+ "/method/#{encodename_package(cname)}/#{typemark2char(tmark)}/#{filename}"
34
48
  end
35
49
 
36
50
  def function_url(name)
37
- $bitclust_html_base + "/function/#{name.empty? ? 'index' : name}.html"
51
+ filename = html_filename(name.empty? ? 'index' : name, @suffix)
52
+ @bitclust_html_base + "/function/#{filename}"
38
53
  end
39
54
 
40
55
  def document_url(name)
41
- $bitclust_html_base + "/doc/#{encodename_package(name)}.html"
56
+ filename = html_filename(encodename_package(name), @suffix)
57
+ @bitclust_html_base + "/doc/#{filename}"
42
58
  end
43
59
 
44
60
  def css_url
45
- $bitclust_html_base + "/" + @css_url
61
+ @bitclust_html_base + "/" + @css_url
46
62
  end
47
63
 
48
64
  def favicon_url
49
- $bitclust_html_base + "/" + @favicon_url
65
+ @bitclust_html_base + "/" + @favicon_url
50
66
  end
51
67
 
52
68
  def library_index_url
53
- $bitclust_html_base + "/library/index.html"
69
+ @bitclust_html_base + "/library/#{html_filename("index", @suffix)}"
54
70
  end
55
71
 
56
72
  def function_index_url
57
- $bitclust_html_base + "/function/index.html"
73
+ @bitclust_html_base + "/function/#{html_filename("index", @suffix)}"
58
74
  end
59
75
 
60
76
  def encodename_package(str)
61
- if $fs_casesensitive
62
- NameUtils.encodename_url(str)
77
+ if @fs_casesensitive
78
+ encodename_url(str)
63
79
  else
64
- NameUtils.encodename_fs(str)
80
+ encodename_fs(str)
65
81
  end
66
82
  end
67
83
  end
@@ -75,6 +91,7 @@ module BitClust
75
91
  @catalogdir = nil
76
92
  @templatedir = srcdir_root + "data/bitclust/template.offline"
77
93
  @themedir = srcdir_root + "theme/default"
94
+ @suffix = ".html"
78
95
  @parser.banner = "Usage: #{File.basename($0, '.*')} statichtml [options]"
79
96
  @parser.on('-o', '--outputdir=PATH', 'Output directory') do |path|
80
97
  begin
@@ -93,8 +110,11 @@ module BitClust
93
110
  @parser.on('--themedir=PATH', 'Theme directory') do |path|
94
111
  @themedir = Pathname.new(path).realpath
95
112
  end
113
+ @parser.on('--suffix=SUFFIX', 'Suffix for each (X)HTML file [.html]') do |suffix|
114
+ @suffix = suffix
115
+ end
96
116
  @parser.on('--fs-casesensitive', 'Filesystem is case-sensitive') do
97
- $fs_casesensitive = true
117
+ @fs_casesensitive = true
98
118
  end
99
119
  @parser.on('--[no-]quiet', 'Be quiet') do |quiet|
100
120
  @verbose = !quiet
@@ -128,14 +148,14 @@ module BitClust
128
148
  create_html_entries("capi", fdb.functions, manager, fdb)
129
149
  end
130
150
 
131
- $bitclust_html_base = '..'
132
- create_file(@outputdir + 'library/index.html',
151
+ @urlmapper.bitclust_html_base = '..'
152
+ create_file(@outputdir + "library/#{html_filename("index", @suffix)}",
133
153
  manager.library_index_screen(db.libraries.sort, {:database => db}).body,
134
154
  :verbose => @verbose)
135
- create_file(@outputdir + 'class/index.html',
155
+ create_file(@outputdir + "class/#{html_filename("index", @suffix)}",
136
156
  manager.class_index_screen(db.classes.sort, {:database => db}).body,
137
157
  :verbose => @verbose)
138
- create_file(@outputdir + 'function/index.html',
158
+ create_file(@outputdir + "function/#{html_filename("index", @suffix)}",
139
159
  manager.function_index_screen(fdb.functions.sort, { :database => fdb }).body,
140
160
  :verbose => @verbose)
141
161
  create_index_html(@outputdir)
@@ -159,7 +179,7 @@ module BitClust
159
179
  def create_manager_config
160
180
  @manager_config = {
161
181
  :catalogdir => @catalogdir,
162
- :suffix => '.html',
182
+ :suffix => @suffix,
163
183
  :templatedir => @templatedir,
164
184
  :themedir => @themedir,
165
185
  :css_url => 'style.css',
@@ -168,6 +188,7 @@ module BitClust
168
188
  :tochm_mode => true
169
189
  }
170
190
  @manager_config[:urlmapper] = URLMapperEx.new(@manager_config)
191
+ @urlmapper = @manager_config[:urlmapper]
171
192
  end
172
193
 
173
194
  def create_html_entries(title, entries, manager, db)
@@ -203,11 +224,12 @@ module BitClust
203
224
  end
204
225
 
205
226
  def create_index_html(outputdir)
206
- path = outputdir + 'index.html'
227
+ index_filename = html_filename("index", @suffix)
228
+ path = outputdir + index_filename
207
229
  File.open(path, 'w'){|io|
208
230
  io.write <<HERE
209
- <meta http-equiv="refresh" content="0; URL=doc/index.html">
210
- <a href="doc/index.html">Go</a>
231
+ <meta http-equiv="refresh" content="0; URL=doc/#{index_filename}">
232
+ <a href="doc/#{index_filename}">Go</a>
211
233
  HERE
212
234
  }
213
235
  end
@@ -216,8 +238,8 @@ HERE
216
238
  e = entry.is_a?(Array) ? entry.sort.first : entry
217
239
  case e.type_id
218
240
  when :library, :class, :doc
219
- $bitclust_html_base = '..'
220
- path = outputdir + e.type_id.to_s + (encodename_package(e.name) + '.html')
241
+ @urlmapper.bitclust_html_base = '..'
242
+ path = outputdir + e.type_id.to_s + html_filename(encodename_package(e.name), @suffix)
221
243
  create_html_file_p(entry, manager, path, db)
222
244
  path.relative_path_from(outputdir).to_s
223
245
  when :function
@@ -230,19 +252,19 @@ HERE
230
252
 
231
253
  def create_html_method_file(method_name, entries, manager, outputdir, db)
232
254
  path = nil
233
- $bitclust_html_base = '../../..'
255
+ @urlmapper.bitclust_html_base = '../../..'
234
256
  e = entries.sort.first
235
257
  name = method_name.sub(e.klass.name + e.typemark, "")
236
258
  path = outputdir + e.type_id.to_s + encodename_package(e.klass.name) +
237
- e.typechar + (encodename_package(name) + '.html')
259
+ e.typechar + html_filename(encodename_package(name), @suffix)
238
260
  create_html_file_p(entries, manager, path, db)
239
261
  path.relative_path_from(outputdir).to_s
240
262
  end
241
263
 
242
264
  def create_html_function_file(entry, manager, outputdir, db)
243
265
  path = nil
244
- $bitclust_html_base = '..'
245
- path = outputdir + entry.type_id.to_s + (entry.name + '.html')
266
+ @urlmapper.bitclust_html_base = '..'
267
+ path = outputdir + entry.type_id.to_s + html_filename(entry.name, @suffix)
246
268
  create_html_file_p(entry, manager, path, db)
247
269
  path.relative_path_from(outputdir).to_s
248
270
  end
@@ -265,10 +287,10 @@ HERE
265
287
  end
266
288
 
267
289
  def encodename_package(str)
268
- if $fs_casesensitive
269
- NameUtils.encodename_url(str)
290
+ if @fs_casesensitive
291
+ encodename_url(str)
270
292
  else
271
- NameUtils.encodename_fs(str)
293
+ encodename_fs(str)
272
294
  end
273
295
  end
274
296
  end
@@ -1,3 +1,3 @@
1
1
  module BitClust
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
data/test/run_test.rb CHANGED
File without changes
@@ -1,6 +1,6 @@
1
1
  require 'test/unit'
2
2
  require 'bitclust'
3
- require 'bitclust/database/functiondatabase'
3
+ require 'bitclust/functiondatabase'
4
4
  require 'tmpdir'
5
5
  require 'fileutils'
6
6
 
@@ -22,7 +22,7 @@ some text
22
22
  some text
23
23
  HERE
24
24
  end
25
- @db = BitClust::Database::FunctionDatabase.new(prefix)
25
+ @db = BitClust::FunctionDatabase.new(prefix)
26
26
  @db.transaction {
27
27
  @db.update_by_file(src, src)
28
28
  }
@@ -48,7 +48,7 @@ HERE
48
48
  end
49
49
 
50
50
  def test_search_functions__nonexistent
51
- assert_raise(BitClust::Database::FunctionNotFound) do
51
+ assert_raise(BitClust::FunctionNotFound) do
52
52
  @db.search_functions('nonexistent')
53
53
  end
54
54
  end
@@ -0,0 +1,51 @@
1
+ require 'test/unit'
2
+ require 'bitclust'
3
+ require 'bitclust/functionreferenceparser'
4
+
5
+ class TestFunctionReferenceParser < Test::Unit::TestCase
6
+ def setup
7
+ prefix = 'db'
8
+ src = "test.rd"
9
+
10
+ @pwd = Dir.pwd
11
+ Dir.chdir(@tmpdir = Dir.mktmpdir)
12
+ File.open(src, 'w') do |file|
13
+ file.puts <<'HERE'
14
+ --- VALUE func()
15
+ #@since 2.0.0
16
+ some text 1
17
+ #@else
18
+ some text 2
19
+ #@end
20
+ HERE
21
+ end
22
+ @path = File.join(@tmpdir, src)
23
+ @db = BitClust::FunctionDatabase.new(prefix)
24
+ @parser = BitClust::FunctionReferenceParser.new(@db)
25
+ end
26
+
27
+ def teardown
28
+ Dir.chdir @pwd
29
+ FileUtils.rm_r(@tmpdir, :force => true)
30
+ end
31
+
32
+ data("1.9.3" => {
33
+ :version => "1.9.3",
34
+ :expected => ["some text 2\n"],
35
+ },
36
+ "2.0.0" => {
37
+ :version => "2.0.0",
38
+ :expected => ["some text 1\n"],
39
+ },
40
+ "2.1.0" => {
41
+ :version => "2.1.0",
42
+ :expected => ["some text 1\n"],
43
+ })
44
+ def test_parse_file(data)
45
+ @db.transaction {
46
+ result =
47
+ @parser.parse_file(@path, "test.c", {"version" => data[:version]})
48
+ assert_equal data[:expected], result.collect(&:source)
49
+ }
50
+ end
51
+ end
@@ -50,12 +50,25 @@ class TestMethodDatabase < Test::Unit::TestCase
50
50
  assert_equal 'AAA', result.records.first.entry.name
51
51
  end
52
52
 
53
+ def test_dynamic_include
54
+ assert_equal(["BazA"],
55
+ @db.get_class("A").dynamically_included.map{|m| m.name})
56
+ assert_equal(["BazB"],
57
+ @db.get_class("B").dynamically_included.map{|m| m.name})
58
+ end
59
+
53
60
  private
54
61
  def setup_files
55
62
  FileUtils.mkdir_p("#{@root}/_builtin")
63
+
56
64
  File.open("#{@root}/LIBRARIES", 'w+') do |file|
57
65
  file.puts '_builtin'
66
+ file.puts 'dyn_include_open_a'
67
+ file.puts 'dyn_include_reopen_a'
68
+ file.puts 'dyn_include_reopen_b'
69
+ file.puts 'dyn_include_open_b'
58
70
  end
71
+
59
72
  File.open("#{@root}/_builtin.rd", 'w+') do |file|
60
73
  file.puts <<'HERE'
61
74
  description
@@ -77,5 +90,25 @@ aaa
77
90
 
78
91
  HERE
79
92
  end
93
+
94
+ File.open("#{@root}/dyn_include_open_a.rd", 'w+') do |file|
95
+ file.puts "= class A"
96
+ end
97
+
98
+ File.open("#{@root}/dyn_include_reopen_a.rd", 'w+') do |file|
99
+ file.puts "= module BazA"
100
+ file.puts "= reopen A"
101
+ file.puts "include BazA"
102
+ end
103
+
104
+ File.open("#{@root}/dyn_include_open_b.rd", 'w+') do |file|
105
+ file.puts "= class B"
106
+ end
107
+
108
+ File.open("#{@root}/dyn_include_reopen_b.rd", 'w+') do |file|
109
+ file.puts "= module BazB"
110
+ file.puts "= reopen B"
111
+ file.puts "include BazB"
112
+ end
80
113
  end
81
114
  end
@@ -340,6 +340,19 @@ class TestNameUtils < Test::Unit::TestCase
340
340
  assert_equal(expected, decodename_url(target))
341
341
  end
342
342
 
343
+ data("Array" => ["Array", "Array"],
344
+ "String" => ["String", "String"],
345
+ "index" => ["index", "index"],
346
+ "*" => ["2A", "*"],
347
+ "**" => ["2A-2A", "**"],
348
+ "<=>" => ["3C-3D-3E", "<=>"],
349
+ "open-uri" => ["open-2Duri", "open-uri"],
350
+ "net.http" => ["net.http", "net.http"])
351
+ def test_encodename_rdocurl(data)
352
+ expected, target = data
353
+ assert_equal(expected, encodename_rdocurl(target))
354
+ end
355
+
343
356
  data("Array" => ["-array", "Array"],
344
357
  "String" => ["-string", "String"],
345
358
  "CGI" => ["-c-g-i", "CGI"],