Merge pull request #2013 from reitermarkus/spec-hardware
Convert Hardware test to spec.
This commit is contained in:
commit
69d1cedd12
40
Library/Homebrew/test/hardware_spec.rb
Normal file
40
Library/Homebrew/test/hardware_spec.rb
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
require "hardware"
|
||||||
|
|
||||||
|
module Hardware
|
||||||
|
describe CPU do
|
||||||
|
describe "::type" do
|
||||||
|
it "returns the current CPU's type as a symbol, or :dunno if it cannot be detected" do
|
||||||
|
expect(
|
||||||
|
[
|
||||||
|
:intel,
|
||||||
|
:ppc,
|
||||||
|
:dunno,
|
||||||
|
],
|
||||||
|
).to include(described_class.type)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "::family" do
|
||||||
|
it "returns the current CPU's family name as a symbol, or :dunno if it cannot be detected" do
|
||||||
|
skip "Needs an Intel CPU." unless described_class.intel?
|
||||||
|
|
||||||
|
expect(
|
||||||
|
[
|
||||||
|
:core,
|
||||||
|
:core2,
|
||||||
|
:penryn,
|
||||||
|
:nehalem,
|
||||||
|
:arrandale,
|
||||||
|
:sandybridge,
|
||||||
|
:ivybridge,
|
||||||
|
:haswell,
|
||||||
|
:broadwell,
|
||||||
|
:skylake,
|
||||||
|
:kabylake,
|
||||||
|
:dunno,
|
||||||
|
],
|
||||||
|
).to include(described_class.family)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -1,15 +0,0 @@
|
|||||||
require "testing_env"
|
|
||||||
require "hardware"
|
|
||||||
|
|
||||||
class HardwareTests < Homebrew::TestCase
|
|
||||||
def test_hardware_cpu_type
|
|
||||||
assert_includes [:intel, :ppc, :dunno], Hardware::CPU.type
|
|
||||||
end
|
|
||||||
|
|
||||||
if Hardware::CPU.intel?
|
|
||||||
def test_hardware_intel_family
|
|
||||||
families = [:core, :core2, :penryn, :nehalem, :arrandale, :sandybridge, :ivybridge, :haswell, :broadwell, :skylake, :kabylake, :dunno]
|
|
||||||
assert_includes families, Hardware::CPU.family
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Loading…
x
Reference in New Issue
Block a user