Begin Philomena Search Syntax parser snapshot tests#571
Open
MareStare wants to merge 26 commits intophilomena-dev:masterfrom
Open
Begin Philomena Search Syntax parser snapshot tests#571MareStare wants to merge 26 commits intophilomena-dev:masterfrom
MareStare wants to merge 26 commits intophilomena-dev:masterfrom
Conversation
eb11616 to
f14f637
Compare
MareStare
commented
May 13, 2025
test/support/phiql_case.ex
Outdated
| @@ -0,0 +1,138 @@ | |||
| defmodule Philomena.QueryCase do | |||
Contributor
Author
There was a problem hiding this comment.
Todo rename QueryCase to PhiqlCase
Member
|
De-ponify the test queries (since I assume it doesn't really matter what they are), we're aiming for eventual debranding and more neutral texts in the software in the future. |
Member
|
I also think calling it just "query" instead of "phiql" is less confusing. In my mind the language's name has always been just "search syntax" or "query syntax". |
Contributor
Author
|
Marking as draft until I fix the review comments |
Contributor
Author
|
This is now ready for review Fixed the review comments and improved the code a bit:
|
fc1f6c5 to
7a90475
Compare
Meow
reviewed
May 21, 2025
| user_fixture(attrs) | ||
| |> Users.User.confirm_changeset() | ||
| |> Repo.update!() | ||
| user_fixture(Map.put(attrs, :confirmed, true)) |
Member
There was a problem hiding this comment.
use |> syntax here (and the next occurence)
attrs
|> Map.put(...)
|> user_fixture()
Contributor
Author
There was a problem hiding this comment.
Fixed in 4f90db5. Had to rebase to fix merge conflicts
ae199f5 to
92c4328
Compare
liamwhite
reviewed
May 21, 2025
92c4328 to
4f90db5
Compare
liamwhite
reviewed
May 21, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added the initial plumbing for Philomena Search Syntax parser tests.
The bulk of this code implements the "testing engine" for the parser. The tests are defined declaratively like this:
This test can be invoked either via the regular
mix testto validate that the existing test snapshot is fresh. Or viaphilomena update-phiql-teststo update the test snapshot after a change was made to the source code. The test snapshot has this format in the simplest form:{ "wildcard": [ { "philomena": "*", "opensearch": { "match_all": {} } } ] }There can be an additional
contextskey in the test case in case if the parser output differs between contexts like anon user, regular user or admin/mod user.Todo
Fix this comment from @liamwhite in Discord:
Consider using toml instead of JSON and try define the test inputs directly in the snapshot?