Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
soutaro committed Aug 15, 2024
1 parent 427fe4b commit fc04083
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 45 deletions.
1 change: 1 addition & 0 deletions test/interaction_worker_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def test_handle_request_initialize
worker = InteractionWorker.new(project: project, reader: worker_reader, writer: worker_writer)

worker.handle_request({ method: "initialize", id: 1, params: nil })
worker.handle_request({ method: "$/file/load", params: { content: {} } })

q = flush_queue(worker.queue)
assert_equal 1, q.size
Expand Down
14 changes: 7 additions & 7 deletions test/master_type_check_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Customer
Project::DSL.parse(project, steepfile.read)

controller = Server::Master::TypeCheckController.new(project: project)
controller.load(command_line_args: [])
controller.load(command_line_args: []) {}

controller.target_paths[0].tap do |paths|
assert_equal Set[current_dir + "lib/customer.rb"], paths.code_paths
Expand Down Expand Up @@ -137,7 +137,7 @@ class Customer
Project::DSL.parse(project, steepfile.read)

controller = Server::Master::TypeCheckController.new(project: project)
controller.load(command_line_args: [])
controller.load(command_line_args: []) {}
controller.changed_paths.clear()

controller.push_changes(current_dir + "lib/customer.rb")
Expand Down Expand Up @@ -177,7 +177,7 @@ class Customer
Project::DSL.parse(project, steepfile.read)

controller = Server::Master::TypeCheckController.new(project: project)
controller.load(command_line_args: [])
controller.load(command_line_args: []) {}
controller.changed_paths.clear()

controller.update_priority(open: current_dir + "lib/customer.rb")
Expand Down Expand Up @@ -213,7 +213,7 @@ class Customer
Project::DSL.parse(project, steepfile.read)

controller = Server::Master::TypeCheckController.new(project: project)
controller.load(command_line_args: [])
controller.load(command_line_args: []) {}
controller.changed_paths.clear()

assert_nil controller.make_request()
Expand Down Expand Up @@ -241,7 +241,7 @@ class Customer
Project::DSL.parse(project, steepfile.read)

controller = Server::Master::TypeCheckController.new(project: project)
controller.load(command_line_args: [])
controller.load(command_line_args: []) {}
controller.changed_paths.clear()

controller.update_priority(open: current_dir + "lib/customer.rb")
Expand Down Expand Up @@ -278,7 +278,7 @@ class Customer
Project::DSL.parse(project, steepfile.read)

controller = Server::Master::TypeCheckController.new(project: project)
controller.load(command_line_args: [])
controller.load(command_line_args: []) {}
controller.changed_paths.clear()

controller.update_priority(open: current_dir + "lib/customer.rb")
Expand Down Expand Up @@ -319,7 +319,7 @@ class Account
Project::DSL.parse(project, steepfile.read)

controller = Server::Master::TypeCheckController.new(project: project)
controller.load(command_line_args: [])
controller.load(command_line_args: []) {}
controller.changed_paths.clear()

controller.update_priority(open: current_dir + "lib/customer.rb")
Expand Down
38 changes: 0 additions & 38 deletions test/type_check_worker_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ def test_handle_request_typecheck_start
reader: worker_reader,
writer: worker_writer
)
worker.load_files(project: worker.project, commandline_args: [])

worker.handle_request(
{
Expand Down Expand Up @@ -250,7 +249,6 @@ def test_handle_job_start_typecheck
reader: worker_reader,
writer: worker_writer
)
worker.load_files(project: worker.project, commandline_args: [])

changes = {}
changes[Pathname("lib/hello.rb")] = [Services::ContentChange.string(<<~RUBY)]
Expand Down Expand Up @@ -298,7 +296,6 @@ def test_handle_job_validate_app_signature
writer: worker_writer
)

worker.load_files(project: worker.project, commandline_args: [])
worker.instance_variable_set(:@current_type_check_guid, "guid")

{}.tap do |changes|
Expand Down Expand Up @@ -349,7 +346,6 @@ def test_handle_job_validate_app_signature_skip
writer: worker_writer
)

worker.load_files(project: worker.project, commandline_args: [])
worker.instance_variable_set(:@current_type_check_guid, nil)

{}.tap do |changes|
Expand Down Expand Up @@ -396,7 +392,6 @@ def test_handle_job_validate_lib_signature
writer: worker_writer
)

worker.load_files(project: worker.project, commandline_args: [])
worker.instance_variable_set(:@current_type_check_guid, "guid")

{}.tap do |changes|
Expand Down Expand Up @@ -450,7 +445,6 @@ def test_handle_job_validate_lib_signature_skip
writer: worker_writer
)

worker.load_files(project: worker.project, commandline_args: [])
worker.instance_variable_set(:@current_type_check_guid, nil)

{}.tap do |changes|
Expand Down Expand Up @@ -498,7 +492,6 @@ def test_handle_job_typecheck_code
writer: worker_writer
)

worker.load_files(project: worker.project, commandline_args: [])
worker.instance_variable_set(:@current_type_check_guid, "guid")

{}.tap do |changes|
Expand Down Expand Up @@ -557,7 +550,6 @@ def test_handle_job_typecheck_code_diagnostics
writer: worker_writer
)

worker.load_files(project: worker.project, commandline_args: [])
worker.instance_variable_set(:@current_type_check_guid, "guid")

{}.tap do |changes|
Expand Down Expand Up @@ -619,7 +611,6 @@ def test_handle_job_typecheck_skip
writer: worker_writer
)

worker.load_files(project: worker.project, commandline_args: [])
worker.instance_variable_set(:@current_type_check_guid, nil)

{}.tap do |changes|
Expand Down Expand Up @@ -685,35 +676,6 @@ def new_class_method: () -> void
end
end

def test_loading_files_with_args
in_tmpdir do
project = Project.new(steepfile_path: current_dir + "Steepfile")
Project::DSL.parse(project, <<EOF)
target :lib do
check "lib"
signature "sig"
end
EOF

(current_dir + "lib").mkdir
(current_dir + "lib/foo.rb").write("")
(current_dir + "lib/bar.rb").write("")

worker = Server::TypeCheckWorker.new(
project: project,
assignment: assignment,
commandline_args: [],
reader: worker_reader,
writer: worker_writer
)

worker.load_files(project: worker.project, commandline_args: ["lib/foo.rb"])
worker.service.update(changes: worker.pop_buffer) {}

assert_equal [Pathname("lib/foo.rb")], worker.service.source_files.keys
end
end

def test_job_stats
in_tmpdir do
project = Project.new(steepfile_path: current_dir + "Steepfile")
Expand Down

0 comments on commit fc04083

Please sign in to comment.