Permalink
Browse files

Added support for autotest.

Requires a new release of ZenTest to actually work.
I'm tired, I'll do that tomorrow
  • Loading branch information...
1 parent f2a37d3 commit 092e0081c26eeda2ca6561eb19123b468965c84a @zenspider zenspider committed Dec 5, 2007
Showing with 74 additions and 1,128 deletions.
  1. +61 −0 .autotest
  2. +3 −3 bin/mspec
  3. +10 −1 spec/mini_rspec.rb
  4. +0 −1,124 spec/reports/ci-excludes.txt
View
@@ -0,0 +1,61 @@
+# -*- ruby -*-
+
+Autotest.add_hook :run_command do |at|
+ system "rake"
+end
+
+class Autotest
+ alias :old_ruby :ruby
+ alias :old_make_test_cmd :make_test_cmd
+
+ def ruby
+ "USE_MSPEC=1 shotgun/rubinius"
+ end
+
+ def make_test_cmd files_to_test
+ cmds = []
+ full, partial = files_to_test.partition { |k,v| v.empty? }
+
+ unless full.empty? then
+ classes = full.map {|k,v| k}.flatten.uniq.sort.join(' ')
+
+ system "find spec -name \*excludes.txt | xargs cat > all-exclude.txt~"
+
+ cmds << "#{ruby} -I#{@libs} -e \"puts 'Started autotest'; %w[#{classes}].each { |f| require f }\" | #{unit_diff}"
+ end
+
+ partial.each do |klass, methods|
+ cmds << "#{ruby} -I#{@libs} #{klass} -n \"/^(#{Regexp.union(*methods).source})$/\" | #{unit_diff}"
+ end
+
+ return cmds.join("#{SEP} ")
+ end
+end
+
+Autotest.add_hook :initialize do |at|
+ at.exceptions << /\.rbc$/ << /\.txt$/
+
+ at.add_mapping %r%^spec/.*_spec\.rb$% do |filename, _|
+ filename
+ end
+
+ at.add_mapping %r%^kernel/(.*)/(.*).rb$% do |_, m|
+ Dir["spec/#{m[1]}/#{m[2]}/*_spec.rb"]
+ end
+
+ at.add_mapping %r%^kernel/(.*)/(.*).rb$% do |_, m|
+ Dir["spec/#{m[1]}/#{m[2]}/*_spec.rb"]
+ end
+
+ at.add_mapping %r%^compiler/(bytecode|sexp|translation)/*.rb$% do |_, m|
+ Dir["spec/compiler/rubinius/*_spec.rb"] + Dir["spec/language/*_spec.rb"]
+ end
+
+ at.add_mapping %r%^lib/(.*).rb% do |_, m|
+ Dir["spec/library/#{m[1]}*_spec.rb"]
+ end
+
+ at.add_mapping %r%^shotgun/lib/subtend/ruby.c$% do |_, m|
+ Dir["spec/rubinius|spec/rubinius/subtend/*_spec.rb"]
+ end
+end
View
@@ -126,9 +126,9 @@ end
code = <<-EOC
$VERBOSE=nil
#{name}
-@runner = SpecRunner.new(#{format}.new(#{output.inspect if output}));
-@runner.only(*#{only.inspect});
-@runner.except(*#{except.inspect});
+@runner = SpecRunner.new(#{format}.new(#{output.inspect if output}))
+@runner.only(*#{only.inspect})
+@runner.except(*#{except.inspect})
#{files.inspect}.each do |f|
cname = "\#{f}c"
File.delete(cname) if #{clean} and File.exist?(cname)
View
@@ -380,7 +380,16 @@ def describe(msg)
end
if @runner == nil
- @runner = SpecRunner.new
+ $stderr.puts "creating default SpecRunner with excludes"
+
+ @runner = SpecRunner.new DottedReporter.new
+ @runner.except "spec/exclude.txt", "all-exclude.txt~"
+
+ at_exit {
+ puts
+ puts "Finished in unknown seconds"
+ @runner.reporter.summary
+ }
end
# Expose the runner methods
Oops, something went wrong.

0 comments on commit 092e008

Please sign in to comment.