Skip to content

Commit 0b9433d

Browse files
authored
Rename test classes from Test* to *Test (#1359)
Since class names are usually nouns, test classes should be named like `ClassNameTest` instead of `TestClassName`. This convention is now commonly used in projects (e.g. Rails) and tools like Ruby LSP use it to check if a class is a test class. (From tools' perspective, checking `Test` as a postfix is more accurate than checking `Test` as a prefix as `TestHelper`, `TestCase`...etc. are not test classes.) I've previously renamed some classes this way. This commit renames all remaining classes to follow the convention.
1 parent fdaa5a6 commit 0b9433d

File tree

82 files changed

+72
-72
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+72
-72
lines changed

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ end
3838
Rake::TestTask.new(:normal_test) do |t|
3939
t.verbose = true
4040
t.deps = :generate
41-
t.test_files = FileList["test/**/test_*.rb"].exclude("test/rdoc/test_rdoc_rubygems_hook.rb")
41+
t.test_files = FileList["test/**/*_test.rb"].exclude("test/rdoc/rdoc_rubygems_hook_test.rb")
4242
end
4343

4444
Rake::TestTask.new(:rubygems_test) do |t|
4545
t.verbose = true
4646
t.deps = :generate
47-
t.pattern = "test/rdoc/test_rdoc_rubygems_hook.rb"
47+
t.pattern = "test/rdoc/rdoc_rubygems_hook_test.rb"
4848
end
4949

5050
path = "pkg/#{Bundler::GemHelper.gemspec.full_name}"

test/rdoc/test_rdoc_alias.rb renamed to test/rdoc/rdoc_alias_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22
require_relative 'xref_test_case'
33

4-
class TestRDocAlias < XrefTestCase
4+
class RDocAliasTest < XrefTestCase
55

66
def test_to_s
77
a = RDoc::Alias.new nil, 'a', 'b', ''

test/rdoc/test_rdoc_any_method.rb renamed to test/rdoc/rdoc_any_method_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22
require_relative 'xref_test_case'
33

4-
class TestRDocAnyMethod < XrefTestCase
4+
class RDocAnyMethodTest < XrefTestCase
55

66
def test_aref
77
m = RDoc::AnyMethod.new nil, 'method?'

test/rdoc/test_rdoc_attr.rb renamed to test/rdoc/rdoc_attr_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22
require_relative 'helper'
33

4-
class TestRDocAttr < RDoc::TestCase
4+
class RDocAttrTest < RDoc::TestCase
55

66
def setup
77
super

test/rdoc/test_rdoc_code_object.rb renamed to test/rdoc/rdoc_code_object_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
require_relative 'xref_test_case'
55

6-
class TestRDocCodeObject < XrefTestCase
6+
class RDocCodeObjectTest < XrefTestCase
77

88
def setup
99
super
File renamed without changes.

test/rdoc/test_rdoc_constant.rb renamed to test/rdoc/rdoc_constant_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22
require_relative 'xref_test_case'
33

4-
class TestRDocConstant < XrefTestCase
4+
class RDocConstantTest < XrefTestCase
55

66
def setup
77
super

test/rdoc/test_rdoc_context_section.rb renamed to test/rdoc/rdoc_context_section_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22
require_relative 'helper'
33

4-
class TestRDocContextSection < RDoc::TestCase
4+
class RDocContextSectionTest < RDoc::TestCase
55

66
def setup
77
super

test/rdoc/test_rdoc_context.rb renamed to test/rdoc/rdoc_context_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22
require_relative 'xref_test_case'
33

4-
class TestRDocContext < XrefTestCase
4+
class RDocContextTest < XrefTestCase
55

66
def setup
77
super

0 commit comments

Comments
 (0)