Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

put guards on imcompatible specs to prevent ruby, jruby from running …

…them. work around for Dir ** globbing being broken.
  • Loading branch information...
commit 6e51eee65c310255183d81d97a98be313ca68afc 1 parent 03dfae6
@brixen brixen authored
View
59 Rakefile
@@ -1,5 +1,5 @@
-require 'rake/rubinius_spec_tasks'
require 'rake/legacy_tasks'
+
task :default => :spec
def newer?(file, cmp)
@@ -44,13 +44,18 @@ def update_archive(files, archive, dir=nil)
Dir.chdir(curdir) if dir
end
-desc "Completely rebuild everything"
-task :rebuild => ['build:clean', 'build:shotgun', 'build:compiler', 'build:bootstrap', 'build:core', 'build:library']
-
-desc "Build shotgun (the C-code VM)"
-task :build => ['build:shotgun']
-
+# spec tasks
namespace :spec do
+ namespace :setup do
+ desc "Setup for subtend examples"
+ task :subtend do
+ Dir[File.join(ROOT,"spec/subtend/**/Rakefile")].each do |rakefile|
+ sh "rake -f #{rakefile}"
+ end
+ end
+ end
+
+ desc "Run continuous integration examples"
task :ci do
begin
stat = File.stat("CI-specs")
@@ -64,8 +69,47 @@ namespace :spec do
end
sh "bin/mspec CI-specs"
end
+
+ spec_targets = %w(compiler core incompatible language library parser rubinius)
+ # Build a spec:<task_name> for each group of Rubinius specs
+ spec_targets.each do |group|
+ desc "Run #{group} examples"
+ task group => do
+ sh "bin/mspec spec/#{group}"
+ end
+ end
+
+ desc "Run subtend examples"
+ task :subtend => "spec:setup:subtend" do
+ sh "bin/mspec spec/subtend"
+ end
+
+ # Specdiffs to make it easier to see what your changes have affected :)
+ desc 'Run specs and produce a diff against current base'
+ task :diff => 'diff:run'
+
+ 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'
+ end
+
+ desc 'Replace the base spec file with a new one'
+ task :replace do
+ system 'bin/mspec spec > spec/diffs/base.txt'
+ end
+ end
end
+# build tasks
+desc "Completely rebuild everything"
+task :rebuild => ['build:clean', 'build:shotgun', 'build:compiler', 'build:bootstrap', 'build:core', 'build:library']
+
+desc "Build shotgun (the C-code VM)"
+task :build => ['build:shotgun']
+
namespace :build do
desc "Removes build by-products for shotgun, compiler, and library"
@@ -171,6 +215,7 @@ task :pristine do
end
end
+# svn tasks
desc "Remove runtime/*.rba then svn up"
task :svn => 'svn:up'
namespace :svn do
View
4 bin/mspec
@@ -69,16 +69,14 @@ if patterns.empty?
end
files = []
-dirs = []
patterns.each do |item|
stat = File.stat(File.expand_path(item))
files << item if stat.file?
- dirs << item if stat.directory?
+ files.concat(Dir[item+"/**/*_spec.rb"]) if stat.directory?
end
cmd = <<-EOC
#{target} -Ispec -rmini_rspec.rb -rmini_mock.rb -e '@reporter = #{format}.new;
-#{dirs.inspect}.each { |d| Dir[d+"/**/*_spec.rb"].each { |f| load f }};
#{files.inspect}.each { |f| load f }'
EOC
system cmd
View
4 spec/incompatible/bignum_spec.rb
@@ -1,5 +1,7 @@
require File.dirname(__FILE__) + '/../spec_helper'
+if rubinius_examples
+
context "Bignum instance method" do
specify "coerce should return [Bignum, Bignum] if other is a Fixnum" do
a = 0xffffffff.coerce(1)
@@ -16,3 +18,5 @@
b.collect { |i| i.class }.should == [Float, Float]
end
end
+
+end
View
4 spec/incompatible/fixnum_spec.rb
@@ -1,5 +1,7 @@
require File.dirname(__FILE__) + '/../spec_helper'
+if rubinius_examples
+
context "Fixnum instance method" do
specify "coerce should return [Bignum, Bignum] if other is a Bignum" do
a = 1.coerce(0xffffffff)
@@ -7,3 +9,5 @@
a.collect { |i| i.class }.should == [Bignum, Bignum]
end
end
+
+end
View
14 spec/incompatible/hash_spec.rb
@@ -1,11 +1,15 @@
require File.dirname(__FILE__) + '/../spec_helper'
+if rubinius_examples
+
# Class methods:
# .[]
-# Parser chockes on this as of 620
-context 'Creating a Hash' do
- specify 'Hash[] is able to process key, val arguments followed by key => val arguments' do
- Hash[:a, 1, :b, 2, :c => 3].should == {:a => 1, :b => 2, :c => 3}
- end
+# Parser chockes on this as of 1334
+# context 'Creating a Hash' do
+# specify 'Hash[] is able to process key, val arguments followed by key => val arguments' do
+# Hash[:a, 1, :b, 2, :c => 3].should == {:a => 1, :b => 2, :c => 3}
+# end
+# end
+
end
View
4 spec/incompatible/integer_spec.rb
@@ -1,4 +1,8 @@
require File.dirname(__FILE__) + '/../spec_helper'
+if rubinius_examples
+
context "Integer instance method" do
end
+
+end
View
4 spec/incompatible/module_spec.rb
@@ -1,5 +1,7 @@
require File.dirname(__FILE__) + '/../spec_helper'
+if rubinius_examples
+
context "Module" do
specify "const_defined? should return true if the name is defined" do
@@ -33,3 +35,5 @@ def foo
end
end
+
+end
View
4 spec/incompatible/object_spec.rb
@@ -1,5 +1,7 @@
require File.dirname(__FILE__) + '/../spec_helper'
+if rubinius_examples
+
describe "Object instance method coerce_string" do
specify "raises TypeError if the instance does not respond to to_str" do
class A; end
@@ -32,3 +34,5 @@ def to_str
C.new.coerce_string.should == "zam"
end
end
+
+end
View
4 spec/incompatible/string_spec.rb
@@ -1,5 +1,7 @@
require File.dirname(__FILE__) + '/../spec_helper'
+if rubinius_examples
+
context "String instance method" do
specify "lstrip should return a string with all leading \\000 and whitespace characters removed" do
"".lstrip.should == ""
@@ -53,3 +55,5 @@
("%e" % -1e1020).should == "-inf"
end
end
+
+end
View
18 spec/mini_rspec.rb
@@ -8,8 +8,6 @@
# end
# end
-@time_start = Time.now
-
class SpecReporter
class ExpectationReport
def exception=(e)
@@ -66,16 +64,19 @@ def exception(e)
end
def summary
- @out.print "\n\n"
- @exceptions.each_with_index do |r,i|
- print_failure(i+1,r)
- print_backtrace(r.exception)
+ unless @summarized
+ @out.print "\n\n"
+ @exceptions.each_with_index do |r,i|
+ print_failure(i+1,r)
+ print_backtrace(r.exception)
+ end
+ print_summary
+ @summarized = true
end
- print_summary
end
def print_summary
- @out.print "\n" + @examples.to_s + " examples, " + @failures.to_s + " failures\n"
+ @out.print @examples.to_s + " examples, " + @failures.to_s + " failures\n"
end
def print_failure(i,r)
@@ -90,6 +91,7 @@ def print_backtrace(e)
else
@out.print "<No message>"
end
+ @out.print "\n"
end
end
View
4 spec/spec_helper.rb
@@ -9,3 +9,7 @@
rescue
require 'mspec_helper'
end
+
+def rubinius_examples
+ Object.const_defined?(:RUBY_ENGINE) and RUBY_ENGINE == 'rbx'
+end
Please sign in to comment.
Something went wrong with that request. Please try again.