From e337cade4676e6c96a91c8609f8ec2a8c5798416 Mon Sep 17 00:00:00 2001 From: Ayomide Bakare Date: Mon, 10 Jan 2022 19:25:51 +0300 Subject: [PATCH] [#163] add test for multiple puzzles in single comment block --- test/test_source.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/test_source.rb b/test/test_source.rb index 33d32a7..7c5f291 100644 --- a/test/test_source.rb +++ b/test/test_source.rb @@ -79,6 +79,31 @@ def test_parsing_leading_spaces end end + def test_multiple_puzzles_single_comment_block + Dir.mktmpdir 'test' do |dir| + file = File.join(dir, 'a.txt') + File.write( + file, + " + /* + * \x40todo #1 First one with + * a few lines + * \x40todo #1 Second one also + * with a few lines + */ + " + ) + stub_source_find_github_user(file, 'hey') do |source| + PDD.opts = nil + assert_equal 2, source.puzzles.size + puzzle = source.puzzles.last + assert_equal '5-6', puzzle.props[:lines] + assert_equal 'Second one also with a few lines', puzzle.props[:body] + assert_equal '1', puzzle.props[:ticket] + end + end + end + def test_succeed_despite_bad_puzzles Dir.mktmpdir 'test' do |dir| file = File.join(dir, 'a.txt')