From e5cfbf6101cb411fd606dd67a9b4096ef489a004 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Sat, 3 Jan 2015 16:19:12 +0800 Subject: [PATCH] readline: add test Closes Homebrew/homebrew#35495. Signed-off-by: Mike McQuaid --- Formula/readline.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Formula/readline.rb b/Formula/readline.rb index e567decb4b..0820aeb9c8 100644 --- a/Formula/readline.rb +++ b/Formula/readline.rb @@ -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 + #include + #include + + 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