summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2024-01-19 15:42:24 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2024-01-19 16:27:45 +0900
commitf4670b46c458cdc57eeee2fead2ffe811ea65096 (patch)
tree6f0653e1ae848a3ba1bf58b54076c6b85733d046
parentb4ee5266f196afc66686e88a4033262fa0f4933d (diff)
spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.4"' spec/ruby/library/abbrev/**/*.rb
-rw-r--r--spec/ruby/library/abbrev/abbrev_spec.rb47
1 files changed, 25 insertions, 22 deletions
diff --git a/spec/ruby/library/abbrev/abbrev_spec.rb b/spec/ruby/library/abbrev/abbrev_spec.rb
index 61b0926597..79045a0804 100644
--- a/spec/ruby/library/abbrev/abbrev_spec.rb
+++ b/spec/ruby/library/abbrev/abbrev_spec.rb
@@ -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"}
+
+ 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 == {}
+ it "returns an empty hash when called on an empty array" do
+ func.call([]).should == {}
+ end
end
end
end