require 'rake'
require 'rake/testtask'

desc "Runs the test suite for the core classes"
Rake::TestTask.new('test_core') do |t|
   t.test_files = FileList['test/core/**/tc*']
   t.warning = true
end

desc "Runs the test suite for the Array class"
Rake::TestTask.new('test_array') do |t|
   t.test_files = FileList['test/core/Array/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the Bignum class"
Rake::TestTask.new('test_bignum') do |t|
   t.test_files = FileList['test/core/Bignum/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the Binding class"
Rake::TestTask.new('test_binding') do |t|
   t.test_files = FileList['test/core/Binding/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the Class module"
Rake::TestTask.new('test_class') do |t|
   t.test_files = FileList['test/core/Class/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the Comparable module"
Rake::TestTask.new('test_comparable') do |t|
   t.test_files = FileList['test/core/Comparable/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the Dir class"
Rake::TestTask.new('test_dir') do |t|
   t.libs << 'lib'
   t.warning = true
   t.test_files = FileList['test/core/Dir/*/*.rb']
end

desc "Runs the test suite for the Enumerable class"
Rake::TestTask.new('test_enumerable') do |t|
   t.libs << 'lib'
   t.warning = true
   t.test_files = FileList['test/core/Enumerable/*/*.rb']
end

desc "Runs the test suite for the FalseClass class"
Rake::TestTask.new('test_false') do |t|
   t.libs << 'lib'
   t.warning = true
   t.test_files = FileList['test/core/FalseClass/*/*.rb']
end

desc "Runs the test suite for the File class"
Rake::TestTask.new('test_file') do |t|
   t.libs << 'lib'
   t.warning = true
   if defined? JRUBY_VERSION
      files = [
         'test/core/File/class/tc_basename.rb',
         'test/core/File/class/tc_constants.rb',
         'test/core/File/class/tc_delete.rb',
         'test/core/File/class/tc_directory.rb',
         'test/core/File/class/tc_dirname.rb',
         'test/core/File/class/tc_exist.rb',
         'test/core/File/class/tc_expand_path.rb',
         'test/core/File/class/tc_extname.rb',
         'test/core/File/class/tc_expand_path.rb',
         'test/core/File/class/tc_file.rb',
         'test/core/File/class/tc_join.rb',
         'test/core/File/class/tc_new.rb',
         'test/core/File/class/tc_size.rb',
         'test/core/File/class/tc_split.rb',
         'test/core/File/class/tc_zero.rb',
      ]
   else
      files = FileList['test/core/File/*/*.rb']
   end
   t.test_files = files
end

desc "Runs the test suite for the File::Stat class"
Rake::TestTask.new('test_file_stat') do |t|
   t.libs << 'lib'
   t.warning = true
   t.test_files = FileList['test/core/FileStat/*/*.rb']
end

desc "Runs the test suite for the Fixnum class"
Rake::TestTask.new('test_fixnum') do |t|
   t.libs << 'lib'
   t.warning = true
   t.test_files = FileList['test/core/Fixnum/*/*.rb']
end

desc "Runs the test suite for the Float class"
Rake::TestTask.new('test_float') do |t|
   t.libs << 'lib'
   t.warning = true
   t.test_files = FileList['test/core/Float/*/*.rb']
end

desc "Runs the test suite for the Hash class"
Rake::TestTask.new('test_hash') do |t|
   t.test_files = FileList['test/core/Hash/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the Integer class"
Rake::TestTask.new('test_integer') do |t|
   t.test_files = FileList['test/core/Integer/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the IO class"
Rake::TestTask.new('test_io') do |t|
   t.test_files = FileList['test/core/IO/*/*.rb']
   t.verbose = true
   t.warning = true
end

desc "Runs the test suite for the Math module"
Rake::TestTask.new('test_math') do |t|
   t.test_files = FileList['test/core/Math/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the Module object"
Rake::TestTask.new('test_module') do |t|
   t.test_files = FileList['test/core/Module/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the NilClass class"
Rake::TestTask.new('test_nil') do |t|
   t.test_files = FileList['test/core/NilClass/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the Numeric class"
Rake::TestTask.new('test_numeric') do |t|
   t.test_files = FileList['test/core/Numeric/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the ObjectSpace class"
Rake::TestTask.new('test_objectspace') do |t|
   t.test_files = FileList['test/core/ObjectSpace/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the Process module"
Rake::TestTask.new('test_process') do |t|
   t.test_files = FileList['test/core/Process/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the Process::GID module"
Rake::TestTask.new('test_process_gid') do |t|
   t.test_files = FileList['test/core/ProcessGID/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the Process::Sys module"
Rake::TestTask.new('test_process_sys') do |t|
   t.test_files = FileList['test/core/ProcessSys/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the Process::UID module"
Rake::TestTask.new('test_process_uid') do |t|
   t.test_files = FileList['test/core/ProcessUID/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the Range class"
Rake::TestTask.new('test_range') do |t|
   t.test_files = FileList['test/core/Range/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the String class"
Rake::TestTask.new('test_string') do |t|
   t.test_files = FileList['test/core/String/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the Struct class"
Rake::TestTask.new('test_struct') do |t|
   t.test_files = FileList['test/core/Struct/*/*.rb']
   t.warning = true
end

desc "Runs the test suite for the TrueClass class"
Rake::TestTask.new('test_true') do |t|
   t.libs << 'lib'
   t.warning = true
   t.test_files = FileList['test/core/TrueClass/*/*.rb']
end

## Test tasks for the stdlib ##

desc "Run the test suite for all stdlib packages"
Rake::TestTask.new('test_stdlib') do |t|
   t.libs << 'lib'
   t.warning = true
   t.test_files = FileList['test/stdlib/*/*.rb']
end

desc "Run the test suite for the English package"
Rake::TestTask.new('test_english') do |t|
   t.libs << 'lib'
   t.warning = true
   t.test_files = FileList['test/stdlib/English/*.rb']
end

desc "Run the test suite for the Pathname package"
Rake::TestTask.new('test_pathname') do |t|
   t.libs << 'lib'
   t.warning = true
   t.test_files = FileList['test/stdlib/Pathname/*.rb']
end

desc "Run the test suite for the Rational package"
Rake::TestTask.new('test_rational') do |t|
   t.libs << 'lib'
   t.warning = true
   t.test_files = FileList['test/stdlib/Rational/*.rb']
end

desc "Run the test suite for the Set package"
Rake::TestTask.new('test_set') do |t|
   t.libs << 'lib'
   t.warning = true
   t.test_files = FileList['test/stdlib/Set/*.rb']
end

desc "Run the test suite for the Socket package"
Rake::TestTask.new('test_socket') do |t|
   t.libs << 'lib'
   t.warning = true
   t.test_files = FileList['test/stdlib/Socket/*.rb']
end
