@@ -1733,6 +1733,62 @@ def test_spot_with_node
17331733 assert_equal expected_spot , actual_spot
17341734 end
17351735
1736+ module SingletonMethodWithSpacing
1737+ LINENO = __LINE__ + 1
1738+ def self . baz ( x :)
1739+ x
1740+ end
1741+ end
1742+
1743+ def test_singleton_method_with_spacing_missing_keyword
1744+ lineno = __LINE__
1745+ assert_error_message ( ArgumentError , <<~END ) do
1746+ missing keyword: :x (ArgumentError)
1747+
1748+ caller: #{ __FILE__ } :#{ lineno + 16 }
1749+ | SingletonMethodWithSpacing.baz
1750+ ^^^^
1751+ callee: #{ __FILE__ } :#{ SingletonMethodWithSpacing ::LINENO }
1752+ #{
1753+ MethodDefLocationSupported ?
1754+ "| def self . baz(x:)
1755+ ^^^^^" :
1756+ "(cannot highlight method definition; try Ruby 4.0 or later)"
1757+ }
1758+ END
1759+
1760+ SingletonMethodWithSpacing . baz
1761+ end
1762+ end
1763+
1764+ module SingletonMethodMultipleKwargs
1765+ LINENO = __LINE__ + 1
1766+ def self . run ( shop_id :, param1 :)
1767+ shop_id + param1
1768+ end
1769+ end
1770+
1771+ def test_singleton_method_multiple_missing_keywords
1772+ lineno = __LINE__
1773+ assert_error_message ( ArgumentError , <<~END ) do
1774+ missing keywords: :shop_id, :param1 (ArgumentError)
1775+
1776+ caller: #{ __FILE__ } :#{ lineno + 16 }
1777+ | SingletonMethodMultipleKwargs.run
1778+ ^^^^
1779+ callee: #{ __FILE__ } :#{ SingletonMethodMultipleKwargs ::LINENO }
1780+ #{
1781+ MethodDefLocationSupported ?
1782+ "| def self.run(shop_id:, param1:)
1783+ ^^^^" :
1784+ "(cannot highlight method definition; try Ruby 4.0 or later)"
1785+ }
1786+ END
1787+
1788+ SingletonMethodMultipleKwargs . run
1789+ end
1790+ end
1791+
17361792 private
17371793
17381794 def find_node_by_id ( node , node_id )
0 commit comments