From 1e3b81198c71b2d7f2c1799ae7d48bf148ddd295 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Thu, 26 Dec 2024 14:57:04 +0900 Subject: [PATCH] Update test --- test/server/lsp_formatter_test.rb | 63 ++++++++++++++++--------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/test/server/lsp_formatter_test.rb b/test/server/lsp_formatter_test.rb index ce7d8e10..c1c651d6 100644 --- a/test/server/lsp_formatter_test.rb +++ b/test/server/lsp_formatter_test.rb @@ -211,45 +211,48 @@ def foo: () -> Symbol end def test_ruby_hover_method_call__special - with_factory do - typing = type_check(<<~RUBY) - [1, nil].compact - RUBY - - call = typing.call_of(node: typing.source.node) + with_factory do + typing = type_check(<<~RUBY) + [1, nil].compact + RUBY - content = Services::HoverProvider::Ruby::MethodCallContent.new( - node: nil, - method_call: call, - location: nil - ) + call = typing.call_of(node: typing.source.node) - comment = Server::LSPFormatter.format_hover_content(content) - assert_equal <<~MD.chomp, comment - ```rbs - ::Array[::Integer] - ``` + content = Services::HoverProvider::Ruby::MethodCallContent.new( + node: nil, + method_call: call, + location: nil + ) - ---- - **💡 Custom typing rule applies** + comment = Server::LSPFormatter.format_hover_content(content) + assert_equal <<~MD, comment + ```rbs + ::Array[::Integer] + ``` - ---- - **Method type**: - ```rbs - () -> ::Array[::Integer] - ``` - ---- - ### 📚 Array#compact + ---- + **💡 Custom typing rule applies** - Returns a new Array containing all non-`nil` elements from `self`: + ---- + **Method type**: + ```rbs + () -> ::Array[::Integer] + ``` + ---- + ### 📚 Array#compact - a = [nil, 0, nil, 1, nil, 2, nil] - a.compact # => [0, 1, 2] + Returns a new array containing only the non-`nil` elements from `self`; + element order is preserved: + a = [nil, 0, nil, false, nil, '', nil, [], nil, {}] + a.compact # => [0, false, \"\", [], {}] - MD - end + Related: Array#compact!; see also [Methods for + Deleting](rdoc-ref:Array@Methods+for+Deleting). + + MD end + end def test_ruby_hover_method_call__error