Sha256: b82e7dddbc147720ba2d35620cc7e5dd068e3f0be314de314eb0cffcf68039b8
Contents?: true
Size: 1 KB
Versions: 4
Compression:
Stored size: 1 KB
Contents
require File.join(File.dirname(__FILE__), "/../spec_helper") describe Array do it "should be able to swap by value" do [1,2,3,4].swap(1,4).should eql([4,2,3,1]) end it "should be able to swap by index" do %w(a b c d).swap_by_index(0, 3).should eql(%w(d b c a)) end it "should be able to shift a subset (mask) of elements all the way right without disrupting the order of the subset and it's nonmember neighbors." do %w(a x b y c z).shift_mask_right(%w(x y z)).should eql(%w(a b c x y z)) end it "should be able to shift_mask_right with non-used members in the mask" do %w(a x b y c z).shift_mask_right(%w(x y z innocent bystander)).should eql(%w(a b c x y z)) end it "should have a shortcut for |" do a = [1,2,3] a.unique_push!(4) a.should eql([1,2,3,4]) a = [1,2,3] a.upush!(4) a.should eql([1,2,3,4]) end it "should be able to uniquely push more than one element" do a = [1,2,3] a.upush!(4,5,6) a.should eql([1,2,3,4,5,6]) end end
Version data entries
4 entries across 4 versions & 1 rubygems