summaryrefslogtreecommitdiff
path: root/spec/ruby/library/readline
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/readline')
-rw-r--r--spec/ruby/library/readline/basic_quote_characters_spec.rb18
-rw-r--r--spec/ruby/library/readline/basic_word_break_characters_spec.rb16
-rw-r--r--spec/ruby/library/readline/completer_quote_characters_spec.rb16
-rw-r--r--spec/ruby/library/readline/completer_word_break_characters_spec.rb16
-rw-r--r--spec/ruby/library/readline/completion_append_character_spec.rb16
-rw-r--r--spec/ruby/library/readline/completion_case_fold_spec.rb18
-rw-r--r--spec/ruby/library/readline/completion_proc_spec.rb22
-rw-r--r--spec/ruby/library/readline/constants_spec.rb18
-rw-r--r--spec/ruby/library/readline/emacs_editing_mode_spec.rb11
-rw-r--r--spec/ruby/library/readline/filename_quote_characters_spec.rb18
-rw-r--r--spec/ruby/library/readline/history/append_spec.rb28
-rw-r--r--spec/ruby/library/readline/history/delete_at_spec.rb38
-rw-r--r--spec/ruby/library/readline/history/each_spec.rb23
-rw-r--r--spec/ruby/library/readline/history/element_reference_spec.rb35
-rw-r--r--spec/ruby/library/readline/history/element_set_spec.rb35
-rw-r--r--spec/ruby/library/readline/history/empty_spec.rb13
-rw-r--r--spec/ruby/library/readline/history/history_spec.rb9
-rw-r--r--spec/ruby/library/readline/history/length_spec.rb9
-rw-r--r--spec/ruby/library/readline/history/pop_spec.rb23
-rw-r--r--spec/ruby/library/readline/history/push_spec.rb26
-rw-r--r--spec/ruby/library/readline/history/shared/size.rb14
-rw-r--r--spec/ruby/library/readline/history/shift_spec.rb23
-rw-r--r--spec/ruby/library/readline/history/size_spec.rb9
-rw-r--r--spec/ruby/library/readline/history/to_s_spec.rb9
-rw-r--r--spec/ruby/library/readline/readline_spec.rb26
-rw-r--r--spec/ruby/library/readline/spec_helper.rb11
-rw-r--r--spec/ruby/library/readline/vi_editing_mode_spec.rb11
27 files changed, 511 insertions, 0 deletions
diff --git a/spec/ruby/library/readline/basic_quote_characters_spec.rb b/spec/ruby/library/readline/basic_quote_characters_spec.rb
new file mode 100644
index 0000000000..f6467c8be4
--- /dev/null
+++ b/spec/ruby/library/readline/basic_quote_characters_spec.rb
@@ -0,0 +1,18 @@
+require_relative 'spec_helper'
+
+platform_is_not :darwin do
+ with_feature :readline do
+ describe "Readline.basic_quote_characters" do
+ it "returns not nil" do
+ Readline.basic_quote_characters.should_not == nil
+ end
+ end
+
+ describe "Readline.basic_quote_characters=" do
+ it "returns the passed string" do
+ Readline.basic_quote_characters = "test"
+ Readline.basic_quote_characters.should == "test"
+ end
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/basic_word_break_characters_spec.rb b/spec/ruby/library/readline/basic_word_break_characters_spec.rb
new file mode 100644
index 0000000000..ef05d6560b
--- /dev/null
+++ b/spec/ruby/library/readline/basic_word_break_characters_spec.rb
@@ -0,0 +1,16 @@
+require_relative 'spec_helper'
+
+with_feature :readline do
+ describe "Readline.basic_word_break_characters" do
+ it "returns not nil" do
+ Readline.basic_word_break_characters.should_not == nil
+ end
+ end
+
+ describe "Readline.basic_word_break_characters=" do
+ it "returns the passed string" do
+ Readline.basic_word_break_characters = "test"
+ Readline.basic_word_break_characters.should == "test"
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/completer_quote_characters_spec.rb b/spec/ruby/library/readline/completer_quote_characters_spec.rb
new file mode 100644
index 0000000000..1109ea1f03
--- /dev/null
+++ b/spec/ruby/library/readline/completer_quote_characters_spec.rb
@@ -0,0 +1,16 @@
+require_relative 'spec_helper'
+
+with_feature :readline do
+ describe "Readline.completer_quote_characters" do
+ it "returns nil" do
+ Readline.completer_quote_characters.should == nil
+ end
+ end
+
+ describe "Readline.completer_quote_characters=" do
+ it "returns the passed string" do
+ Readline.completer_quote_characters = "test"
+ Readline.completer_quote_characters.should == "test"
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/completer_word_break_characters_spec.rb b/spec/ruby/library/readline/completer_word_break_characters_spec.rb
new file mode 100644
index 0000000000..91a002b9de
--- /dev/null
+++ b/spec/ruby/library/readline/completer_word_break_characters_spec.rb
@@ -0,0 +1,16 @@
+require_relative 'spec_helper'
+
+with_feature :readline do
+ describe "Readline.completer_word_break_characters" do
+ it "returns nil" do
+ Readline.completer_word_break_characters.should == nil
+ end
+ end
+
+ describe "Readline.completer_word_break_characters=" do
+ it "returns the passed string" do
+ Readline.completer_word_break_characters = "test"
+ Readline.completer_word_break_characters.should == "test"
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/completion_append_character_spec.rb b/spec/ruby/library/readline/completion_append_character_spec.rb
new file mode 100644
index 0000000000..2a14d5d30e
--- /dev/null
+++ b/spec/ruby/library/readline/completion_append_character_spec.rb
@@ -0,0 +1,16 @@
+require_relative 'spec_helper'
+
+with_feature :readline do
+ describe "Readline.completion_append_character" do
+ it "returns not nil" do
+ Readline.completion_append_character.should_not == nil
+ end
+ end
+
+ describe "Readline.completion_append_character=" do
+ it "returns the first character of the passed string" do
+ Readline.completion_append_character = "test"
+ Readline.completion_append_character.should == "t"
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/completion_case_fold_spec.rb b/spec/ruby/library/readline/completion_case_fold_spec.rb
new file mode 100644
index 0000000000..b6a4aab101
--- /dev/null
+++ b/spec/ruby/library/readline/completion_case_fold_spec.rb
@@ -0,0 +1,18 @@
+require_relative 'spec_helper'
+
+with_feature :readline do
+ describe "Readline.completion_case_fold" do
+ it "returns nil" do
+ Readline.completion_case_fold.should == nil
+ end
+ end
+
+ describe "Readline.completion_case_fold=" do
+ it "returns the passed boolean" do
+ Readline.completion_case_fold = true
+ Readline.completion_case_fold.should == true
+ Readline.completion_case_fold = false
+ Readline.completion_case_fold.should == false
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/completion_proc_spec.rb b/spec/ruby/library/readline/completion_proc_spec.rb
new file mode 100644
index 0000000000..037fc6de21
--- /dev/null
+++ b/spec/ruby/library/readline/completion_proc_spec.rb
@@ -0,0 +1,22 @@
+require_relative 'spec_helper'
+
+with_feature :readline do
+ describe "Readline.completion_proc" do
+ it "returns nil" do
+ Readline.completion_proc.should == nil
+ end
+ end
+
+ describe "Readline.completion_proc=" do
+ it "returns the passed Proc" do
+ proc = Proc.new do |e|
+ end
+ Readline.completion_proc = proc
+ Readline.completion_proc.should == proc
+ end
+
+ it "returns an ArgumentError if not given an Proc or #call" do
+ -> { Readline.completion_proc = "test" }.should.raise(ArgumentError)
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/constants_spec.rb b/spec/ruby/library/readline/constants_spec.rb
new file mode 100644
index 0000000000..91536ce1cc
--- /dev/null
+++ b/spec/ruby/library/readline/constants_spec.rb
@@ -0,0 +1,18 @@
+require_relative 'spec_helper'
+
+with_feature :readline do
+ # Note: additional specs for HISTORY are in 'history' subdir.
+ describe "Readline::HISTORY" do
+ it "is defined" do
+ Readline.const_defined?(:HISTORY).should == true
+ end
+ end
+
+ describe "Readline::VERSION" do
+ it "is defined and is a non-empty String" do
+ Readline.const_defined?(:VERSION).should == true
+ Readline::VERSION.should.is_a?(String)
+ Readline::VERSION.should_not.empty?
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/emacs_editing_mode_spec.rb b/spec/ruby/library/readline/emacs_editing_mode_spec.rb
new file mode 100644
index 0000000000..93ded3d023
--- /dev/null
+++ b/spec/ruby/library/readline/emacs_editing_mode_spec.rb
@@ -0,0 +1,11 @@
+require_relative 'spec_helper'
+
+platform_is_not :darwin do
+ with_feature :readline do
+ describe "Readline.emacs_editing_mode" do
+ it "returns nil" do
+ Readline.emacs_editing_mode.should == nil
+ end
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/filename_quote_characters_spec.rb b/spec/ruby/library/readline/filename_quote_characters_spec.rb
new file mode 100644
index 0000000000..6bcb04fc79
--- /dev/null
+++ b/spec/ruby/library/readline/filename_quote_characters_spec.rb
@@ -0,0 +1,18 @@
+require_relative 'spec_helper'
+
+platform_is_not :darwin do
+ with_feature :readline do
+ describe "Readline.filename_quote_characters" do
+ it "returns nil" do
+ Readline.filename_quote_characters.should == nil
+ end
+ end
+
+ describe "Readline.filename_quote_characters=" do
+ it "returns the passed string" do
+ Readline.filename_quote_characters = "test"
+ Readline.filename_quote_characters.should == "test"
+ end
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/history/append_spec.rb b/spec/ruby/library/readline/history/append_spec.rb
new file mode 100644
index 0000000000..be0e515b84
--- /dev/null
+++ b/spec/ruby/library/readline/history/append_spec.rb
@@ -0,0 +1,28 @@
+require_relative '../spec_helper'
+
+with_feature :readline do
+ describe "Readline::HISTORY.<<" do
+ it "appends the given Object to the history" do
+ Readline::HISTORY << "1"
+ Readline::HISTORY.size.should == 1
+
+ Readline::HISTORY << "2"
+ Readline::HISTORY.size.should == 2
+
+ Readline::HISTORY.pop.should == "2"
+ Readline::HISTORY.pop.should == "1"
+ end
+
+ it "tries to convert the passed Object to a String using #to_str" do
+ obj = mock("Converted to String")
+ obj.should_receive(:to_str).and_return("converted")
+
+ Readline::HISTORY << obj
+ Readline::HISTORY.pop.should == "converted"
+ end
+
+ it "raises a TypeError when the passed Object can't be converted to a String" do
+ -> { Readline::HISTORY << mock("Object") }.should.raise(TypeError)
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/history/delete_at_spec.rb b/spec/ruby/library/readline/history/delete_at_spec.rb
new file mode 100644
index 0000000000..4383ff7e83
--- /dev/null
+++ b/spec/ruby/library/readline/history/delete_at_spec.rb
@@ -0,0 +1,38 @@
+require_relative '../spec_helper'
+
+with_feature :readline do
+ describe "Readline::HISTORY.delete_at" do
+ it "deletes and returns the history entry at the specified index" do
+ Readline::HISTORY.push("1", "2", "3")
+
+ Readline::HISTORY.delete_at(1).should == "2"
+ Readline::HISTORY.size.should == 2
+
+ Readline::HISTORY.delete_at(1).should == "3"
+ Readline::HISTORY.size.should == 1
+
+ Readline::HISTORY.delete_at(0).should == "1"
+ Readline::HISTORY.size.should == 0
+
+
+ Readline::HISTORY.push("1", "2", "3", "4")
+
+ Readline::HISTORY.delete_at(-2).should == "3"
+ Readline::HISTORY.size.should == 3
+
+ Readline::HISTORY.delete_at(-2).should == "2"
+ Readline::HISTORY.size.should == 2
+
+ Readline::HISTORY.delete_at(0).should == "1"
+ Readline::HISTORY.size.should == 1
+
+ Readline::HISTORY.delete_at(0).should == "4"
+ Readline::HISTORY.size.should == 0
+ end
+
+ it "raises an IndexError when the given index is greater than the history size" do
+ -> { Readline::HISTORY.delete_at(10) }.should.raise(IndexError)
+ -> { Readline::HISTORY.delete_at(-10) }.should.raise(IndexError)
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/history/each_spec.rb b/spec/ruby/library/readline/history/each_spec.rb
new file mode 100644
index 0000000000..aa48dd46df
--- /dev/null
+++ b/spec/ruby/library/readline/history/each_spec.rb
@@ -0,0 +1,23 @@
+require_relative '../spec_helper'
+
+with_feature :readline do
+ describe "Readline::HISTORY.each" 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 "yields each item in the history" do
+ result = []
+ Readline::HISTORY.each do |x|
+ result << x
+ end
+ result.should == ["1", "2", "3"]
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/history/element_reference_spec.rb b/spec/ruby/library/readline/history/element_reference_spec.rb
new file mode 100644
index 0000000000..1f1642626f
--- /dev/null
+++ b/spec/ruby/library/readline/history/element_reference_spec.rb
@@ -0,0 +1,35 @@
+require_relative '../spec_helper'
+
+with_feature :readline do
+ 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 history item at the passed index" do
+ Readline::HISTORY[0].should == "1"
+ Readline::HISTORY[1].should == "2"
+ Readline::HISTORY[2].should == "3"
+
+ Readline::HISTORY[-1].should == "3"
+ Readline::HISTORY[-2].should == "2"
+ Readline::HISTORY[-3].should == "1"
+ end
+
+ it "raises an IndexError when there is no item at the passed index" do
+ -> { Readline::HISTORY[-10] }.should.raise(IndexError)
+ -> { Readline::HISTORY[-9] }.should.raise(IndexError)
+ -> { Readline::HISTORY[-8] }.should.raise(IndexError)
+
+ -> { Readline::HISTORY[8] }.should.raise(IndexError)
+ -> { Readline::HISTORY[9] }.should.raise(IndexError)
+ -> { Readline::HISTORY[10] }.should.raise(IndexError)
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/history/element_set_spec.rb b/spec/ruby/library/readline/history/element_set_spec.rb
new file mode 100644
index 0000000000..0787b6343d
--- /dev/null
+++ b/spec/ruby/library/readline/history/element_set_spec.rb
@@ -0,0 +1,35 @@
+require_relative '../spec_helper'
+
+with_feature :readline do
+ 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
+ -> { Readline::HISTORY[10] = "test" }.should.raise(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
+ -> { Readline::HISTORY[10] = "test" }.should.raise(IndexError)
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/history/empty_spec.rb b/spec/ruby/library/readline/history/empty_spec.rb
new file mode 100644
index 0000000000..5b722dccd3
--- /dev/null
+++ b/spec/ruby/library/readline/history/empty_spec.rb
@@ -0,0 +1,13 @@
+require_relative '../spec_helper'
+
+with_feature :readline do
+ describe "Readline::HISTORY.empty?" do
+ it "returns true when the history is empty" do
+ Readline::HISTORY.should.empty?
+ Readline::HISTORY.push("test")
+ Readline::HISTORY.should_not.empty?
+ Readline::HISTORY.pop
+ Readline::HISTORY.should.empty?
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/history/history_spec.rb b/spec/ruby/library/readline/history/history_spec.rb
new file mode 100644
index 0000000000..3233071033
--- /dev/null
+++ b/spec/ruby/library/readline/history/history_spec.rb
@@ -0,0 +1,9 @@
+require_relative '../spec_helper'
+
+with_feature :readline do
+ describe "Readline::HISTORY" do
+ it "is extended with the Enumerable module" do
+ Readline::HISTORY.should.is_a?(Enumerable)
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/history/length_spec.rb b/spec/ruby/library/readline/history/length_spec.rb
new file mode 100644
index 0000000000..9427d10a00
--- /dev/null
+++ b/spec/ruby/library/readline/history/length_spec.rb
@@ -0,0 +1,9 @@
+require_relative '../spec_helper'
+
+with_feature :readline do
+ require_relative 'shared/size'
+
+ describe "Readline::HISTORY.length" do
+ it_behaves_like :readline_history_size, :length
+ end
+end
diff --git a/spec/ruby/library/readline/history/pop_spec.rb b/spec/ruby/library/readline/history/pop_spec.rb
new file mode 100644
index 0000000000..0b780a38cc
--- /dev/null
+++ b/spec/ruby/library/readline/history/pop_spec.rb
@@ -0,0 +1,23 @@
+require_relative '../spec_helper'
+
+with_feature :readline do
+ describe "Readline::HISTORY.pop" do
+ it "returns nil when the history is empty" do
+ Readline::HISTORY.pop.should == nil
+ end
+
+ it "returns and removes the last item from the history" do
+ Readline::HISTORY.push("1", "2", "3")
+ Readline::HISTORY.size.should == 3
+
+ Readline::HISTORY.pop.should == "3"
+ Readline::HISTORY.size.should == 2
+
+ Readline::HISTORY.pop.should == "2"
+ Readline::HISTORY.size.should == 1
+
+ Readline::HISTORY.pop.should == "1"
+ Readline::HISTORY.size.should == 0
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/history/push_spec.rb b/spec/ruby/library/readline/history/push_spec.rb
new file mode 100644
index 0000000000..4bbf1763a1
--- /dev/null
+++ b/spec/ruby/library/readline/history/push_spec.rb
@@ -0,0 +1,26 @@
+require_relative '../spec_helper'
+
+with_feature :readline do
+ describe "Readline::HISTORY.push" do
+ it "pushes all passed Objects into the history" do
+ Readline::HISTORY.push("1", "2", "3")
+ Readline::HISTORY.size.should == 3
+
+ Readline::HISTORY.pop.should == "3"
+ Readline::HISTORY.pop.should == "2"
+ Readline::HISTORY.pop.should == "1"
+ end
+
+ it "tries to convert the passed Object to a String using #to_str" do
+ obj = mock("Converted to String")
+ obj.should_receive(:to_str).and_return("converted")
+
+ Readline::HISTORY.push(obj)
+ Readline::HISTORY.pop.should == "converted"
+ end
+
+ it "raises a TypeError when the passed Object can't be converted to a String" do
+ -> { Readline::HISTORY.push(mock("Object")) }.should.raise(TypeError)
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/history/shared/size.rb b/spec/ruby/library/readline/history/shared/size.rb
new file mode 100644
index 0000000000..1d6df86f78
--- /dev/null
+++ b/spec/ruby/library/readline/history/shared/size.rb
@@ -0,0 +1,14 @@
+describe :readline_history_size, shared: true do
+ it "returns the size of the history" do
+ Readline::HISTORY.send(@method).should == 0
+ Readline::HISTORY.push("1", "2", "")
+ Readline::HISTORY.send(@method).should == 3
+
+ Readline::HISTORY.pop
+ Readline::HISTORY.send(@method).should == 2
+
+ Readline::HISTORY.pop
+ Readline::HISTORY.pop
+ Readline::HISTORY.send(@method).should == 0
+ end
+end
diff --git a/spec/ruby/library/readline/history/shift_spec.rb b/spec/ruby/library/readline/history/shift_spec.rb
new file mode 100644
index 0000000000..d852480a2a
--- /dev/null
+++ b/spec/ruby/library/readline/history/shift_spec.rb
@@ -0,0 +1,23 @@
+require_relative '../spec_helper'
+
+with_feature :readline do
+ describe "Readline::HISTORY.shift" do
+ it "returns nil when the history is empty" do
+ Readline::HISTORY.shift.should == 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
+ end
+end
diff --git a/spec/ruby/library/readline/history/size_spec.rb b/spec/ruby/library/readline/history/size_spec.rb
new file mode 100644
index 0000000000..c55253ccea
--- /dev/null
+++ b/spec/ruby/library/readline/history/size_spec.rb
@@ -0,0 +1,9 @@
+require_relative '../spec_helper'
+
+with_feature :readline do
+ require_relative 'shared/size'
+
+ describe "Readline::HISTORY.size" do
+ it_behaves_like :readline_history_size, :size
+ end
+end
diff --git a/spec/ruby/library/readline/history/to_s_spec.rb b/spec/ruby/library/readline/history/to_s_spec.rb
new file mode 100644
index 0000000000..ee338f2ab4
--- /dev/null
+++ b/spec/ruby/library/readline/history/to_s_spec.rb
@@ -0,0 +1,9 @@
+require_relative '../spec_helper'
+
+with_feature :readline do
+ describe "Readline::HISTORY.to_s" do
+ it "returns 'HISTORY'" do
+ Readline::HISTORY.to_s.should == "HISTORY"
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/readline_spec.rb b/spec/ruby/library/readline/readline_spec.rb
new file mode 100644
index 0000000000..6e349ad543
--- /dev/null
+++ b/spec/ruby/library/readline/readline_spec.rb
@@ -0,0 +1,26 @@
+require_relative 'spec_helper'
+
+with_feature :readline do
+ describe "Readline.readline" do
+ before :each do
+ @file = tmp('readline')
+ @out = tmp('out.txt')
+ touch(@file) { |f|
+ f.puts "test"
+ }
+ @options = { options: "-rreadline", args: [@out, "< #{@file}"] }
+ end
+
+ after :each do
+ rm_r @file, @out
+ end
+
+ # Somehow those specs block on Windows
+ platform_is_not :windows do
+ it "returns the input string" do
+ ruby_exe('File.write ARGV[0], Readline.readline', @options)
+ File.read(@out).should == "test"
+ end
+ end
+ end
+end
diff --git a/spec/ruby/library/readline/spec_helper.rb b/spec/ruby/library/readline/spec_helper.rb
new file mode 100644
index 0000000000..32d820f7ac
--- /dev/null
+++ b/spec/ruby/library/readline/spec_helper.rb
@@ -0,0 +1,11 @@
+require_relative '../../spec_helper'
+
+begin
+ require 'readline'
+rescue LoadError
+else
+ # rb-readline and reline behave quite differently
+ unless defined?(RbReadline) or defined?(Reline)
+ MSpec.enable_feature :readline
+ end
+end
diff --git a/spec/ruby/library/readline/vi_editing_mode_spec.rb b/spec/ruby/library/readline/vi_editing_mode_spec.rb
new file mode 100644
index 0000000000..3ce4f5a7e6
--- /dev/null
+++ b/spec/ruby/library/readline/vi_editing_mode_spec.rb
@@ -0,0 +1,11 @@
+require_relative 'spec_helper'
+
+platform_is_not :darwin do
+ with_feature :readline do
+ describe "Readline.vi_editing_mode" do
+ it "returns nil" do
+ Readline.vi_editing_mode.should == nil
+ end
+ end
+ end
+end