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