Permalink
Browse files

outputting full path when file does not parse

  • Loading branch information...
1 parent dd0e208 commit ba48870eadd48cdd2e2981a5904e164e915b2320 @erictheise erictheise committed Jan 10, 2013
Showing with 10 additions and 4 deletions.
  1. +2 −2 lib/jekyll/convertible.rb
  2. +8 −2 test/test_convertible.rb
@@ -33,9 +33,9 @@ def read_yaml(base, name)
self.data = YAML.load($1)
end
rescue => e
- puts "Error reading file #{name}: #{e.message}"
+ puts "Error reading file #{File.join(base,name)}: #{e.message}"
rescue SyntaxError => e
- puts "YAML Exception reading #{name}: #{e.message}"
+ puts "YAML Exception reading #{File.join(base,name)}: #{e.message}"
end
self.data ||= {}
View
@@ -20,20 +20,26 @@ class TestConvertible < Test::Unit::TestCase
end
should "not parse if there is syntax error in front-matter" do
+ @name = 'broken_front_matter2.erb'
out = capture_stdout do
- ret = @convertible.read_yaml(@base, 'broken_front_matter2.erb')
+ ret = @convertible.read_yaml(@base, @name)
assert_equal({}, ret)
end
assert_match(/YAML Exception|syntax error/, out)
+ assert_match(/#{@base}/, out)
+ assert_match(/#{@name}/, out)
end
if RUBY_VERSION >= '1.9.2'
should "not parse if there is encoding error in file" do
+ @name = 'broken_front_matter3.erb'
out = capture_stdout do
- ret = @convertible.read_yaml(@base, 'broken_front_matter3.erb')
+ ret = @convertible.read_yaml(@base, @name)
assert_equal({}, ret)
end
assert_match(/invalid byte sequence in UTF-8/, out)
+ assert_match(/#{@base}/, out)
+ assert_match(/#{@name}/, out)
end
end
end

0 comments on commit ba48870

Please sign in to comment.