-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify rustdoc search test #92570
Simplify rustdoc search test #92570
Conversation
Some changes occurred in HTML/CSS/JS. |
This comment has been minimized.
This comment has been minimized.
ESLint is failing because we need to update it to accept es6, which I do in #92490. |
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #92690) made this pull request unmergeable. Please resolve the merge conflicts. |
triage: @jsha could you please fix the merge conflicts? |
@rustbot author |
That's correct. |
c01f48d
to
3c1034d
Compare
I've fixed the merge conflicts and this passes tests locally. Still need to do two things:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
c8a73ce
to
3faa18a
Compare
This is now ready for review. |
@@ -381,22 +150,20 @@ function valueCheck(fullPath, expected, result, error_text, queryName) { | |||
} | |||
} | |||
} | |||
|
|||
function runParser(query, expected, loaded, loadedFile, queryName) { | |||
function runParser(query, expected, parseQuery, queryName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Little nit: please add an empty line before this function.
This is really great! All the hacks have been removed thanks to this, it's really awesome! Just one nit then it's good for me. |
Previously, search.js relied on the DOM and the `window` object. It can now be loaded in the absence of the DOM, for instance by Node. The same is true of search-index.js. This allows removing a lot of code from src/tools/rustdoc-js/tester.js that tried to parse search.js and extract specific functions that were needed for testing.
3faa18a
to
4539794
Compare
@bors r+ |
📌 Commit 4539794 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (4c5f6e6): comparison url. Summary: This benchmark run did not return any relevant results. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
Previously, rustdoc search attempted to parse search.js and extract out only certain methods and variables.
This change makes search.js and search-index.js loadable as CommonJS modules, so they can be loaded directly.
As part of that change, I had to separate execSearch from interacting with the DOM. This wound up being a nice cleanup that made more explicit what inputs it was taking.
I removed search.js' dependency on storage.js by moving hasOwnPropertyRustdoc directly into search.js, and replacing onEach with forEach in a path that is called by the tester.
r? @GuillaumeGomez
Demo: https://rustdoc.crud.net/jsha/rustdoc-search-refactor/std/?search=foo