test/test_source.rb in pdd-0.14 vs test/test_source.rb in pdd-0.14.1

- old
+ new

@@ -33,18 +33,18 @@ def test_parsing Dir.mktmpdir 'test' do |dir| file = File.join(dir, 'a.txt') File.write( file, - ' + " * @todo #44 hello, - * how are you doing? + * how are you\t\r\tdoing? * -something else Something else ~~ @todo #ABC-3 this is another puzzle ~~ and it also has to work - ' + " ) list = PDD::VerboseSource.new(file, PDD::Source.new(file, 'hey')).puzzles assert_equal 2, list.size puzzle = list.first assert_equal '2-3', puzzle.props[:lines] @@ -68,10 +68,27 @@ end assert !error.message.index('Space expected').nil? end 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( + file, + ' + * @todo 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? + end + end + def test_reads_git_author Dir.mktmpdir 'test' do |dir| fail unless system(" set -e cd '#{dir}' @@ -84,9 +101,10 @@ git blame a.txt ") list = PDD::Source.new(File.join(dir, 'a.txt'), '').puzzles assert_equal 1, list.size puzzle = list.first + assert_equal '1-de87adc8', puzzle.props[:id] assert_equal '1-1', puzzle.props[:lines] assert_equal 'this is the puzzle', puzzle.props[:body] assert_equal 'test', puzzle.props[:author] assert_equal 'test@teamed.io', puzzle.props[:email] assert_match(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z/, puzzle.props[:time])