Navigation Menu

Skip to content

Commit

Permalink
Extract raw output normalization code
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Aug 14, 2012
1 parent fec07b3 commit fd04225
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/grntest/tester.rb
Expand Up @@ -938,12 +938,16 @@ def normalize_result(result)
when :output
normalized_result << normalize_output(content, options)
when :error
normalized_result << "#{content}\n".force_encoding("ASCII-8BIT")
normalized_result << normalize_raw_content(content)
end
end
normalized_result
end

def normalize_raw_content(content)
"#{content}\n".force_encoding("ASCII-8BIT")
end

def normalize_output(content, options)
type = options[:type]
case type
Expand All @@ -955,10 +959,9 @@ def normalize_output(content, options)
if normalized_output.bytesize > @max_n_columns
normalized_output = JSON.pretty_generate(normalized_output_content)
end
normalized_output.force_encoding("ASCII-8BIT")
"#{normalized_output}\n"
normalize_raw_content(normalized_output)
else
"#{content}\n".force_encoding("ASCII-8BIT")
normalize_raw_content(content)
end
end

Expand Down

0 comments on commit fd04225

Please sign in to comment.