blob: eb1ac233d12eee15197fc78c6a5ad344e329409e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
require "testing_env"
require "sandbox"
class SandboxTest < Homebrew::TestCase
def setup
skip "sandbox not implemented" unless Sandbox.available?
end
def test_allow_write
s = Sandbox.new
testpath = Pathname.new(TEST_TMPDIR)
foo = testpath/"foo"
s.allow_write foo
s.exec "touch", foo
assert_predicate foo, :exist?
foo.unlink
end
def test_deny_write
s = Sandbox.new
testpath = Pathname.new(TEST_TMPDIR)
bar = testpath/"bar"
shutup do
assert_raises(ErrorDuringExecution) { s.exec "touch", bar }
end
refute_predicate bar, :exist?
end
end
|