Skip to content

Commit 15ab61b

Browse files
committed
[GR-14806] Update specs.
PullRequest: truffleruby/2381
2 parents 28f8fce + 5dfe39c commit 15ab61b

File tree

30 files changed

+402
-50
lines changed

30 files changed

+402
-50
lines changed

ci.jsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ local composition_environment = utils.add_inclusion_tracking(part_definitions, "
490490
"ruby-test-specs-linux-11": $.platform.linux + $.jdk.v11 + $.env.jvm + gate_no_build + $.use.build_no_clean + $.run.test_unit_tck + native_config + $.run.clean + $.run.test_specs + { timelimit: "50:00" },
491491
"ruby-test-specs-darwin": $.platform.darwin + $.jdk.v8 + $.env.jvm + gate_no_build + $.use.build_no_clean + $.run.test_unit_tck + native_config + $.run.clean + $.run.test_specs + { timelimit: "01:35:00" },
492492
"ruby-test-specs-darwin-11": $.platform.darwin + $.jdk.v11 + $.env.jvm + gate_no_build + $.use.build_no_clean + $.run.test_unit_tck + native_config + $.run.clean + $.run.test_specs + { timelimit: "01:35:00" },
493-
"ruby-test-fast-linux-arm64": $.platform.linux_arm64 + $.jdk.v11 + $.env.jvm + gate + $.run.test_fast + native_config + { timelimit: "30:00" },
493+
# "ruby-test-fast-linux-arm64": $.platform.linux_arm64 + $.jdk.v11 + $.env.jvm + gate + $.run.test_fast + native_config + { timelimit: "30:00" }, # GR-29056
494494
"ruby-test-fast-linux": $.platform.linux + $.jdk.v8 + $.env.jvm + gate + $.run.test_fast + { timelimit: "30:00" }, # To catch missing slow tags
495495
"ruby-test-mri-linux": $.platform.linux + $.jdk.v8 + $.env.jvm + gate + $.run.test_mri + { timelimit: "45:00" },
496496
"ruby-test-mri-darwin": $.platform.darwin + $.jdk.v8 + $.env.jvm + gate + $.run.test_mri + { timelimit: "01:30:00" },

spec/ruby/core/dir/fixtures/common.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,14 @@ def self.expected_paths
169169
subdir_two
170170
]
171171
end
172+
173+
if RUBY_VERSION > '3.1'
174+
def self.expected_glob_paths
175+
expected_paths - ['..']
176+
end
177+
else
178+
def self.expected_glob_paths
179+
expected_paths
180+
end
181+
end
172182
end

spec/ruby/core/dir/glob_spec.rb

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@
3939
end
4040

4141
it "matches both dot and non-dotfiles with '*' and option File::FNM_DOTMATCH" do
42-
Dir.glob('*', File::FNM_DOTMATCH).sort.should == DirSpecs.expected_paths
42+
Dir.glob('*', File::FNM_DOTMATCH).sort.should == DirSpecs.expected_glob_paths
4343
end
4444

4545
it "matches files with any beginning with '*<non-special characters>' and option File::FNM_DOTMATCH" do
4646
Dir.glob('*file', File::FNM_DOTMATCH).sort.should == %w|.dotfile nondotfile|.sort
4747
end
4848

4949
it "matches any files in the current directory with '**' and option File::FNM_DOTMATCH" do
50-
Dir.glob('**', File::FNM_DOTMATCH).sort.should == DirSpecs.expected_paths
50+
Dir.glob('**', File::FNM_DOTMATCH).sort.should == DirSpecs.expected_glob_paths
5151
end
5252

5353
it "recursively matches any subdirectories except './' or '../' with '**/' from the current directory and option File::FNM_DOTMATCH" do
@@ -70,16 +70,31 @@
7070
Dir.glob('**/', File::FNM_DOTMATCH).sort.should == expected
7171
end
7272

73-
it "recursively matches files and directories in nested dot subdirectory with 'nested/**/*' from the current directory and option File::FNM_DOTMATCH" do
74-
expected = %w[
75-
nested/.
76-
nested/.dotsubir
77-
nested/.dotsubir/.
78-
nested/.dotsubir/.dotfile
79-
nested/.dotsubir/nondotfile
80-
]
73+
ruby_version_is ''...'3.1' do
74+
it "recursively matches files and directories in nested dot subdirectory with 'nested/**/*' from the current directory and option File::FNM_DOTMATCH" do
75+
expected = %w[
76+
nested/.
77+
nested/.dotsubir
78+
nested/.dotsubir/.
79+
nested/.dotsubir/.dotfile
80+
nested/.dotsubir/nondotfile
81+
]
8182

82-
Dir.glob('nested/**/*', File::FNM_DOTMATCH).sort.should == expected.sort
83+
Dir.glob('nested/**/*', File::FNM_DOTMATCH).sort.should == expected.sort
84+
end
85+
end
86+
87+
ruby_version_is '3.1' do
88+
it "recursively matches files and directories in nested dot subdirectory except . with 'nested/**/*' from the current directory and option File::FNM_DOTMATCH" do
89+
expected = %w[
90+
nested/.
91+
nested/.dotsubir
92+
nested/.dotsubir/.dotfile
93+
nested/.dotsubir/nondotfile
94+
]
95+
96+
Dir.glob('nested/**/*', File::FNM_DOTMATCH).sort.should == expected.sort
97+
end
8398
end
8499

85100
# This is a separate case to check **/ coming after a constant

spec/ruby/core/dir/shared/glob.rb

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,16 @@
121121
Dir.send(@method, 'special/test\{1\}/*').should == ['special/test{1}/file[1]']
122122
end
123123

124-
it "matches dotfiles with '.*'" do
125-
Dir.send(@method, '.*').sort.should == %w|. .. .dotfile .dotsubdir|.sort
124+
ruby_version_is ''...'3.1' do
125+
it "matches dotfiles with '.*'" do
126+
Dir.send(@method, '.*').sort.should == %w|. .. .dotfile .dotsubdir|.sort
127+
end
128+
end
129+
130+
ruby_version_is '3.1' do
131+
it "matches dotfiles except .. with '.*'" do
132+
Dir.send(@method, '.*').sort.should == %w|. .dotfile .dotsubdir|.sort
133+
end
126134
end
127135

128136
it "matches non-dotfiles with '*<non-special characters>'" do
@@ -167,8 +175,16 @@
167175
Dir.send(@method, '**').sort.should == expected
168176
end
169177

170-
it "matches dotfiles in the current directory with '.**'" do
171-
Dir.send(@method, '.**').sort.should == %w|. .. .dotsubdir .dotfile|.sort
178+
ruby_version_is ''...'3.1' do
179+
it "matches dotfiles in the current directory with '.**'" do
180+
Dir.send(@method, '.**').sort.should == %w|. .. .dotsubdir .dotfile|.sort
181+
end
182+
end
183+
184+
ruby_version_is '3.1' do
185+
it "matches dotfiles in the current directory except .. with '.**'" do
186+
Dir.send(@method, '.**').sort.should == %w|. .dotsubdir .dotfile|.sort
187+
end
172188
end
173189

174190
it "recursively matches any nondot subdirectories with '**/'" do
@@ -189,9 +205,19 @@
189205
Dir.send(@method, '**/').sort.should == expected
190206
end
191207

192-
it "recursively matches any subdirectories including ./ and ../ with '.**/'" do
193-
Dir.chdir("#{DirSpecs.mock_dir}/subdir_one") do
194-
Dir.send(@method, '.**/').sort.should == %w|./ ../|.sort
208+
ruby_version_is ''...'3.1' do
209+
it "recursively matches any subdirectories including ./ and ../ with '.**/'" do
210+
Dir.chdir("#{DirSpecs.mock_dir}/subdir_one") do
211+
Dir.send(@method, '.**/').sort.should == %w|./ ../|.sort
212+
end
213+
end
214+
end
215+
216+
ruby_version_is '3.1' do
217+
it "recursively matches any subdirectories including ./ with '.**/'" do
218+
Dir.chdir("#{DirSpecs.mock_dir}/subdir_one") do
219+
Dir.send(@method, '.**/').should == ['./']
220+
end
195221
end
196222
end
197223

@@ -234,7 +260,7 @@
234260
end
235261

236262
it "matches dot or non-dotfiles with '{,.}*'" do
237-
Dir.send(@method, '{,.}*').sort.should == DirSpecs.expected_paths
263+
Dir.send(@method, '{,.}*').sort.should == DirSpecs.expected_glob_paths
238264
end
239265

240266
it "respects the order of {} expressions, expanding left most first" do

spec/ruby/core/gc/disable_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
GC.enable
66
end
77

8-
it "returns true iff the garbage collection was previously disabled" do
8+
it "returns true if and only if the garbage collection was previously disabled" do
99
GC.enable
1010
GC.disable.should == false
1111
GC.disable.should == true

spec/ruby/core/gc/enable_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
describe "GC.enable" do
44

5-
it "returns true iff the garbage collection was already disabled" do
5+
it "returns true if and only if the garbage collection was already disabled" do
66
GC.enable
77
GC.enable.should == false
88
GC.disable

spec/ruby/core/hash/shared/eql.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def y.eql?(o) true end
118118
{ 1.0 => "x" }.send(@method, { 1 => "x" }).should be_false
119119
end
120120

121-
it "returns true iff other Hash has the same number of keys and each key-value pair matches" do
121+
it "returns true if and only if other Hash has the same number of keys and each key-value pair matches" do
122122
a = { a: 5 }
123123
b = {}
124124
a.send(@method, b).should be_false

spec/ruby/core/integer/allbits_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require_relative '../../spec_helper'
22

33
describe "Integer#allbits?" do
4-
it "returns true iff all the bits of the argument are set in the receiver" do
4+
it "returns true if and only if all the bits of the argument are set in the receiver" do
55
42.allbits?(42).should == true
66
0b1010_1010.allbits?(0b1000_0010).should == true
77
0b1010_1010.allbits?(0b1000_0001).should == false

spec/ruby/core/integer/anybits_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require_relative '../../spec_helper'
22

33
describe "Integer#anybits?" do
4-
it "returns true iff all the bits of the argument are set in the receiver" do
4+
it "returns true if and only if all the bits of the argument are set in the receiver" do
55
42.anybits?(42).should == true
66
0b1010_1010.anybits?(0b1000_0010).should == true
77
0b1010_1010.anybits?(0b1000_0001).should == true

spec/ruby/core/integer/nobits_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require_relative '../../spec_helper'
22

33
describe "Integer#nobits?" do
4-
it "returns true iff all no bits of the argument are set in the receiver" do
4+
it "returns true if and only if all no bits of the argument are set in the receiver" do
55
42.nobits?(42).should == false
66
0b1010_1010.nobits?(0b1000_0010).should == false
77
0b1010_1010.nobits?(0b1000_0001).should == false

0 commit comments

Comments
 (0)