spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.4"' spec/ruby/library/abbrev/**/*.rb
This commit is contained in:
parent
b4ee5266f1
commit
f4670b46c4
@ -1,31 +1,34 @@
|
||||
require_relative '../../spec_helper'
|
||||
require 'abbrev'
|
||||
|
||||
#test both Abbrev.abbrev and Array#abbrev in
|
||||
#the same manner, as they're more or less aliases
|
||||
#of one another
|
||||
ruby_version_is ""..."3.4" do
|
||||
require 'abbrev'
|
||||
|
||||
[["Abbrev.abbrev", -> a { Abbrev.abbrev(a)}],
|
||||
["Array#abbrev", -> a { a.abbrev}]
|
||||
].each do |(name, func)|
|
||||
#test both Abbrev.abbrev and Array#abbrev in
|
||||
#the same manner, as they're more or less aliases
|
||||
#of one another
|
||||
|
||||
describe name do
|
||||
it "returns a hash of all unambiguous abbreviations of the array of strings passed in" do
|
||||
func.call(['ruby', 'rules']).should == {"rub" => "ruby",
|
||||
"ruby" => "ruby",
|
||||
"rul" => "rules",
|
||||
"rule" => "rules",
|
||||
"rules" => "rules"}
|
||||
[["Abbrev.abbrev", -> a { Abbrev.abbrev(a)}],
|
||||
["Array#abbrev", -> a { a.abbrev}]
|
||||
].each do |(name, func)|
|
||||
|
||||
func.call(["car", "cone"]).should == {"ca" => "car",
|
||||
"car" => "car",
|
||||
"co" => "cone",
|
||||
"con" => "cone",
|
||||
"cone" => "cone"}
|
||||
end
|
||||
describe name do
|
||||
it "returns a hash of all unambiguous abbreviations of the array of strings passed in" do
|
||||
func.call(['ruby', 'rules']).should == {"rub" => "ruby",
|
||||
"ruby" => "ruby",
|
||||
"rul" => "rules",
|
||||
"rule" => "rules",
|
||||
"rules" => "rules"}
|
||||
|
||||
it "returns an empty hash when called on an empty array" do
|
||||
func.call([]).should == {}
|
||||
func.call(["car", "cone"]).should == {"ca" => "car",
|
||||
"car" => "car",
|
||||
"co" => "cone",
|
||||
"con" => "cone",
|
||||
"cone" => "cone"}
|
||||
end
|
||||
|
||||
it "returns an empty hash when called on an empty array" do
|
||||
func.call([]).should == {}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user