Skip to content

Commit

Permalink
changes to support better CI specs
Browse files Browse the repository at this point in the history
hat mini_rspec will take a filename as an exclude/include argument and read the actual excludes/includes from the file.
added that mspec will take -o FILE to use an alternate to STDOUT for the spec reporter output.
updated spec tasks. misc spec changes.
added naive implementation of IO#each.
  • Loading branch information
brixen committed Aug 19, 2007
1 parent 05e36a6 commit d0e6b65
Show file tree
Hide file tree
Showing 11 changed files with 315 additions and 256 deletions.
23 changes: 7 additions & 16 deletions Rakefile
Expand Up @@ -74,6 +74,7 @@ end
# spec tasks
desc "Run continuous integration examples"
task :spec => 'spec:ci'

namespace :spec do
namespace :setup do
desc "Setup for subtend examples"
Expand All @@ -86,19 +87,9 @@ namespace :spec do

desc "Run continuous integration examples"
task :ci do
begin
stat = File.stat("CI-specs")
if stat.file?
raise "CI-specs is a file. Remove it to run CI specs"
elsif stat.directory?
sh "svn up CI-specs"
end
rescue
sh("svn co http://code.fallingsnow.net/svn/rubinius/branches/CI-specs")
end
target = ENV['SPEC_TARGET'] || 'rbx'
system %(shotgun/rubinius -e 'puts "rbx build: \#{Rubinius::BUILDREV}"') if target == 'rbx'
sh "bin/mspec -t #{target} -f ci CI-specs"
sh "bin/mspec -t #{target} -f ci -x spec/reports/ci-excludes.txt spec"
end

spec_targets = %w(compiler core language library parser rubinius)
Expand All @@ -112,7 +103,7 @@ namespace :spec do

desc "Run subtend examples"
task :subtend => "spec:setup:subtend" do
sh "bin/mspec spec/subtend"
sh "bin/mspec spec/rubinius/subtend"
end

# Specdiffs to make it easier to see what your changes have affected :)
Expand All @@ -122,14 +113,14 @@ namespace :spec do
namespace :diff do
desc 'Run specs and produce a diff against current base'
task :run do
system 'bin/mspec spec > /tmp/rbs_specdiff'
system 'diff -u spec/diffs/base.txt /tmp/rbs_specdiff'
system 'rm /tmp/rbs_specdiff'
system 'bin/mspec -f ci -o spec/reports/specdiff.txt spec'
system 'diff -u spec/reports/base.txt spec/reports/specdiff.txt'
system 'rm spec/reports/specdiff.txt'
end

desc 'Replace the base spec file with a new one'
task :replace do
system 'bin/mspec spec > spec/diffs/base.txt'
system 'bin/mspec -f ci -o spec/reports/base.txt spec'
end
end

Expand Down
7 changes: 6 additions & 1 deletion bin/mspec
Expand Up @@ -16,6 +16,7 @@ requires = ['-rmini_rspec.rb', '-rmini_mock.rb']
except = []
only = []
name = nil
output = nil
target = 'shotgun/rubinius'
format = 'DottedReporter'

Expand Down Expand Up @@ -69,6 +70,10 @@ opts = OptionParser.new("", 24, ' ') do |opts|
"Overrides the name used to determine the implementation") do |n|
name = "RUBY_NAME = \"#{n}\";"
end
opts.on("-o", "--output FILE", String,
"Reporter output will be sent to FILE") do |f|
output = f
end
opts.on("-e", "--example RE", String,
"Execute example(s) with descriptions matching RE") do |r|
only << r
Expand Down Expand Up @@ -104,7 +109,7 @@ end

cmd = <<-EOC
#{target} #{includes.join(" ")} #{requires.join(" ")} -e '#{name}
@runner = SpecRunner.new(#{format}.new);
@runner = SpecRunner.new(#{format}.new(#{output.inspect if output}));
@runner.only(*#{only.inspect});
@runner.except(*#{except.inspect});
#{files.inspect}.each { |f| load f }'
Expand Down
8 changes: 7 additions & 1 deletion kernel/core/00io.rb
Expand Up @@ -78,7 +78,7 @@ def sync
true
end

def gets
def gets(sep=$/)
cur = read(1)
return nil unless cur
out = cur
Expand All @@ -91,6 +91,12 @@ def gets
return out
end

def each(sep=$/)
while line = gets(sep)
yield line
end
end

def self.pipe
lhs = IO.allocate
rhs = IO.allocate
Expand Down
Binary file modified runtime/core.rba
Binary file not shown.

0 comments on commit d0e6b65

Please sign in to comment.