summaryrefslogtreecommitdiff
path: root/test/rake/test_rake_package_task.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-23 22:11:55 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-23 22:11:55 +0000
commitd001539a0538cba0e48be2ebdafe29e67b006a4e (patch)
treeabf1591ca3b56f04f46cc2cce9918700620a3ab1 /test/rake/test_rake_package_task.rb
parent3fbc9440feb66cf762834b6d66e6f3a893bab5b7 (diff)
* lib/rake: Import Rake 0.9.2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rake/test_rake_package_task.rb')
-rw-r--r--test/rake/test_rake_package_task.rb79
1 files changed, 79 insertions, 0 deletions
diff --git a/test/rake/test_rake_package_task.rb b/test/rake/test_rake_package_task.rb
new file mode 100644
index 00000000000..87cb57c1053
--- /dev/null
+++ b/test/rake/test_rake_package_task.rb
@@ -0,0 +1,79 @@
+require File.expand_path('../helper', __FILE__)
+require 'rake/packagetask'
+
+class TestRakePackageTask < Rake::TestCase
+
+ def test_initialize
+ touch 'install.rb'
+ touch 'a.c'
+ touch 'b.c'
+ mkdir 'CVS'
+ touch 'a.rb~'
+
+ pkg = Rake::PackageTask.new("pkgr", "1.2.3") { |p|
+ p.package_files << "install.rb"
+ p.package_files.include '*.c'
+ p.package_files.exclude(/\bCVS\b/)
+ p.package_files.exclude(/~$/)
+ p.package_dir = 'pkg'
+ p.need_tar = true
+ p.need_tar_gz = true
+ p.need_tar_bz2 = true
+ p.need_zip = true
+ }
+
+ assert_equal "pkg", pkg.package_dir
+
+ assert_includes pkg.package_files, 'a.c'
+
+ assert_equal 'pkgr', pkg.name
+ assert_equal '1.2.3', pkg.version
+ assert Rake::Task[:package]
+ assert Rake::Task['pkg/pkgr-1.2.3.tgz']
+ assert Rake::Task['pkg/pkgr-1.2.3.tar.gz']
+ assert Rake::Task['pkg/pkgr-1.2.3.tar.bz2']
+ assert Rake::Task['pkg/pkgr-1.2.3.zip']
+ assert Rake::Task['pkg/pkgr-1.2.3']
+ assert Rake::Task[:clobber_package]
+ assert Rake::Task[:repackage]
+ end
+
+ def test_initialize_no_version
+ e = assert_raises RuntimeError do
+ Rake::PackageTask.new 'pkgr'
+ end
+
+ assert_equal 'Version required (or :noversion)', e.message
+ end
+
+ def test_initialize_noversion
+ pkg = Rake::PackageTask.new 'pkgr', :noversion
+
+ assert_equal 'pkg', pkg.package_dir
+ assert_equal 'pkgr', pkg.name
+ assert_equal nil, pkg.version
+ end
+
+ def test_clone
+ pkg = Rake::PackageTask.new("x", :noversion)
+ p2 = pkg.clone
+ pkg.package_files << "y"
+ p2.package_files << "x"
+ assert_equal ["y"], pkg.package_files
+ assert_equal ["x"], p2.package_files
+ end
+
+ def test_package_name
+ pkg = Rake::PackageTask.new 'a', '1'
+
+ assert_equal 'a-1', pkg.package_name
+ end
+
+ def test_package_name_noversion
+ pkg = Rake::PackageTask.new 'a', :noversion
+
+ assert_equal 'a', pkg.package_name
+ end
+
+end
+