Skip to content

Commit b027cfa

Browse files
authored
Ignore test/expectations/ for sorbet (#2075)
A expecation currently does something like this: ```rb def method end ``` This makes it impossible to call `Object.method` while keeping sorbet happy. There is only one file that sorbet should know about in that folder, just move that somewhere else. Also fixes two RuboCop offenses in that file since it was previously ignored
1 parent 0d310e1 commit b027cfa

18 files changed

+19
-18
lines changed

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ To add a new expectations test runner for a new request handler:
6868

6969
```ruby
7070
require "test_helper"
71-
require "expectations/expectations_test_runner"
71+
require_relative "support/expectations_test_runner"
7272

7373
class MyRequestExpectationsTest < ExpectationsTestRunner
7474
# The first argument is the fully qualified name of the request class
@@ -83,7 +83,7 @@ example
8383

8484
```ruby
8585
require "test_helper"
86-
require "expectations/expectations_test_runner"
86+
require_relative "support/expectations_test_runner"
8787

8888
class MyRequestExpectationsTest < ExpectationsTestRunner
8989
expectations_tests RubyLsp::Requests::MyRequest, "my_request"

sorbet/config

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
.
33
--ignore=vendor/
44
--ignore=test/fixtures/
5+
--ignore=test/expectations/
56
--enable-experimental-requires-ancestor

test/requests/code_action_resolve_expectations_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33

44
require "test_helper"
5-
require "expectations/expectations_test_runner"
5+
require_relative "support/expectations_test_runner"
66

77
class CodeActionResolveExpectationsTest < ExpectationsTestRunner
88
expectations_tests RubyLsp::Requests::CodeActionResolve, "code_action_resolve"

test/requests/code_actions_expectations_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33

44
require "test_helper"
5-
require "expectations/expectations_test_runner"
5+
require_relative "support/expectations_test_runner"
66

77
class CodeActionsExpectationsTest < ExpectationsTestRunner
88
expectations_tests RubyLsp::Requests::CodeActions, "code_actions"

test/requests/code_actions_formatting_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33

44
require "test_helper"
5-
require "expectations/expectations_test_runner"
5+
require_relative "support/expectations_test_runner"
66

77
# Tests RuboCop disable directives - before/after on whole file
88
class CodeActionsFormattingTest < Minitest::Test

test/requests/code_lens_expectations_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33

44
require "test_helper"
5-
require "expectations/expectations_test_runner"
5+
require_relative "support/expectations_test_runner"
66

77
class CodeLensExpectationsTest < ExpectationsTestRunner
88
expectations_tests RubyLsp::Requests::CodeLens, "code_lens"

test/requests/definition_expectations_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33

44
require "test_helper"
5-
require "expectations/expectations_test_runner"
5+
require_relative "support/expectations_test_runner"
66

77
class DefinitionExpectationsTest < ExpectationsTestRunner
88
expectations_tests RubyLsp::Requests::Definition, "definition"

test/requests/diagnostics_expectations_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33

44
require "test_helper"
5-
require "expectations/expectations_test_runner"
5+
require_relative "support/expectations_test_runner"
66

77
class DiagnosticsExpectationsTest < ExpectationsTestRunner
88
expectations_tests RubyLsp::Requests::Diagnostics, "diagnostics"

test/requests/document_highlight_expectations_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33

44
require "test_helper"
5-
require "expectations/expectations_test_runner"
5+
require_relative "support/expectations_test_runner"
66

77
class DocumentHighlightExpectationsTest < ExpectationsTestRunner
88
expectations_tests RubyLsp::Requests::DocumentHighlight, "document_highlight"

test/requests/document_link_expectations_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33

44
require "test_helper"
5-
require "expectations/expectations_test_runner"
5+
require_relative "support/expectations_test_runner"
66

77
class DocumentLinkExpectationsTest < ExpectationsTestRunner
88
expectations_tests RubyLsp::Requests::DocumentLink, "document_link"

test/requests/document_symbol_expectations_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33

44
require "test_helper"
5-
require "expectations/expectations_test_runner"
5+
require_relative "support/expectations_test_runner"
66

77
class DocumentSymbolExpectationsTest < ExpectationsTestRunner
88
expectations_tests RubyLsp::Requests::DocumentSymbol, "document_symbol"

test/requests/folding_ranges_expectations_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33

44
require "test_helper"
5-
require "expectations/expectations_test_runner"
5+
require_relative "support/expectations_test_runner"
66

77
class FoldingRangesExpectationsTest < ExpectationsTestRunner
88
expectations_tests RubyLsp::Requests::FoldingRanges, "folding_ranges"

test/requests/formatting_expectations_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33

44
require "test_helper"
5-
require "expectations/expectations_test_runner"
5+
require_relative "support/expectations_test_runner"
66

77
class FormattingExpectationsTest < ExpectationsTestRunner
88
expectations_tests RubyLsp::Requests::Formatting, "formatting"

test/requests/hover_expectations_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33

44
require "test_helper"
5-
require "expectations/expectations_test_runner"
5+
require_relative "support/expectations_test_runner"
66

77
class HoverExpectationsTest < ExpectationsTestRunner
88
expectations_tests RubyLsp::Requests::Hover, "hover"

test/requests/inlay_hints_expectations_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33

44
require "test_helper"
5-
require "expectations/expectations_test_runner"
5+
require_relative "support/expectations_test_runner"
66

77
class InlayHintsExpectationsTest < ExpectationsTestRunner
88
expectations_tests RubyLsp::Requests::InlayHints, "inlay_hints"

test/requests/selection_ranges_expectations_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33

44
require "test_helper"
5-
require "expectations/expectations_test_runner"
5+
require_relative "support/expectations_test_runner"
66

77
class SelectionRangesExpectationsTest < ExpectationsTestRunner
88
expectations_tests RubyLsp::Requests::SelectionRanges, "selection_ranges"

test/requests/semantic_highlighting_expectations_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33

44
require "test_helper"
5-
require "expectations/expectations_test_runner"
5+
require_relative "support/expectations_test_runner"
66

77
class SemanticHighlightingExpectationsTest < ExpectationsTestRunner
88
expectations_tests RubyLsp::Requests::SemanticHighlighting, "semantic_highlighting"

test/expectations/expectations_test_runner.rb test/requests/support/expectations_test_runner.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def test_#{expectation_suffix}__#{uniq_name_from_path(path)}__does_not_raise
8282
# from test/fixtures/prism/test/prism/fixtures/unparser/corpus/semantic/and.txt
8383
# to test_fixtures_prism_test_prism_fixtures_unparser_corpus_semantic_and
8484
def uniq_name_from_path(path)
85-
path.gsub("/", "_").gsub('.txt', '')
85+
path.gsub("/", "_").gsub(".txt", "")
8686
end
8787
end
8888

0 commit comments

Comments
 (0)