mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
r61950 changes mode_t to ushort on FreeBSD and Darwin
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c4380069b7
commit
c151679cc3
2 changed files with 64 additions and 14 deletions
|
@ -15,7 +15,7 @@ describe "File#chmod" do
|
|||
@file.chmod(0755).should == 0
|
||||
end
|
||||
|
||||
platform_is_not :freebsd, :netbsd, :openbsd do
|
||||
platform_is_not :freebsd, :netbsd, :openbsd, :darwin do
|
||||
it "always succeeds with any numeric values" do
|
||||
vals = [-2**30, -2**16, -2**8, -2, -1,
|
||||
-0.5, 0, 1, 2, 5.555575, 16, 32, 64, 2**8, 2**16, 2**30]
|
||||
|
@ -25,9 +25,8 @@ describe "File#chmod" do
|
|||
end
|
||||
end
|
||||
|
||||
# -256, -2 and -1 raise Errno::E079 on FreeBSD
|
||||
# -256, -2 and -1 raise Errno::EFTYPE on NetBSD
|
||||
platform_is :freebsd, :netbsd do
|
||||
platform_is :netbsd do
|
||||
it "always succeeds with any numeric values" do
|
||||
vals = [-2**30, -2**16, #-2**8, -2, -1,
|
||||
-0.5, 0, 1, 2, 5.555575, 16, 32, 64, 2**8, 2**16, 2**30]
|
||||
|
@ -38,7 +37,7 @@ describe "File#chmod" do
|
|||
end
|
||||
|
||||
# -256, -2 and -1 raise Errno::EINVAL on OpenBSD
|
||||
platform_is :openbsd do
|
||||
platform_is :freebsd, :openbsd, :darwin do
|
||||
it "always succeeds with any numeric values" do
|
||||
vals = [#-2**30, -2**16, -2**8, -2, -1,
|
||||
-0.5, 0, 1, 2, 5.555575, 16, 32, 64, 2**8]#, 2**16, 2**30
|
||||
|
@ -47,6 +46,7 @@ describe "File#chmod" do
|
|||
}
|
||||
end
|
||||
end
|
||||
|
||||
it "invokes to_int on non-integer argument" do
|
||||
mode = File.stat(@filename).mode
|
||||
(obj = mock('mode')).should_receive(:to_int).and_return(mode)
|
||||
|
@ -123,7 +123,7 @@ describe "File.chmod" do
|
|||
@count.should == 1
|
||||
end
|
||||
|
||||
platform_is_not :freebsd, :netbsd, :openbsd do
|
||||
platform_is_not :freebsd, :netbsd, :openbsd, :darwin do
|
||||
it "always succeeds with any numeric values" do
|
||||
vals = [-2**30, -2**16, -2**8, -2, -1,
|
||||
-0.5, 0, 1, 2, 5.555575, 16, 32, 64, 2**8, 2**16, 2**30]
|
||||
|
@ -133,9 +133,8 @@ describe "File.chmod" do
|
|||
end
|
||||
end
|
||||
|
||||
# -256, -2 and -1 raise Errno::E079 on FreeBSD
|
||||
# -256, -2 and -1 raise Errno::EFTYPE on NetBSD
|
||||
platform_is :freebsd, :netbsd do
|
||||
platform_is :netbsd do
|
||||
it "always succeeds with any numeric values" do
|
||||
vals = [-2**30, -2**16, #-2**8, -2, -1,
|
||||
-0.5, 0, 1, 2, 5.555575, 16, 32, 64, 2**8, 2**16, 2**30]
|
||||
|
@ -145,14 +144,46 @@ describe "File.chmod" do
|
|||
end
|
||||
end
|
||||
|
||||
platform_is :openbsd do
|
||||
platform_is :darwin do
|
||||
it "succeeds with valid values" do
|
||||
vals = [-2**8, -2, -1, -0.5, 0, 1, 2, 5.555575, 16, 32, 64, 2**8]
|
||||
vals.each { |v|
|
||||
lambda { File.chmod(v, @file) }.should_not raise_error
|
||||
}
|
||||
end
|
||||
|
||||
it "fails with invalid values" do
|
||||
vals = [-2**30, -2**16, 2**16, 2**30]
|
||||
vals.each { |v|
|
||||
lambda { File.chmod(v, @file) }.should raise_error(RangeError)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
platform_is :freebsd, :openbsd do
|
||||
it "succeeds with valid values" do
|
||||
vals = [-0.5, 0, 1, 2, 5.555575, 16, 32, 64, 2**8]
|
||||
vals.each { |v|
|
||||
lambda { File.chmod(v, @file) }.should_not raise_error
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# -256, -2 and -1 raise Errno::EFTYPE on FreeBSD
|
||||
platform_is :freebsd do
|
||||
it "fails with invalid values" do
|
||||
vals = [-2**30, -2**16, 2**16, 2**30]
|
||||
vals.each { |v|
|
||||
lambda { File.chmod(v, @file) }.should raise_error(RangeError)
|
||||
}
|
||||
vals = [-2**8, -2, -1, 65535]
|
||||
vals.each { |v|
|
||||
lambda { File.chmod(v, @file) }.should raise_error(Errno::EFTYPE)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
platform_is :openbsd do
|
||||
it "fails with invalid values" do
|
||||
vals = [-2**30, -2**16, -2**8, -2, -1, 2**16, 2**30]
|
||||
vals.each { |v|
|
||||
|
|
|
@ -30,12 +30,31 @@ describe "File.umask" do
|
|||
end
|
||||
end
|
||||
|
||||
it "always succeeds with any integer values" do
|
||||
vals = [-2**30, -2**16, -2**8, -2,
|
||||
-1.5, -1, 0.5, 0, 1, 2, 7.77777, 16, 32, 64, 2**8, 2**16, 2**30]
|
||||
vals.each { |v|
|
||||
lambda { File.umask(v) }.should_not raise_error
|
||||
}
|
||||
platform_is_not :freebsd, :darwin do
|
||||
it "always succeeds with any integer values" do
|
||||
vals = [-2**30, -2**16, -2**8, -2,
|
||||
-1.5, -1, 0.5, 0, 1, 2, 7.77777, 16, 32, 64, 2**8, 2**16, 2**30]
|
||||
vals.each { |v|
|
||||
lambda { File.umask(v) }.should_not raise_error
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
platform_is :freebsd, :darwin do
|
||||
it "always succeeds with any integer values" do
|
||||
vals = [-2**8, -2,
|
||||
-1.5, -1, 0.5, 0, 1, 2, 7.77777, 16, 32, 64, 2**8]
|
||||
vals.each { |v|
|
||||
lambda { File.umask(v) }.should_not raise_error
|
||||
}
|
||||
end
|
||||
|
||||
it "fails with invalid values" do
|
||||
vals = [-2**30, -2**16, 2**16, 2**30]
|
||||
vals.each { |v|
|
||||
lambda { File.chmod(v, @file) }.should raise_error(RangeError)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
it "raises ArgumentError when more than one argument is provided" do
|
||||
|
|
Loading…
Reference in a new issue