From cdc2c0b90062aca33d731ddb4a6bf13fa71555dc Mon Sep 17 00:00:00 2001 From: Mike Naberezny Date: Sat, 15 Feb 2014 11:15:34 -0800 Subject: checkstyle: add test Closes #26751. Signed-off-by: Adam Vandenberg --- Library/Formula/checkstyle.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Library/Formula') diff --git a/Library/Formula/checkstyle.rb b/Library/Formula/checkstyle.rb index b521b7388..df589ef0d 100644 --- a/Library/Formula/checkstyle.rb +++ b/Library/Formula/checkstyle.rb @@ -9,4 +9,14 @@ class Checkstyle < Formula libexec.install "checkstyle-#{version}-all.jar", "sun_checks.xml" bin.write_jar_script libexec/"checkstyle-#{version}-all.jar", "checkstyle" end + + test do + path = testpath/"foo.java" + path.write "public class Foo{ }\n" + + output = `#{bin}/checkstyle -c #{libexec}/sun_checks.xml -r #{path}` + errors = output.split("\n").select { |line| line.start_with?(path) } + assert errors.include?("#{path}:1:17: '{' is not preceded with whitespace.") + assert_equal errors.size, $?.exitstatus + end end -- cgit v1.2.3