From e25e352abee00a13ed7e189a089e6dc413e58798 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Mon, 29 Dec 2014 15:45:57 +0800 Subject: [PATCH] astyle: add test Closes Homebrew/homebrew#35333. Signed-off-by: Mike McQuaid --- Formula/astyle.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Formula/astyle.rb b/Formula/astyle.rb index c0826f121d..e7faa0fd55 100644 --- a/Formula/astyle.rb +++ b/Formula/astyle.rb @@ -1,5 +1,3 @@ -require "formula" - class Astyle < Formula homepage "http://astyle.sourceforge.net/" url "https://downloads.sourceforge.net/project/astyle/astyle/astyle%202.05/astyle_2.05_macosx.tar.gz" @@ -19,4 +17,16 @@ class Astyle < Formula bin.install "bin/astyle" end end + + test do + (testpath/"test.c").write("int main(){return 0;}\n") + system "#{bin}/astyle", "--style=gnu", "--indent=spaces=4", + "--lineend=linux", "#{testpath}/test.c" + assert_equal File.read("test.c"), <<-EOS.undent + int main() + { + return 0; + } + EOS + end end