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
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/ruby_extensions/string_spec.rb