mirror of
https://github.com/flynx/pWiki.git
synced 2026-07-14 04:20:58 +00:00
preparing for deeper testing...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
49ee54539f
commit
a4453e18a4
7
v3/package-lock.json
generated
7
v3/package-lock.json
generated
@ -13,6 +13,7 @@
|
||||
"ig-actions": "*",
|
||||
"ig-features": "*",
|
||||
"ig-object": "*",
|
||||
"ig-serialize": "*",
|
||||
"ig-types": "*",
|
||||
"requirejs": "*",
|
||||
"uuid": "*"
|
||||
@ -141,6 +142,12 @@
|
||||
"ig-stoppable": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ig-serialize": {
|
||||
"version": "1.3.4",
|
||||
"resolved": "https://registry.npmjs.org/ig-serialize/-/ig-serialize-1.3.4.tgz",
|
||||
"integrity": "sha512-aIrZ7ljyXVRUsyvcWfF2JSz/4hWtDrJcTpHJ2y4QD48YXF/0eIwwzDbB6dCmoK2EO5fHfxa82WrVBncb+kDqvg==",
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/ig-stoppable": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/ig-stoppable/-/ig-stoppable-2.0.4.tgz",
|
||||
|
||||
@ -11,7 +11,8 @@
|
||||
"ig-actions": "*",
|
||||
"ig-features": "*",
|
||||
"ig-object": "*",
|
||||
"ig-types": "*"
|
||||
"ig-types": "*",
|
||||
"ig-serialize": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ig-test": "*"
|
||||
|
||||
@ -1355,10 +1355,15 @@ module.parser = {
|
||||
// XXX need a way to make encode option transparent...
|
||||
// XXX store a page cache in state...
|
||||
// XXX UPDATE...
|
||||
include2: Macro(
|
||||
['src', 'recursive', 'join',
|
||||
['s', 'strict', 'isolated']],
|
||||
function*(parser, args, body, state, key='included', handler){
|
||||
}),
|
||||
include: Macro(
|
||||
['src', 'recursive', 'join',
|
||||
['s', 'strict', 'isolated']],
|
||||
async function*(args, body, state, key='included', handler){
|
||||
async function*(parser, args, body, state, key='included', handler){
|
||||
var macro = 'include'
|
||||
if(typeof(args) == 'string'){
|
||||
var [macro, args, body, state, key, handler] = arguments
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
var test = require('ig-test')
|
||||
var serialize = require('ig-serialize')
|
||||
|
||||
var parser = require('../parser').parser
|
||||
|
||||
@ -10,10 +11,15 @@ var parser = require('../parser').parser
|
||||
|
||||
test.Setups({
|
||||
empty: function(assert){
|
||||
return [ '', '' ] },
|
||||
return { code: [ '', '' ] }},
|
||||
|
||||
// XXX var...
|
||||
|
||||
// XXX arg...
|
||||
|
||||
// slot...
|
||||
slot_empty: function(assert){
|
||||
return [
|
||||
return {code: [
|
||||
'@slot(slot)',
|
||||
'@slot("slot")',
|
||||
'@slot(\'slot\')',
|
||||
@ -26,44 +32,44 @@ test.Setups({
|
||||
'<slot name=slot/>',
|
||||
'<slot name="slot"/>',
|
||||
'<slot name=\'slot\'/>',
|
||||
'' ] },
|
||||
'' ]} },
|
||||
slot_value: function(assert){
|
||||
return [
|
||||
return {code: [
|
||||
'<slot slot value/>',
|
||||
'<slot slot text=value/>',
|
||||
'@slot(slot value)',
|
||||
'@slot(slot text=value)',
|
||||
'value' ] },
|
||||
'value' ]} },
|
||||
slot_fill: function(assert){
|
||||
var ins = this.slot_value(assert).slice(0, -1)
|
||||
return [
|
||||
var ins = this.slot_value(assert).code.slice(0, -1)
|
||||
return {code: [
|
||||
...ins.map(function(e){
|
||||
return e + '@slot(slot other)' }),
|
||||
...ins.map(function(e){
|
||||
return e + '<slot slot other/>' }),
|
||||
...ins.map(function(e){
|
||||
return e + '<slot slot>other</slot>' }),
|
||||
'other' ] },
|
||||
'other' ]} },
|
||||
slot_fill_fill: function(assert){
|
||||
var ins = this.slot_fill(assert).slice(0, -1)
|
||||
return [
|
||||
var ins = this.slot_fill(assert).code.slice(0, -1)
|
||||
return {code: [
|
||||
...ins.map(function(e){
|
||||
return e + '@slot(slot third)' }),
|
||||
...ins.map(function(e){
|
||||
return e + '<slot slot third/>' }),
|
||||
...ins.map(function(e){
|
||||
return e + '<slot slot>third</slot>' }),
|
||||
'third' ] },
|
||||
'third' ]} },
|
||||
|
||||
// XXX these are an alternative to <content/>...
|
||||
slot_nested: function(assert){
|
||||
return [
|
||||
return {code: [
|
||||
'<slot slot>[[ <slot slot.content/> ]]</slot>@slot(slot.content value)',
|
||||
'[[ value ]]' ] },
|
||||
'[[ value ]]' ]} },
|
||||
slot_nested_overwrite: function(assert){
|
||||
return [
|
||||
return {code: [
|
||||
'<slot slot>[[ <slot slot.content/> ]]</slot>@slot(slot value)',
|
||||
'value' ] },
|
||||
'value' ]} },
|
||||
|
||||
/* XXX SHOWN_HIDDEN
|
||||
// XXX these need to be revised...
|
||||
@ -72,29 +78,29 @@ test.Setups({
|
||||
slot_shown: function(assert){
|
||||
var ins = this.slot_value(assert)
|
||||
var expect = ins.pop()
|
||||
return [
|
||||
return {code: [
|
||||
...ins.map(function(i){
|
||||
return i +' @slot(slot that shown)' }),
|
||||
'that that' ] },
|
||||
'that that' ]} },
|
||||
slot_hidden: function(assert){
|
||||
return [
|
||||
return {code: [
|
||||
'<slot slot value hidden/>',
|
||||
'@slot(slot value hidden)',
|
||||
'' ] },
|
||||
'' ]} },
|
||||
slot_hidden_value: function(assert){
|
||||
var ins = this.slot_hidden(assert)
|
||||
var expect = ins.pop()
|
||||
return [
|
||||
return {code: [
|
||||
...ins.map(function(i){
|
||||
return i +'@slot(slot other)' }),
|
||||
'' ] },
|
||||
'' ]} },
|
||||
slot_hidden_shown: function(assert){
|
||||
var ins = this.slot_hidden(assert)
|
||||
var expect = ins.pop()
|
||||
return [
|
||||
return {code: [
|
||||
...ins.map(function(i){
|
||||
return i +'@slot(slot shown)' }),
|
||||
'' ] },
|
||||
'' ]} },
|
||||
//*/
|
||||
})
|
||||
|
||||
@ -105,16 +111,22 @@ test.Modifiers({
|
||||
|
||||
test.Tests({
|
||||
parse: function(assert, state){
|
||||
var {page, code, st} = state
|
||||
page ??= {}
|
||||
st ??= {}
|
||||
|
||||
var res
|
||||
var inputs = state.slice(0, -1)
|
||||
var expect = state.at(-1)
|
||||
var inputs = code.slice(0, -1)
|
||||
var expect = code.at(-1)
|
||||
var i = 0
|
||||
for(var input of inputs){
|
||||
for(var input of inputs){
|
||||
var p = serialize.partialDeepCopy(page)
|
||||
var s = serialize.partialDeepCopy(st)
|
||||
assert(
|
||||
(res = parser.parse(
|
||||
{},
|
||||
p,
|
||||
input,
|
||||
{}))
|
||||
s))
|
||||
=== expect,
|
||||
'Parsing:',
|
||||
'\n\t in: "'+ input +'"',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user