Permalink
Browse files

Removing obsolete tests and update README

  • Loading branch information...
1 parent 84bc1e2 commit 881cbbd21fe59c2d39e174baaa3511f28eb45fd1 @marcandre committed Dec 20, 2011
View
@@ -0,0 +1,13 @@
+Backports should be run against RubySpec. Check https://github.com/rubyspec/rubyspec for installation instructions.
+
+Use the `--unguarded` option to run all specs, including those of versions higher than the current Ruby. Use the `-r` option to require backports.
+
+For example:
+
+ cd YOUR_PATH_TO/rubyspec
+ rvm use 1.8.7
+ mspec core/range/cover_spec.rb --unguarded -r YOUR_PATH_TO/backports/lib/backports
+
+This will run the specs for Range#cover for Ruby 1.8.7 after loading backports.
+
+You need to check which tests fail to decide if it's OK that they do or not. For example it is to be expected that specs checking for encoding behavior will fail, as backports does not support the Ruby 1.9 encoding functionality.
View
@@ -1 +0,0 @@
-As backports should be ran against RubySpec, tests should ideally be added to RubySpec instead of here...
View
@@ -1,82 +0,0 @@
-require 'test_helper'
-
-class ArrayTest < Test::Unit::TestCase
- context "Array" do
- context "#combination" do
- should "conform to doc" do
- a = [ "a", "b", "c" ]
- assert_equal [["a"], ["b"], ["c"]], a.combination(1).to_a
- assert_equal [["a", "b"], ["a", "c"], ["b", "c"]], a.combination(2).to_a
- assert_equal [["a", "b", "c"]], a.combination(3).to_a
- assert_equal [], a.combination(4).to_a
- end
- end
-
- context "#flatten" do
- should "conform to doc" do
- s = [ 1, 2, 3 ]
- t = [ 4, 5, 6, [7, 8] ]
- a = [ s, t, 9, 10 ]
- assert_equal [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], a.flatten
- a = [ 1, 2, [3, [4, 5] ] ]
- assert_equal [1, 2, 3, [4, 5]], a.flatten(1)
- end
- end
-
- context "#index" do
- should "conform to doc" do
- a = [ "a", "b", "c" ]
- assert_equal 1, a.index("b")
- assert_equal nil, a.index("z")
- assert_equal 1, a.index{|x|x=="b"}
- end
- end
-
- context "#reverse_each" do
- should "return an enumerator when no block is given" do
- assert_equal [4,3,2], [1,2,3,4].reverse_each.take(3)
- end
- end
-
- context "#pop" do
- should "conform to doc" do
- a = %w{ f r a b j o u s }
- assert_equal "s", a.pop
- assert_equal ["f", "r", "a", "b", "j", "o", "u"] , a
- assert_equal ["j", "o", "u"], a.pop(3)
- assert_equal ["f", "r", "a", "b"] , a
- end
- end
-
- context "#product" do
- should "conform to doc" do
- assert_equal [[1, 3], [1, 4], [2, 3], [2, 4]], [1, 2].product([3, 4])
- assert_equal [[1, 3, 5], [1, 4, 5], [2, 3, 5], [2, 4, 5]], [1, 2].product([3, 4], [5])
- assert_equal [[1], [2]], [1, 2].product
- end
- end
-
- context "#sample" do
- should "conform to doc" do
- assert_equal nil, [].sample
- assert_equal [], [].sample(5)
- assert_equal 42, [42].sample
- assert_equal [42], [42].sample(5)
- a = [ :foo, :bar, 42 ]
- s = a.sample(2)
- assert_equal 2, s.size
- assert_equal 1, (a-s).size
- assert_equal [], a-(0..20).sum{a.sample(2)}
- end
- end
-
- context "#shift" do
- should "conform to doc" do
- args = [ "-m", "-q", "-v", "filename" ]
- assert_equal "-m", args.shift
- assert_equal ["-q", "-v"], args.shift(2)
- assert_equal ["filename"], args
- end
- end
- end
-end
View
@@ -1,71 +0,0 @@
-require 'test_helper'
-require 'backports/basic_object'
-
-class BasicObjectTest < Test::Unit::TestCase
- context "BasicObject" do
- should "do it's best to keep stuff undefined" do
- # written in one big test because sequence matters
- # and defining classes / methods can't really be undone
-
- size = BasicObject.instance_methods.size
- assert size <= 7
-
- class Subclass < BasicObject
- def foo
- :bar
- end
- end
-
- assert_equal size + 1, Subclass.instance_methods.size
-
- module ::Kernel
- def bar
- :foo
- end
- end
-
- assert Subclass.method_defined?(:bar) if RUBY_VERSION < '1.9' # for now
-
- class ForceCleanup < Subclass
- end
-
- assert !Subclass.method_defined?(:bar) # should be cleaned up
-
- module SomeExtension
- def foo
- 42
- end
- end
-
- class ::Object
- include SomeExtension
- end
-
- class ForceCleanupAgain < Subclass
- end
-
- # puts BasicObject.instance_methods - BasicObject.instance_methods(false)
- # puts BasicObject.instance_method(:foo).owner
- # puts SomeExtension <= Object
- assert Subclass.method_defined?(:foo) # should not be cleaned up!
- assert !BasicObject.method_defined?(:foo) # but BasicObject should have been cleaned up!
-
- class BasicObject
- def last_case
- 1.0/0
- end
- end
-
- module SomeExtension
- def last_case
- 0
- end
- end
-
- class ForceCleanupForTheLastTime < BasicObject
- end
-
- assert BasicObject.method_defined?(:last_case)
- end
- end
-end
View
@@ -1,20 +0,0 @@
-require 'test_helper'
-
-class BindingTest < Test::Unit::TestCase
- class Demo
- def initialize(n)
- @secret = n
- end
- def get_binding
- return binding()
- end
- end
-
- context "Binding" do
- context "#eval" do
- should "conform to doc" do
- assert_equal 99, Demo.new(99).get_binding.eval("@secret")
- end
- end
- end
-end
Oops, something went wrong.

0 comments on commit 881cbbd

Please sign in to comment.