caskroom/homebrew-cask — pull request #7906 by claui (2014-12-08 17:33:28+00:00)
Title: HOLD: Add tests for `brew cask search` when casks have the same token

This PR adds failing tests for just one more edge case I’ve encountered.

### Issue

When two or more Casks (from separate repos) have the same token, the `brew cask search` command can get a bit confused.

I’m not really sure if we’re committed to supporting this in the first place. However, we have a method `Cask::CLI::nice_listing` which [suggests that we are](https://github.com/caskroom/homebrew-cask/blob/a335d3b06d49e4a30c8ab013cae2962704f89b1e/lib/cask/cli.rb#L146-L147).

For this discussion, let’s suppose a user has tapped into a repo called `other/repo` which happens to carry another `firefox`. (This PR includes a Cask like this in case you want to have a look.)

### Current behavior

Now that either repo has a `firefox`, the command `brew cask search fire` yields:

```md
==> Partial matches
caskroom/cask/firefox caskroom/cask/firefox mediafire-desktop multifirefox
```

with `caskroom/cask/firefox` listed twice while `other/repo/firefox` is missing.

Similarly, `brew cask search firefox` yields:

```md
==> Exact match
caskroom/cask/firefox
==> Partial matches
multifirefox
```

with only one match, but `other/repo/firefox` still missing.

### Proposed behavior

Instead, I’d expect `brew cask search fire` to yield:

```md
==> Partial matches
caskroom/cask/firefox other/repo/firefox mediafire-desktop multifirefox
```

and `brew cask search firefox` to yield something like this:

```md
==> Exact match
caskroom/cask/firefox
==> Partial matches
other/repo/firefox multifirefox
```

### Please do NOT merge

I only created this PR to have a place for the failing tests … and to kindly ask for your thoughts about them.

The [upcoming version](https://github.com/claui/homebrew-cask/commit/468cc476de79eded62b0b0bc321cd794c181d932) of `brew cask search` already implements what the _Proposed_ section says. Still, I’d love some feedback from the @caskroom/maintainers … does the proposed behavior make sense?