aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/checkstyle.rb
diff options
context:
space:
mode:
authorMike Naberezny2014-02-15 11:15:34 -0800
committerAdam Vandenberg2014-02-15 11:26:00 -0800
commitcdc2c0b90062aca33d731ddb4a6bf13fa71555dc (patch)
treec928b5cd5320f8ad9d32a3537b85567b127f87f4 /Library/Formula/checkstyle.rb
parent3242929d47c474185cb777b9697d85885fa921d6 (diff)
downloadhomebrew-cdc2c0b90062aca33d731ddb4a6bf13fa71555dc.tar.bz2
checkstyle: add test
Closes #26751. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Formula/checkstyle.rb')
-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