Sha256: 0c350d3164d3bc7940ff9b8989a1856d4cedf639b6c7b3828c95a95765284919

Contents?: true

Size: 789 Bytes

Versions: 262

Compression:

Stored size: 789 Bytes

Contents

require 'spec_helper'

describe String do
  before do
    @string = %{
      0123456789
      012345
      01234567
      0123
    }.tabto(0).strip
  end
  
  it "can translate indices to column numbers" do
    @string.column_of(0).should == 1
    @string.column_of(5).should == 6
    @string.column_of(10).should == 11
    @string.column_of(11).should == 1
    @string.column_of(17).should == 7
    @string.column_of(18).should == 1
    @string.column_of(24).should == 7
  end
  
  it "can translate indices to line numbers" do
    @string.line_of(0).should == 1
    @string.line_of(5).should == 1
    @string.line_of(10).should == 1
    @string.line_of(11).should == 2
    @string.line_of(17).should == 2
    @string.line_of(18).should == 3
    @string.line_of(24).should == 3
  end
end

Version data entries

262 entries across 217 versions & 32 rubygems

Version Path
mail-2.1.5.1 lib/mail/vendor/treetop-1.4.4/spec/ruby_extensions/string_spec.rb
mail-2.1.5 lib/mail/vendor/treetop-1.4.3/spec/ruby_extensions/string_spec.rb