Make sure trailing newline is preserved when ignoring deprecations in functional tests

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
Clinton Wolfe 2019-04-25 14:48:35 -04:00
parent 91c0f1e83b
commit 23fdecd9c3

View file

@ -44,11 +44,13 @@ module Inspec
end
def stderr_ignore_deprecations
stderr.split("\n").reject { |l| l.include? ' DEPRECATION: ' }.join("\n")
suffix = stderr.end_with?("\n") ? "\n" : ''
stderr.split("\n").reject { |l| l.include? ' DEPRECATION: ' }.join("\n") + suffix
end
def stdout_ignore_deprecations
stdout.split("\n").reject { |l| l.include? ' DEPRECATION: ' }.join("\n")
suffix = stdout.end_with?("\n") ? "\n" : ''
stdout.split("\n").reject { |l| l.include? ' DEPRECATION: ' }.join("\n") + suffix
end
end
end