aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/support
diff options
context:
space:
mode:
authorMike McQuaid2017-02-26 20:48:36 +0000
committerMike McQuaid2017-02-26 20:48:36 +0000
commitc2a460ec6d857ba33c89174d8d93fcaa403c3717 (patch)
tree089045fec4c46fb74e3b48868e2b335497df7b84 /Library/Homebrew/test/support
parentd3ae1cc264dc9eb9b602dd6aa21c4282dc049c79 (diff)
parentff93e1624b214c9b48731174a9135789fc3695a8 (diff)
downloadbrew-c2a460ec6d857ba33c89174d8d93fcaa403c3717.tar.bz2
Merge branch 'master' into filter_all_env_vars_932
Diffstat (limited to 'Library/Homebrew/test/support')
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/appcast-checkpoint-sha256-for-empty-string.rb4
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/appcast-invalid-checkpoint.rb4
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/appcast-missing-checkpoint.rb3
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/appcast-valid-checkpoint.rb4
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/appdir-interpolation.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/auto-updates.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/bad-checksum.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/basic-cask.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/booby-trap.rb8
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/container-7z.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/container-air.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/container-bzip2.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/container-cab.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/container-dmg.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/container-gzip.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/container-lzma.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/container-pkg.rb7
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/container-rar.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/container-sit.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/container-tar-gz.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/container-xar.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/container-xz.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-absolute-target.rb3
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-no-target.rb3
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-relative-target.rb3
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid-sha256.rb4
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-multiple.rb13
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-url.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-conflicts-with-key.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-arch-value.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-key.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-macos-bad-release.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-macos-conflicting-forms.rb12
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-x11-value.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-conflicting-keys.rb12
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-key-id.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-key-url.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-missing-key.rb10
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-multiple-stanzas.rb13
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-parameter.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-signature-url.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-type.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-format.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-token-mismatch.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-version.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-stage-only-conflict.rb10
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-homepage.rb10
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-url.rb10
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-version.rb10
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/local-caffeine.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/local-transmission.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/missing-checksum.rb8
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/missing-homepage.rb5
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/missing-name.rb5
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/missing-sha256.rb5
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/missing-url.rb5
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/missing-version.rb4
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/naked-executable.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/nested-app.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/no-checksum.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/no-dsl-version.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/osdn-correct-url-format.rb6
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/osdn-incorrect-url-format.rb6
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/sha256-for-empty-string.rb4
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-correct-url-format.rb6
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-incorrect-url-format.rb6
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-version-latest-correct-url-format.rb6
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/stage-only.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/test-opera-mail.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/test-opera.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/version-latest-string.rb4
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/version-latest-with-checksum.rb4
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-accessibility-access.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-alt-target.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-appcast.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-binary.rb10
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-caveats.rb23
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-choices.rb16
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-conditional-caveats.rb14
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-conflicts-with.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-arch.rb12
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-cyclic-helper.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-cyclic.rb12
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-multiple.rb12
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-formula-multiple.rb12
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-formula.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-array.rb12
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-comparison.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-failure.rb12
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-string.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-symbol.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-x11-false.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-x11.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-dsl-version.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-embedded-binary.rb10
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-generic-artifact-no-target.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-generic-artifact.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-gpg-key-url.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-gpg.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-installable.rb21
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-manual.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-script.rb15
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-macosx-dir.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-pkgutil-zap.rb13
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-suite.rb10
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-correct.rb10
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-incorrect.rb9
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-subdir.rb10
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-delete.rb17
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-early-script.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-kext.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-launchctl.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-login-item.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-pkgutil.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-quit.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-rmdir.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-script-app.rb21
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-script.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-signal.rb14
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-trash.rb17
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-delete.rb17
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-early-script.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-kext.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-launchctl.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-login-item.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-pkgutil.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-quit.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-rmdir.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-script.rb11
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-signal.rb14
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-trash.rb17
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/Casks/with-zap.rb19
-rw-r--r--Library/Homebrew/test/support/fixtures/cask/empty_directory/.gitignore0
-rw-r--r--Library/Homebrew/test/support/helper/env.rb15
-rw-r--r--Library/Homebrew/test/support/helper/fixtures.rb13
-rw-r--r--Library/Homebrew/test/support/helper/formula.rb19
-rw-r--r--Library/Homebrew/test/support/helper/fs_leak_logger.rb4
-rw-r--r--Library/Homebrew/test/support/helper/integration_command_test_case.rb109
-rw-r--r--Library/Homebrew/test/support/helper/lifecycle_enforcer.rb22
-rw-r--r--Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb176
-rw-r--r--Library/Homebrew/test/support/helper/test_case.rb58
-rw-r--r--Library/Homebrew/test/support/lib/config.rb5
143 files changed, 1670 insertions, 99 deletions
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/appcast-checkpoint-sha256-for-empty-string.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/appcast-checkpoint-sha256-for-empty-string.rb
new file mode 100644
index 000000000..4e74d728d
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/appcast-checkpoint-sha256-for-empty-string.rb
@@ -0,0 +1,4 @@
+cask 'appcast-checkpoint-sha256-for-empty-string' do
+ appcast 'http://localhost/appcast.xml',
+ checkpoint: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/appcast-invalid-checkpoint.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/appcast-invalid-checkpoint.rb
new file mode 100644
index 000000000..8b6934148
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/appcast-invalid-checkpoint.rb
@@ -0,0 +1,4 @@
+cask 'appcast-invalid-checkpoint' do
+ appcast 'http://localhost/appcast.xml',
+ checkpoint: 'not a valid shasum'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/appcast-missing-checkpoint.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/appcast-missing-checkpoint.rb
new file mode 100644
index 000000000..fefdbcb3a
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/appcast-missing-checkpoint.rb
@@ -0,0 +1,3 @@
+cask 'appcast-missing-checkpoint' do
+ appcast 'http://localhost/appcast.xml'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/appcast-valid-checkpoint.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/appcast-valid-checkpoint.rb
new file mode 100644
index 000000000..84c9ca512
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/appcast-valid-checkpoint.rb
@@ -0,0 +1,4 @@
+cask 'appcast-valid-checkpoint' do
+ appcast 'http://localhost/appcast.xml',
+ checkpoint: 'd5b2dfbef7ea28c25f7a77cd7fa14d013d82b626db1d82e00e25822464ba19e2'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/appdir-interpolation.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/appdir-interpolation.rb
new file mode 100644
index 000000000..e4b3e79e6
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/appdir-interpolation.rb
@@ -0,0 +1,9 @@
+cask 'appdir-interpolation' do
+ version '2.61'
+ sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg"
+ homepage 'http://example.com/appdir-interpolation'
+
+ binary "#{appdir}/some/path"
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/auto-updates.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/auto-updates.rb
new file mode 100644
index 000000000..1cada2561
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/auto-updates.rb
@@ -0,0 +1,11 @@
+cask 'auto-updates' do
+ version '2.61'
+ sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg"
+ homepage 'http://example.com/auto-updates'
+
+ auto_updates true
+
+ app 'Transmission.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/bad-checksum.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/bad-checksum.rb
new file mode 100644
index 000000000..254ee59fd
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/bad-checksum.rb
@@ -0,0 +1,9 @@
+cask 'bad-checksum' do
+ version '1.2.3'
+ sha256 'badbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadb'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/basic-cask.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/basic-cask.rb
new file mode 100644
index 000000000..ff1d90003
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/basic-cask.rb
@@ -0,0 +1,9 @@
+cask 'basic-cask' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url 'http://example.com/TestCask.dmg'
+ homepage 'http://example.com/'
+
+ app 'TestCask.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/booby-trap.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/booby-trap.rb
new file mode 100644
index 000000000..21bd97952
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/booby-trap.rb
@@ -0,0 +1,8 @@
+cask 'booby-trap' do
+ version '0.0.7'
+
+ url do
+ # to be lazily evaluated
+ fail 'Boom'
+ end
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-7z.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-7z.rb
new file mode 100644
index 000000000..5b043a75e
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-7z.rb
@@ -0,0 +1,11 @@
+cask 'container-7z' do
+ version '1.2.3'
+ sha256 '3f9542ace85ed5f88549e2d0ea82210f8ddc87e0defbb78469d3aed719b3c964'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/container.7z"
+ homepage 'https://example.com/container-7z'
+
+ depends_on formula: 'unar'
+
+ app 'container'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-air.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-air.rb
new file mode 100644
index 000000000..5aaf3d53e
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-air.rb
@@ -0,0 +1,9 @@
+cask 'container-air' do
+ version '0.1'
+ sha256 '554472e163f8a028629b12b468e29acda9f16b223dff74fcd218bba73cc2365a'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/container.air"
+ homepage 'https://example.com/container-air'
+
+ app 'container.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-bzip2.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-bzip2.rb
new file mode 100644
index 000000000..60f834b7f
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-bzip2.rb
@@ -0,0 +1,9 @@
+cask 'container-bzip2' do
+ version '1.2.3'
+ sha256 'eaf67b3a62cb9275f96e45d05c70b94bef9ef1dae344083e93eda6b0b388a61c'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/container.bz2"
+ homepage 'https://example.com/container-bzip2'
+
+ app 'container-bzip2--1.2.3'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-cab.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-cab.rb
new file mode 100644
index 000000000..e57131567
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-cab.rb
@@ -0,0 +1,11 @@
+cask 'container-cab' do
+ version '1.2.3'
+ sha256 'c267f5cebb14814c8e612a8b7d2bda02aec913f869509b6f1d3883427c0f552b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/container.cab"
+ homepage 'https://example.com/container-cab'
+
+ depends_on formula: 'cabextract'
+
+ app 'container'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-dmg.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-dmg.rb
new file mode 100644
index 000000000..e9974b5d2
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-dmg.rb
@@ -0,0 +1,9 @@
+cask 'container-dmg' do
+ version '1.2.3'
+ sha256 '74d89d4fa5cef175cf43666ce11fefa3741aa1522114042ac75e656be37141a1'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/container.dmg"
+ homepage 'https://example.com/container-dmg'
+
+ app 'container'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-gzip.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-gzip.rb
new file mode 100644
index 000000000..0bfc4108f
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-gzip.rb
@@ -0,0 +1,9 @@
+cask 'container-gzip' do
+ version '1.2.3'
+ sha256 'fa4ebb5246583c4b6e62e1df4e3b71b4e38a1d7d91c025665827195d36214b20'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/container.gz"
+ homepage 'https://example.com/container-gzip'
+
+ app 'container'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-lzma.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-lzma.rb
new file mode 100644
index 000000000..92d2c253e
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-lzma.rb
@@ -0,0 +1,11 @@
+cask 'container-lzma' do
+ version '1.2.3'
+ sha256 '9d7edb32d02ab9bd9749a5bde8756595ea4cfcb1da02ca11c30fb591d4c1ed85'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/container.lzma"
+ homepage 'https://example.com/container-lzma'
+
+ depends_on formula: 'lzma'
+
+ app 'container-lzma--1.2.3'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-pkg.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-pkg.rb
new file mode 100644
index 000000000..2ff4cca1e
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-pkg.rb
@@ -0,0 +1,7 @@
+cask 'container-pkg' do
+ version '1.2.3'
+ sha256 '611c50c8a2a2098951d2cd0fd54787ed81b92cd97b4b08bd7cba17f1e1d8e40b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/container.pkg"
+ homepage 'https://example.com/container-pkg'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-rar.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-rar.rb
new file mode 100644
index 000000000..33ea670d1
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-rar.rb
@@ -0,0 +1,11 @@
+cask 'container-rar' do
+ version '1.2.3'
+ sha256 '419af7864c0e1f125515c49b08bd22e0f7de39f5285897c440fe03c714871763'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/container.rar"
+ homepage 'https://example.com/container-rar'
+
+ depends_on formula: 'unar'
+
+ app 'container'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-sit.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-sit.rb
new file mode 100644
index 000000000..5715795a7
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-sit.rb
@@ -0,0 +1,11 @@
+cask 'container-sit' do
+ version '1.2.3'
+ sha256 '0d21a64dce625044345c8ecca888e5439feaf254dac7f884917028a744f93cf3'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/container.sit"
+ homepage 'https://example.com/container-sit'
+
+ depends_on formula: 'unar'
+
+ app 'container'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-tar-gz.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-tar-gz.rb
new file mode 100644
index 000000000..e32931c89
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-tar-gz.rb
@@ -0,0 +1,9 @@
+cask 'container-tar-gz' do
+ version '1.2.3'
+ sha256 'fab685fabf73d5a9382581ce8698fce9408f5feaa49fa10d9bc6c510493300f5'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/container.tar.gz"
+ homepage 'https://example.com/container-tar-gz'
+
+ app 'container'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-xar.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-xar.rb
new file mode 100644
index 000000000..82a751d5d
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-xar.rb
@@ -0,0 +1,9 @@
+cask 'container-xar' do
+ version '1.2.3'
+ sha256 '5bb8e09a6fc630ebeaf266b1fd2d15e2ae7d32d7e4da6668a8093426fa1ba509'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/container.xar"
+ homepage 'https://example.com/container-xar'
+
+ app 'container'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-xz.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-xz.rb
new file mode 100644
index 000000000..3f844af04
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-xz.rb
@@ -0,0 +1,11 @@
+cask 'container-xz' do
+ version '1.2.3'
+ sha256 '839263f474edde1d54a9101606e6f0dc9d963acc93f6dcc5af8d10ebc3187c02'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/container.xz"
+ homepage 'https://example.com/container-xz'
+
+ depends_on formula: 'xz'
+
+ app 'container-xz--1.2.3'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-absolute-target.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-absolute-target.rb
new file mode 100644
index 000000000..a1844a9c9
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-absolute-target.rb
@@ -0,0 +1,3 @@
+cask 'generic-artifact-absolute-target' do
+ artifact 'Caffeine.app', target: "#{Hbc.appdir}/Caffeine.app"
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-no-target.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-no-target.rb
new file mode 100644
index 000000000..a3e65caab
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-no-target.rb
@@ -0,0 +1,3 @@
+cask 'generic-artifact-no-target' do
+ artifact 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-relative-target.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-relative-target.rb
new file mode 100644
index 000000000..eb521e35a
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-relative-target.rb
@@ -0,0 +1,3 @@
+cask 'generic-artifact-relative-target' do
+ artifact 'Caffeine.app', target: 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid-sha256.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid-sha256.rb
new file mode 100644
index 000000000..2804da7c3
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid-sha256.rb
@@ -0,0 +1,4 @@
+cask 'invalid-sha256' do
+ version '1.2.3'
+ sha256 'not a valid shasum'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-multiple.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-multiple.rb
new file mode 100644
index 000000000..37634f619
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-multiple.rb
@@ -0,0 +1,13 @@
+cask 'invalid-appcast-multiple' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ appcast 'http://example.com/appcast1.xml',
+ checkpoint: '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+ appcast 'http://example.com/appcast2.xml',
+ checkpoint: '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+ homepage 'http://example.com/invalid-appcast-multiple'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-url.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-url.rb
new file mode 100644
index 000000000..7b51ffb53
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-url.rb
@@ -0,0 +1,11 @@
+cask 'invalid-appcast-url' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ appcast 1,
+ checkpoint: '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+ homepage 'http://example.com/invalid-appcast-url'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-conflicts-with-key.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-conflicts-with-key.rb
new file mode 100644
index 000000000..b066139ce
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-conflicts-with-key.rb
@@ -0,0 +1,11 @@
+cask 'invalid-conflicts-with-key' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/invalid-conflicts-with-key'
+
+ conflicts_with no_such_key: 'unar'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-arch-value.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-arch-value.rb
new file mode 100644
index 000000000..b21912a6e
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-arch-value.rb
@@ -0,0 +1,11 @@
+cask 'invalid-depends-on-arch-value' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/invalid-depends-on-arch-value'
+
+ depends_on arch: :no_such_arch
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-key.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-key.rb
new file mode 100644
index 000000000..24a912893
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-key.rb
@@ -0,0 +1,11 @@
+cask 'invalid-depends-on-key' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/invalid-depends-on-key'
+
+ depends_on no_such_key: 'unar'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-macos-bad-release.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-macos-bad-release.rb
new file mode 100644
index 000000000..723ceacbb
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-macos-bad-release.rb
@@ -0,0 +1,11 @@
+cask 'invalid-depends-on-macos-bad-release' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/invalid-depends-on-macos-bad-release'
+
+ depends_on macos: :no_such_release
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-macos-conflicting-forms.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-macos-conflicting-forms.rb
new file mode 100644
index 000000000..689e24b67
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-macos-conflicting-forms.rb
@@ -0,0 +1,12 @@
+cask 'invalid-depends-on-macos-conflicting-forms' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/invalid-depends-on-macos-conflicting-forms'
+
+ depends_on macos: :yosemite
+ depends_on macos: '>= :mavericks'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-x11-value.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-x11-value.rb
new file mode 100644
index 000000000..5c3faec35
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-x11-value.rb
@@ -0,0 +1,11 @@
+cask 'invalid-depends-on-x11-value' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/invalid-depends-on-x11-value'
+
+ depends_on x11: :no_such_value
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-conflicting-keys.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-conflicting-keys.rb
new file mode 100644
index 000000000..baf124b7a
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-conflicting-keys.rb
@@ -0,0 +1,12 @@
+cask 'invalid-gpg-conflicting-keys' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/invalid-gpg-conflicting-keys'
+ gpg 'http://example.com/gpg-signature.asc',
+ key_id: '01234567',
+ key_url: 'http://example.com/gpg-key-url'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-key-id.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-key-id.rb
new file mode 100644
index 000000000..386593b06
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-key-id.rb
@@ -0,0 +1,11 @@
+cask 'invalid-gpg-key-id' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/invalid-gpg-key-id'
+ gpg 'http://example.com/gpg-signature.asc',
+ key_id: '012'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-key-url.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-key-url.rb
new file mode 100644
index 000000000..4108380d2
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-key-url.rb
@@ -0,0 +1,11 @@
+cask 'invalid-gpg-key-url' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/invalid-gpg-key-url'
+ gpg 'http://example.com/gpg-signature.asc',
+ key_url: 1
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-missing-key.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-missing-key.rb
new file mode 100644
index 000000000..3375801c9
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-missing-key.rb
@@ -0,0 +1,10 @@
+cask 'invalid-gpg-missing-key' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/invalid-gpg-missing-keys'
+ gpg 'http://example.com/gpg-signature.asc'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-multiple-stanzas.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-multiple-stanzas.rb
new file mode 100644
index 000000000..b420f74d5
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-multiple-stanzas.rb
@@ -0,0 +1,13 @@
+cask 'invalid-gpg-multiple-stanzas' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/invalid-gpg-multiple-stanzas'
+ gpg 'http://example.com/gpg-signature.asc',
+ key_id: '01234567'
+ gpg 'http://example.com/gpg-signature.asc',
+ key_id: '01234567'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-parameter.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-parameter.rb
new file mode 100644
index 000000000..40f6a9dae
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-parameter.rb
@@ -0,0 +1,11 @@
+cask 'invalid-gpg-parameter' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/invalid-gpg-type'
+ gpg 'http://example.com/gpg-signature.asc',
+ no_such_parameter: :value
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-signature-url.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-signature-url.rb
new file mode 100644
index 000000000..43cc27b08
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-signature-url.rb
@@ -0,0 +1,11 @@
+cask 'invalid-gpg-signature-url' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/invalid-gpg-signature-url'
+ gpg 1,
+ key_id: '01234567'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-type.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-type.rb
new file mode 100644
index 000000000..a369ef875
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-type.rb
@@ -0,0 +1,11 @@
+cask 'invalid-gpg-type' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/invalid-gpg-type'
+ gpg 'http://example.com/gpg-signature.asc',
+ no_such_parameter: :value
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-format.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-format.rb
new file mode 100644
index 000000000..c8c613767
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-format.rb
@@ -0,0 +1,9 @@
+cask => 'invalid-header-format' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-token-mismatch.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-token-mismatch.rb
new file mode 100644
index 000000000..af15a13ef
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-token-mismatch.rb
@@ -0,0 +1,9 @@
+cask 'invalid-header-token-mismatch-this-text-does-not-belong' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-version.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-version.rb
new file mode 100644
index 000000000..7e37e61df
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-version.rb
@@ -0,0 +1,9 @@
+cask 'invalid-header-version' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-stage-only-conflict.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-stage-only-conflict.rb
new file mode 100644
index 000000000..5a0ccadf6
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-stage-only-conflict.rb
@@ -0,0 +1,10 @@
+cask 'invalid-stage-only-conflict' do
+ version '2.61'
+ sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg"
+ homepage 'http://example.com/invalid-stage-only-conflict'
+
+ app 'Transmission.app'
+ stage_only true
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-homepage.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-homepage.rb
new file mode 100644
index 000000000..5170a9c0f
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-homepage.rb
@@ -0,0 +1,10 @@
+cask 'invalid-two-homepage' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/local-caffeine'
+ homepage 'http://www.example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-url.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-url.rb
new file mode 100644
index 000000000..f548400a4
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-url.rb
@@ -0,0 +1,10 @@
+cask 'invalid-two-url' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ url 'http://example.com/caffeine.zip'
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-version.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-version.rb
new file mode 100644
index 000000000..fbffa8a1e
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-version.rb
@@ -0,0 +1,10 @@
+cask 'invalid-two-version' do
+ version '1.2.3'
+ version '2.0'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/local-caffeine.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/local-caffeine.rb
new file mode 100644
index 000000000..934d22463
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/local-caffeine.rb
@@ -0,0 +1,9 @@
+cask 'local-caffeine' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/local-transmission.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/local-transmission.rb
new file mode 100644
index 000000000..6709ac12e
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/local-transmission.rb
@@ -0,0 +1,9 @@
+cask 'local-transmission' do
+ version '2.61'
+ sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg"
+ homepage 'http://example.com/local-transmission'
+
+ app 'Transmission.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-checksum.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-checksum.rb
new file mode 100644
index 000000000..907b1375f
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-checksum.rb
@@ -0,0 +1,8 @@
+cask 'missing-checksum' do
+ version '1.2.3'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-homepage.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-homepage.rb
new file mode 100644
index 000000000..cf06d6c33
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-homepage.rb
@@ -0,0 +1,5 @@
+cask 'missing-homepage' do
+ version '1.2.3'
+
+ url 'http://localhost/something.dmg'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-name.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-name.rb
new file mode 100644
index 000000000..0801f4abb
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-name.rb
@@ -0,0 +1,5 @@
+cask 'missing-name' do
+ version '1.2.3'
+
+ url 'http://localhost/something.dmg'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-sha256.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-sha256.rb
new file mode 100644
index 000000000..e6e6d9d20
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-sha256.rb
@@ -0,0 +1,5 @@
+cask 'missing-sha256' do
+ version '1.2.3'
+
+ url 'http://localhost/something.dmg'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-url.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-url.rb
new file mode 100644
index 000000000..0bfaec332
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-url.rb
@@ -0,0 +1,5 @@
+cask 'missing-url' do
+ version '1.2.3'
+
+ homepage 'http://example.com'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-version.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-version.rb
new file mode 100644
index 000000000..88e13d8bb
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-version.rb
@@ -0,0 +1,4 @@
+cask 'missing-version' do
+ url 'http://localhost/something.dmg'
+ homepage 'http://example.com'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/naked-executable.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/naked-executable.rb
new file mode 100644
index 000000000..2f4e30dc1
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/naked-executable.rb
@@ -0,0 +1,9 @@
+cask 'naked-executable' do
+ version '1.2.3'
+ sha256 '306c6ca7407560340797866e077e053627ad409277d1b9da58106fce4cf717cb'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/naked_executable"
+ homepage 'http://example.com/naked-executable'
+
+ container type: :naked
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/nested-app.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/nested-app.rb
new file mode 100644
index 000000000..6061f7bff
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/nested-app.rb
@@ -0,0 +1,11 @@
+cask 'nested-app' do
+ version '1.2.3'
+ sha256 '1866dfa833b123bb8fe7fa7185ebf24d28d300d0643d75798bc23730af734216'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/NestedApp.dmg.zip"
+ homepage 'http://example.com/nested-app'
+
+ container nested: 'NestedApp.dmg'
+
+ app 'MyNestedApp.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/no-checksum.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/no-checksum.rb
new file mode 100644
index 000000000..1e06c6168
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/no-checksum.rb
@@ -0,0 +1,9 @@
+cask 'no-checksum' do
+ version '1.2.3'
+ sha256 :no_check
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/no-dsl-version.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/no-dsl-version.rb
new file mode 100644
index 000000000..3bafa171d
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/no-dsl-version.rb
@@ -0,0 +1,9 @@
+cask 'no-dsl-version' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url 'http://example.com/TestCask.dmg'
+ homepage 'http://example.com/'
+
+ app 'TestCask.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/osdn-correct-url-format.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/osdn-correct-url-format.rb
new file mode 100644
index 000000000..7e60fc179
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/osdn-correct-url-format.rb
@@ -0,0 +1,6 @@
+cask 'osdn-correct-url-format' do
+ version '1.2.3'
+
+ url 'http://user.dl.osdn.jp/something/id/Something-1.2.3.dmg'
+ homepage 'http://osdn.jp/projects/something/'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/osdn-incorrect-url-format.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/osdn-incorrect-url-format.rb
new file mode 100644
index 000000000..68b4ecd4c
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/osdn-incorrect-url-format.rb
@@ -0,0 +1,6 @@
+cask 'osdn-incorrect-url-format' do
+ version '1.2.3'
+
+ url 'http://osdn.jp/projects/something/files/Something-1.2.3.dmg/download'
+ homepage 'http://osdn.jp/projects/something/'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/sha256-for-empty-string.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/sha256-for-empty-string.rb
new file mode 100644
index 000000000..0bf3ee9b5
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/sha256-for-empty-string.rb
@@ -0,0 +1,4 @@
+cask 'sha256-for-empty-string' do
+ version '1.2.3'
+ sha256 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-correct-url-format.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-correct-url-format.rb
new file mode 100644
index 000000000..439eb8998
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-correct-url-format.rb
@@ -0,0 +1,6 @@
+cask 'sourceforge-correct-url-format' do
+ version '1.2.3'
+
+ url 'https://downloads.sourceforge.net/something/Something-1.2.3.dmg'
+ homepage 'https://sourceforge.net/projects/something/'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-incorrect-url-format.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-incorrect-url-format.rb
new file mode 100644
index 000000000..39ac52414
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-incorrect-url-format.rb
@@ -0,0 +1,6 @@
+cask 'sourceforge-incorrect-url-format' do
+ version '1.2.3'
+
+ url 'http://sourceforge.net/projects/something/files/Something-1.2.3.dmg/download'
+ homepage 'http://sourceforge.net/projects/something/'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-version-latest-correct-url-format.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-version-latest-correct-url-format.rb
new file mode 100644
index 000000000..07b068f70
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-version-latest-correct-url-format.rb
@@ -0,0 +1,6 @@
+cask 'sourceforge-version-latest-correct-url-format' do
+ version :latest
+
+ url 'https://sourceforge.net/projects/something/files/latest/download'
+ homepage 'https://sourceforge.net/projects/something/'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/stage-only.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/stage-only.rb
new file mode 100644
index 000000000..941e2084f
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/stage-only.rb
@@ -0,0 +1,9 @@
+cask 'stage-only' do
+ version '2.61'
+ sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg"
+ homepage 'http://example.com/stage-only'
+
+ stage_only true
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/test-opera-mail.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/test-opera-mail.rb
new file mode 100644
index 000000000..3e2c76e67
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/test-opera-mail.rb
@@ -0,0 +1,9 @@
+cask 'test-opera-mail' do
+ version '1.0'
+ sha256 'afd192e308f8ea8ddb3d426fd6663d97078570417ee78b8e1fa15f515ae3d677'
+
+ url 'http://get-ash-1.opera.com/pub/opera/mail/1.0/mac/Opera-Mail-1.0-1040.i386.dmg'
+ homepage 'http://www.opera.com/computer/mail'
+
+ app 'Opera Mail.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/test-opera.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/test-opera.rb
new file mode 100644
index 000000000..7ca0157d9
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/test-opera.rb
@@ -0,0 +1,9 @@
+cask 'test-opera' do
+ version '19.0.1326.47'
+ sha256 '7b91f20ab754f7b3fef8dc346e0393917e11676b74c8f577408841619f76040a'
+
+ url 'http://get.geo.opera.com/pub/opera/desktop/19.0.1326.47/mac/Opera_19.0.1326.47_Setup.dmg'
+ homepage 'http://www.opera.com/'
+
+ app 'Opera.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest-string.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest-string.rb
new file mode 100644
index 000000000..6bd090c28
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest-string.rb
@@ -0,0 +1,4 @@
+cask 'version-latest-string' do
+ version 'latest'
+ sha256 :no_check
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest-with-checksum.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest-with-checksum.rb
new file mode 100644
index 000000000..040cfc76e
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest-with-checksum.rb
@@ -0,0 +1,4 @@
+cask 'version-latest-with-checksum' do
+ version :latest
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-accessibility-access.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-accessibility-access.rb
new file mode 100644
index 000000000..4c1c9897a
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-accessibility-access.rb
@@ -0,0 +1,11 @@
+cask 'with-accessibility-access' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url 'http://example.com/TestCask.dmg'
+ homepage 'http://example.com/'
+
+ accessibility_access true
+
+ app 'TestCask.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-alt-target.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-alt-target.rb
new file mode 100644
index 000000000..7a6d75a9c
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-alt-target.rb
@@ -0,0 +1,9 @@
+cask 'with-alt-target' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app', target: 'AnotherName.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-appcast.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-appcast.rb
new file mode 100644
index 000000000..fc57e5e65
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-appcast.rb
@@ -0,0 +1,11 @@
+cask 'with-appcast' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ appcast 'http://example.com/appcast.xml',
+ checkpoint: '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+ homepage 'http://example.com/with-appcast'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-binary.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-binary.rb
new file mode 100644
index 000000000..38be2e772
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-binary.rb
@@ -0,0 +1,10 @@
+cask 'with-binary' do
+ version '1.2.3'
+ sha256 'd5b2dfbef7ea28c25f7a77cd7fa14d013d82b626db1d82e00e25822464ba19e2'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/AppWithBinary.zip"
+ homepage 'http://example.com/with-binary'
+
+ app 'App.app'
+ binary 'binary'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-caveats.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-caveats.rb
new file mode 100644
index 000000000..d5d90114a
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-caveats.rb
@@ -0,0 +1,23 @@
+cask 'with-caveats' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+
+ # simple string is evaluated at compile-time
+ caveats <<-EOS.undent
+ Here are some things you might want to know.
+ EOS
+ # do block is evaluated at install-time
+ caveats do
+ "Cask token: #{token}"
+ end
+ # a do block may print and use a DSL
+ caveats do
+ puts 'Custom text via puts followed by DSL-generated text:'
+ path_environment_variable('/custom/path/bin')
+ end
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-choices.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-choices.rb
new file mode 100644
index 000000000..640a3bbb3
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-choices.rb
@@ -0,0 +1,16 @@
+cask 'with-choices' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg',
+ choices: [
+ {
+ 'choiceIdentifier' => 'choice1',
+ 'choiceAttribute' => 'selected',
+ 'attributeSetting' => 1,
+ },
+ ]
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-conditional-caveats.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-conditional-caveats.rb
new file mode 100644
index 000000000..e3c666834
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-conditional-caveats.rb
@@ -0,0 +1,14 @@
+cask 'with-conditional-caveats' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+
+ # a do block may print and use a DSL
+ caveats do
+ puts 'This caveat is conditional' if false # rubocop:disable Lint/LiteralInCondition
+ end
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-conflicts-with.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-conflicts-with.rb
new file mode 100644
index 000000000..ab3631743
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-conflicts-with.rb
@@ -0,0 +1,11 @@
+cask 'with-conflicts-with' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-conflicts-with'
+
+ conflicts_with formula: 'unar'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-arch.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-arch.rb
new file mode 100644
index 000000000..9fe0d043b
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-arch.rb
@@ -0,0 +1,12 @@
+cask 'with-depends-on-arch' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-depends-on-arch'
+
+ # covers all known hardware; always succeeds
+ depends_on arch: :intel
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-cyclic-helper.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-cyclic-helper.rb
new file mode 100644
index 000000000..3a90295e5
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-cyclic-helper.rb
@@ -0,0 +1,11 @@
+cask 'with-depends-on-cask-cyclic-helper' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-depends-on-cask-cyclic-helper'
+
+ depends_on cask: 'with-depends-on-cask-cyclic'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-cyclic.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-cyclic.rb
new file mode 100644
index 000000000..776351568
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-cyclic.rb
@@ -0,0 +1,12 @@
+cask 'with-depends-on-cask-cyclic' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-depends-on-cask-cyclic'
+
+ depends_on cask: 'local-caffeine'
+ depends_on cask: 'with-depends-on-cask-cyclic-helper'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-multiple.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-multiple.rb
new file mode 100644
index 000000000..74e1c2747
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-multiple.rb
@@ -0,0 +1,12 @@
+cask 'with-depends-on-cask-multiple' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-depends-on-cask-multiple'
+
+ depends_on cask: 'local-caffeine'
+ depends_on cask: 'local-transmission'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask.rb
new file mode 100644
index 000000000..52daec865
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask.rb
@@ -0,0 +1,11 @@
+cask 'with-depends-on-cask' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-depends-on-cask'
+
+ depends_on cask: 'local-transmission'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-formula-multiple.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-formula-multiple.rb
new file mode 100644
index 000000000..07d7bb86a
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-formula-multiple.rb
@@ -0,0 +1,12 @@
+cask 'with-depends-on-formula-multiple' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-depends-on-formula-multiple'
+
+ depends_on formula: 'unar'
+ depends_on formula: 'fileutils'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-formula.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-formula.rb
new file mode 100644
index 000000000..ac980f890
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-formula.rb
@@ -0,0 +1,11 @@
+cask 'with-depends-on-formula' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-depends-on-formula'
+
+ depends_on formula: 'unar'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-array.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-array.rb
new file mode 100644
index 000000000..7fb1a9016
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-array.rb
@@ -0,0 +1,12 @@
+cask 'with-depends-on-macos-array' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-depends-on-macos-array'
+
+ # since all OS releases are included, this should always pass
+ depends_on macos: ['10.4', '10.5', '10.6', '10.7', '10.8', '10.9', '10.10', MacOS.version.to_s]
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-comparison.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-comparison.rb
new file mode 100644
index 000000000..1483bcf74
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-comparison.rb
@@ -0,0 +1,11 @@
+cask 'with-depends-on-macos-comparison' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-depends-on-macos-comparison'
+
+ depends_on macos: '>= 10.4'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-failure.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-failure.rb
new file mode 100644
index 000000000..483d75814
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-failure.rb
@@ -0,0 +1,12 @@
+cask 'with-depends-on-macos-failure' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-depends-on-macos-failure'
+
+ # guarantee a mismatched release
+ depends_on macos: MacOS.version.to_s == '10.4' ? '10.5' : '10.4'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-string.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-string.rb
new file mode 100644
index 000000000..887771fe2
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-string.rb
@@ -0,0 +1,11 @@
+cask 'with-depends-on-macos-string' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-depends-on-macos-string'
+
+ depends_on macos: MacOS.version.to_s
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-symbol.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-symbol.rb
new file mode 100644
index 000000000..e5aa05d23
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-symbol.rb
@@ -0,0 +1,11 @@
+cask 'with-depends-on-macos-symbol' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-depends-on-macos-symbol'
+
+ depends_on macos: MacOS.version.to_sym
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-x11-false.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-x11-false.rb
new file mode 100644
index 000000000..d5107edc5
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-x11-false.rb
@@ -0,0 +1,11 @@
+cask 'with-depends-on-x11-false' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-depends-on-x11-false'
+
+ depends_on x11: false
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-x11.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-x11.rb
new file mode 100644
index 000000000..bcb781637
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-x11.rb
@@ -0,0 +1,11 @@
+cask 'with-depends-on-x11' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-depends-on-x11'
+
+ depends_on x11: true
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-dsl-version.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-dsl-version.rb
new file mode 100644
index 000000000..15f0319c5
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-dsl-version.rb
@@ -0,0 +1,9 @@
+cask :v1 => 'with-dsl-version' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url 'http://example.com/TestCask.dmg'
+ homepage 'http://example.com/'
+
+ app 'TestCask.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-embedded-binary.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-embedded-binary.rb
new file mode 100644
index 000000000..5987bbfe6
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-embedded-binary.rb
@@ -0,0 +1,10 @@
+cask 'with-embedded-binary' do
+ version '1.2.3'
+ sha256 'fe052d3e77d92676775fd916ddb8942e72a565b844ea7f6d055474c99bb4e47b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/AppWithEmbeddedBinary.zip"
+ homepage 'http://example.com/with-binary'
+
+ app 'App.app'
+ binary "#{appdir}/App.app/Contents/MacOS/App/binary"
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-generic-artifact-no-target.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-generic-artifact-no-target.rb
new file mode 100644
index 000000000..f7f1ddc22
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-generic-artifact-no-target.rb
@@ -0,0 +1,9 @@
+cask 'with-generic-artifact-no-target' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-generic-artifact'
+
+ artifact 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-generic-artifact.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-generic-artifact.rb
new file mode 100644
index 000000000..d6ce0ce8d
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-generic-artifact.rb
@@ -0,0 +1,9 @@
+cask 'with-generic-artifact' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-generic-artifact'
+
+ artifact 'Caffeine.app', target: "#{Hbc.appdir}/Caffeine.app"
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-gpg-key-url.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-gpg-key-url.rb
new file mode 100644
index 000000000..fc0c9ddfc
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-gpg-key-url.rb
@@ -0,0 +1,11 @@
+cask 'with-gpg-key-url' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-gpg-key-url'
+ gpg 'http://example.com/gpg-signature.asc',
+ key_url: 'http://example.com/gpg-key-url'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-gpg.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-gpg.rb
new file mode 100644
index 000000000..e07546b94
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-gpg.rb
@@ -0,0 +1,11 @@
+cask 'with-gpg' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-gpg'
+ gpg 'http://example.com/gpg-signature.asc',
+ key_id: '01234567'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-installable.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-installable.rb
new file mode 100644
index 000000000..8416f3f88
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-installable.rb
@@ -0,0 +1,21 @@
+cask 'with-installable' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ uninstall script: { executable: 'MyFancyPkg/FancyUninstaller.tool', args: %w[--please] },
+ quit: 'my.fancy.package.app',
+ login_item: 'Fancy',
+ delete: [
+ "#{TEST_TMPDIR}/absolute_path",
+ '~/path_with_tilde',
+ "#{TEST_TMPDIR}/glob_path*",
+ 'impermissible/relative/path',
+ '/another/impermissible/../relative/path',
+ ],
+ rmdir: "#{TEST_TMPDIR}/empty_directory_path"
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-manual.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-manual.rb
new file mode 100644
index 000000000..a857b6900
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-manual.rb
@@ -0,0 +1,9 @@
+cask 'with-installer-manual' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/local-caffeine'
+
+ installer manual: 'Caffeine.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-script.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-script.rb
new file mode 100644
index 000000000..b32d131e0
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-script.rb
@@ -0,0 +1,15 @@
+cask 'with-installer-script' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/with-install-script'
+
+ installer script: '/usr/bin/true',
+ args: ['--flag']
+ # acceptable alternate form
+ installer script: {
+ executable: '/usr/bin/false',
+ args: ['--flag'],
+ }
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-macosx-dir.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-macosx-dir.rb
new file mode 100644
index 000000000..505e9f5a7
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-macosx-dir.rb
@@ -0,0 +1,9 @@
+cask 'with-macosx-dir' do
+ version '1.2.3'
+ sha256 '5633c3a0f2e572cbf021507dec78c50998b398c343232bdfc7e26221d0a5db4d'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyApp.zip"
+ homepage 'http://example.com/MyFancyApp'
+
+ app 'MyFancyApp/MyFancyApp.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-pkgutil-zap.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-pkgutil-zap.rb
new file mode 100644
index 000000000..d86d47126
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-pkgutil-zap.rb
@@ -0,0 +1,13 @@
+cask 'with-pkgutil-zap' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ zap pkgutil: 'my.fancy.package.*',
+ kext: 'my.fancy.package.kernelextension',
+ launchctl: 'my.fancy.package.service'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-suite.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-suite.rb
new file mode 100644
index 000000000..88158e10d
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-suite.rb
@@ -0,0 +1,10 @@
+cask 'with-suite' do
+ version '1.2.3'
+ sha256 'd95dcc12d4e5be0bc3cb9793c4b7e7f69a25f0b3c7418494b0c883957e6eeae4'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine-suite.zip"
+ name 'Caffeine'
+ homepage 'http://example.com/with-suite'
+
+ suite 'Caffeine'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-correct.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-correct.rb
new file mode 100644
index 000000000..3963d7790
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-correct.rb
@@ -0,0 +1,10 @@
+cask 'with-two-apps-correct' do
+ version '1.2.3'
+ sha256 '3178fbfd1ea5d87a2a0662a4eb599ebc9a03888e73f37538d9f3f6ee69d2368e'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeines.zip"
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine Mini.app'
+ app 'Caffeine Pro.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-incorrect.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-incorrect.rb
new file mode 100644
index 000000000..c3ca473bd
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-incorrect.rb
@@ -0,0 +1,9 @@
+cask 'with-two-apps-incorrect' do
+ version '1.2.3'
+ sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app', 'Caffeine.app/Contents/MacOS/Caffeine'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-subdir.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-subdir.rb
new file mode 100644
index 000000000..879e6e4ce
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-subdir.rb
@@ -0,0 +1,10 @@
+cask 'with-two-apps-subdir' do
+ version '1.2.3'
+ sha256 'd687c22a21c02bd8f07da9302c8292b93a04df9a929e3f04d09aea6c76f75c65'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/caffeines-subdir.zip"
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeines/Caffeine Mini.app'
+ app 'Caffeines/Caffeine Pro.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-delete.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-delete.rb
new file mode 100644
index 000000000..c7d2e4767
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-delete.rb
@@ -0,0 +1,17 @@
+cask 'with-uninstall-delete' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ uninstall delete: [
+ "#{TEST_TMPDIR}/absolute_path",
+ '~/path_with_tilde',
+ "#{TEST_TMPDIR}/glob_path*",
+ 'impermissible/relative/path',
+ '/another/impermissible/../relative/path',
+ ]
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-early-script.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-early-script.rb
new file mode 100644
index 000000000..a9cec5b97
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-early-script.rb
@@ -0,0 +1,11 @@
+cask 'with-uninstall-early-script' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ uninstall early_script: { executable: 'MyFancyPkg/FancyUninstaller.tool', args: %w[--please] }
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-kext.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-kext.rb
new file mode 100644
index 000000000..9b27a1f36
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-kext.rb
@@ -0,0 +1,11 @@
+cask 'with-uninstall-kext' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ uninstall kext: 'my.fancy.package.kernelextension'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-launchctl.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-launchctl.rb
new file mode 100644
index 000000000..e5aa2b2d7
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-launchctl.rb
@@ -0,0 +1,11 @@
+cask 'with-uninstall-launchctl' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyApp.zip"
+ homepage 'http://example.com/fancy'
+
+ app 'Fancy.app'
+
+ uninstall launchctl: 'my.fancy.package.service'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-login-item.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-login-item.rb
new file mode 100644
index 000000000..46f1f9704
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-login-item.rb
@@ -0,0 +1,11 @@
+cask 'with-uninstall-login-item' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ uninstall login_item: 'Fancy'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-pkgutil.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-pkgutil.rb
new file mode 100644
index 000000000..00157322d
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-pkgutil.rb
@@ -0,0 +1,11 @@
+cask 'with-uninstall-pkgutil' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ uninstall pkgutil: 'my.fancy.package.*'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-quit.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-quit.rb
new file mode 100644
index 000000000..7f9515578
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-quit.rb
@@ -0,0 +1,11 @@
+cask 'with-uninstall-quit' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ uninstall quit: 'my.fancy.package.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-rmdir.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-rmdir.rb
new file mode 100644
index 000000000..8ded5b835
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-rmdir.rb
@@ -0,0 +1,11 @@
+cask 'with-uninstall-rmdir' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ uninstall rmdir: "#{TEST_TMPDIR}/empty_directory_path"
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-script-app.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-script-app.rb
new file mode 100644
index 000000000..f5f3ae5dd
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-script-app.rb
@@ -0,0 +1,21 @@
+cask 'with-uninstall-script-app' do
+ version '1.2.3'
+ sha256 '5633c3a0f2e572cbf021507dec78c50998b398c343232bdfc7e26221d0a5db4d'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyApp.zip"
+ homepage 'http://example.com/MyFancyApp'
+
+ app 'MyFancyApp/MyFancyApp.app'
+
+ postflight do
+ IO.write "#{appdir}/MyFancyApp.app/uninstall.sh", <<-EOS.undent
+ #!/bin/sh
+ /bin/rm -r "#{appdir}/MyFancyApp.app"
+ EOS
+ end
+
+ uninstall script: {
+ executable: "#{appdir}/MyFancyApp.app/uninstall.sh",
+ sudo: false
+ }
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-script.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-script.rb
new file mode 100644
index 000000000..3e2dd0bb9
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-script.rb
@@ -0,0 +1,11 @@
+cask 'with-uninstall-script' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ uninstall script: { executable: 'MyFancyPkg/FancyUninstaller.tool', args: %w[--please] }
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-signal.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-signal.rb
new file mode 100644
index 000000000..850055c3c
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-signal.rb
@@ -0,0 +1,14 @@
+cask 'with-uninstall-signal' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ uninstall signal: [
+ ['TERM', 'my.fancy.package.app'],
+ ['KILL', 'my.fancy.package.app'],
+ ]
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-trash.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-trash.rb
new file mode 100644
index 000000000..b085b3e32
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-trash.rb
@@ -0,0 +1,17 @@
+cask 'with-uninstall-trash' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ uninstall trash: [
+ "#{TEST_TMPDIR}/absolute_path",
+ '~/path_with_tilde',
+ "#{TEST_TMPDIR}/glob_path*",
+ 'impermissible/relative/path',
+ '/another/impermissible/../relative/path',
+ ]
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-delete.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-delete.rb
new file mode 100644
index 000000000..d81a387f9
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-delete.rb
@@ -0,0 +1,17 @@
+cask 'with-zap-delete' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ zap delete: [
+ "#{TEST_TMPDIR}/absolute_path",
+ '~/path_with_tilde',
+ "#{TEST_TMPDIR}/glob_path*",
+ 'impermissible/relative/path',
+ '/another/impermissible/../relative/path',
+ ]
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-early-script.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-early-script.rb
new file mode 100644
index 000000000..9375d2cc7
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-early-script.rb
@@ -0,0 +1,11 @@
+cask 'with-zap-early-script' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ zap early_script: { executable: 'MyFancyPkg/FancyUninstaller.tool', args: %w[--please] }
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-kext.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-kext.rb
new file mode 100644
index 000000000..e9c29f619
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-kext.rb
@@ -0,0 +1,11 @@
+cask 'with-zap-kext' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ zap kext: 'my.fancy.package.kernelextension'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-launchctl.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-launchctl.rb
new file mode 100644
index 000000000..6d17ccfb0
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-launchctl.rb
@@ -0,0 +1,11 @@
+cask 'with-zap-launchctl' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyApp.zip"
+ homepage 'http://example.com/fancy'
+
+ app 'Fancy.app'
+
+ zap launchctl: 'my.fancy.package.service'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-login-item.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-login-item.rb
new file mode 100644
index 000000000..2715892ef
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-login-item.rb
@@ -0,0 +1,11 @@
+cask 'with-zap-login-item' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ zap login_item: 'Fancy'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-pkgutil.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-pkgutil.rb
new file mode 100644
index 000000000..c7f08b76d
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-pkgutil.rb
@@ -0,0 +1,11 @@
+cask 'with-zap-pkgutil' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ zap pkgutil: 'my.fancy.package.*'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-quit.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-quit.rb
new file mode 100644
index 000000000..4e4ab3a85
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-quit.rb
@@ -0,0 +1,11 @@
+cask 'with-zap-quit' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ zap quit: 'my.fancy.package.app'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-rmdir.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-rmdir.rb
new file mode 100644
index 000000000..a67c4ca9a
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-rmdir.rb
@@ -0,0 +1,11 @@
+cask 'with-zap-rmdir' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ zap rmdir: "#{TEST_TMPDIR}/empty_directory_path"
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-script.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-script.rb
new file mode 100644
index 000000000..5e033301a
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-script.rb
@@ -0,0 +1,11 @@
+cask 'with-zap-script' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ zap script: { executable: 'MyFancyPkg/FancyUninstaller.tool', args: %w[--please] }
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-signal.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-signal.rb
new file mode 100644
index 000000000..47870cf05
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-signal.rb
@@ -0,0 +1,14 @@
+cask 'with-zap-signal' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ zap signal: [
+ ['TERM', 'my.fancy.package.app'],
+ ['KILL', 'my.fancy.package.app'],
+ ]
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-trash.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-trash.rb
new file mode 100644
index 000000000..ea2bc2a01
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-trash.rb
@@ -0,0 +1,17 @@
+cask 'with-zap-trash' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ zap trash: [
+ "#{TEST_TMPDIR}/absolute_path",
+ '~/path_with_tilde',
+ "#{TEST_TMPDIR}/glob_path*",
+ 'impermissible/relative/path',
+ '/another/impermissible/../relative/path',
+ ]
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap.rb
new file mode 100644
index 000000000..275516fba
--- /dev/null
+++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap.rb
@@ -0,0 +1,19 @@
+cask 'with-zap' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ uninstall quit: 'my.fancy.package.app.from.uninstall'
+
+ zap script: {
+ executable: 'MyFancyPkg/FancyUninstaller.tool',
+ args: %w[--please],
+ },
+ quit: 'my.fancy.package.app',
+ login_item: 'Fancy',
+ delete: '~/Library/Preferences/my.fancy.app.plist'
+end
diff --git a/Library/Homebrew/test/support/fixtures/cask/empty_directory/.gitignore b/Library/Homebrew/test/support/fixtures/cask/empty_directory/.gitignore
deleted file mode 100644
index e69de29bb..000000000
--- a/Library/Homebrew/test/support/fixtures/cask/empty_directory/.gitignore
+++ /dev/null
diff --git a/Library/Homebrew/test/support/helper/env.rb b/Library/Homebrew/test/support/helper/env.rb
deleted file mode 100644
index 904a1d4c7..000000000
--- a/Library/Homebrew/test/support/helper/env.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test
- module Helper
- module Env
- def with_environment(partial_env)
- old = ENV.to_hash
- ENV.update partial_env
- begin
- yield
- ensure
- ENV.replace old
- end
- end
- end
- end
-end
diff --git a/Library/Homebrew/test/support/helper/fixtures.rb b/Library/Homebrew/test/support/helper/fixtures.rb
new file mode 100644
index 000000000..716fe2008
--- /dev/null
+++ b/Library/Homebrew/test/support/helper/fixtures.rb
@@ -0,0 +1,13 @@
+module Test
+ module Helper
+ module Fixtures
+ def dylib_path(name)
+ Pathname.new("#{TEST_FIXTURE_DIR}/mach/#{name}.dylib")
+ end
+
+ def bundle_path(name)
+ Pathname.new("#{TEST_FIXTURE_DIR}/mach/#{name}.bundle")
+ end
+ end
+ end
+end
diff --git a/Library/Homebrew/test/support/helper/formula.rb b/Library/Homebrew/test/support/helper/formula.rb
new file mode 100644
index 000000000..7f55f4b66
--- /dev/null
+++ b/Library/Homebrew/test/support/helper/formula.rb
@@ -0,0 +1,19 @@
+require "formulary"
+
+module Test
+ module Helper
+ module Formula
+ def formula(name = "formula_name", path: Formulary.core_path(name), spec: :stable, alias_path: nil, &block)
+ Class.new(::Formula, &block).new(name, path, spec, alias_path: alias_path)
+ end
+
+ # Use a stubbed {Formulary::FormulaLoader} to make a given formula be found
+ # when loading from {Formulary} with `ref`.
+ def stub_formula_loader(formula, ref = formula.full_name)
+ loader = double(get_formula: formula)
+ allow(Formulary).to receive(:loader_for).with(ref, from: :keg).and_return(loader)
+ allow(Formulary).to receive(:loader_for).with(ref, from: nil).and_return(loader)
+ end
+ end
+ end
+end
diff --git a/Library/Homebrew/test/support/helper/fs_leak_logger.rb b/Library/Homebrew/test/support/helper/fs_leak_logger.rb
index 774ccda04..3fbb148fa 100644
--- a/Library/Homebrew/test/support/helper/fs_leak_logger.rb
+++ b/Library/Homebrew/test/support/helper/fs_leak_logger.rb
@@ -9,13 +9,13 @@ module Test
klass.make_my_diffs_pretty!
end
- def before_setup
+ def setup
@__files_before_test = []
Find.find(TEST_TMPDIR) { |f| @__files_before_test << f.sub(TEST_TMPDIR, "") }
super
end
- def after_teardown
+ def teardown
super
files_after_test = []
Find.find(TEST_TMPDIR) { |f| files_after_test << f.sub(TEST_TMPDIR, "") }
diff --git a/Library/Homebrew/test/support/helper/integration_command_test_case.rb b/Library/Homebrew/test/support/helper/integration_command_test_case.rb
index b79fdd6e0..7ba094645 100644
--- a/Library/Homebrew/test/support/helper/integration_command_test_case.rb
+++ b/Library/Homebrew/test/support/helper/integration_command_test_case.rb
@@ -3,43 +3,16 @@ require "fileutils"
require "pathname"
require "formula"
require "test/support/helper/test_case"
+require "open3"
class IntegrationCommandTestCase < Homebrew::TestCase
def setup
+ super
@cmd_id_index = 0 # Assign unique IDs to invocations of `cmd_output`.
(HOMEBREW_PREFIX/"bin").mkpath
FileUtils.touch HOMEBREW_PREFIX/"bin/brew"
end
- def teardown
- coretap = CoreTap.new
- paths_to_delete = [
- HOMEBREW_LINKED_KEGS,
- HOMEBREW_PINNED_KEGS,
- HOMEBREW_CELLAR.children,
- HOMEBREW_CACHE.children,
- HOMEBREW_LOCK_DIR.children,
- HOMEBREW_LOGS.children,
- HOMEBREW_TEMP.children,
- HOMEBREW_PREFIX/".git",
- HOMEBREW_PREFIX/"bin",
- HOMEBREW_PREFIX/"share",
- HOMEBREW_PREFIX/"opt",
- HOMEBREW_PREFIX/"Caskroom",
- HOMEBREW_LIBRARY/"Taps/caskroom",
- HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-bundle",
- HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-foo",
- HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-services",
- HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-shallow",
- HOMEBREW_REPOSITORY/".git",
- coretap.path/".git",
- coretap.alias_dir,
- coretap.formula_dir.children,
- coretap.path/"formula_renames.json",
- ].flatten
- FileUtils.rm_rf paths_to_delete
- end
-
def needs_test_cmd_taps
return if ENV["HOMEBREW_TEST_OFFICIAL_CMD_TAPS"]
skip "HOMEBREW_TEST_OFFICIAL_CMD_TAPS is not set"
@@ -56,66 +29,46 @@ class IntegrationCommandTestCase < Homebrew::TestCase
end
def cmd_output(*args)
- # 1.8-compatible way of writing def cmd_output(*args, **env)
env = args.last.is_a?(Hash) ? args.pop : {}
- cmd_args = %W[
- -W0
- -I#{HOMEBREW_LIBRARY_PATH}/test/support/lib
- -I#{HOMEBREW_LIBRARY_PATH}
- -rconfig
+
+ env.merge!(
+ "HOMEBREW_BREW_FILE" => HOMEBREW_PREFIX/"bin/brew",
+ "HOMEBREW_INTEGRATION_TEST" => cmd_id_from_args(args),
+ "HOMEBREW_TEST_TMPDIR" => TEST_TMPDIR,
+ "HOMEBREW_DEVELOPER" => ENV["HOMEBREW_DEVELOPER"],
+ )
+
+ ruby_args = [
+ "-W0",
+ "-I", "#{HOMEBREW_LIBRARY_PATH}/test/support/lib",
+ "-I", HOMEBREW_LIBRARY_PATH.to_s,
+ "-rconfig"
]
- if ENV["HOMEBREW_TESTS_COVERAGE"]
- # This is needed only because we currently use a patched version of
- # simplecov, and gems installed through git are not available without
- # requiring bundler/setup first. See also the comment in test/Gemfile.
- # Remove this line when we'll switch back to a stable simplecov release.
- cmd_args << "-rbundler/setup"
- cmd_args << "-rsimplecov"
- end
- cmd_args << "-rtest/support/helper/integration_mocks"
- cmd_args << (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path.to_s
- cmd_args += args
- developer = ENV["HOMEBREW_DEVELOPER"]
- Bundler.with_original_env do
- ENV["HOMEBREW_BREW_FILE"] = HOMEBREW_PREFIX/"bin/brew"
- ENV["HOMEBREW_INTEGRATION_TEST"] = cmd_id_from_args(args)
- ENV["HOMEBREW_TEST_TMPDIR"] = TEST_TMPDIR
- ENV["HOMEBREW_DEVELOPER"] = developer
- env.each_pair do |k, v|
- ENV[k] = v
- end
+ ruby_args << "-rsimplecov" if ENV["HOMEBREW_TESTS_COVERAGE"]
+ ruby_args << "-rtest/support/helper/integration_mocks"
+ ruby_args << (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path.to_s
- read, write = IO.pipe
- begin
- pid = fork do
- read.close
- $stdout.reopen(write)
- $stderr.reopen(write)
- write.close
- exec RUBY_PATH, *cmd_args
- end
- write.close
- read.read.chomp
- ensure
- Process.wait(pid)
- read.close
- end
+ Bundler.with_original_env do
+ output, status = Open3.capture2e(env, RUBY_PATH, *ruby_args, *args)
+ [output.chomp, status]
end
end
def cmd(*args)
- output = cmd_output(*args)
- status = $?.exitstatus
- puts "\n'brew #{args.join " "}' output: #{output}" if status.nonzero?
- assert_equal 0, status
+ output, status = cmd_output(*args)
+ assert status.success?, <<-EOS.undent
+ `brew #{args.join " "}` exited with non-zero status!
+ #{output}
+ EOS
output
end
def cmd_fail(*args)
- output = cmd_output(*args)
- status = $?.exitstatus
- $stderr.puts "\n'brew #{args.join " "}'" if status.zero?
- refute_equal 0, status
+ output, status = cmd_output(*args)
+ refute status.success?, <<-EOS.undent
+ `brew #{args.join " "}` exited with zero status!
+ #{output}
+ EOS
output
end
diff --git a/Library/Homebrew/test/support/helper/lifecycle_enforcer.rb b/Library/Homebrew/test/support/helper/lifecycle_enforcer.rb
new file mode 100644
index 000000000..413f8b11e
--- /dev/null
+++ b/Library/Homebrew/test/support/helper/lifecycle_enforcer.rb
@@ -0,0 +1,22 @@
+module Test
+ module Helper
+ module LifecycleEnforcer
+ def setup
+ @__setup_called = true
+ super
+ end
+
+ def teardown
+ @__teardown_called = true
+ super
+ end
+
+ def after_teardown
+ assert @__setup_called, "Expected setup to call `super` but didn't"
+ assert @__teardown_called, "Expected teardown to call `super` but didn't"
+
+ super
+ end
+ end
+ end
+end
diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb
new file mode 100644
index 000000000..2eb98826a
--- /dev/null
+++ b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb
@@ -0,0 +1,176 @@
+require "rspec"
+require "open3"
+
+RSpec::Matchers.define_negated_matcher :not_to_output, :output
+RSpec::Matchers.define_negated_matcher :be_a_failure, :be_a_success
+
+RSpec.shared_context "integration test" do
+ extend RSpec::Matchers::DSL
+
+ matcher :be_a_success do
+ match do |actual|
+ status = actual.is_a?(Proc) ? actual.call : actual
+ status.respond_to?(:success?) && status.success?
+ end
+
+ def supports_block_expectations?
+ true
+ end
+
+ # It needs to be nested like this:
+ #
+ # expect {
+ # expect {
+ # # command
+ # }.to be_a_success
+ # }.to output(something).to_stdout
+ #
+ # rather than this:
+ #
+ # expect {
+ # expect {
+ # # command
+ # }.to output(something).to_stdout
+ # }.to be_a_success
+ #
+ def expects_call_stack_jump?
+ true
+ end
+ end
+
+ before(:each) do
+ (HOMEBREW_PREFIX/"bin").mkpath
+ FileUtils.touch HOMEBREW_PREFIX/"bin/brew"
+ end
+
+ after(:each) do
+ FileUtils.rm HOMEBREW_PREFIX/"bin/brew"
+ FileUtils.rmdir HOMEBREW_PREFIX/"bin"
+ end
+
+ # Generate unique ID to be able to
+ # properly merge coverage results.
+ def command_id_from_args(args)
+ @command_count ||= 0
+ pretty_args = args.join(" ").gsub(TEST_TMPDIR, "@TMPDIR@")
+ file_and_line = caller[1].sub(/(.*\d+):.*/, '\1')
+ .sub("#{HOMEBREW_LIBRARY_PATH}/test/", "")
+ "#{file_and_line}:brew #{pretty_args}:#{@command_count += 1}"
+ end
+
+ # Runs a `brew` command with the test configuration
+ # and with coverage reporting enabled.
+ def brew(*args)
+ env = args.last.is_a?(Hash) ? args.pop : {}
+
+ # Avoid warnings when HOMEBREW_PREFIX/bin is not in PATH.
+ path = [
+ env["PATH"],
+ (HOMEBREW_PREFIX/"bin").realpath.to_s,
+ ENV["PATH"],
+ ].compact.join(File::PATH_SEPARATOR)
+
+ env.merge!(
+ "PATH" => path,
+ "HOMEBREW_BREW_FILE" => HOMEBREW_PREFIX/"bin/brew",
+ "HOMEBREW_INTEGRATION_TEST" => command_id_from_args(args),
+ "HOMEBREW_TEST_TMPDIR" => TEST_TMPDIR,
+ "HOMEBREW_DEVELOPER" => ENV["HOMEBREW_DEVELOPER"],
+ )
+
+ ruby_args = [
+ "-W0",
+ "-I", "#{HOMEBREW_LIBRARY_PATH}/test/support/lib",
+ "-I", HOMEBREW_LIBRARY_PATH.to_s,
+ "-rconfig"
+ ]
+ ruby_args << "-rsimplecov" if ENV["HOMEBREW_TESTS_COVERAGE"]
+ ruby_args << "-rtest/support/helper/integration_mocks"
+ ruby_args << (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path.to_s
+
+ Bundler.with_original_env do
+ stdout, stderr, status = Open3.capture3(env, RUBY_PATH, *ruby_args, *args)
+ $stdout.print stdout
+ $stderr.print stderr
+ status
+ end
+ end
+
+ def setup_test_formula(name, content = nil)
+ case name
+ when /^testball/
+ content = <<-EOS.undent
+ desc "Some test"
+ homepage "https://example.com/#{name}"
+ url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz"
+ sha256 "#{TESTBALL_SHA256}"
+
+ option "with-foo", "Build with foo"
+
+ def install
+ (prefix/"foo"/"test").write("test") if build.with? "foo"
+ prefix.install Dir["*"]
+ (buildpath/"test.c").write \
+ "#include <stdio.h>\\nint main(){return printf(\\"test\\");}"
+ bin.mkpath
+ system ENV.cc, "test.c", "-o", bin/"test"
+ end
+
+ #{content}
+
+ # something here
+ EOS
+ when "foo"
+ content = <<-EOS.undent
+ url "https://example.com/#{name}-1.0"
+ EOS
+ when "bar"
+ content = <<-EOS.undent
+ url "https://example.com/#{name}-1.0"
+ depends_on "foo"
+ EOS
+ end
+
+ Formulary.core_path(name).tap do |formula_path|
+ formula_path.write <<-EOS.undent
+ class #{Formulary.class_s(name)} < Formula
+ #{content}
+ end
+ EOS
+ end
+ end
+
+ def setup_remote_tap(name)
+ Tap.fetch(name).tap do |tap|
+ tap.install(full_clone: false, quiet: true) unless tap.installed?
+ end
+ end
+
+ def install_and_rename_coretap_formula(old_name, new_name)
+ shutup do
+ CoreTap.instance.path.cd do |tap_path|
+ system "git", "init"
+ system "git", "add", "--all"
+ system "git", "commit", "-m",
+ "#{old_name.capitalize} has not yet been renamed"
+
+ brew "install", old_name
+
+ (tap_path/"Formula/#{old_name}.rb").unlink
+ (tap_path/"formula_renames.json").write JSON.generate(old_name => new_name)
+
+ system "git", "add", "--all"
+ system "git", "commit", "-m",
+ "#{old_name.capitalize} has been renamed to #{new_name.capitalize}"
+ end
+ end
+ end
+
+ def testball
+ "#{TEST_FIXTURE_DIR}/testball.rb"
+ end
+end
+
+RSpec.configure do |config|
+ config.include_context "integration test", :integration_test
+end
diff --git a/Library/Homebrew/test/support/helper/test_case.rb b/Library/Homebrew/test/support/helper/test_case.rb
index 60c91e7bb..568beb947 100644
--- a/Library/Homebrew/test/support/helper/test_case.rb
+++ b/Library/Homebrew/test/support/helper/test_case.rb
@@ -1,16 +1,66 @@
+require "formulary"
+require "tap"
+
module Homebrew
class TestCase < ::Minitest::Test
- require "test/support/helper/env"
require "test/support/helper/fs_leak_logger"
+ require "test/support/helper/lifecycle_enforcer"
require "test/support/helper/shutup"
require "test/support/helper/version_assertions"
- include Test::Helper::Env
include Test::Helper::FSLeakLogger
+ include Test::Helper::LifecycleEnforcer
include Test::Helper::Shutup
include Test::Helper::VersionAssertions
- TEST_SHA1 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze
- TEST_SHA256 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze
+ TEST_DIRECTORIES = [
+ CoreTap.instance.path/"Formula",
+ HOMEBREW_CACHE,
+ HOMEBREW_CACHE_FORMULA,
+ HOMEBREW_CELLAR,
+ HOMEBREW_LOCK_DIR,
+ HOMEBREW_LOGS,
+ HOMEBREW_TEMP,
+ ].freeze
+
+ def setup
+ # These directories need to be created before
+ # `FSLeakLogger` is called with `super`.
+ TEST_DIRECTORIES.each(&:mkpath)
+
+ super
+
+ @__argv = ARGV.dup
+ @__env = ENV.to_hash # dup doesn't work on ENV
+ end
+
+ def teardown
+ ARGV.replace(@__argv)
+ ENV.replace(@__env)
+
+ Tab.clear_cache
+
+ FileUtils.rm_rf [
+ TEST_DIRECTORIES.map(&:children),
+ HOMEBREW_LINKED_KEGS,
+ HOMEBREW_PINNED_KEGS,
+ HOMEBREW_PREFIX/".git",
+ HOMEBREW_PREFIX/"bin",
+ HOMEBREW_PREFIX/"share",
+ HOMEBREW_PREFIX/"opt",
+ HOMEBREW_PREFIX/"Caskroom",
+ HOMEBREW_LIBRARY/"Taps/caskroom",
+ HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-bundle",
+ HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-foo",
+ HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-services",
+ HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-shallow",
+ HOMEBREW_REPOSITORY/".git",
+ CoreTap.instance.path/".git",
+ CoreTap.instance.alias_dir,
+ CoreTap.instance.path/"formula_renames.json",
+ ]
+
+ super
+ end
def formula(name = "formula_name", path = Formulary.core_path(name), spec = :stable, alias_path: nil, &block)
@_f = Class.new(Formula, &block).new(name, path, spec, alias_path: alias_path)
diff --git a/Library/Homebrew/test/support/lib/config.rb b/Library/Homebrew/test/support/lib/config.rb
index f6fdb4ecb..3a0a76722 100644
--- a/Library/Homebrew/test/support/lib/config.rb
+++ b/Library/Homebrew/test/support/lib/config.rb
@@ -2,6 +2,8 @@ unless ENV["HOMEBREW_BREW_FILE"]
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!"
end
+require "constants"
+
require "tmpdir"
require "pathname"
@@ -38,3 +40,6 @@ TESTBALL_SHA256 = "91e3f7930c98d7ccfb288e115ed52d06b0e5bc16fec7dce8bdda865300270
TESTBALL_PATCHES_SHA256 = "799c2d551ac5c3a5759bea7796631a7906a6a24435b52261a317133a0bfb34d9".freeze
PATCH_A_SHA256 = "83404f4936d3257e65f176c4ffb5a5b8d6edd644a21c8d8dcc73e22a6d28fcfa".freeze
PATCH_B_SHA256 = "57958271bb802a59452d0816e0670d16c8b70bdf6530bcf6f78726489ad89b90".freeze
+
+TEST_SHA1 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze
+TEST_SHA256 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze