Skip to content
Merged
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
4 changes: 4 additions & 0 deletions lib/spoom/sorbet/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ def parse_string(sorbet_config)
state = :skip
when /^-.*=?/
next
when /^#/
next
when /^$/
next
else
case state
when :ignore
Expand Down
31 changes: 31 additions & 0 deletions test/spoom/sorbet/config_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,37 @@ def test_parses_a_config_string_with_mixed_options
assert_empty(config.allowed_extensions)
end

def test_parses_a_config_string_with_mixed_options_comments_and_empty_lines
config = Spoom::Sorbet::Config.parse_string(<<~CONFIG)
a
--other=b
# This is a comment.
--file
c

--d
e
--dir=f
-g
--dir

h
--file=i
--ignore
# Comment in between.
j
--ignore=k
l
m
-n
--o
p
CONFIG
assert_equal(['a', 'c', 'f', 'h', 'i', 'l', 'm'], config.paths)
assert_equal(['j', 'k'], config.ignore)
assert_empty(config.allowed_extensions)
end

def test_parses_a_real_config_string
config = Spoom::Sorbet::Config.parse_string(<<~CONFIG)
.
Expand Down