Sha256: ca3d789f7872a675d40cfbcf4dc799ed8b4cf5606948fb568e91b596d2c07b20
Contents?: true
Size: 832 Bytes
Versions: 28
Compression:
Stored size: 832 Bytes
Contents
require File.expand_path('spec/spec_helper') describe String do describe :naive_split do it "splits repeated pattern" do "aaa".naive_split('a').should == ['','','',''] end it "splits normal stuff" do "abacad".naive_split('a').should == ['','b','c','d'] end it "splits empty into 1" do "".naive_split('a').should == [''] end it "splits 1 into 2" do "a".naive_split('a').should == ['',''] end end describe :surrounded_in? do [ ['aba','a',true], ['abcab','ab',true], ['acc','a',false], ['cca','a',false], ['(cca)',['(',')'],true], ['(cca',['(',')'],false], ].each do |text, word, success| it "is #{success} for #{word} in #{text}" do text.surrounded_in?(*[*word]).should == success end end end end
Version data entries
28 entries across 28 versions & 1 rubygems