Skip to content

Commit ceaa79d

Browse files
committed
Adjust tests for removing special handling "|" at the beginning of a path on Windows
1 parent e5d229c commit ceaa79d

5 files changed

Lines changed: 50 additions & 10 deletions

File tree

core/io/binread_spec.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,16 @@
5555
end
5656

5757
ruby_version_is "4.0" do
58-
it "raises Errno::ENOENT when path starts with a pipe" do
59-
-> { IO.binread("|echo ok") }.should.raise(Errno::ENOENT)
58+
platform_is_not :windows do
59+
it "raises Errno::ENOENT when path starts with a pipe" do
60+
-> { IO.binread("|echo ok") }.should.raise(Errno::ENOENT)
61+
end
62+
end
63+
64+
platform_is :windows do
65+
it "raises Errno::EINVAL when path starts with a pipe" do
66+
-> { IO.binread("|echo ok") }.should.raise(Errno::EINVAL)
67+
end
6068
end
6169
end
6270
end

core/io/foreach_spec.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,16 @@
5656
end
5757

5858
ruby_version_is "4.0" do
59-
it "raises Errno::ENOENT when path starts with a pipe" do
60-
-> { IO.foreach("|echo ok").to_a }.should.raise(Errno::ENOENT)
59+
platform_is_not :windows do
60+
it "raises Errno::ENOENT when path starts with a pipe" do
61+
-> { IO.foreach("|echo ok").to_a }.should.raise(Errno::ENOENT)
62+
end
63+
end
64+
65+
platform_is :windows do
66+
it "raises Errno::EINVAL when path starts with a pipe" do
67+
-> { IO.foreach("|echo ok").to_a }.should.raise(Errno::EINVAL)
68+
end
6169
end
6270
end
6371
end

core/io/read_spec.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,16 @@
223223
end
224224

225225
ruby_version_is "4.0" do
226-
it "raises Errno::ENOENT when path starts with a pipe" do
227-
-> { IO.read("|echo ok") }.should.raise(Errno::ENOENT)
226+
platform_is_not :windows do
227+
it "raises Errno::ENOENT when path starts with a pipe" do
228+
-> { IO.read("|echo ok") }.should.raise(Errno::ENOENT)
229+
end
230+
end
231+
232+
platform_is :windows do
233+
it "raises Errno::EINVAL when path starts with a pipe" do
234+
-> { IO.read("|echo ok") }.should.raise(Errno::EINVAL)
235+
end
228236
end
229237
end
230238
end

core/io/readlines_spec.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,16 @@
216216
end
217217

218218
ruby_version_is "4.0" do
219-
it "raises Errno::ENOENT when path starts with a pipe" do
220-
-> { IO.readlines("|echo ok") }.should.raise(Errno::ENOENT)
219+
platform_is_not :windows do
220+
it "raises Errno::ENOENT when path starts with a pipe" do
221+
-> { IO.readlines("|echo ok") }.should.raise(Errno::ENOENT)
222+
end
223+
end
224+
225+
platform_is :windows do
226+
it "raises Errno::EINVAL when path starts with a pipe" do
227+
-> { IO.readlines("|echo ok") }.should.raise(Errno::EINVAL)
228+
end
221229
end
222230
end
223231

core/kernel/open_spec.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,16 @@
8888
end
8989

9090
ruby_version_is "4.0" do
91-
it "raises Errno::ENOENT when path starts with a pipe" do
92-
-> { open("|echo ok") { } }.should.raise(Errno::ENOENT)
91+
platform_is_not :windows do
92+
it "raises Errno::ENOENT when path starts with a pipe" do
93+
-> { open("|echo ok") { } }.should.raise(Errno::ENOENT)
94+
end
95+
end
96+
97+
platform_is :windows do
98+
it "raises Errno::EINVAL when path starts with a pipe" do
99+
-> { open("|echo ok") { } }.should.raise(Errno::EINVAL)
100+
end
93101
end
94102
end
95103

0 commit comments

Comments
 (0)