@@ -267,6 +267,61 @@ return "Hello World";`;
267267 expectExpandedStatementToBe ( query . grouping [ 0 ] . statement , expectedStatement ) ;
268268 } ) ;
269269 } ) ;
270+
271+ describe ( 'includes inside Boolean combinations' , ( ) => {
272+ // ( {{includes.filter1}} ) AND ( {{includes.filter2}} )
273+ // ( include filter1 ) AND ( include filter2 )
274+ const includes = makeIncludes (
275+ // Force line break
276+ [ 'filter1' , 'not done' ] ,
277+ [ 'filter2' , 'due 2025-05-01' ] ,
278+ ) ;
279+ const expectedStatement = '( not done ) AND ( due 2025-05-01 )' ;
280+
281+ it ( 'should allow Boolean instructions to use includes placeholders' , ( ) => {
282+ const source = '( {{includes.filter1}} ) AND ( {{includes.filter2}} )' ;
283+ const query = createValidQuery ( source , includes ) ;
284+
285+ expectFiltersToBe ( query , [ expectedStatement ] ) ;
286+ expect ( query . explainQuery ( ) ) . toMatchInlineSnapshot ( `
287+ "( {{includes.filter1}} ) AND ( {{includes.filter2}} ) =>
288+ ( not done ) AND ( due 2025-05-01 ) =>
289+ AND (All of):
290+ not done
291+ due 2025-05-01 =>
292+ due date is on 2025-05-01 (Thursday 1st May 2025)
293+ "
294+ ` ) ;
295+ } ) ;
296+
297+ it ( 'should allow Boolean instructions to use include instruction BUT DOES NOT' , ( ) => {
298+ const source = '( include filter1 ) AND ( include filter2 )' ;
299+ const query = createQuery ( source , includes ) ;
300+ expect ( query . error ) . toMatchInlineSnapshot ( `
301+ "Could not interpret the following instruction as a Boolean combination:
302+ ( include filter1 ) AND ( include filter2 )
303+
304+ The error message is:
305+ couldn't parse sub-expression 'include filter1'
306+
307+ The instruction was converted to the following simplified line:
308+ ( f1 ) AND ( f2 )
309+
310+ Where the sub-expressions in the simplified line are:
311+ 'f1': 'include filter1'
312+ => ERROR:
313+ do not understand query
314+ 'f2': 'include filter2'
315+ => ERROR:
316+ do not understand query
317+
318+ For help, see:
319+ https://publish.obsidian.md/tasks/Queries/Combining+Filters
320+
321+ Problem line: "( include filter1 ) AND ( include filter2 )""
322+ ` ) ;
323+ } ) ;
324+ } ) ;
270325} ) ;
271326
272327describe ( 'include - explain output' , ( ) => {
0 commit comments