Sha256: e22139f18c057211cd4a017b3c33190cb367a4bb0dca0f52e175d36dce889aa1

Contents?: true

Size: 956 Bytes

Versions: 7

Compression:

Stored size: 956 Bytes

Contents

require 'rib/test'
require 'rib/test/multiline'
require 'rib/more/multiline_history'

describe Rib::MultilineHistory do
  behaves_like :rib
  behaves_like :setup_multiline

  def check str, err=nil
    @shell.history.clear
    with_history(str, err)

    setup_shell

    @shell.history.clear
    @shell.history << 'old history'
    with_history(str, err, 'old history')
  end

  def with_history str, err, *prefix
    lines = str.split("\n")
    lines[0...-1].inject([]){ |result, line|
      input(line)
      @shell.loop_once
      result << line
      @shell.history.to_a.should.eq prefix + result
      result
    }
    input_done(lines.last, err)
    history = if lines.size == 1
                lines.first
              else
                "\n#{lines.join("\n")}"
              end
    @shell.history.to_a.should.eq prefix + [history]
  end

  test_for Rib::History, Rib::Multiline, Rib::MultilineHistory do
    behaves_like :multiline
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rib-1.2.5 test/more/test_multiline_history.rb
rib-1.2.4 test/more/test_multiline_history.rb
rib-1.2.3 test/more/test_multiline_history.rb
rib-1.2.2 test/more/test_multiline_history.rb
rib-1.2.1 test/more/test_multiline_history.rb
rib-1.2.0 test/more/test_multiline_history.rb
rib-0.9.0 test/more/test_multiline_history.rb