Sha256: 1739f89cfa870d63396d5d20b69311744806cdd542832d4e27e2b9fedb3c0dc3

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require File.dirname(__FILE__) + '/../../../spec_helper'

process_is_foreground do

  not_supported_on :ironruby do
    require 'readline'
    describe "Readline::HISTORY.[]=" do
      before(:each) do
        Readline::HISTORY.push("1", "2", "3")
      end

      after(:each) do
        Readline::HISTORY.pop
        Readline::HISTORY.pop
        Readline::HISTORY.pop
      end

      it "returns the new value for the passed index" do
        (Readline::HISTORY[1] = "second test").should == "second test"
      end

      it "raises an IndexError when there is no item at the passed positive index" do
        lambda { Readline::HISTORY[10] = "test" }.should raise_error(IndexError)
      end

      it "sets the item at the given index" do
        Readline::HISTORY[0] = "test"
        Readline::HISTORY[0].should == "test"

        Readline::HISTORY[1] = "second test"
        Readline::HISTORY[1].should == "second test"
      end

      it "raises an IndexError when there is no item at the passed negative index" do
        lambda { Readline::HISTORY[10] = "test" }.should raise_error(IndexError)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
readline-ffi-0.0.2 spec/library/readline/history/element_set_spec.rb