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
classiccms-0.5.9 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
challah-0.7.0 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
challah-0.7.0.pre2 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.5.8 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.5.7 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.5.6 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.5.5 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
challah-0.7.0.pre vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.5.2 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.5.1 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.5.0 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.4.2 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.4.1 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.4.0 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.3.9 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
challah-0.6.2 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
initforthe-cookies-0.0.1 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb