summaryrefslogtreecommitdiff
path: root/test/rdoc
diff options
context:
space:
mode:
authorUlysse Buonomo <buonomo.ulysse@gmail.com>2022-02-10 03:31:06 +0100
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-02-12 15:06:06 +0900
commit5348a34504a67597e3a3ed98a3020dfd762241ad (patch)
tree7f9f69344798fa039d3f382974f92d26f3369aa3 /test/rdoc
parent08137c5dd99354225874abc95280188738030794 (diff)
[ruby/rdoc] Relative loading for easier development (https://github.com/ruby/rdoc/pull/821)
This patch makes sure we only load relative code. Hence when coding or testing rdoc, we'll be sure to always be using the correct code. Discussion started at https://github.com/ruby/rdoc/pull/817. Signed-off-by: Ulysse Buonomo <buonomo.ulysse@gmail.com> https://github.com/ruby/rdoc/commit/aa41bd48eb Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Diffstat (limited to 'test/rdoc')
-rw-r--r--test/rdoc/helper.rb6
-rw-r--r--test/rdoc/support/test_case.rb2
-rw-r--r--test/rdoc/test_rdoc_alias.rb3
-rw-r--r--test/rdoc/test_rdoc_any_method.rb2
-rw-r--r--test/rdoc/test_rdoc_class_module.rb3
-rw-r--r--test/rdoc/test_rdoc_code_object.rb2
-rw-r--r--test/rdoc/test_rdoc_constant.rb2
-rw-r--r--test/rdoc/test_rdoc_context.rb2
-rw-r--r--test/rdoc/test_rdoc_cross_reference.rb3
-rw-r--r--test/rdoc/test_rdoc_extend.rb3
-rw-r--r--test/rdoc/test_rdoc_include.rb3
-rw-r--r--test/rdoc/test_rdoc_markdown.rb5
-rw-r--r--test/rdoc/test_rdoc_markdown_test.rb4
-rw-r--r--test/rdoc/test_rdoc_markup_to_html_crossref.rb3
-rw-r--r--test/rdoc/test_rdoc_method_attr.rb3
-rw-r--r--test/rdoc/test_rdoc_normal_class.rb3
-rw-r--r--test/rdoc/test_rdoc_normal_module.rb3
-rw-r--r--test/rdoc/test_rdoc_require.rb3
-rw-r--r--test/rdoc/test_rdoc_ri_driver.rb4
-rw-r--r--test/rdoc/test_rdoc_rubygems_hook.rb10
-rw-r--r--test/rdoc/test_rdoc_store.rb2
-rw-r--r--test/rdoc/test_rdoc_task.rb1
-rw-r--r--test/rdoc/test_rdoc_top_level.rb3
23 files changed, 31 insertions, 44 deletions
diff --git a/test/rdoc/helper.rb b/test/rdoc/helper.rb
index 2ba26c296b..7985433060 100644
--- a/test/rdoc/helper.rb
+++ b/test/rdoc/helper.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative './support/test_case'
-require_relative './support/formatter_test_case'
-require_relative './support/text_formatter_test_case'
+require_relative 'support/test_case'
+require_relative 'support/formatter_test_case'
+require_relative 'support/text_formatter_test_case'
diff --git a/test/rdoc/support/test_case.rb b/test/rdoc/support/test_case.rb
index 7617fc8471..36009111e2 100644
--- a/test/rdoc/support/test_case.rb
+++ b/test/rdoc/support/test_case.rb
@@ -13,7 +13,7 @@ require 'tempfile'
require 'tmpdir'
require 'stringio'
-require 'rdoc'
+require_relative '../../../lib/rdoc'
##
# RDoc::TestCase is an abstract TestCase to provide common setup and teardown
diff --git a/test/rdoc/test_rdoc_alias.rb b/test/rdoc/test_rdoc_alias.rb
index 89ae2d5a56..3c096a49b4 100644
--- a/test/rdoc/test_rdoc_alias.rb
+++ b/test/rdoc/test_rdoc_alias.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require File.expand_path '../xref_test_case', __FILE__
+require_relative 'xref_test_case'
class TestRDocAlias < XrefTestCase
@@ -11,4 +11,3 @@ class TestRDocAlias < XrefTestCase
end
end
-
diff --git a/test/rdoc/test_rdoc_any_method.rb b/test/rdoc/test_rdoc_any_method.rb
index caff86b059..826ef1c8d8 100644
--- a/test/rdoc/test_rdoc_any_method.rb
+++ b/test/rdoc/test_rdoc_any_method.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require File.expand_path '../xref_test_case', __FILE__
+require_relative 'xref_test_case'
class TestRDocAnyMethod < XrefTestCase
diff --git a/test/rdoc/test_rdoc_class_module.rb b/test/rdoc/test_rdoc_class_module.rb
index 13021b9cc7..27d37cb7dd 100644
--- a/test/rdoc/test_rdoc_class_module.rb
+++ b/test/rdoc/test_rdoc_class_module.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require File.expand_path '../xref_test_case', __FILE__
+require_relative 'xref_test_case'
class TestRDocClassModule < XrefTestCase
@@ -1501,4 +1501,3 @@ class TestRDocClassModule < XrefTestCase
end
end
-
diff --git a/test/rdoc/test_rdoc_code_object.rb b/test/rdoc/test_rdoc_code_object.rb
index fad182722a..24e228cce1 100644
--- a/test/rdoc/test_rdoc_code_object.rb
+++ b/test/rdoc/test_rdoc_code_object.rb
@@ -1,7 +1,7 @@
# coding: US-ASCII
# frozen_string_literal: true
-require File.expand_path '../xref_test_case', __FILE__
+require_relative 'xref_test_case'
class TestRDocCodeObject < XrefTestCase
diff --git a/test/rdoc/test_rdoc_constant.rb b/test/rdoc/test_rdoc_constant.rb
index 79dcdad57e..32ffe3f84d 100644
--- a/test/rdoc/test_rdoc_constant.rb
+++ b/test/rdoc/test_rdoc_constant.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require File.expand_path '../xref_test_case', __FILE__
+require_relative 'xref_test_case'
class TestRDocConstant < XrefTestCase
diff --git a/test/rdoc/test_rdoc_context.rb b/test/rdoc/test_rdoc_context.rb
index f77fb31383..85665599fb 100644
--- a/test/rdoc/test_rdoc_context.rb
+++ b/test/rdoc/test_rdoc_context.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require File.expand_path '../xref_test_case', __FILE__
+require_relative 'xref_test_case'
class TestRDocContext < XrefTestCase
diff --git a/test/rdoc/test_rdoc_cross_reference.rb b/test/rdoc/test_rdoc_cross_reference.rb
index 0417bf5d50..fee6fe59eb 100644
--- a/test/rdoc/test_rdoc_cross_reference.rb
+++ b/test/rdoc/test_rdoc_cross_reference.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require File.expand_path '../xref_test_case', __FILE__
+require_relative 'xref_test_case'
class TestRDocCrossReference < XrefTestCase
OPERATOR_METHODS = %w'== === != =~ !~ < > <= >= <=> [] []= << >> -@ +@ ! - + * / % ** !@ ` | & ^ ~'
@@ -215,4 +215,3 @@ class TestRDocCrossReference < XrefTestCase
end
end
-
diff --git a/test/rdoc/test_rdoc_extend.rb b/test/rdoc/test_rdoc_extend.rb
index e78f287b83..cc5038cc51 100644
--- a/test/rdoc/test_rdoc_extend.rb
+++ b/test/rdoc/test_rdoc_extend.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require File.expand_path '../xref_test_case', __FILE__
+require_relative 'xref_test_case'
class TestRDocExtend < XrefTestCase
@@ -92,4 +92,3 @@ class TestRDocExtend < XrefTestCase
end
end
-
diff --git a/test/rdoc/test_rdoc_include.rb b/test/rdoc/test_rdoc_include.rb
index b8e8f26039..380464f6cc 100644
--- a/test/rdoc/test_rdoc_include.rb
+++ b/test/rdoc/test_rdoc_include.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require File.expand_path '../xref_test_case', __FILE__
+require_relative 'xref_test_case'
class TestRDocInclude < XrefTestCase
@@ -107,4 +107,3 @@ class TestRDocInclude < XrefTestCase
end
end
-
diff --git a/test/rdoc/test_rdoc_markdown.rb b/test/rdoc/test_rdoc_markdown.rb
index ad53e9473c..c223c44c12 100644
--- a/test/rdoc/test_rdoc_markdown.rb
+++ b/test/rdoc/test_rdoc_markdown.rb
@@ -2,8 +2,8 @@
# frozen_string_literal: true
require_relative 'helper'
-require 'rdoc/markup/block_quote'
-require 'rdoc/markdown'
+require_relative '../../lib/rdoc/markup/block_quote'
+require_relative '../../lib/rdoc/markdown'
class TestRDocMarkdown < RDoc::TestCase
@@ -1068,4 +1068,3 @@ and an extra note.[^2]
end
end
-
diff --git a/test/rdoc/test_rdoc_markdown_test.rb b/test/rdoc/test_rdoc_markdown_test.rb
index 0ecd000136..d4f894c924 100644
--- a/test/rdoc/test_rdoc_markdown_test.rb
+++ b/test/rdoc/test_rdoc_markdown_test.rb
@@ -2,8 +2,8 @@
require_relative 'helper'
require 'pp'
-require 'rdoc'
-require 'rdoc/markdown'
+require_relative '../../lib/rdoc'
+require_relative '../../lib/rdoc/markdown'
class TestRDocMarkdownTest < RDoc::TestCase
diff --git a/test/rdoc/test_rdoc_markup_to_html_crossref.rb b/test/rdoc/test_rdoc_markup_to_html_crossref.rb
index f6fabfb7db..1c778a4fad 100644
--- a/test/rdoc/test_rdoc_markup_to_html_crossref.rb
+++ b/test/rdoc/test_rdoc_markup_to_html_crossref.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require File.expand_path '../xref_test_case', __FILE__
+require_relative 'xref_test_case'
class TestRDocMarkupToHtmlCrossref < XrefTestCase
@@ -260,4 +260,3 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
end
end
-
diff --git a/test/rdoc/test_rdoc_method_attr.rb b/test/rdoc/test_rdoc_method_attr.rb
index 68a9d6cc21..d607619a60 100644
--- a/test/rdoc/test_rdoc_method_attr.rb
+++ b/test/rdoc/test_rdoc_method_attr.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require File.expand_path '../xref_test_case', __FILE__
+require_relative 'xref_test_case'
class TestRDocMethodAttr < XrefTestCase
@@ -191,4 +191,3 @@ class TestRDocMethodAttr < XrefTestCase
end
end
-
diff --git a/test/rdoc/test_rdoc_normal_class.rb b/test/rdoc/test_rdoc_normal_class.rb
index 7cb5e4bfc7..3d097ebb52 100644
--- a/test/rdoc/test_rdoc_normal_class.rb
+++ b/test/rdoc/test_rdoc_normal_class.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require File.expand_path '../xref_test_case', __FILE__
+require_relative 'xref_test_case'
class TestRDocNormalClass < XrefTestCase
@@ -45,4 +45,3 @@ class TestRDocNormalClass < XrefTestCase
end
end
-
diff --git a/test/rdoc/test_rdoc_normal_module.rb b/test/rdoc/test_rdoc_normal_module.rb
index 68e776c41f..cccee5c44c 100644
--- a/test/rdoc/test_rdoc_normal_module.rb
+++ b/test/rdoc/test_rdoc_normal_module.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require File.expand_path '../xref_test_case', __FILE__
+require_relative 'xref_test_case'
class TestRDocNormalModule < XrefTestCase
@@ -40,4 +40,3 @@ class TestRDocNormalModule < XrefTestCase
end
end
-
diff --git a/test/rdoc/test_rdoc_require.rb b/test/rdoc/test_rdoc_require.rb
index 46c225299a..4cc53e6c6c 100644
--- a/test/rdoc/test_rdoc_require.rb
+++ b/test/rdoc/test_rdoc_require.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require File.expand_path '../xref_test_case', __FILE__
+require_relative 'xref_test_case'
class TestRDocRequire < XrefTestCase
@@ -23,4 +23,3 @@ class TestRDocRequire < XrefTestCase
end
end
-
diff --git a/test/rdoc/test_rdoc_ri_driver.rb b/test/rdoc/test_rdoc_ri_driver.rb
index 87e4ebd2b1..5f3468c368 100644
--- a/test/rdoc/test_rdoc_ri_driver.rb
+++ b/test/rdoc/test_rdoc_ri_driver.rb
@@ -32,8 +32,8 @@ class TestRDocRIDriver < RDoc::TestCase
end
def teardown
- ENV['RI'] = @orig_ri
- FileUtils.rm_rf @tmpdir
+ defined?(@orig_ri) and ENV['RI'] = @orig_ri
+ defined?(@tmpdir) and FileUtils.rm_rf @tmpdir
super
end
diff --git a/test/rdoc/test_rdoc_rubygems_hook.rb b/test/rdoc/test_rdoc_rubygems_hook.rb
index 04f84d4bcc..59a7ed0f89 100644
--- a/test/rdoc/test_rdoc_rubygems_hook.rb
+++ b/test/rdoc/test_rdoc_rubygems_hook.rb
@@ -1,9 +1,9 @@
# frozen_string_literal: true
-require "rubygems"
-require "fileutils"
-require "tmpdir"
-require 'rdoc/rubygems_hook'
-require "test/unit"
+require 'rubygems'
+require 'fileutils'
+require 'tmpdir'
+require_relative '../../lib/rdoc/rubygems_hook'
+require 'test/unit'
class TestRDocRubygemsHook < Test::Unit::TestCase
def setup
diff --git a/test/rdoc/test_rdoc_store.rb b/test/rdoc/test_rdoc_store.rb
index 0abad42328..aa4db4c65e 100644
--- a/test/rdoc/test_rdoc_store.rb
+++ b/test/rdoc/test_rdoc_store.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require File.expand_path '../xref_test_case', __FILE__
+require_relative 'xref_test_case'
class TestRDocStore < XrefTestCase
diff --git a/test/rdoc/test_rdoc_task.rb b/test/rdoc/test_rdoc_task.rb
index 77f2af33a3..23add7d5fe 100644
--- a/test/rdoc/test_rdoc_task.rb
+++ b/test/rdoc/test_rdoc_task.rb
@@ -171,4 +171,3 @@ class TestRDocTask < RDoc::TestCase
end
end if defined?(Rake::Task)
-
diff --git a/test/rdoc/test_rdoc_top_level.rb b/test/rdoc/test_rdoc_top_level.rb
index 3f6d153b68..3cfaa9b763 100644
--- a/test/rdoc/test_rdoc_top_level.rb
+++ b/test/rdoc/test_rdoc_top_level.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require File.expand_path '../xref_test_case', __FILE__
+require_relative 'xref_test_case'
class TestRDocTopLevel < XrefTestCase
@@ -288,4 +288,3 @@ class TestRDocTopLevel < XrefTestCase
end
end
-