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_relative '../../spec_helper'
|
||||||
require 'abbrev'
|
|
||||||
|
|
||||||
#test both Abbrev.abbrev and Array#abbrev in
|
ruby_version_is ""..."3.4" do
|
||||||
#the same manner, as they're more or less aliases
|
require 'abbrev'
|
||||||
#of one another
|
|
||||||
|
|
||||||
[["Abbrev.abbrev", -> a { Abbrev.abbrev(a)}],
|
#test both Abbrev.abbrev and Array#abbrev in
|
||||||
["Array#abbrev", -> a { a.abbrev}]
|
#the same manner, as they're more or less aliases
|
||||||
].each do |(name, func)|
|
#of one another
|
||||||
|
|
||||||
describe name do
|
[["Abbrev.abbrev", -> a { Abbrev.abbrev(a)}],
|
||||||
it "returns a hash of all unambiguous abbreviations of the array of strings passed in" do
|
["Array#abbrev", -> a { a.abbrev}]
|
||||||
func.call(['ruby', 'rules']).should == {"rub" => "ruby",
|
].each do |(name, func)|
|
||||||
"ruby" => "ruby",
|
|
||||||
"rul" => "rules",
|
|
||||||
"rule" => "rules",
|
|
||||||
"rules" => "rules"}
|
|
||||||
|
|
||||||
func.call(["car", "cone"]).should == {"ca" => "car",
|
describe name do
|
||||||
"car" => "car",
|
it "returns a hash of all unambiguous abbreviations of the array of strings passed in" do
|
||||||
"co" => "cone",
|
func.call(['ruby', 'rules']).should == {"rub" => "ruby",
|
||||||
"con" => "cone",
|
"ruby" => "ruby",
|
||||||
"cone" => "cone"}
|
"rul" => "rules",
|
||||||
end
|
"rule" => "rules",
|
||||||
|
"rules" => "rules"}
|
||||||
|
|
||||||
it "returns an empty hash when called on an empty array" do
|
func.call(["car", "cone"]).should == {"ca" => "car",
|
||||||
func.call([]).should == {}
|
"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
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user