Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

Don't perform automatic wildcarding on searches.#104

Merged
erikrose merged 9 commits intomozilla:masterfrom
abbeyj:no-implicit-wildcards
Feb 21, 2013
Merged

Don't perform automatic wildcarding on searches.#104
erikrose merged 9 commits intomozilla:masterfrom
abbeyj:no-implicit-wildcards

Conversation

@abbeyj
Copy link
Copy Markdown
Contributor

@abbeyj abbeyj commented Feb 20, 2013

Previously a search like function:foo would find all functions that had
"foo" anywhere in their name (like get_foo, set_foo, etc.). This made
it hard to search for a function called exactly "foo" when there were
many other functions containing that term.

Now function:foo matches only functions called "foo". Wildcards can be
specified with * and ? characters. For instance, function:foo matches
the old behavior and returns all functions where "foo" appears somewhere
in the name. Similarly, function:foo* matches functions that begin with
"foo" and function:*foo matches functions that end with "foo". Using
function:ba? searches for all functions that start with "ba" followed by
exactly one more character so "bar" and "baz" match but "babar" does not.

Open question: should things like function:* be disallowed?

James Abbatiello added 4 commits February 20, 2013 14:39
Previously a search like function:foo would find all functions that had
"foo" anywhere in their name (like get_foo, set_foo, etc.).  This made
it hard to search for a function called exactly "foo" when there were
many other functions containing that term.

Now function:foo matches only functions called "foo".  Wildcards can be
specified with * and ? characters.  For instance, function:*foo* matches
the old behavior and returns all functions where "foo" appears somewhere
in the name.  Similarly, function:foo* matches functions that begin with
"foo" and function:*foo matches functions that end with "foo".  Using
function:ba? searches for all functions that start with "ba" followed by
exactly one more character so "bar" and "baz" match but "babar" does not.
dxr/testing.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this case is worth a dedicated helper method. It can be done in a one-liner like this:

    eq_(self.search_results('void -"int"'), [])

What do you think? (And in any case, what's success_lines for?)

dxr/testing.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use eq_(..., []) here, we'll give a more informative error message, in that we'll actually show what unexpected results were returned.

@erikrose erikrose merged commit 170f296 into mozilla:master Feb 21, 2013
@abbeyj abbeyj deleted the no-implicit-wildcards branch February 21, 2013 21:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants