diff options
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/flex.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Library/Formula/flex.rb b/Library/Formula/flex.rb index 2eb6f096f..59ab1431e 100644 --- a/Library/Formula/flex.rb +++ b/Library/Formula/flex.rb @@ -19,4 +19,25 @@ class Flex < Formula "--prefix=#{prefix}" system "make", "install" end + + test do + (testpath/"test.flex").write <<-EOS.undent + CHAR [a-z][A-Z] + %% + {CHAR}+ printf("%s", yytext); + [ \\t\\n]+ printf("\\n"); + %% + int main() + { + yyin = stdin; + yylex(); + } + EOS + system "#{bin}/flex", "test.flex" + system ENV.cc, "lex.yy.c", "-L#{lib}", "-lfl", "-o", "test" + assert_equal shell_output("echo \"Hello World\" | ./test"), <<-EOS.undent + Hello + World + EOS + end end |
