Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

output full path & name for files that don't parse #745

Merged
merged 4 commits into from Jan 11, 2013
@@ -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}"
@parkr

parkr Jan 10, 2013

Owner

Please add a space () between the comma afterbaseand beforename.

@erictheise

erictheise Jan 10, 2013

Contributor

Done.

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,24 @@ 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(/#{File.join(@base, 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(/#{File.join(@base, name)}/, out)
end
end
end