From ff52a119ae9f8aaf01d7bbf8d3b164501638afd7 Mon Sep 17 00:00:00 2001 From: Mike Naberezny Date: Thu, 6 Feb 2014 12:05:53 -0800 Subject: bgrep: add test Closes #26482. Signed-off-by: Mike McQuaid --- Library/Formula/bgrep.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Library') diff --git a/Library/Formula/bgrep.rb b/Library/Formula/bgrep.rb index f81477247..19fca5142 100644 --- a/Library/Formula/bgrep.rb +++ b/Library/Formula/bgrep.rb @@ -9,4 +9,15 @@ class Bgrep < Formula system "#{ENV.cc} #{ENV.cflags} -o bgrep bgrep.c" bin.install "bgrep" end + + test do + path = testpath/"hi.prg" + code = [0x00, 0xc0, 0xa9, 0x48, 0x20, 0xd2, 0xff, + 0xa9, 0x49, 0x20, 0xd2, 0xff, 0x60].pack("C*") + path.open("wb") { |f| f.write code } + + lines = `#{bin}/bgrep 20d2ff #{path}`.strip.split("\n") + assert_equal ["#{path}: 00000004", "#{path}: 00000009"], lines + assert_equal 0, $?.exitstatus + end end -- cgit v1.2.3