diff options
Diffstat (limited to 'spec/ruby/library/readline')
26 files changed, 61 insertions, 98 deletions
diff --git a/spec/ruby/library/readline/basic_quote_characters_spec.rb b/spec/ruby/library/readline/basic_quote_characters_spec.rb index 7d25df2047..f6467c8be4 100644 --- a/spec/ruby/library/readline/basic_quote_characters_spec.rb +++ b/spec/ruby/library/readline/basic_quote_characters_spec.rb @@ -1,10 +1,10 @@ -require File.expand_path('../spec_helper', __FILE__) +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 be_nil + Readline.basic_quote_characters.should_not == nil 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 index c2ec6cede7..ef05d6560b 100644 --- a/spec/ruby/library/readline/basic_word_break_characters_spec.rb +++ b/spec/ruby/library/readline/basic_word_break_characters_spec.rb @@ -1,9 +1,9 @@ -require File.expand_path('../spec_helper', __FILE__) +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 be_nil + Readline.basic_word_break_characters.should_not == nil end end diff --git a/spec/ruby/library/readline/completer_quote_characters_spec.rb b/spec/ruby/library/readline/completer_quote_characters_spec.rb index a836a0591e..1109ea1f03 100644 --- a/spec/ruby/library/readline/completer_quote_characters_spec.rb +++ b/spec/ruby/library/readline/completer_quote_characters_spec.rb @@ -1,9 +1,9 @@ -require File.expand_path('../spec_helper', __FILE__) +require_relative 'spec_helper' with_feature :readline do describe "Readline.completer_quote_characters" do it "returns nil" do - Readline.completer_quote_characters.should be_nil + Readline.completer_quote_characters.should == nil 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 index 2e0cc277a6..91a002b9de 100644 --- a/spec/ruby/library/readline/completer_word_break_characters_spec.rb +++ b/spec/ruby/library/readline/completer_word_break_characters_spec.rb @@ -1,9 +1,9 @@ -require File.expand_path('../spec_helper', __FILE__) +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 be_nil + Readline.completer_word_break_characters.should == nil end end diff --git a/spec/ruby/library/readline/completion_append_character_spec.rb b/spec/ruby/library/readline/completion_append_character_spec.rb index ee41abea05..2a14d5d30e 100644 --- a/spec/ruby/library/readline/completion_append_character_spec.rb +++ b/spec/ruby/library/readline/completion_append_character_spec.rb @@ -1,9 +1,9 @@ -require File.expand_path('../spec_helper', __FILE__) +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 be_nil + Readline.completion_append_character.should_not == nil end end diff --git a/spec/ruby/library/readline/completion_case_fold_spec.rb b/spec/ruby/library/readline/completion_case_fold_spec.rb index 604460869e..b6a4aab101 100644 --- a/spec/ruby/library/readline/completion_case_fold_spec.rb +++ b/spec/ruby/library/readline/completion_case_fold_spec.rb @@ -1,9 +1,9 @@ -require File.expand_path('../spec_helper', __FILE__) +require_relative 'spec_helper' with_feature :readline do describe "Readline.completion_case_fold" do it "returns nil" do - Readline.completion_case_fold.should be_nil + Readline.completion_case_fold.should == nil end end diff --git a/spec/ruby/library/readline/completion_proc_spec.rb b/spec/ruby/library/readline/completion_proc_spec.rb index e525fbd191..037fc6de21 100644 --- a/spec/ruby/library/readline/completion_proc_spec.rb +++ b/spec/ruby/library/readline/completion_proc_spec.rb @@ -1,9 +1,9 @@ -require File.expand_path('../spec_helper', __FILE__) +require_relative 'spec_helper' with_feature :readline do describe "Readline.completion_proc" do it "returns nil" do - Readline.completion_proc.should be_nil + Readline.completion_proc.should == nil end end @@ -16,7 +16,7 @@ with_feature :readline do end it "returns an ArgumentError if not given an Proc or #call" do - lambda { Readline.completion_proc = "test" }.should raise_error(ArgumentError) + -> { 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 index 226a3509b9..91536ce1cc 100644 --- a/spec/ruby/library/readline/constants_spec.rb +++ b/spec/ruby/library/readline/constants_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path('../spec_helper', __FILE__) +require_relative 'spec_helper' with_feature :readline do # Note: additional specs for HISTORY are in 'history' subdir. @@ -11,8 +11,8 @@ with_feature :readline do describe "Readline::VERSION" do it "is defined and is a non-empty String" do Readline.const_defined?(:VERSION).should == true - Readline::VERSION.should be_kind_of(String) - Readline::VERSION.should_not be_empty + 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 index 6c2e84b08f..93ded3d023 100644 --- a/spec/ruby/library/readline/emacs_editing_mode_spec.rb +++ b/spec/ruby/library/readline/emacs_editing_mode_spec.rb @@ -1,10 +1,10 @@ -require File.expand_path('../spec_helper', __FILE__) +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 be_nil + Readline.emacs_editing_mode.should == nil 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 index abee5e9700..6bcb04fc79 100644 --- a/spec/ruby/library/readline/filename_quote_characters_spec.rb +++ b/spec/ruby/library/readline/filename_quote_characters_spec.rb @@ -1,10 +1,10 @@ -require File.expand_path('../spec_helper', __FILE__) +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 be_nil + Readline.filename_quote_characters.should == nil end end diff --git a/spec/ruby/library/readline/history/append_spec.rb b/spec/ruby/library/readline/history/append_spec.rb index 3ea0bbf57f..be0e515b84 100644 --- a/spec/ruby/library/readline/history/append_spec.rb +++ b/spec/ruby/library/readline/history/append_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../spec_helper', __FILE__) +require_relative '../spec_helper' with_feature :readline do describe "Readline::HISTORY.<<" do @@ -22,7 +22,7 @@ with_feature :readline do end it "raises a TypeError when the passed Object can't be converted to a String" do - lambda { Readline::HISTORY << mock("Object") }.should raise_error(TypeError) + -> { 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 index 38f180ca08..4383ff7e83 100644 --- a/spec/ruby/library/readline/history/delete_at_spec.rb +++ b/spec/ruby/library/readline/history/delete_at_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../spec_helper', __FILE__) +require_relative '../spec_helper' with_feature :readline do describe "Readline::HISTORY.delete_at" do @@ -31,15 +31,8 @@ with_feature :readline do end it "raises an IndexError when the given index is greater than the history size" do - lambda { Readline::HISTORY.delete_at(10) }.should raise_error(IndexError) - lambda { Readline::HISTORY.delete_at(-10) }.should raise_error(IndexError) - end - - it "taints the returned strings" do - Readline::HISTORY.push("1", "2", "3") - Readline::HISTORY.delete_at(0).tainted?.should be_true - Readline::HISTORY.delete_at(0).tainted?.should be_true - Readline::HISTORY.delete_at(0).tainted?.should be_true + -> { 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 index 5057e04970..aa48dd46df 100644 --- a/spec/ruby/library/readline/history/each_spec.rb +++ b/spec/ruby/library/readline/history/each_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../spec_helper', __FILE__) +require_relative '../spec_helper' with_feature :readline do describe "Readline::HISTORY.each" do @@ -19,11 +19,5 @@ with_feature :readline do end result.should == ["1", "2", "3"] end - - it "yields tainted Objects" do - Readline::HISTORY.each do |x| - x.tainted?.should be_true - end - 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 index c656179ddd..1f1642626f 100644 --- a/spec/ruby/library/readline/history/element_reference_spec.rb +++ b/spec/ruby/library/readline/history/element_reference_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../spec_helper', __FILE__) +require_relative '../spec_helper' with_feature :readline do describe "Readline::HISTORY.[]" do @@ -12,11 +12,6 @@ with_feature :readline do Readline::HISTORY.pop end - it "returns tainted objects" do - Readline::HISTORY[0].tainted?.should be_true - Readline::HISTORY[1].tainted?.should be_true - end - it "returns the history item at the passed index" do Readline::HISTORY[0].should == "1" Readline::HISTORY[1].should == "2" @@ -28,13 +23,13 @@ with_feature :readline do end it "raises an IndexError when there is no item at the passed index" do - lambda { Readline::HISTORY[-10] }.should raise_error(IndexError) - lambda { Readline::HISTORY[-9] }.should raise_error(IndexError) - lambda { Readline::HISTORY[-8] }.should raise_error(IndexError) + -> { Readline::HISTORY[-10] }.should.raise(IndexError) + -> { Readline::HISTORY[-9] }.should.raise(IndexError) + -> { Readline::HISTORY[-8] }.should.raise(IndexError) - lambda { Readline::HISTORY[8] }.should raise_error(IndexError) - lambda { Readline::HISTORY[9] }.should raise_error(IndexError) - lambda { Readline::HISTORY[10] }.should raise_error(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 index 8d6fe196ef..0787b6343d 100644 --- a/spec/ruby/library/readline/history/element_set_spec.rb +++ b/spec/ruby/library/readline/history/element_set_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../spec_helper', __FILE__) +require_relative '../spec_helper' with_feature :readline do describe "Readline::HISTORY.[]=" do @@ -17,7 +17,7 @@ with_feature :readline do 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) + -> { Readline::HISTORY[10] = "test" }.should.raise(IndexError) end it "sets the item at the given index" do @@ -29,7 +29,7 @@ with_feature :readline do 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) + -> { 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 index 92a4fcd063..5b722dccd3 100644 --- a/spec/ruby/library/readline/history/empty_spec.rb +++ b/spec/ruby/library/readline/history/empty_spec.rb @@ -1,13 +1,13 @@ -require File.expand_path('../../spec_helper', __FILE__) +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 be_empty + Readline::HISTORY.should.empty? Readline::HISTORY.push("test") - Readline::HISTORY.should_not be_empty + Readline::HISTORY.should_not.empty? Readline::HISTORY.pop - Readline::HISTORY.should be_empty + 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 index dfa6544036..3233071033 100644 --- a/spec/ruby/library/readline/history/history_spec.rb +++ b/spec/ruby/library/readline/history/history_spec.rb @@ -1,9 +1,9 @@ -require File.expand_path('../../spec_helper', __FILE__) +require_relative '../spec_helper' with_feature :readline do describe "Readline::HISTORY" do it "is extended with the Enumerable module" do - Readline::HISTORY.should be_kind_of(Enumerable) + 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 index 6700d4f234..9427d10a00 100644 --- a/spec/ruby/library/readline/history/length_spec.rb +++ b/spec/ruby/library/readline/history/length_spec.rb @@ -1,7 +1,7 @@ -require File.expand_path('../../spec_helper', __FILE__) +require_relative '../spec_helper' with_feature :readline do - require File.expand_path('../shared/size', __FILE__) + require_relative 'shared/size' describe "Readline::HISTORY.length" do it_behaves_like :readline_history_size, :length diff --git a/spec/ruby/library/readline/history/pop_spec.rb b/spec/ruby/library/readline/history/pop_spec.rb index 34562dff3b..0b780a38cc 100644 --- a/spec/ruby/library/readline/history/pop_spec.rb +++ b/spec/ruby/library/readline/history/pop_spec.rb @@ -1,9 +1,9 @@ -require File.expand_path('../../spec_helper', __FILE__) +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 be_nil + Readline::HISTORY.pop.should == nil end it "returns and removes the last item from the history" do @@ -19,12 +19,5 @@ with_feature :readline do Readline::HISTORY.pop.should == "1" Readline::HISTORY.size.should == 0 end - - it "taints the returned strings" do - Readline::HISTORY.push("1", "2", "3") - Readline::HISTORY.pop.tainted?.should be_true - Readline::HISTORY.pop.tainted?.should be_true - Readline::HISTORY.pop.tainted?.should be_true - end end end diff --git a/spec/ruby/library/readline/history/push_spec.rb b/spec/ruby/library/readline/history/push_spec.rb index b59b17ed03..4bbf1763a1 100644 --- a/spec/ruby/library/readline/history/push_spec.rb +++ b/spec/ruby/library/readline/history/push_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../spec_helper', __FILE__) +require_relative '../spec_helper' with_feature :readline do describe "Readline::HISTORY.push" do @@ -20,7 +20,7 @@ with_feature :readline do end it "raises a TypeError when the passed Object can't be converted to a String" do - lambda { Readline::HISTORY.push(mock("Object")) }.should raise_error(TypeError) + -> { Readline::HISTORY.push(mock("Object")) }.should.raise(TypeError) end end end diff --git a/spec/ruby/library/readline/history/shift_spec.rb b/spec/ruby/library/readline/history/shift_spec.rb index 3d4782998d..d852480a2a 100644 --- a/spec/ruby/library/readline/history/shift_spec.rb +++ b/spec/ruby/library/readline/history/shift_spec.rb @@ -1,9 +1,9 @@ -require File.expand_path('../../spec_helper', __FILE__) +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 be_nil + Readline::HISTORY.shift.should == nil end it "returns and removes the first item from the history" do @@ -19,12 +19,5 @@ with_feature :readline do 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 diff --git a/spec/ruby/library/readline/history/size_spec.rb b/spec/ruby/library/readline/history/size_spec.rb index 815c68de27..c55253ccea 100644 --- a/spec/ruby/library/readline/history/size_spec.rb +++ b/spec/ruby/library/readline/history/size_spec.rb @@ -1,7 +1,7 @@ -require File.expand_path('../../spec_helper', __FILE__) +require_relative '../spec_helper' with_feature :readline do - require File.expand_path('../shared/size', __FILE__) + require_relative 'shared/size' describe "Readline::HISTORY.size" do it_behaves_like :readline_history_size, :size diff --git a/spec/ruby/library/readline/history/to_s_spec.rb b/spec/ruby/library/readline/history/to_s_spec.rb index 30ba5a1249..ee338f2ab4 100644 --- a/spec/ruby/library/readline/history/to_s_spec.rb +++ b/spec/ruby/library/readline/history/to_s_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../spec_helper', __FILE__) +require_relative '../spec_helper' with_feature :readline do describe "Readline::HISTORY.to_s" do diff --git a/spec/ruby/library/readline/readline_spec.rb b/spec/ruby/library/readline/readline_spec.rb index 599f84dffd..6e349ad543 100644 --- a/spec/ruby/library/readline/readline_spec.rb +++ b/spec/ruby/library/readline/readline_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path('../spec_helper', __FILE__) +require_relative 'spec_helper' with_feature :readline do describe "Readline.readline" do @@ -21,11 +21,6 @@ with_feature :readline do ruby_exe('File.write ARGV[0], Readline.readline', @options) File.read(@out).should == "test" end - - it "taints the returned strings" do - ruby_exe('File.write ARGV[0], Readline.readline.tainted?', @options) - File.read(@out).should == "true" - end end end end diff --git a/spec/ruby/library/readline/spec_helper.rb b/spec/ruby/library/readline/spec_helper.rb index 04ab0f755f..32d820f7ac 100644 --- a/spec/ruby/library/readline/spec_helper.rb +++ b/spec/ruby/library/readline/spec_helper.rb @@ -1,11 +1,11 @@ -require File.expand_path('../../../spec_helper', __FILE__) +require_relative '../../spec_helper' begin require 'readline' rescue LoadError else - # rb-readline behaves quite differently - unless defined?(RbReadline) + # 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 index db6d4387f8..3ce4f5a7e6 100644 --- a/spec/ruby/library/readline/vi_editing_mode_spec.rb +++ b/spec/ruby/library/readline/vi_editing_mode_spec.rb @@ -1,10 +1,10 @@ -require File.expand_path('../spec_helper', __FILE__) +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 be_nil + Readline.vi_editing_mode.should == nil end end end |
