Skip to content

Commit

Permalink
#43 messages tested and fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Yegor Bugayenko committed Sep 7, 2015
1 parent f440b71 commit 7252aa4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/pdd/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def puzzles
re.match(line) do |match|
puzzles << puzzle(lines.drop(idx + 1), match, idx)
end
rescue Error => ex
raise Error, ["#{ex.message} in line ##{idx} of #{@path}", ex]
rescue ArgumentError => ex
raise Error, ["in line ##{idx}", ex]
end
/(.*(?:^|\s))@todo\s+#([\w\-\.:\/]+)/
end
Expand Down Expand Up @@ -138,7 +138,7 @@ def initialize(file, source)
def puzzles
@source.puzzles
rescue Error => ex
raise Error, "#{ex.message} in #{@file}"
raise Error, ["in #{@file}", ex]
end
end
end
3 changes: 1 addition & 2 deletions test/test_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,9 @@ def test_failing_on_broken_unicode
Dir.mktmpdir 'test' do |dir|
file = File.join(dir, 'xx.txt')
File.write(file, " * @todo #44 this is a broken unicode: \x92")
error = assert_raises PDD::Error do
assert_raises PDD::Error do
PDD::VerboseSource.new(file, PDD::Source.new(file, 'xx')).puzzles
end
assert !error.message.index('in line #1 of xx.txt').nil?
end
end

Expand Down

0 comments on commit 7252aa4

Please sign in to comment.