These tests were very simple before and now this should result
in more code coverage without affecting test performance.
The only tricky thing was testing the `--missing` option without
actually installing a package using `install_test_formula` because
that is very slow (around 10 seconds on my machine). I ended
up just writing the tab to a plausible keg directory for each
package I wanted to "install". This allows us to test the behavior
while also not increasing CI time by ~20 seconds (though it'd
probably be faster on CI than my local machine).
- Fix cask info output being incorrect
- Improve some code referring to casks as formulae
- Move livecheck cask fixtures to not shadow existing names
- Adjust the cask tap symlinking logic to make handling outdated
shadowed casks significantly easier
- Fix various flaky tests caused by casks sharding logic
- Prefer longer paths when there's multiple formulae or casks in a tap
with the same name rather than always using the first
- Load paths with no API when needed (e.g. for `brew edit`)
- Use no API mode for `brew log` as it's needed there
- Define sharding format for homebrew-cask and homebrew-core inside
`Tap` methods
- Create new formulae/casks in location defined by these `Tap` methods
- Fix a bug in Formulary that made sharded formulae lookup less
efficient (and possibly broke it for core and some API usage)
- Fix various other hardcoded Formula/Cask directory assumptions
Co-authored-by: Bo Anderson <mail@boanderson.me>
This was originally used by the API but was replaced months
ago by SimulateSystem. Essentially, it's only current use
was in the #to_h method but is not used internally at all
when creating cask instances from the API JSON.
- Cask source paths were added to the API in 844db75361. The main
`everything.json` file was updated with the new data in that commit,
but this one was missed causing local test failures.
Before:
```
Cask::Cask#to_h when loaded from cask file returns expected hash
Failure/Error: expect(JSON.pretty_generate(hash)).to eq(expected_json_after_ventura)
[...]
Diff:
@@ -93,7 +93,7 @@
"en",
"eo"
],
- "ruby_source_path": "Formula/everything.rb",
+ "ruby_source_path": "Casks/everything.rb",
"ruby_source_checksum": {
"sha256": "b2707d1952f02c3fa566b7ad2a707a847a959d36f51d3dee642dbe5deec12f27"
}
# ./test/cask/cask_spec.rb:231:in `block (4 levels) in <top (required)>'
# ./test/support/helper/spec/shared_context/homebrew_cask.rb:52:in `block (2 levels) in <top (required)>'
```
- This still doesn't pass `brew readall` for Casks, but it gets us a
little closer since if `url` has a `version` interpolated in it, the
`version` stanza has to come first.
- See https://github.com/Homebrew/homebrew-cask/pull/143201 for the
current failures.
- "System Preferences" was updated to be "System Settings" in macOS
Ventura. This naming was updated in our caveats generator in PR 14997.
- This test was failing for me locally (on Ventura) because it was
hardcoded to expect `System Preferences => Security & Privacy`, but
getting `System Settings => Privacy & Security`.
- This is not the most important thing in the world, we can probably
live with the failing test, but I thought I'd try to fix it anyway.