aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
authorXu Cheng2014-12-29 11:11:41 +0800
committerMike McQuaid2014-12-29 07:48:51 +0000
commit4aee2f8ffa100acbf8892cc608d5c70bc47454df (patch)
treea3ff0359f73ca47146fe889ee5c45831328c1c49 /Library/Formula
parent6de5b01e3fefabc082115738721ef52c29d4ee26 (diff)
downloadhomebrew-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.rb21
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