aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2014-07-27 16:23:54 -0700
committerAdam Vandenberg2014-07-27 16:23:54 -0700
commita483bcbc929c4e2172906673288139c55bd591c8 (patch)
treeef19fa936b1031d4e572799f6267f8f08bd1444d /Library
parent38e99436dd27902250c08c69d22ac5b0d057f2cc (diff)
downloadhomebrew-a483bcbc929c4e2172906673288139c55bd591c8.tar.bz2
use binwrite in tests
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/yara.rb4
-rw-r--r--Library/Formula/z80dasm.rb2
-rw-r--r--Library/Formula/zxcc.rb2
3 files changed, 3 insertions, 5 deletions
diff --git a/Library/Formula/yara.rb b/Library/Formula/yara.rb
index 0678a8676..cb04a97d3 100644
--- a/Library/Formula/yara.rb
+++ b/Library/Formula/yara.rb
@@ -39,9 +39,7 @@ class Yara < Formula
EOS
program = testpath/"zero.prg"
- File.open(program, "wb") do |f|
- f.write [0x00, 0xc0, 0xa9, 0x30, 0x4c, 0xd2, 0xff].pack("C*")
- end
+ program.binwrite [0x00, 0xc0, 0xa9, 0x30, 0x4c, 0xd2, 0xff].pack("C*")
out = `#{bin}/yara #{rules} #{program}`
assert_equal "chrout #{program}\n", out
diff --git a/Library/Formula/z80dasm.rb b/Library/Formula/z80dasm.rb
index 3721ca3aa..b08455260 100644
--- a/Library/Formula/z80dasm.rb
+++ b/Library/Formula/z80dasm.rb
@@ -12,7 +12,7 @@ class Z80dasm < Formula
test do
path = testpath/"a.bin"
- path.open("wb") { |f| f.write [0xcd, 0x34, 0x12].pack("c*") }
+ path.binwrite [0xcd, 0x34, 0x12].pack("c*")
output = `#{bin}/z80dasm #{path}`.strip
assert output.include?("call 01234h")
diff --git a/Library/Formula/zxcc.rb b/Library/Formula/zxcc.rb
index 0a03bf3e5..446a3dc9d 100644
--- a/Library/Formula/zxcc.rb
+++ b/Library/Formula/zxcc.rb
@@ -23,7 +23,7 @@ class Zxcc < Formula
].pack("c*")
path = testpath/"hello.com"
- path.open("wb") { |f| f.write code }
+ path.binwrite code
output = `#{bin}/zxcc #{path}`.strip
assert_equal "Hello", output