diff options
| author | Baptiste Fontaine | 2015-01-03 14:32:26 +0100 |
|---|---|---|
| committer | Jack Nagel | 2015-01-03 21:40:25 -0500 |
| commit | 585ff9990112d03444ab5e326ffb5bf6e18b0f0a (patch) | |
| tree | 53b2aef5fe9951784c9b92f9db794d19ae62778e /Library/Formula/antlr.rb | |
| parent | 0a6ea49bc1304588f6317553e7a9be4a81aec3c8 (diff) | |
| download | homebrew-585ff9990112d03444ab5e326ffb5bf6e18b0f0a.tar.bz2 | |
antlr: test added
Closes #35511.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Formula/antlr.rb')
| -rw-r--r-- | Library/Formula/antlr.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/Library/Formula/antlr.rb b/Library/Formula/antlr.rb index 003b41046..3533b0217 100644 --- a/Library/Formula/antlr.rb +++ b/Library/Formula/antlr.rb @@ -1,5 +1,3 @@ -require "formula" - class Antlr < Formula homepage "http://www.antlr.org/" url "http://www.antlr.org/download/antlr-4.4-complete.jar" @@ -13,4 +11,24 @@ class Antlr < Formula java -classpath #{prefix}/antlr-#{version}-complete.jar:. org.antlr.v4.runtime.misc.TestRig "$@" EOS end + + test do + path = testpath/"Expr.g4" + path.write <<-EOS.undent + grammar Expr; + prog:\t(expr NEWLINE)* ; + expr:\texpr ('*'|'/') expr + |\texpr ('+'|'-') expr + |\tINT + |\t'(' expr ')' + ; + NEWLINE :\t[\\r\\n]+ ; + INT :\t[0-9]+ ; + EOS + ENV.prepend "CLASSPATH", "#{prefix}/antlr-#{version}-complete.jar", ":" + ENV.prepend "CLASSPATH", ".", ":" + system "#{bin}/antlr4", "Expr.g4" + system "javac", *Dir["Expr*.java"] + assert_match(/^$/, pipe_output("#{bin}/grun Expr prog", "22+20\n")) + end end |
