From 5b5361b92ec4730d31cc4646641e29f6002acdf0 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Tue, 2 Apr 2013 15:33:35 -0500 Subject: Fix requires in test_x11_dependency.rb --- Library/Homebrew/test/test_x11_dependency.rb | 74 ++++++++++++++++++++++++++++ Library/Homebrew/test/test_x11_deps.rb | 73 --------------------------- 2 files changed, 74 insertions(+), 73 deletions(-) create mode 100644 Library/Homebrew/test/test_x11_dependency.rb delete mode 100644 Library/Homebrew/test/test_x11_deps.rb (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/test/test_x11_dependency.rb b/Library/Homebrew/test/test_x11_dependency.rb new file mode 100644 index 000000000..884a7cd27 --- /dev/null +++ b/Library/Homebrew/test/test_x11_dependency.rb @@ -0,0 +1,74 @@ +require 'testing_env' +require 'extend/set' +require 'requirements/x11_dependency' + +class X11DependencyTests < Test::Unit::TestCase + def test_eql_instances_are_eql + x = X11Dependency.new + y = X11Dependency.new + assert x.eql?(y) + assert y.eql?(x) + assert x.hash == y.hash + end + + def test_not_eql_when_hashes_differ + x = X11Dependency.new("foo") + y = X11Dependency.new + assert x.hash != y.hash + assert !x.eql?(y) + assert !y.eql?(x) + end + + def test_proxy_for + x = X11Dependency::Proxy.for("libpng") + assert_instance_of X11Dependency::Proxy::Libpng, x + assert_kind_of X11Dependency, x + end + + def test_proxy_eql_instances_are_eql + x = X11Dependency::Proxy.for("libpng") + y = X11Dependency::Proxy.for("libpng") + assert x.eql?(y) + assert y.eql?(x) + assert x.hash == y.hash + end + + def test_proxy_not_eql_when_hashes_differ + x = X11Dependency::Proxy.for("libpng") + y = X11Dependency::Proxy.for("fontconfig") + assert x.hash != y.hash + assert !x.eql?(y) + assert !y.eql?(x) + end + + def test_x_never_eql_to_proxy_x11_dep + x = X11Dependency.new("libpng") + p = X11Dependency::Proxy.for("libpng") + assert !x.eql?(p) + assert !p.eql?(x) + end + + def test_x_env + x = X11Dependency.new + x.stubs(:satisfied?).returns(true) + ENV.expects(:x11) + x.modify_build_environment + end +end + +class X11DepCollectionTests < Test::Unit::TestCase + def setup + @set = ComparableSet.new + end + + def test_x_can_coxist_with_proxy + @set << X11Dependency.new << X11Dependency::Proxy.for("libpng") + assert_equal 2, @set.count + end + + def test_multiple_proxies_can_coexist + @set << X11Dependency::Proxy.for("libpng") + @set << X11Dependency::Proxy.for("fontconfig") + assert_equal 2, @set.count + end +end diff --git a/Library/Homebrew/test/test_x11_deps.rb b/Library/Homebrew/test/test_x11_deps.rb deleted file mode 100644 index 0d5e3978b..000000000 --- a/Library/Homebrew/test/test_x11_deps.rb +++ /dev/null @@ -1,73 +0,0 @@ -require 'testing_env' -require 'requirements' - -class X11DependencyTests < Test::Unit::TestCase - def test_eql_instances_are_eql - x = X11Dependency.new - y = X11Dependency.new - assert x.eql?(y) - assert y.eql?(x) - assert x.hash == y.hash - end - - def test_not_eql_when_hashes_differ - x = X11Dependency.new("foo") - y = X11Dependency.new - assert x.hash != y.hash - assert !x.eql?(y) - assert !y.eql?(x) - end - - def test_proxy_for - x = X11Dependency::Proxy.for("libpng") - assert_instance_of X11Dependency::Proxy::Libpng, x - assert_kind_of X11Dependency, x - end - - def test_proxy_eql_instances_are_eql - x = X11Dependency::Proxy.for("libpng") - y = X11Dependency::Proxy.for("libpng") - assert x.eql?(y) - assert y.eql?(x) - assert x.hash == y.hash - end - - def test_proxy_not_eql_when_hashes_differ - x = X11Dependency::Proxy.for("libpng") - y = X11Dependency::Proxy.for("fontconfig") - assert x.hash != y.hash - assert !x.eql?(y) - assert !y.eql?(x) - end - - def test_x_never_eql_to_proxy_x11_dep - x = X11Dependency.new("libpng") - p = X11Dependency::Proxy.for("libpng") - assert !x.eql?(p) - assert !p.eql?(x) - end - - def test_x_env - x = X11Dependency.new - x.stubs(:satisfied?).returns(true) - ENV.expects(:x11) - x.modify_build_environment - end -end - -class X11DepCollectionTests < Test::Unit::TestCase - def setup - @set = ComparableSet.new - end - - def test_x_can_coxist_with_proxy - @set << X11Dependency.new << X11Dependency::Proxy.for("libpng") - assert_equal 2, @set.count - end - - def test_multiple_proxies_can_coexist - @set << X11Dependency::Proxy.for("libpng") - @set << X11Dependency::Proxy.for("fontconfig") - assert_equal 2, @set.count - end -end -- cgit v1.2.3