summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-09-02 15:08:53 +0900
committerGitHub <noreply@github.com>2019-09-02 15:08:53 +0900
commit6f206b8ec6f945804c56cf8249739c6e94ed65f6 (patch)
tree8e04d964baa3cd07239dcaeb35ed41d113c55c39 /spec
parent633ae3278ecce7c2b98fa1aa6106f963894c538a (diff)
Prohibit nul-separated glob pattern [Feature #14643] (#2419)
Notes
Notes: Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'spec')
-rw-r--r--spec/ruby/core/dir/shared/glob.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/ruby/core/dir/shared/glob.rb b/spec/ruby/core/dir/shared/glob.rb
index e4ffb51286..62675145df 100644
--- a/spec/ruby/core/dir/shared/glob.rb
+++ b/spec/ruby/core/dir/shared/glob.rb
@@ -30,7 +30,7 @@ describe :dir_glob, shared: true do
end
end
- ruby_version_is "2.6" do
+ ruby_version_is "2.6"..."2.7" do
it "splits the string on \\0 if there is only one string given and warns" do
-> {
Dir.send(@method, "file_o*\0file_t*").should ==
@@ -39,6 +39,12 @@ describe :dir_glob, shared: true do
end
end
+ ruby_version_is "2.7" do
+ it "raises an ArgumentError if the string contains \\0" do
+ -> {Dir.send(@method, "file_o*\0file_t*")}.should raise_error ArgumentError, /nul-separated/
+ end
+ end
+
it "matches non-dotfiles with '*'" do
expected = %w[
brace