Sha256: 7bb4ec2be2d32863f65d285e3b6cd32610706fa8f7bbfcc175269482e6fc2d3b

Contents?: true

Size: 828 Bytes

Versions: 46

Compression:

Stored size: 828 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 "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

46 entries across 46 versions & 1 rubygems

Version Path
epitools-0.4.10 spec/clitools_spec.rb
epitools-0.4.9 spec/clitools_spec.rb
epitools-0.4.8 spec/clitools_spec.rb
epitools-0.4.7 spec/clitools_spec.rb
epitools-0.4.6 spec/clitools_spec.rb
epitools-0.4.5 spec/clitools_spec.rb