Hi,

The Rake::TestTask class currently allows both verbose and warning options, which is good. However, there may also be times when a user wants to run tests at a particular $SAFE level.

This relatively simple patch provides that ability. What do you think?

Regards,

Dan

c:\>diff -u testtask.orig testtask.rb
--- testtask.orig       Wed Dec 31 04:17:51 2008
+++ testtask.rb Wed Dec 31 04:29:32 2008
@@ -55,6 +55,10 @@
     # E.g. warning=true implies "ruby -w" used to run the tests.
     attr_accessor :warning

+    # Request that the tests be run at the given safe level.
+    # E.g. safe_level=1 implies "ruby -T1" is used to run the tests.
+    attr_accessor :safe_level
+
     # Glob pattern to match test files. (default is 'test/test*.rb')
     attr_accessor :pattern

@@ -86,6 +90,7 @@
       @test_files = nil
       @verbose = false
       @warning = false
+      @safe_level = 0
       @loader = :rake
       @ruby_opts = []
       yield self if block_given?
@@ -111,6 +116,7 @@
             end
           @ruby_opts.unshift( "-I#{lib_path}" )
           @ruby_opts.unshift( "-w" ) if @warning
+          @ruby_opts.unshift( "-...@safe_level}") if @safe_level > 0
           ruby @ruby_opts.join(" ") +
             " \"#{run_code}\" " +
             file_list.collect { |fn| "\"#{fn}\"" }.join(' ') +
_______________________________________________
Rake-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rake-devel

Reply via email to