Merge pull request #392 from avdv/fix-unrecognized

Fix unrecognized files count and colorization
This commit is contained in:
Claudio Bley 2020-09-07 21:22:11 +02:00 committed by GitHub
commit 965eb6130d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -328,9 +328,9 @@ module ColorLS
else
key = content.name.split('.').last.downcase.to_sym
key = @file_aliases[key] unless @files.key? key
key = :file if key.nil?
color = file_color(content, key)
group = @files.key?(key) ? :recognized_files : :unrecognized_files
key = :file if key.nil?
end
[key, color, group]

View file

@ -300,4 +300,12 @@ RSpec.describe ColorLS::Flags do
expect { subject }.to output(/setlocale error/).to_stderr.and output.to_stdout
end
end
context 'with unrecognized files' do
let(:args) { ['--report', FIXTURES] }
it 'should show a report with unrecognized files' do
expect { subject }.to output(/Unrecognized files\s+: 3/).to_stdout
end
end
end