Skip to content

Commit a747f3c

Browse files
committed
Fix transient failure caused by Encoding#replicate
1 parent bd772b8 commit a747f3c

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

core/file/dirname_spec.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,14 @@ def object.to_int; 2; end
7878
File.dirname("foo/../").should == "foo"
7979
end
8080

81-
it "rejects strings encoded with non ASCII-compatible encodings" do
82-
Encoding.list.reject(&:ascii_compatible?).reject(&:dummy?).each do |enc|
83-
path = "/foo/bar".encode(enc)
84-
-> {
85-
File.dirname(path)
86-
}.should raise_error(Encoding::CompatibilityError)
81+
ruby_version_is "3.3" do # Ruby 3.2 has Encoding#replicate which can break this
82+
it "rejects strings encoded with non ASCII-compatible encodings" do
83+
Encoding.list.reject(&:ascii_compatible?).reject(&:dummy?).each do |enc|
84+
path = "/foo/bar".encode(enc)
85+
-> {
86+
File.dirname(path)
87+
}.should raise_error(Encoding::CompatibilityError)
88+
end
8789
end
8890
end
8991

0 commit comments

Comments
 (0)