Skip to content

Commit

Permalink
Add coverage test that utilizes options parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
KaanOzkan committed Jan 24, 2025
1 parent dac0d85 commit c4791d3
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions test/spoom/cli/srb/coverage_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,77 @@ def test_finish_on_original_branch
assert_equal("fake-branch", @project.git_current_branch)
end

def test_config_options_string
# Add ignore path to config to test config options string
@project.write!("sorbet/config", "\n--ignore=lib/a.rb", append: true)

result = @project.spoom("srb coverage snapshot")
out = censor_sorbet_version(result.out)
assert_equal(<<~MSG, out)
Sorbet static: X.X.XXXX
Sorbet runtime: X.X.XXXX
Content:
files: 3
files excluding rbis: 2
modules: 3
classes: 1
methods: 9
methods excluding rbis: 9
Sigils:
true: 3 (100%)
Methods:
with signature: 2 (22%)
without signature: 7 (78%)
Methods excluding RBIs
with signature: 2 (22%)
without signature: 7 (78%)
Calls:
typed: 4 (67%)
untyped: 2 (33%)
MSG
end

def test_config_options_string_ignores_wildcard
# Add wildcard path that shouldn't have an effect as there's no shell expansion
@project.write!("sorbet/config", "\n--ignore=*/a.rb", append: true)

result = @project.spoom("srb coverage snapshot")
out = censor_sorbet_version(result.out)
assert_equal(<<~MSG, out)
Sorbet static: X.X.XXXX
Sorbet runtime: X.X.XXXX
Content:
files: 4
files excluding rbis: 3
modules: 5
classes: 2
methods: 14
methods excluding rbis: 14
Sigils:
false: 1 (25%)
true: 3 (75%)
Methods:
with signature: 2 (14%)
without signature: 12 (86%)
Methods excluding RBIs
with signature: 2 (14%)
without signature: 12 (86%)
Calls:
typed: 5 (83%)
untyped: 1 (17%)
MSG
end

private

def create_git_history!
Expand Down

0 comments on commit c4791d3

Please sign in to comment.