提交 7c60a011 编写于 作者: J Justin Collins

Output message for OutputProcessor errors

instead of just an empty string. This should happen almost never, but
hopefully this will prompt people to report bugs if it does happen
instead of hiding them.
上级 193e4665
...@@ -10,7 +10,7 @@ class Brakeman::OutputProcessor < Ruby2Ruby ...@@ -10,7 +10,7 @@ class Brakeman::OutputProcessor < Ruby2Ruby
#Copies +exp+ and then formats it. #Copies +exp+ and then formats it.
def format exp def format exp
process(exp.deep_clone) || "" process(exp.deep_clone) || "[Format Error]"
end end
alias process_safely format alias process_safely format
......
...@@ -6,19 +6,19 @@ class OutputProcessorTests < Test::Unit::TestCase ...@@ -6,19 +6,19 @@ class OutputProcessorTests < Test::Unit::TestCase
end end
def test_output_nil def test_output_nil
assert_output "", nil assert_output "[Format Error]", nil
end end
def test_output_empty_sexp def test_output_empty_sexp
assert_output "", Sexp.new assert_output "[Format Error]", Sexp.new
end end
def test_output_missing_node_type def test_output_missing_node_type
assert_output "", Sexp.new(Sexp.new(:str, 'x')) assert_output "[Format Error]", Sexp.new(Sexp.new(:str, 'x'))
end end
def test_output_bad_node_type def test_output_bad_node_type
assert_output "", Sexp.new(:bad_node_type) assert_output "[Format Error]", Sexp.new(:bad_node_type)
end end
def test_output_local_variable def test_output_local_variable
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册