aboutsummaryrefslogtreecommitdiffstats
path: root/test/rdoc/test_rdoc_any_method.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-27 01:30:18 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-27 01:30:18 +0000
commit95e213d3542034e0fd2613de6990a7ddfe5718ca (patch)
tree76ec64fccb338dbcbc4d3f07c2f494ef9b7fe1ff /test/rdoc/test_rdoc_any_method.rb
parent41fb243684f60e231fc77ec54752fe4e844523d5 (diff)
downloadruby-95e213d3542034e0fd2613de6990a7ddfe5718ca.tar.gz
Merge rdoc-6.1.0.beta1.
* https://github.com/ruby/rdoc/compare/v6.0.4...v6.1.0.beta1 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_any_method.rb')
-rw-r--r--test/rdoc/test_rdoc_any_method.rb31
1 files changed, 29 insertions, 2 deletions
diff --git a/test/rdoc/test_rdoc_any_method.rb b/test/rdoc/test_rdoc_any_method.rb
index b5281f611d..6dd46b0b46 100644
--- a/test/rdoc/test_rdoc_any_method.rb
+++ b/test/rdoc/test_rdoc_any_method.rb
@@ -85,6 +85,33 @@ method(a, b) { |c, d| ... }
assert_equal expected, @c2_a.markup_code
end
+ def test_markup_code_with_line_numbers
+ position_comment = "# File #{@file_name}, line 1"
+ tokens = [
+ { :line_no => 1, :char_no => 0, :kind => :on_comment, :text => position_comment },
+ { :line_no => 1, :char_no => position_comment.size, :kind => :on_nl, :text => "\n" },
+ { :line_no => 2, :char_no => 0, :kind => :on_const, :text => 'A' },
+ { :line_no => 2, :char_no => 1, :kind => :on_nl, :text => "\n" },
+ { :line_no => 3, :char_no => 0, :kind => :on_const, :text => 'B' }
+ ]
+
+ @c2_a.collect_tokens
+ @c2_a.add_tokens(*tokens)
+
+ assert_equal <<-EXPECTED.chomp, @c2_a.markup_code
+<span class="ruby-comment"># File xref_data.rb, line 1</span>
+<span class="ruby-constant">A</span>
+<span class="ruby-constant">B</span>
+ EXPECTED
+
+ @options.line_numbers = true
+ assert_equal <<-EXPECTED.chomp, @c2_a.markup_code
+ <span class="ruby-comment"># File xref_data.rb</span>
+<span class="line-num">1</span> <span class="ruby-constant">A</span>
+<span class="line-num">2</span> <span class="ruby-constant">B</span>
+ EXPECTED
+ end
+
def test_markup_code_empty
assert_equal '', @c2_a.markup_code
end
@@ -165,7 +192,7 @@ method(a, b) { |c, d| ... }
end
def test_marshal_load_class_method
- class_method = Marshal.load Marshal.dump(@c1.method_list.first)
+ class_method = Marshal.load Marshal.dump(@c1.find_class_method_named 'm')
assert_equal 'C1::m', class_method.full_name
assert_equal 'C1', class_method.parent_name
@@ -174,7 +201,7 @@ method(a, b) { |c, d| ... }
end
def test_marshal_load_instance_method
- instance_method = Marshal.load Marshal.dump(@c1.method_list.last)
+ instance_method = Marshal.load Marshal.dump(@c1.find_instance_method_named 'm')
assert_equal 'C1#m', instance_method.full_name
assert_equal 'C1', instance_method.parent_name