aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Formula')
-rw-r--r--Library/Formula/checkstyle.rb10
1 files changed, 10 insertions, 0 deletions
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