Sha256: de1553efe8b6a26bd168f45b2aed70da158c12e9aab6e5c9063f69a3e7fd22c8

Contents?: true

Size: 751 Bytes

Versions: 3

Compression:

Stored size: 751 Bytes

Contents

#! /usr/bin/env ruby
# coding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require "array_select_indices.rb"


describe Array, "including items" do

  it "should do for empty array." do
    [].select_indices{ false }              .should == []
    [].select_indices{ true }               .should == []
  end

  it "should do for array of String." do
    %w[ a b c  ].select_indices{ false }    .should == []
    %w[ a b c  ].select_indices{ true }     .should == [0,1,2]
  end

  it "should do for empty array of Integer." do
    [0,1,2,3].select_indices{ false }       .should == []
    [0,1,2,3].select_indices{ true }        .should == [0,1,2,3]
    [0,1,2,3].select_indices{ |i| i < 2 }   .should == [0,1]
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
builtinextension-0.0.5 spec/array_select_indices_spec.rb
builtinextension-0.0.4 spec/array_select_indices_spec.rb
builtinextension-0.0.3 spec/array_select_indices_spec.rb