test/test_source.rb in pdd-0.20.2 vs test/test_source.rb in pdd-0.20.3

- old
+ new

@@ -104,13 +104,13 @@ skip('doesnt work now') Dir.mktmpdir 'test' do |dir| file = File.join(dir, 'a.txt') File.write( file, - ' + " * \x40todo 44 this puzzle is not formatted correctly - ' + " ) error = assert_raises PDD::Error do PDD::VerboseSource.new(file, PDD::Source.new(file, 'hey')).puzzles end assert !error.message.index('Incorrect format').nil? @@ -128,9 +128,25 @@ ) error = assert_raises PDD::Error do PDD::VerboseSource.new(file, PDD::Source.new(file, 'x')).puzzles end assert !error.message.index("\x40todo must have a leading space").nil? + end + end + + def test_failing_on_puzzle_with_space_after_dash + Dir.mktmpdir 'test' do |dir| + file = File.join(dir, 'hey-you.txt') + File.write( + file, + " + * \x40todo # 123 This puzzle has an unnecessary space before the dash + " + ) + error = assert_raises PDD::Error do + PDD::VerboseSource.new(file, PDD::Source.new(file, 'x')).puzzles + end + assert !error.message.index('an unexpected space').nil? end end def test_reads_git_author skip if Gem.win_platform?