aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-01-04 03:42:53 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-01-04 03:42:53 +0000
commit57ad0310a78e0a856458b51b2795e01f0f2ab0d1 (patch)
tree469c743a98876bb427c6d6edf761b59653ad53d9
parent8dec5d84b43a7dd87d643f602975992b1c6075e7 (diff)
downloadpaludis-57ad0310a78e0a856458b51b2795e01f0f2ab0d1.tar.gz
paludis-57ad0310a78e0a856458b51b2795e01f0f2ab0d1.tar.xz
(ruby) Re-enable tests for DependencyDepTag and composite DepSpecs.
-rw-r--r--ruby/Makefile.am2
-rw-r--r--ruby/dep_spec_TEST.rb81
-rwxr-xr-xruby/dep_spec_TEST_cleanup.sh12
-rwxr-xr-xruby/dep_spec_TEST_setup.sh42
-rw-r--r--ruby/dep_tag_TEST.rb78
-rwxr-xr-xruby/dep_tag_TEST_cleanup.sh12
-rwxr-xr-xruby/dep_tag_TEST_setup.sh42
7 files changed, 195 insertions, 74 deletions
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index 5a3082a..eac409a 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -62,6 +62,8 @@ IF_RUBY_QA_SOURCES = \
EXTRA_DIST = $(IF_RUBY_TESTS) $(IF_RUBY_SOURCES) \
$(IF_RUBY_QA_TESTS) $(IF_RUBY_QA_SOURCES) \
paludis_ruby_so.cc \
+ dep_spec_TEST_setup.sh dep_spec_TEST_cleanup.sh \
+ dep_tag_TEST_setup.sh dep_tag_TEST_cleanup.sh \
dep_list_TEST_setup.sh dep_list_TEST_cleanup.sh \
environment_TEST_setup.sh environment_TEST_cleanup.sh \
find_unused_packages_task_TEST_setup.sh find_unused_packages_task_TEST_cleanup.sh \
diff --git a/ruby/dep_spec_TEST.rb b/ruby/dep_spec_TEST.rb
index 3570280..15d12a2 100644
--- a/ruby/dep_spec_TEST.rb
+++ b/ruby/dep_spec_TEST.rb
@@ -21,6 +21,8 @@
require 'test/unit'
require 'Paludis'
+ENV['PALUDIS_HOME'] = Dir.getwd() + '/dep_spec_TEST_dir/home'
+
module Paludis
class TestCase_DepSpec < Test::Unit::TestCase
def test_create_error
@@ -179,43 +181,46 @@ module Paludis
end
end
-### class TestCase_Composites < Test::Unit::TestCase
-### def test_composites
-### spec = PortageDepParser::parse_depend("|| ( foo/bar foo/baz ) foo/monkey", PackageDepSpecParseMode::Permissive)
-### assert_kind_of CompositeDepSpec, spec
-### assert_kind_of AllDepSpec, spec
-###
-### assert_equal 2, spec.to_a.length
-###
-### spec.each_with_index do | a, i |
-### case i
-### when 0
-### assert_kind_of AnyDepSpec, a
-### assert_equal 2, a.to_a.length
-### a.each_with_index do | b, j |
-### case j
-### when 0
-### assert_kind_of PackageDepSpec, b
-### assert_equal "foo/bar", b.to_s
-###
-### when 1
-### assert_kind_of PackageDepSpec, b
-### assert_equal "foo/baz", b.to_s
-###
-### else
-### throw "Too many items"
-### end
-### end
-###
-### when 1
-### assert_kind_of PackageDepSpec, a
-### assert_equal "foo/monkey", a.to_s
-###
-### else
-### throw "Too many items"
-### end
-### end
-### end
-### end
+ class TestCase_Composites < Test::Unit::TestCase
+ def env
+ @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ end
+
+ def test_composites
+ spec = env.package_database.query(Query::All.new, QueryOrder::RequireExactlyOne).last.build_dependencies_key.value
+ assert_kind_of AllDepSpec, spec
+
+ assert_equal 2, spec.to_a.length
+
+ spec.each_with_index do | a, i |
+ case i
+ when 0
+ assert_kind_of AnyDepSpec, a
+ assert_equal 2, a.to_a.length
+ a.each_with_index do | b, j |
+ case j
+ when 0
+ assert_kind_of PackageDepSpec, b
+ assert_equal "foo/bar", b.to_s
+
+ when 1
+ assert_kind_of PackageDepSpec, b
+ assert_equal "foo/baz", b.to_s
+
+ else
+ throw "Too many items"
+ end
+ end
+
+ when 1
+ assert_kind_of PackageDepSpec, a
+ assert_equal "foo/monkey", a.to_s
+
+ else
+ throw "Too many items"
+ end
+ end
+ end
+ end
end
diff --git a/ruby/dep_spec_TEST_cleanup.sh b/ruby/dep_spec_TEST_cleanup.sh
new file mode 100755
index 0000000..7710f1c
--- /dev/null
+++ b/ruby/dep_spec_TEST_cleanup.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d dep_spec_TEST_dir ] ; then
+ rm -fr dep_spec_TEST_dir
+else
+ true
+fi
+
+
+
+
diff --git a/ruby/dep_spec_TEST_setup.sh b/ruby/dep_spec_TEST_setup.sh
new file mode 100755
index 0000000..fc1ed59
--- /dev/null
+++ b/ruby/dep_spec_TEST_setup.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir dep_spec_TEST_dir || exit 1
+cd dep_spec_TEST_dir || exit 1
+
+mkdir -p home/.paludis/repositories
+
+cat <<END > home/.paludis/repositories/testrepo.conf
+location = `pwd`/testrepo
+format = ebuild
+names_cache = /var/empty
+cache = /var/empty
+profiles = \${location}/profiles/testprofile
+END
+
+mkdir -p testrepo/{eclass,distfiles,profiles/testprofile,foo/bar/files} || exit 1
+cd testrepo || exit 1
+echo "testrepo" > profiles/repo_name || exit 1
+cat <<END > profiles/categories || exit 1
+foo
+END
+cat <<END > profiles/testprofile/make.defaults
+ARCH=test
+USERLAND=test
+KERNEL=test
+END
+cat <<END > profiles/profiles.desc
+test testprofile stable
+END
+
+cat <<"END" > foo/bar/bar-1.0.ebuild || exit 1
+DESCRIPTION="Test package"
+HOMEPAGE="http://paludis.pioto.org/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+DEPEND="|| ( foo/bar foo/baz ) foo/monkey"
+END
+
diff --git a/ruby/dep_tag_TEST.rb b/ruby/dep_tag_TEST.rb
index a3b456a..97d25d1 100644
--- a/ruby/dep_tag_TEST.rb
+++ b/ruby/dep_tag_TEST.rb
@@ -20,6 +20,8 @@
require 'test/unit'
require 'Paludis'
+ENV['PALUDIS_HOME'] = Dir.getwd() + '/dep_tag_TEST_dir/home'
+
module Paludis
class TestCase_DepTag < Test::Unit::TestCase
def test_no_create
@@ -29,42 +31,46 @@ module Paludis
end
end
-### class TestCase_DependencyDepTag < Test::Unit::TestCase
-### def get_dt
-### DependencyDepTag.new(PackageDatabaseEntry.new('foo/var','0','moo'),
-### PackageDepSpec.new('foo/bar', PackageDepSpecParseMode::Permissive))
-### end
-###
-### def test_create
-### assert_kind_of DependencyDepTag, get_dt
-### end
-###
-### def test_create_error
-### assert_raise ArgumentError do
-### DependencyDepTag.new
-### end
-###
-### assert_raise ArgumentError do
-### DependencyDepTag.new('a','b','c')
-### end
-###
-### assert_raise TypeError do
-### DependencyDepTag.new('a','b')
-### end
-###
-### assert_raise ArgumentError do
-### DependencyDepTag.new(1)
-### end
-### end
-###
-### def test_methods
-### dt = get_dt
-### {:short_text => 'foo/var-0::moo', :category=>'dependency'}.each do |method, val|
-### assert_respond_to dt, method
-### assert_equal val, dt.send(method)
-### end
-### end
-### end
+ class TestCase_DependencyDepTag < Test::Unit::TestCase
+ def env
+ @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ end
+
+ def get_dt
+ DependencyDepTag.new(env.package_database.query(Query::All.new, QueryOrder::RequireExactlyOne).last,
+ Paludis::parse_user_package_dep_spec('foo/bar', []))
+ end
+
+ def test_create
+ assert_kind_of DependencyDepTag, get_dt
+ end
+
+ def test_create_error
+ assert_raise ArgumentError do
+ DependencyDepTag.new
+ end
+
+ assert_raise ArgumentError do
+ DependencyDepTag.new('a','b','c')
+ end
+
+ assert_raise TypeError do
+ DependencyDepTag.new('a','b')
+ end
+
+ assert_raise ArgumentError do
+ DependencyDepTag.new(1)
+ end
+ end
+
+ def test_methods
+ dt = get_dt
+ {:short_text => 'foo/bar-1.0::testrepo', :category=>'dependency'}.each do |method, val|
+ assert_respond_to dt, method
+ assert_equal val, dt.send(method)
+ end
+ end
+ end
class TestCase_GLSADepTag < Test::Unit::TestCase
def get_dt
diff --git a/ruby/dep_tag_TEST_cleanup.sh b/ruby/dep_tag_TEST_cleanup.sh
new file mode 100755
index 0000000..28e3591
--- /dev/null
+++ b/ruby/dep_tag_TEST_cleanup.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d dep_tag_TEST_dir ] ; then
+ rm -fr dep_tag_TEST_dir
+else
+ true
+fi
+
+
+
+
diff --git a/ruby/dep_tag_TEST_setup.sh b/ruby/dep_tag_TEST_setup.sh
new file mode 100755
index 0000000..af9a8dd
--- /dev/null
+++ b/ruby/dep_tag_TEST_setup.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir dep_tag_TEST_dir || exit 1
+cd dep_tag_TEST_dir || exit 1
+
+mkdir -p home/.paludis/repositories
+
+cat <<END > home/.paludis/repositories/testrepo.conf
+location = `pwd`/testrepo
+format = ebuild
+names_cache = /var/empty
+cache = /var/empty
+profiles = \${location}/profiles/testprofile
+END
+
+mkdir -p testrepo/{eclass,distfiles,profiles/testprofile,foo/bar/files} || exit 1
+cd testrepo || exit 1
+echo "testrepo" > profiles/repo_name || exit 1
+cat <<END > profiles/categories || exit 1
+foo
+END
+cat <<END > profiles/testprofile/make.defaults
+ARCH=test
+USERLAND=test
+KERNEL=test
+END
+cat <<END > profiles/profiles.desc
+test testprofile stable
+END
+
+cat <<"END" > foo/bar/bar-1.0.ebuild || exit 1
+DESCRIPTION="Test package"
+HOMEPAGE="http://paludis.pioto.org/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+DEPEND="|| ( foo/bar foo/baz ) foo/monkey"
+END
+