added basic filter tests...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2026-07-25 17:22:04 +03:00
parent c3523fe9b4
commit ee25b79fb5
2 changed files with 49 additions and 6 deletions

View File

@ -1048,9 +1048,6 @@ module.parser = {
// <filter> <filter-spec>
// | -<filter> <filter-spec>
//
// XXX BUG why is the 2nd filter a promise????
// '<filter upper/>aaa <filter -upper> moo </filter> bbb'
// -> error in .finalize(..)???
// XXX should we include the global filters (current) or exclude
// them by default???
// XXX BUG: async body breaks nested filters...
@ -1083,7 +1080,6 @@ module.parser = {
// stage III
return function(state){
return Promise.awaitOrRun(
// apply the filters...
that.finalize(
page,
@ -1094,7 +1090,6 @@ module.parser = {
filters
: [...filters, ...state.filters ?? []],
}),
function(body){
// stage III post...
// NOTE: we are protecting the result from

View File

@ -399,7 +399,55 @@ test.Setups({
// XXX
// XXX filter...
// XXX
filter_local: function(assert){
return {
page: P,
code: [
'<filter upper>moo</filter>',
'MOO' ]} },
filter_local_sync: function(assert){
return {
page: P,
code: [
'<filter upper>@include(/page)</filter>',
'PAGE' ]} },
filter_local_async: function(assert){
return {
page: P,
code: [
'<filter upper>@include(/async/page)</filter>',
'PAGE' ]} },
filter_global: function(assert){
return {
page: P,
code: [
'<filter upper/>moo',
'MOO' ]} },
filter_global_sync: function(assert){
return {
page: P,
code: [
'<filter upper/>@include(/page)',
'PAGE' ]} },
filter_global_async: function(assert){
return {
page: P,
code: [
'<filter upper/>@include(/async/page)',
'PAGE' ]} },
filter_mixed_isolated_sync: function(assert){
return {
page: P,
code: [
'<filter upper/>local <filter -upper>@include(/page)</filter>',
'LOCAL Page' ]} },
// XXX BUG
filter_mixed_isolated_async: function(assert){
return {
page: P,
code: [
'<filter upper/>local <filter -upper>@include(/async/page)</filter>',
'LOCAL Page' ]} },
})