Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/steep/drivers/check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ def print_typecheck_result(project:, diagnostic_notifications:, error_messages:)
loader = Services::FileLoader.new(base_dir: project.base_dir)
all_files = project.targets.each.with_object(Set[]) do |target, set|
set.merge(loader.load_changes(target.source_pattern, command_line_patterns, changes: {}).each_key)
set.merge(loader.load_changes(target.inline_source_pattern, command_line_patterns, changes: {}).each_key)
set.merge(loader.load_changes(target.signature_pattern, changes: {}).each_key)
end.to_a

Expand Down
2 changes: 2 additions & 0 deletions sig/test/cli_test.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ class CLITest < Minitest::Test

def test_check_inline_with_command_line_pattern: () -> untyped

def test_check_inline_save_expectations: () -> untyped

def test_check_expression_success: () -> untyped

def test_check_expression_failure: () -> untyped
Expand Down
25 changes: 25 additions & 0 deletions test/cli_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,31 @@ def test_check_inline_with_command_line_pattern
end
end

def test_check_inline_save_expectations
in_tmpdir do
(current_dir + "Steepfile").write(<<-EOF)
target :app do
check "lib", inline: true
end
EOF

(current_dir + "lib").mkdir
(current_dir + "lib/foo.rb").write(<<-EOF)
1 + "2"
EOF

stdout, status = sh(*steep, "check", "--save-expectations")

assert_predicate status, :success?, stdout
assert_match(/Saved expectations in steep_expectations\.yml/, stdout)

expectations = YAML.load_file(current_dir + "steep_expectations.yml")
refute_empty expectations
assert_equal ["lib/foo.rb"], expectations.map {|entry| entry["file"] }
refute_empty expectations[0]["diagnostics"]
end
end

def test_check_expression_success
stdout, status = sh(*steep, "check", "-e", "1 + 2")

Expand Down
Loading