-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tests] JavaScript: refactor test fixtures (#12102)
This PR allows to serve JavaScript test fixtures using a fixture-based logic as for Python tests. Co-authored-by: Bénédikt Tran <[email protected]>
- Loading branch information
1 parent
4fbd368
commit 568e26c
Showing
18 changed files
with
177 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* language_data.js | ||
* ~~~~~~~~~~~~~~~~ | ||
* | ||
* This script contains the language-specific data used by searchtools.js, | ||
* namely the list of stopwords, stemmer, scorer and splitter. | ||
* | ||
* :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS. | ||
* :license: BSD, see LICENSE for details. | ||
* | ||
*/ | ||
|
||
var stopwords = []; | ||
|
||
|
||
/* Non-minified version is copied as a separate JS file, if available */ | ||
|
||
/** | ||
* Dummy stemmer for languages without stemming rules. | ||
*/ | ||
var Stemmer = function() { | ||
this.stemWord = function(w) { | ||
return w; | ||
} | ||
} | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
This is a sample C++ project used to generate a search engine index fixture. | ||
|
||
.. cpp:class:: public Sphinx | ||
|
||
The description of Sphinx class. | ||
|
||
Indexing and querying the term C++ can be challenging, because search-related | ||
tokenization often drops punctuation and mathematical characters (they occur | ||
frequently on the web and would inflate the cardinality and size of web search | ||
indexes). |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Main Page | ||
========= | ||
|
||
This is the main page of the ``multiterm`` test project. | ||
|
||
This document is used as a test fixture to check that the search functionality | ||
included when projects are built into an HTML output format can successfully | ||
match this document when a search query containing multiple terms is performed. | ||
|
||
At the time-of-writing this message, the application doesn't support "phrase | ||
queries" -- queries that require all of the contained terms to appear adjacent | ||
to each other and in the same order in the document as in the query; perhaps it | ||
will do in future? |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
sphinx_utils module | ||
=================== | ||
|
||
Partial (also known as "prefix") matches on document titles should be possible | ||
using the JavaScript search functionality included when HTML documentation | ||
projects are built. | ||
|
||
This document provides a sample reStructuredText input to confirm that partial | ||
title matching is possible. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import subprocess | ||
from pathlib import Path | ||
|
||
SPHINX_ROOT = Path(__file__).resolve().parent.parent | ||
TEST_JS_FIXTURES = SPHINX_ROOT / 'tests' / 'js' / 'fixtures' | ||
TEST_JS_ROOTS = SPHINX_ROOT / 'tests' / 'js' / 'roots' | ||
|
||
|
||
def build(srcdir: Path) -> None: | ||
cmd = ( | ||
'sphinx-build', | ||
'--fresh-env', | ||
'--quiet', | ||
*('--builder', 'html'), | ||
f'{srcdir}', | ||
f'{srcdir}/_build', | ||
) | ||
subprocess.run(cmd, check=True, capture_output=True) | ||
|
||
|
||
for directory in TEST_JS_ROOTS.iterdir(): | ||
searchindex = directory / '_build' / 'searchindex.js' | ||
destination = TEST_JS_FIXTURES / directory.name / 'searchindex.js' | ||
|
||
print(f'Building {directory} ... ', end='') | ||
build(directory) | ||
print('done') | ||
|
||
print(f'Moving {searchindex} to {destination} ... ', end='') | ||
destination.parent.mkdir(exist_ok=True) | ||
searchindex.replace(destination) | ||
print('done') |