readline: add test

Closes Homebrew/homebrew#35495.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Xu Cheng 2015-01-03 16:19:12 +08:00 committed by Mike McQuaid
parent 201c16c1de
commit e5cfbf6101

View file

@ -44,4 +44,20 @@ class Readline < Formula
lib.install_symlink "libhistory.6.3.dylib" => "libhistory.6.2.dylib",
"libreadline.6.3.dylib" => "libreadline.6.2.dylib"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <stdio.h>
#include <stdlib.h>
#include <readline/readline.h>
int main()
{
printf("%s\\n", readline("test> "));
return 0;
}
EOS
system ENV.cc, "test.c", "-lreadline", "-o", "test"
assert_equal "Hello, World!", pipe_output("./test", "Hello, World!\n").strip
end
end