Sha256: 4dbbdbc09395472b96f93ddf0e80bd26f735b032229c2f9807f290b64e6428da
Contents?: true
Size: 987 Bytes
Versions: 88
Compression:
Stored size: 987 Bytes
Contents
require 'epitools/clitools' describe String do it "highlights" do color = :light_yellow highlighted = "xxx#{"match".send(color)}zzz" "xxxmatchzzz".highlight(/match/, color).should == highlighted "xxxmatchzzz".highlight("match", color).should == highlighted "xxxmatchzzz".highlight(/m.+h/, color).should == highlighted "xxxmatchzzz".highlight(/MATCH/i, color).should == highlighted end it "highlights with a block" do result = "xxxmatchxxx".highlight(/match/) { |match| "<8>#{match}</8>" } result.should == "xxx<8>match</8>xxx" end it "cmds" do cmd( ['test -f ?', __FILE__] ).should == true cmd( ['test -d ?', __FILE__] ).should == false cmd( "test", "-f", __FILE__ ).should == true cmd( "test", "-d", __FILE__ ).should == false lambda { cmd( ["test -f ? ?", __FILE__] ) }.should raise_error # too many ?'s lambda { cmd( ["test -f", __FILE__] ) }.should raise_error # too few ?'s end end
Version data entries
88 entries across 88 versions & 1 rubygems