Skip to content

Commit a0941f9

Browse files
committed
Add support for {query:
1 parent bab6c5f commit a0941f9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tree-query.d

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ string extractQuery(string query) {
3939
}
4040
}
4141
unittest {
42-
const nakedQueries = ["{and: [[foo]] [[bar]] }", "{or: [[foo]] [[bar]] }"];
42+
const nakedQueries = [
43+
"{and: [[foo]] [[bar]] }",
44+
"{or: [[foo]] [[bar]] }",
45+
"{and: [[foo]] [[bar]]}",
46+
"{and: [[foo]] {and: [[bar]] [[spam]]}}"
47+
];
4348
foreach (nakedQuery; nakedQueries) {
4449
assert(extractQuery(nakedQuery) == nakedQuery);
4550
assert(extractQuery("{{query:" ~ nakedQuery ~ "}}") == nakedQuery);
@@ -156,7 +161,7 @@ int main(string[] args) {
156161
// Read query immediately. If the user has written an invalid query, show
157162
// an error before we read in all files.
158163
ubyte n = 0;
159-
ParsedQuery qu = booleanQuery(query, n);
164+
ParsedQuery qu = booleanQuery(extractQuery(query), n);
160165
string[] inputs;
161166
string[] inputnames;
162167
if (args.length == 0) {

0 commit comments

Comments
 (0)