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
sunrise-cms-0.3.2 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.1 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.1 vendor/bundle/ruby/1.9.1/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
sunrise-cms-0.3.0 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
rails-uploader-0.0.4 vendor/bundle/ruby/1.9.1/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.3.8 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
challah-0.6.1 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.3.7 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.3.6 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.3.5 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.3.4 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.3.3 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.3.2 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.3.1 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
classiccms-0.3.0 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
sunrise-cms-0.3.0.rc 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
rails-uploader-0.0.1 vendor/bundle/ruby/1.9.1/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb
challah-0.6.0 vendor/bundle/gems/treetop-1.4.10/spec/ruby_extensions/string_spec.rb