From a2d5e3e4d39f42d1ecb25d7fd07920fc96ef870a Mon Sep 17 00:00:00 2001 From: Pierce Lopez Date: Tue, 6 Dec 2016 19:56:17 -0500 Subject: [PATCH] mawk: fix and improve test the test was comparing the local "version" variable to itself now get version from the mawk executable and use mawk to parse it --- Formula/mawk.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Formula/mawk.rb b/Formula/mawk.rb index f6ac973d8b..c08a4caef3 100644 --- a/Formula/mawk.rb +++ b/Formula/mawk.rb @@ -23,7 +23,8 @@ class Mawk < Formula end test do - version = shell_output("#{bin}/mawk '/version/ { print $2 }' #{prefix}/README") - assert_equal version, version.to_s + mawk_expr = '/^mawk / {printf("%s-%s", $2, $3)}' + ver_out = shell_output("#{bin}/mawk -W version 2>&1 | #{bin}/mawk '#{mawk_expr}'") + assert_equal version.to_s, ver_out end end