diff --git a/lib/pdd/sources.rb b/lib/pdd/sources.rb index a5c1354..87c6f96 100644 --- a/lib/pdd/sources.rb +++ b/lib/pdd/sources.rb @@ -57,13 +57,17 @@ def exclude(ptn) private - def binary?(f) + # @todo #98:30min Change the implementation of this method + # to also work in Windows machines. Investigate the possibility + # of use a gem for this. After that, remove the skip of the test + # `test_ignores_binary_files` in `test_sources.rb`. + def binary?(file) return false if Gem.win_platform? - `grep -qI '.' #{Shellwords.escape(f)}` + `grep -qI '.' #{Shellwords.escape(file)}` if $CHILD_STATUS.success? false else - PDD.log.info "#{f} is a binary file (#{File.size(f)} bytes)" + PDD.log.info "#{file} is a binary file (#{File.size(file)} bytes)" true end end diff --git a/test/test_source.rb b/test/test_source.rb index 782f808..20c4fc6 100644 --- a/test/test_source.rb +++ b/test/test_source.rb @@ -28,16 +28,14 @@ # Copyright:: Copyright (c) 2014-2018 Yegor Bugayenko # License:: MIT class TestSource < Minitest::Test - # @todo #85:30min Make this test pass on AppVeyor. def test_parsing - skip('Skipped because it fails on AppVeyor') Dir.mktmpdir 'test' do |dir| file = File.join(dir, 'a.txt') File.write( file, " * \x40todo #44 привет, - * how are you\t\r\tdoing? + * how are you\t\tdoing? * -something else Something else ~~ \x40todo #ABC-3 this is another puzzle @@ -90,7 +88,6 @@ def test_failing_on_incomplete_puzzle end def test_failing_on_broken_unicode - skip if Gem.win_platform? Dir.mktmpdir 'test' do |dir| file = File.join(dir, 'xx.txt') File.write(file, ' * \x40todo #44 this is a broken unicode: ' + 0x92.chr) @@ -101,7 +98,6 @@ def test_failing_on_broken_unicode end def test_failing_on_invalid_puzzle_without_hash_sign - skip('doesnt work now') Dir.mktmpdir 'test' do |dir| file = File.join(dir, 'a.txt') File.write( @@ -113,7 +109,7 @@ def test_failing_on_invalid_puzzle_without_hash_sign error = assert_raises PDD::Error do PDD::VerboseSource.new(file, PDD::Source.new(file, 'hey')).puzzles end - assert !error.message.index('Incorrect format').nil? + assert !error.message.index('is not followed by a puzzle marker').nil? end end