diff options
| author | Xu Cheng | 2014-12-29 11:11:41 +0800 |
|---|---|---|
| committer | Mike McQuaid | 2014-12-29 07:48:51 +0000 |
| commit | 4aee2f8ffa100acbf8892cc608d5c70bc47454df (patch) | |
| tree | a3ff0359f73ca47146fe889ee5c45831328c1c49 /Library/Formula | |
| parent | 6de5b01e3fefabc082115738721ef52c29d4ee26 (diff) | |
| download | homebrew-4aee2f8ffa100acbf8892cc608d5c70bc47454df.tar.bz2 | |
flex: add test
Closes #35328.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
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 |
