tests: clean up whitespace
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
parent
40b531deb1
commit
93f8c71e21
@ -20,9 +20,9 @@ class ARGVTests < Test::Unit::TestCase
|
||||
|
||||
def test_ARGV
|
||||
assert ARGV.named.empty?
|
||||
|
||||
|
||||
(HOMEBREW_CELLAR+'mxcl/10.0').mkpath
|
||||
|
||||
|
||||
ARGV.reset
|
||||
ARGV.unshift 'mxcl'
|
||||
assert_equal 1, ARGV.named.length
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
require 'testing_env'
|
||||
require 'hardware'
|
||||
|
||||
|
||||
class EnvironmentTests < Test::Unit::TestCase
|
||||
def test_ENV_options
|
||||
ENV.gcc_4_0
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
require 'testing_env'
|
||||
require 'test/testball'
|
||||
|
||||
class MockFormula <Formula
|
||||
class MockFormula < Formula
|
||||
def initialize url
|
||||
@url=url
|
||||
@homepage = 'http://example.com/'
|
||||
@ -9,7 +9,7 @@ class MockFormula <Formula
|
||||
end
|
||||
end
|
||||
|
||||
class TestZip <Formula
|
||||
class TestZip < Formula
|
||||
def initialize
|
||||
zip=HOMEBREW_CACHE.parent+'test-0.1.zip'
|
||||
Kernel.system '/usr/bin/zip', '-q', '-0', zip, ABS__FILE__
|
||||
@ -39,7 +39,7 @@ class BeerTasting < Test::Unit::TestCase
|
||||
def test_formula_funcs
|
||||
classname=Formula.class_s(FOOBAR)
|
||||
path=Formula.path(FOOBAR)
|
||||
|
||||
|
||||
assert_equal "FooBar", classname
|
||||
assert_match Regexp.new("^#{HOMEBREW_PREFIX}/Library/Formula"), path.to_s
|
||||
|
||||
@ -57,14 +57,14 @@ class BeerTasting < Test::Unit::TestCase
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
assert_not_nil Formula.factory(FOOBAR)
|
||||
end
|
||||
|
||||
|
||||
def test_zip
|
||||
nostdout { assert_nothing_raised { TestZip.new.brew {} } }
|
||||
end
|
||||
|
||||
|
||||
# needs resurrecting
|
||||
# def test_no_ARGV_dupes
|
||||
# ARGV.reset
|
||||
@ -73,7 +73,7 @@ class BeerTasting < Test::Unit::TestCase
|
||||
# ARGV.named.each{|f| n+=1 if f == 'foo'}
|
||||
# assert_equal 1, n
|
||||
# end
|
||||
|
||||
|
||||
def test_brew_h
|
||||
require 'cmd/info'
|
||||
require 'cmd/prune'
|
||||
@ -135,13 +135,13 @@ class BeerTasting < Test::Unit::TestCase
|
||||
d.mkpath
|
||||
assert_equal '0.1.9', d.version
|
||||
end
|
||||
|
||||
|
||||
def test_pathname_plus_yeast
|
||||
nostdout do
|
||||
assert_nothing_raised do
|
||||
assert !Pathname.getwd.rmdir_if_possible
|
||||
assert !Pathname.getwd.abv.empty?
|
||||
|
||||
|
||||
abcd=orig_abcd=HOMEBREW_CACHE+'abcd'
|
||||
FileUtils.cp ABS__FILE__, abcd
|
||||
installed_paths=HOMEBREW_PREFIX.install abcd
|
||||
@ -154,7 +154,7 @@ class BeerTasting < Test::Unit::TestCase
|
||||
abcd.unlink
|
||||
abcd.write 'HELLOWORLD'
|
||||
assert_equal 'HELLOWORLD', File.read(abcd)
|
||||
|
||||
|
||||
assert !orig_abcd.exist?
|
||||
rv=abcd.cp orig_abcd
|
||||
assert orig_abcd.exist?
|
||||
@ -171,10 +171,10 @@ class BeerTasting < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_pathname_properties
|
||||
foo1 = HOMEBREW_CACHE/'foo-0.1.tar.gz'
|
||||
|
||||
|
||||
assert_equal '.tar.gz', foo1.extname
|
||||
assert_equal 'foo-0.1', foo1.stem
|
||||
assert_equal '0.1', foo1.version
|
||||
|
||||
@ -5,26 +5,26 @@ class ChecksumTests < Test::Unit::TestCase
|
||||
def good_checksum f
|
||||
assert_nothing_raised { nostdout { f.new.brew {} } }
|
||||
end
|
||||
|
||||
|
||||
def bad_checksum f
|
||||
assert_raises ChecksumMismatchError do
|
||||
nostdout { f.new.brew {} }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_md5
|
||||
valid_md5 = Class.new(TestBall) do
|
||||
@md5='060844753f2a3b36ecfc3192d307dab2'
|
||||
end
|
||||
|
||||
|
||||
good_checksum valid_md5
|
||||
end
|
||||
|
||||
|
||||
def test_badmd5
|
||||
invalid_md5 = Class.new(TestBall) do
|
||||
@md5='61aa838a9e4050d1876a295a9e62cbe6'
|
||||
end
|
||||
|
||||
|
||||
bad_checksum invalid_md5
|
||||
end
|
||||
|
||||
@ -32,7 +32,7 @@ class ChecksumTests < Test::Unit::TestCase
|
||||
valid_sha1 = Class.new(TestBall) do
|
||||
@sha1='482e737739d946b7c8cbaf127d9ee9c148b999f5'
|
||||
end
|
||||
|
||||
|
||||
good_checksum valid_sha1
|
||||
end
|
||||
|
||||
@ -40,7 +40,7 @@ class ChecksumTests < Test::Unit::TestCase
|
||||
invalid_sha1 = Class.new(TestBall) do
|
||||
@sha1='7ea8a98acb8f918df723c2ae73fe67d5664bfd7e'
|
||||
end
|
||||
|
||||
|
||||
bad_checksum invalid_sha1
|
||||
end
|
||||
|
||||
@ -48,7 +48,7 @@ class ChecksumTests < Test::Unit::TestCase
|
||||
valid_sha256 = Class.new(TestBall) do
|
||||
@sha256='1dfb13ce0f6143fe675b525fc9e168adb2215c5d5965c9f57306bb993170914f'
|
||||
end
|
||||
|
||||
|
||||
good_checksum valid_sha256
|
||||
end
|
||||
|
||||
@ -56,7 +56,7 @@ class ChecksumTests < Test::Unit::TestCase
|
||||
invalid_sha256 = Class.new(TestBall) do
|
||||
@sha256='dcbf5f44743b74add648c7e35e414076632fa3b24463d68d1f6afc5be77024f8'
|
||||
end
|
||||
|
||||
|
||||
bad_checksum invalid_sha256
|
||||
end
|
||||
end
|
||||
|
||||
@ -5,7 +5,7 @@ class AbstractDownloadStrategy
|
||||
attr_reader :url
|
||||
end
|
||||
|
||||
class MostlyAbstractFormula <Formula
|
||||
class MostlyAbstractFormula < Formula
|
||||
@url=''
|
||||
@homepage = 'http://example.com/'
|
||||
end
|
||||
@ -20,7 +20,7 @@ class FormulaTests < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_class_naming
|
||||
assert_equal 'ShellFm', Formula.class_s('shell.fm')
|
||||
assert_equal 'Fooxx', Formula.class_s('foo++')
|
||||
@ -32,7 +32,7 @@ class FormulaTests < Test::Unit::TestCase
|
||||
def test_cant_override_brew
|
||||
assert_raises(RuntimeError) do
|
||||
eval <<-EOS
|
||||
class TestBallOverrideBrew <Formula
|
||||
class TestBallOverrideBrew < Formula
|
||||
def initialize
|
||||
super "foo"
|
||||
end
|
||||
@ -42,7 +42,7 @@ class FormulaTests < Test::Unit::TestCase
|
||||
EOS
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_abstract_formula
|
||||
f=MostlyAbstractFormula.new
|
||||
assert_equal '__UNKNOWN__', f.name
|
||||
|
||||
@ -4,10 +4,10 @@ require 'test/testball'
|
||||
require 'keg'
|
||||
|
||||
|
||||
class TestScriptFileFormula <ScriptFileFormula
|
||||
class TestScriptFileFormula < ScriptFileFormula
|
||||
url "file:///#{Pathname.new(ABS__FILE__).realpath}"
|
||||
version "1"
|
||||
|
||||
|
||||
def initialize
|
||||
@name='test-script-formula'
|
||||
@homepage = 'http://example.com/'
|
||||
@ -37,7 +37,7 @@ class InstallTests < Test::Unit::TestCase
|
||||
|
||||
# Allow the test to do some processing
|
||||
yield
|
||||
|
||||
|
||||
# Remove the brewed formula and double check
|
||||
# that it did get removed. This lets multiple
|
||||
# tests use the same formula name without
|
||||
@ -51,13 +51,13 @@ class InstallTests < Test::Unit::TestCase
|
||||
|
||||
def test_a_basic_install
|
||||
f=TestBall.new
|
||||
|
||||
|
||||
assert_equal Formula.path(f.name), f.path
|
||||
assert !f.installed?
|
||||
|
||||
|
||||
temporary_install f do
|
||||
assert_match Regexp.new("^#{HOMEBREW_CELLAR}/"), f.prefix.to_s
|
||||
|
||||
|
||||
# Test that things made it into the Keg
|
||||
assert f.bin.directory?
|
||||
assert_equal 3, f.bin.children.length
|
||||
@ -66,7 +66,7 @@ class InstallTests < Test::Unit::TestCase
|
||||
assert_equal 1, libexec.children.length
|
||||
assert !(f.prefix+'main.c').exist?
|
||||
assert f.installed?
|
||||
|
||||
|
||||
# Test that things make it into the Cellar
|
||||
keg=Keg.new f.prefix
|
||||
keg.link
|
||||
@ -75,15 +75,15 @@ class InstallTests < Test::Unit::TestCase
|
||||
assert_equal 3, (HOMEBREW_PREFIX+'bin').children.length
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_script_install
|
||||
f=TestScriptFileFormula.new
|
||||
|
||||
|
||||
temporary_install f do
|
||||
nostdout do
|
||||
f.brew { f.install }
|
||||
end
|
||||
|
||||
|
||||
assert_equal 1, f.bin.children.length
|
||||
end
|
||||
end
|
||||
|
||||
@ -7,7 +7,7 @@ class HardwareTests < Test::Unit::TestCase
|
||||
def test_hardware_cpu_type
|
||||
assert [:intel, :ppc].include?(Hardware.cpu_type)
|
||||
end
|
||||
|
||||
|
||||
def test_hardware_intel_family
|
||||
if Hardware.cpu_type == :intel
|
||||
assert [:core, :core2, :penryn, :nehalem, :arrandale, :sandybridge].include?(Hardware.intel_family)
|
||||
|
||||
@ -17,7 +17,7 @@ class InreplaceTest < Test::Unit::TestCase
|
||||
s1.change_make_var! "FLAG", "def"
|
||||
assert_equal "OTHER=def\nFLAG=def\nFLAG2=abc", s1
|
||||
end
|
||||
|
||||
|
||||
def test_change_make_var_empty_2
|
||||
# Replace empty flag
|
||||
s1="FLAG = \nmv file_a file_b"
|
||||
@ -25,7 +25,7 @@ class InreplaceTest < Test::Unit::TestCase
|
||||
s1.change_make_var! "FLAG", "def"
|
||||
assert_equal "FLAG=def\nmv file_a file_b", s1
|
||||
end
|
||||
|
||||
|
||||
def test_change_make_var_append
|
||||
# Append to flag
|
||||
s1="OTHER=def\nFLAG = abc\nFLAG2=abc"
|
||||
@ -33,7 +33,7 @@ class InreplaceTest < Test::Unit::TestCase
|
||||
s1.change_make_var! "FLAG", "\\1 def"
|
||||
assert_equal "OTHER=def\nFLAG=abc def\nFLAG2=abc", s1
|
||||
end
|
||||
|
||||
|
||||
def test_change_make_var_shell_style
|
||||
# Shell variables have no spaces around =
|
||||
s1="OTHER=def\nFLAG=abc\nFLAG2=abc"
|
||||
|
||||
@ -136,12 +136,6 @@ class MachOPathnameTests < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
class TextExecutableTests < Test::Unit::TestCase
|
||||
TMPDIR = HOMEBREW_PREFIX/'tmp'
|
||||
|
||||
def setup
|
||||
FileUtils.mkdir_p TMPDIR
|
||||
end
|
||||
|
||||
def test_simple_shebang
|
||||
pn = Pathname.new('foo')
|
||||
pn.write '#!/bin/sh'
|
||||
@ -189,8 +183,4 @@ class TextExecutableTests < Test::Unit::TestCase
|
||||
assert pn.arch == :dunno
|
||||
assert_no_match /text executable/, file(pn)
|
||||
end
|
||||
|
||||
def teardown
|
||||
TMPDIR.rmtree
|
||||
end
|
||||
end
|
||||
|
||||
@ -24,10 +24,10 @@ class PatchingTests < Test::Unit::TestCase
|
||||
def test_patchArray
|
||||
patches = Patches.new(["http://example.com/patch1.diff", "http://example.com/patch2.diff"])
|
||||
assert_equal 2, patches.patches.length
|
||||
|
||||
|
||||
p1 = patches.patches[0]
|
||||
assert_equal :p1, p1.patch_p
|
||||
|
||||
|
||||
p2 = patches.patches[0]
|
||||
assert_equal :p1, p2.patch_p
|
||||
end
|
||||
@ -37,7 +37,7 @@ class PatchingTests < Test::Unit::TestCase
|
||||
:p0 => "http://example.com/patch.diff"
|
||||
})
|
||||
assert_equal 1, patches.patches.length
|
||||
|
||||
|
||||
p = patches.patches[0]
|
||||
assert_equal :p0, p.patch_p
|
||||
end
|
||||
@ -47,7 +47,7 @@ class PatchingTests < Test::Unit::TestCase
|
||||
:p1 => "http://example.com/patch.diff"
|
||||
})
|
||||
assert_equal 1, patches.patches.length
|
||||
|
||||
|
||||
p = patches.patches[0]
|
||||
assert_equal :p1, p.patch_p
|
||||
end
|
||||
|
||||
@ -2,26 +2,26 @@ require 'testing_env'
|
||||
require 'test/testball'
|
||||
|
||||
|
||||
class DefaultPatchBall <TestBall
|
||||
class DefaultPatchBall < TestBall
|
||||
def patches
|
||||
# Default is p1
|
||||
"file:///#{TEST_FOLDER}/patches/noop-a.diff"
|
||||
end
|
||||
end
|
||||
|
||||
class ListPatchBall <TestBall
|
||||
class ListPatchBall < TestBall
|
||||
def patches
|
||||
["file:///#{TEST_FOLDER}/patches/noop-a.diff"]
|
||||
end
|
||||
end
|
||||
|
||||
class P0PatchBall <TestBall
|
||||
class P0PatchBall < TestBall
|
||||
def patches
|
||||
{ :p0 => ["file:///#{TEST_FOLDER}/patches/noop-b.diff"] }
|
||||
end
|
||||
end
|
||||
|
||||
class P1PatchBall <TestBall
|
||||
class P1PatchBall < TestBall
|
||||
def patches
|
||||
{ :p1 => ["file:///#{TEST_FOLDER}/patches/noop-a.diff"] }
|
||||
end
|
||||
@ -32,7 +32,7 @@ class PatchingTests < Test::Unit::TestCase
|
||||
def read_file path
|
||||
File.open(path, 'r') { |f| f.read }
|
||||
end
|
||||
|
||||
|
||||
def test_single_patch
|
||||
shutup do
|
||||
DefaultPatchBall.new('test_patch').brew do
|
||||
|
||||
@ -7,7 +7,7 @@ class PathnameInstallTests < Test::Unit::TestCase
|
||||
def setup
|
||||
FileUtils.mkdir_p TEMP_FOLDER
|
||||
end
|
||||
|
||||
|
||||
def with_temp_folder
|
||||
TEMP_FOLDER.cd do
|
||||
# Keep these around while building out tests, to make sure
|
||||
@ -19,47 +19,47 @@ class PathnameInstallTests < Test::Unit::TestCase
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_install_missing_file
|
||||
assert_raises(RuntimeError) do
|
||||
Pathname.getwd.install 'non_existant_file'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_install
|
||||
with_temp_folder do
|
||||
TARGET_FOLDER.install 'a.txt'
|
||||
|
||||
|
||||
assert (TARGET_FOLDER+'a.txt').exist?, "a.txt not installed."
|
||||
assert !(TARGET_FOLDER+'b.txt').exist?, "b.txt was installed."
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_install_list
|
||||
with_temp_folder do
|
||||
TARGET_FOLDER.install %w[a.txt b.txt]
|
||||
|
||||
|
||||
assert (TARGET_FOLDER+'a.txt').exist?, "a.txt not installed."
|
||||
assert (TARGET_FOLDER+'b.txt').exist?, "b.txt not installed."
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_install_glob
|
||||
with_temp_folder do
|
||||
TARGET_FOLDER.install Dir['*.txt']
|
||||
|
||||
|
||||
assert (TARGET_FOLDER+'a.txt').exist?, "a.txt not installed."
|
||||
assert (TARGET_FOLDER+'b.txt').exist?, "b.txt not installed."
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_install_folder
|
||||
with_temp_folder do
|
||||
FileUtils.mkdir_p "bin"
|
||||
system "mv *.txt bin"
|
||||
|
||||
|
||||
TARGET_FOLDER.install "bin"
|
||||
|
||||
|
||||
assert (TARGET_FOLDER+'bin/a.txt').exist?, "a.txt not installed."
|
||||
assert (TARGET_FOLDER+'bin/b.txt').exist?, "b.txt not installed."
|
||||
end
|
||||
@ -68,40 +68,40 @@ class PathnameInstallTests < Test::Unit::TestCase
|
||||
def test_install_rename
|
||||
with_temp_folder do
|
||||
TARGET_FOLDER.install 'a.txt' => 'c.txt'
|
||||
|
||||
|
||||
assert (TARGET_FOLDER+'c.txt').exist?, "c.txt not installed."
|
||||
assert !(TARGET_FOLDER+'a.txt').exist?, "a.txt was installed but not renamed."
|
||||
assert !(TARGET_FOLDER+'b.txt').exist?, "b.txt was installed."
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_install_rename_more
|
||||
with_temp_folder do
|
||||
TARGET_FOLDER.install({'a.txt' => 'c.txt', 'b.txt' => 'd.txt'})
|
||||
|
||||
|
||||
assert (TARGET_FOLDER+'c.txt').exist?, "c.txt not installed."
|
||||
assert (TARGET_FOLDER+'d.txt').exist?, "d.txt not installed."
|
||||
assert !(TARGET_FOLDER+'a.txt').exist?, "a.txt was installed but not renamed."
|
||||
assert !(TARGET_FOLDER+'b.txt').exist?, "b.txt was installed but not renamed."
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_install_rename_folder
|
||||
with_temp_folder do
|
||||
FileUtils.mkdir_p "bin"
|
||||
system "mv *.txt bin"
|
||||
|
||||
|
||||
TARGET_FOLDER.install "bin" => "libexec"
|
||||
|
||||
|
||||
assert !(TARGET_FOLDER+'bin').exist?, "bin was installed but not renamed."
|
||||
assert (TARGET_FOLDER+'libexec/a.txt').exist?, "a.txt not installed."
|
||||
assert (TARGET_FOLDER+'libexec/b.txt').exist?, "b.txt not installed."
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# test_install_symlink
|
||||
# test_install_relative_symlink
|
||||
|
||||
|
||||
def teardown
|
||||
FileUtils.rm_rf TEMP_FOLDER
|
||||
end
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
require 'testing_env'
|
||||
require 'extend/string'
|
||||
|
||||
class StringTest <Test::Unit::TestCase
|
||||
class StringTest < Test::Unit::TestCase
|
||||
def test_undent
|
||||
undented = <<-EOS.undent
|
||||
hi
|
||||
|
||||
@ -82,7 +82,7 @@ class UpdaterTests < Test::Unit::TestCase
|
||||
assert report.select_formula(:R).empty?
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_update_homebrew_with_formulae_changes
|
||||
diff_output = fixture('update_git_diff_output_with_formulae_changes')
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ require 'testing_env'
|
||||
require 'formula'
|
||||
require 'test/testball'
|
||||
|
||||
class MockFormula <Formula
|
||||
class MockFormula < Formula
|
||||
def initialize url
|
||||
@url=url
|
||||
@homepage = 'http://example.com/'
|
||||
@ -10,7 +10,7 @@ class MockFormula <Formula
|
||||
end
|
||||
end
|
||||
|
||||
class TestBadVersion <TestBall
|
||||
class TestBadVersion < TestBall
|
||||
@version="versions can't have spaces"
|
||||
end
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
require 'formula'
|
||||
|
||||
class TestBall <Formula
|
||||
class TestBall < Formula
|
||||
# name parameter required for some Formula::factory
|
||||
def initialize name=nil
|
||||
@url="file:///#{TEST_FOLDER}/tarballs/testball-0.1.tbz"
|
||||
@ -32,7 +32,7 @@ class TestBallWithMirror < Formula
|
||||
end
|
||||
end
|
||||
|
||||
class ConfigureFails <Formula
|
||||
class ConfigureFails < Formula
|
||||
# name parameter required for some Formula::factory
|
||||
def initialize name=nil
|
||||
@url="file:///#{TEST_FOLDER}/tarballs/configure_fails.tar.gz"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user