From a5cbf945962b7a177b3d080bf100dab65757b366 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Thu, 18 Feb 2010 12:00:07 -0800 Subject: [PATCH] Move hardware detection tests to separate file. --- Library/Homebrew/test/test_bucket.rb | 12 ------------ Library/Homebrew/test/test_hardware.rb | 21 +++++++++++++++++++++ Library/Homebrew/test/tests | 3 +++ Library/Homebrew/test/unittest.rb | 2 -- 4 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 Library/Homebrew/test/test_hardware.rb diff --git a/Library/Homebrew/test/test_bucket.rb b/Library/Homebrew/test/test_bucket.rb index cc615466b9..39dd41dab8 100644 --- a/Library/Homebrew/test/test_bucket.rb +++ b/Library/Homebrew/test/test_bucket.rb @@ -101,18 +101,6 @@ class BeerTasting < Test::Unit::TestCase assert_raises(FormulaUnavailableError) { ARGV.formulae } end - # these will raise if we don't recognise your mac, but that prolly - # indicates something went wrong rather than we don't know - 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].include?(Hardware.intel_family) - end - end - def test_brew_h nostdout do assert_nothing_raised do diff --git a/Library/Homebrew/test/test_hardware.rb b/Library/Homebrew/test/test_hardware.rb new file mode 100644 index 0000000000..a753d0cf8d --- /dev/null +++ b/Library/Homebrew/test/test_hardware.rb @@ -0,0 +1,21 @@ +require 'testing_env' + +require 'extend/ARGV' # needs to be after test/unit to avoid conflict with OptionsParser +ARGV.extend(HomebrewArgvExtension) + +require 'hardware' + + +class HardwareTests < Test::Unit::TestCase + # these will raise if we don't recognise your mac, but that prolly + # indicates something went wrong rather than we don't know + 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].include?(Hardware.intel_family) + end + end +end \ No newline at end of file diff --git a/Library/Homebrew/test/tests b/Library/Homebrew/test/tests index ea5cf6cea6..6653b10a9f 100755 --- a/Library/Homebrew/test/tests +++ b/Library/Homebrew/test/tests @@ -9,6 +9,9 @@ # Bulk of the tests ruby unittest.rb $* +# Test hardware sniffers +ruby test_hardware.rb $* + # Test formula installs ruby test_formula_install.rb $* diff --git a/Library/Homebrew/test/unittest.rb b/Library/Homebrew/test/unittest.rb index cfe8bc1286..e93fd7b39c 100755 --- a/Library/Homebrew/test/unittest.rb +++ b/Library/Homebrew/test/unittest.rb @@ -23,13 +23,11 @@ Dir.chdir HOMEBREW_PREFIX at_exit { HOMEBREW_PREFIX.parent.rmtree } require 'utils' -require 'hardware' require 'formula' require 'download_strategy' require 'keg' require 'utils' require 'brew.h' -require 'hardware' # for some reason our utils.rb safe_system behaves completely differently # during these tests. This is worrying for sure.