Sha256: c52c35cb3e190731286f1ea8224df84d639eba13bc95786edd50e63886bc7cf9

Contents?: true

Size: 1.31 KB

Versions: 21

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'appmap/event'

include AppMap

describe 'display_string' do
  def display_string(value)
    Event::MethodEvent.display_string value
  end

  def compare_display_string(value, expected)
    expect(display_string(value)).to eq(expected)
  end

  context 'for a' do
    it 'String' do
      compare_display_string 'foo', 'foo'
    end
    it 'long String' do
      compare_display_string 'foo' * 100, 'foo' * 33 + 'f (...200 more characters)'
    end
    it 'Array' do
      compare_display_string([ 1, 'my', :bar, [ 2, 3 ], { 4 => 5 } ], '[1, my, :bar, [2, 3], {4=>5}]')
    end
    it 'large Array' do
      compare_display_string 50.times.map { |i| i }, '[0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (...40 more items)]'
    end
    it 'large Hash' do
      compare_display_string(50.times.map { |i| [ i*2, i*2+1] }.to_h, '{0=>1, 2=>3, 4=>5, 6=>7, 8=>9, 10=>11, 12=>13, 14=>15, 16=>17, 18=>19 (...40 more entries)}')
    end
    it 'Hash' do
      compare_display_string({ 1 => 2, 'my' => 'neighbor', bar: :baz, ary: [ 1, 2 ]}, '{1=>2, my=>neighbor, :bar=>:baz, :ary=>[1, 2]}')
    end
    it 'big Hash' do
      compare_display_string(50.times.map { |i| [ i*2, i*2+1] }.to_h, '{0=>1, 2=>3, 4=>5, 6=>7, 8=>9, 10=>11, 12=>13, 14=>15, 16=>17, 18=>19 (...40 more entries)}')
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
appmap-0.83.4 spec/display_string_spec.rb
appmap-0.83.3 spec/display_string_spec.rb
appmap-0.83.2 spec/display_string_spec.rb
appmap-0.83.1 spec/display_string_spec.rb
appmap-0.83.0 spec/display_string_spec.rb
appmap-0.82.0 spec/display_string_spec.rb
appmap-0.81.1 spec/display_string_spec.rb
appmap-0.81.0 spec/display_string_spec.rb
appmap-0.80.2 spec/display_string_spec.rb
appmap-0.80.1 spec/display_string_spec.rb
appmap-0.80.0 spec/display_string_spec.rb
appmap-0.79.0 spec/display_string_spec.rb
appmap-0.78.0 spec/display_string_spec.rb
appmap-0.77.4 spec/display_string_spec.rb
appmap-0.77.3 spec/display_string_spec.rb
appmap-0.77.2 spec/display_string_spec.rb
appmap-0.77.1 spec/display_string_spec.rb
appmap-0.77.0 spec/display_string_spec.rb
appmap-0.76.0 spec/display_string_spec.rb
appmap-0.75.0 spec/display_string_spec.rb