Use assert_includes
This commit is contained in:
parent
58a75b0f71
commit
4b6abc7da2
@ -22,9 +22,9 @@ class BuildOptionsTests < Homebrew::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_include
|
def test_include
|
||||||
assert @build.include?("with-foo")
|
assert_includes @build, "with-foo"
|
||||||
assert !@build.include?("with-qux")
|
refute_includes @build, "with-qux"
|
||||||
assert !@build.include?("--with-foo")
|
refute_includes @build, "--with-foo"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_with_without
|
def test_with_without
|
||||||
@ -35,23 +35,23 @@ class BuildOptionsTests < Homebrew::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_used_options
|
def test_used_options
|
||||||
assert @build.used_options.include?("--with-foo")
|
assert_includes @build.used_options, "--with-foo"
|
||||||
assert @build.used_options.include?("--with-bar")
|
assert_includes @build.used_options, "--with-bar"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_unused_options
|
def test_unused_options
|
||||||
assert @build.unused_options.include?("--without-baz")
|
assert_includes @build.unused_options, "--without-baz"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_implicit_options
|
def test_implicit_options
|
||||||
# --without-baz is not explicitly specified on the command line (i.e. args)
|
# --without-baz is not explicitly specified on the command line (i.e. args)
|
||||||
# therefore --with-baz should be implicitly assumed:
|
# therefore --with-baz should be implicitly assumed:
|
||||||
assert @build.implicit_options.include?("--with-baz")
|
assert_includes @build.implicit_options, "--with-baz"
|
||||||
# But all these should not be in the implict_options:
|
# But all these should not be in the implict_options:
|
||||||
assert !@build.implicit_options.include?("--without-baz")
|
refute_includes @build.implicit_options, "--without-baz"
|
||||||
assert !@build.implicit_options.include?("--with-bar")
|
refute_includes @build.implicit_options, "--with-bar"
|
||||||
assert !@build.implicit_options.include?("--without-bar")
|
refute_includes @build.implicit_options, "--without-bar"
|
||||||
assert !@build.implicit_options.include?("--with-qux")
|
refute_includes @build.implicit_options, "--with-qux"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_opposite_of
|
def test_opposite_of
|
||||||
|
|||||||
@ -34,7 +34,7 @@ class DependencyCollectorTests < Homebrew::TestCase
|
|||||||
def test_dependency_tags
|
def test_dependency_tags
|
||||||
assert_predicate Dependency.new('foo', [:build]), :build?
|
assert_predicate Dependency.new('foo', [:build]), :build?
|
||||||
assert_predicate Dependency.new('foo', [:build, :optional]), :optional?
|
assert_predicate Dependency.new('foo', [:build, :optional]), :optional?
|
||||||
assert Dependency.new('foo', [:universal]).options.include? '--universal'
|
assert_includes Dependency.new('foo', [:universal]).options, "--universal"
|
||||||
assert_empty Dependency.new('foo').tags
|
assert_empty Dependency.new('foo').tags
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -3,11 +3,11 @@ require 'hardware'
|
|||||||
|
|
||||||
class HardwareTests < Homebrew::TestCase
|
class HardwareTests < Homebrew::TestCase
|
||||||
def test_hardware_cpu_type
|
def test_hardware_cpu_type
|
||||||
assert [:intel, :ppc].include?(Hardware::CPU.type)
|
assert_includes [:intel, :ppc], Hardware::CPU.type
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_hardware_intel_family
|
def test_hardware_intel_family
|
||||||
families = [:core, :core2, :penryn, :nehalem, :arrandale, :sandybridge, :ivybridge, :haswell]
|
families = [:core, :core2, :penryn, :nehalem, :arrandale, :sandybridge, :ivybridge, :haswell]
|
||||||
assert families.include?(Hardware::CPU.family)
|
assert_includes families, Hardware::CPU.family
|
||||||
end if Hardware::CPU.intel?
|
end if Hardware::CPU.intel?
|
||||||
end
|
end
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class LanguageModuleDependencyTests < Homebrew::TestCase
|
|||||||
mod_name = "foo"
|
mod_name = "foo"
|
||||||
import_name = "bar"
|
import_name = "bar"
|
||||||
l = LanguageModuleDependency.new(:python, mod_name, import_name)
|
l = LanguageModuleDependency.new(:python, mod_name, import_name)
|
||||||
assert l.message.include?(mod_name)
|
assert_includes l.message, mod_name
|
||||||
assert l.the_test.one? { |c| c.include?(import_name) }
|
assert l.the_test.one? { |c| c.include?(import_name) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class OptionsTests < Homebrew::TestCase
|
|||||||
def test_no_duplicate_options
|
def test_no_duplicate_options
|
||||||
@options << Option.new("foo")
|
@options << Option.new("foo")
|
||||||
@options << Option.new("foo")
|
@options << Option.new("foo")
|
||||||
assert @options.include? "--foo"
|
assert_includes @options, "--foo"
|
||||||
assert_equal 1, @options.count
|
assert_equal 1, @options.count
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -65,9 +65,9 @@ class OptionsTests < Homebrew::TestCase
|
|||||||
|
|
||||||
def test_include
|
def test_include
|
||||||
@options << Option.new("foo")
|
@options << Option.new("foo")
|
||||||
assert @options.include? "--foo"
|
assert_includes @options, "--foo"
|
||||||
assert @options.include? "foo"
|
assert_includes @options, "foo"
|
||||||
assert @options.include? Option.new("foo")
|
assert_includes @options, Option.new("foo")
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_union_returns_options
|
def test_union_returns_options
|
||||||
@ -102,7 +102,7 @@ class OptionsTests < Homebrew::TestCase
|
|||||||
def test_concat_array
|
def test_concat_array
|
||||||
option = Option.new("foo")
|
option = Option.new("foo")
|
||||||
@options.concat([option])
|
@options.concat([option])
|
||||||
assert @options.include?(option)
|
assert_includes @options, option
|
||||||
assert_equal [option], @options.to_a
|
assert_equal [option], @options.to_a
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ class OptionsTests < Homebrew::TestCase
|
|||||||
opts = Options.new
|
opts = Options.new
|
||||||
opts << option
|
opts << option
|
||||||
@options.concat(opts)
|
@options.concat(opts)
|
||||||
assert @options.include?(option)
|
assert_includes @options, option
|
||||||
assert_equal [option], @options.to_a
|
assert_equal [option], @options.to_a
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -16,8 +16,8 @@ class PatchingTests < Homebrew::TestCase
|
|||||||
|
|
||||||
def assert_patched(path)
|
def assert_patched(path)
|
||||||
s = File.read(path)
|
s = File.read(path)
|
||||||
assert !s.include?("NOOP"), "File was unpatched."
|
refute_includes s, "NOOP", "#{path} was not patched as expected"
|
||||||
assert s.include?("ABCD"), "File was not patched as expected."
|
assert_includes s, "ABCD", "#{path} was not patched as expected"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_single_patch
|
def test_single_patch
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user