Sha256: 7cae6437e3b20cd46b125390457cea3b1749133ddf09d18530e9ea48920d65c3

Contents?: true

Size: 1010 Bytes

Versions: 1

Compression:

Stored size: 1010 Bytes

Contents

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

process_is_foreground do

  not_supported_on :ironruby do
    require 'readline'
    describe "Readline::HISTORY.shift" do
      it "returns nil when the history is empty" do
        Readline::HISTORY.shift.should be_nil
      end

      it "returns and removes the first item from the history" do
        Readline::HISTORY.push("1", "2", "3")
        Readline::HISTORY.size.should == 3

        Readline::HISTORY.shift.should == "1"
        Readline::HISTORY.size.should == 2

        Readline::HISTORY.shift.should == "2"
        Readline::HISTORY.size.should == 1

        Readline::HISTORY.shift.should == "3"
        Readline::HISTORY.size.should == 0
      end

      it "taints the returned strings" do
        Readline::HISTORY.push("1", "2", "3")
        Readline::HISTORY.shift.tainted?.should be_true
        Readline::HISTORY.shift.tainted?.should be_true
        Readline::HISTORY.shift.tainted?.should be_true
      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/shift_spec.rb