diff options
| author | Tim D. Smith | 2016-08-11 00:23:02 -0700 |
|---|---|---|
| committer | Tim D. Smith | 2016-08-14 12:23:17 -0700 |
| commit | 4309a19a7cbaec0cce496a5a1fe459cee087dfd7 (patch) | |
| tree | 665cf368d26dae3782cfe2bc148d44eaefc13693 /Library/Homebrew | |
| parent | 2aad3e052a13ac507b1f8864273a7de2d259c15f (diff) | |
| download | brew-4309a19a7cbaec0cce496a5a1fe459cee087dfd7.tar.bz2 | |
Test that sandbox complains correctly
Test that sandbox does not complain about bogus .pyc errors and does
complain about other failures.
Closes #684.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/test/test_sandbox.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_sandbox.rb b/Library/Homebrew/test/test_sandbox.rb index 2cf9c5106..dc907d428 100644 --- a/Library/Homebrew/test/test_sandbox.rb +++ b/Library/Homebrew/test/test_sandbox.rb @@ -25,4 +25,30 @@ class SandboxTest < Homebrew::TestCase end refute_predicate @file, :exist? end + + def test_complains_on_failure + Utils.expects(:popen_read => "foo") + ARGV.stubs(:verbose? => true) + out, _err = capture_io do + assert_raises(ErrorDuringExecution) { @sandbox.exec "false" } + end + assert_match "foo", out + end + + def test_ignores_bogus_python_error + with_bogus_error = <<-EOS.undent + foo + Mar 17 02:55:06 sandboxd[342]: Python(49765) deny file-write-unlink /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/errors.pyc + bar + EOS + Utils.expects(:popen_read => with_bogus_error) + ARGV.stubs(:verbose? => true) + out, _err = capture_io do + assert_raises(ErrorDuringExecution) { @sandbox.exec "false" } + end + refute_predicate out, :empty? + assert_match "foo", out + assert_match "bar", out + refute_match "Python", out + end end |
