File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
lib/puppet-lint/plugins/check_whitespace
spec/unit/puppet-lint/plugins/check_whitespace Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ def fix(problem)
3030
3131 prev_token = problem [ :token ] . prev_token
3232 next_token = problem [ :token ] . next_token
33- prev_token . next_token = next_token
33+ prev_token . next_token = next_token unless prev_token . nil?
3434 next_token . prev_token = prev_token unless next_token . nil?
3535 tokens . delete ( problem [ :token ] )
3636 end
Original file line number Diff line number Diff line change 105105 expect ( manifest ) . to eq ( fixed )
106106 end
107107 end
108+
109+ context 'empty lines with nothing but whitespace' do
110+ let ( :code ) { " \n " }
111+
112+ it 'detects problems with both empty lines' do
113+ expect ( problems ) . to have ( 2 ) . problem
114+ end
115+
116+ it 'fixes the manifest' do
117+ expect ( manifest ) . to eq ( "\n " )
118+ end
119+ end
108120 end
109121end
You can’t perform that action at this time.
0 commit comments