Skip to content

Commit

Permalink
Add test for long declarative test names; should fail in 3.4+
Browse files Browse the repository at this point in the history
  • Loading branch information
catlee committed Jan 17, 2025
1 parent 8c7e394 commit 913233d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions railties/test/test_unit/test_parser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ def test_oneline; assert true; end
assert_not false
}

test "long declarative " \
"name" do
assert true
end

# Check that extensions can provide aliases for testing methods
def self.my_testing_alias(test_name, &)
define_method(:"test_#{test_name}", &)
Expand All @@ -55,7 +60,6 @@ def test_parser
.map { |method| TestParserTestFixture.instance_method(method) }
.sort_by { |method| method.source_location[1] }
.map { |method| [method.name, *Rails::TestUnit::TestParser.definition_for(method)] }

expected = [
[:test_method, __FILE__, 9..13],
[:test_oneline, __FILE__, 15..15],
Expand All @@ -65,7 +69,8 @@ def test_parser
[:test_declarative_oneline, __FILE__, 33..33],
[:test_declarative_oneline_do, __FILE__, 35..35],
[:"test_declarative_multiline_w/_braces", __FILE__, 37..40],
[:"test_method_alias", __FILE__, 47..47],
[:"test_long_declarative_name", __FILE__, 42..45],
[:"test_method_alias", __FILE__, 52..52],
]

assert_equal expected, actual
Expand Down

0 comments on commit 913233d

Please sign in to comment.