Pull common code into setup method

This commit is contained in:
Jack Nagel 2014-06-10 20:40:51 -05:00
parent c7685d2b70
commit e3472540c1

View File

@ -171,12 +171,17 @@ end
class TextExecutableTests < Test::Unit::TestCase class TextExecutableTests < Test::Unit::TestCase
include FileHelper include FileHelper
attr_reader :pn
def setup
@pn = HOMEBREW_PREFIX.join("an_executable")
end
def teardown def teardown
(HOMEBREW_PREFIX/'foo_script').unlink HOMEBREW_PREFIX.join("an_executable").unlink
end end
def test_simple_shebang def test_simple_shebang
pn = HOMEBREW_PREFIX/'foo_script'
pn.write '#!/bin/sh' pn.write '#!/bin/sh'
assert !pn.universal? assert !pn.universal?
assert !pn.i386? assert !pn.i386?
@ -192,7 +197,6 @@ class TextExecutableTests < Test::Unit::TestCase
end end
def test_shebang_with_options def test_shebang_with_options
pn = HOMEBREW_PREFIX/'foo_script'
pn.write '#! /usr/bin/perl -w' pn.write '#! /usr/bin/perl -w'
assert !pn.universal? assert !pn.universal?
assert !pn.i386? assert !pn.i386?
@ -208,7 +212,6 @@ class TextExecutableTests < Test::Unit::TestCase
end end
def test_malformed_shebang def test_malformed_shebang
pn = HOMEBREW_PREFIX/'foo_script'
pn.write ' #!' pn.write ' #!'
assert !pn.universal? assert !pn.universal?
assert !pn.i386? assert !pn.i386?