namespace :test do desc 'run all sample tests' task :samples do ruby "./sample/suite.rb" end desc 'run functional tests' task :functional do ENV['check_rubygems'] = 'true' ruby './test/functional/suite.rb' ruby './test/functional/for_redcloth.rb' end namespace :functional do desc 'run all functional tests on all supported Ruby platforms' task :all do $stdout.sync = true for task in %w(test:functional 187 test:functional ee test:functional 19 test:functional 191 test:functional jruby test:functional) if task == 'test:functional' puts "\n\nTesting with #{RUBY}..." Rake::Task['test:functional'].reenable Rake::Task['test:functional'].invoke else Rake::Task[task].invoke end end end end desc 'run unit tests' task :units do ENV['check_rubygems'] = 'true' ruby './test/unit/suite.rb' end namespace :units do desc 'run all unit tests on all supported Ruby platforms' task :all do $stdout.sync = true for task in %w(test:units 187 test:units ee test:units 19 test:units 191 test:units jruby test:units) if task == 'test:units' puts "\n\nTesting with #{RUBY}..." Rake::Task['test:units'].reenable Rake::Task['test:units'].invoke else Rake::Task[task].invoke end end end end desc 'run all scanner tests' task :scanners do ruby "./test/scanners/suite.rb" end namespace :scanner do Dir['./test/scanners/*'].each do |scanner| next unless File.directory? scanner lang = File.basename(scanner) desc "run all scanner tests for #{lang}" task lang do ruby "./test/scanners/suite.rb #{lang}" end end end desc 'clean test output files' task :clean do for file in Dir['test/scanners/**/*.actual.*'] rm file end for file in Dir['test/scanners/**/*.debug.diff'] rm file end for file in Dir['test/scanners/**/*.debug.diff.html'] rm file end for file in Dir['test/scanners/**/*.expected.html'] rm file end end desc 'run all tests on all supported Ruby platforms' task :all do $stdout.sync = true for task in %w(test 19 test jruby test) if task == 'test' print "\n\nTesting with " ruby '-v' Rake::Task['test'].reenable Rake::Task['test:exe'].reenable Rake::Task['test:functional'].reenable Rake::Task['test:units'].reenable Rake::Task['test:scanners'].reenable Rake::Task['test'].invoke else Rake::Task[task].invoke end end end desc 'test the CodeRay executable' task :exe do ruby './test/executable/suite.rb' end end task :test => %w( test:functional test:exe test:units ) task :samples => 'test:samples'