124 lines
2.4 KiB
JSON
124 lines
2.4 KiB
JSON
{
|
|
"description": "Test `#declare` for queries with `#show` `#ask`",
|
|
"setup": [
|
|
{
|
|
"namespace": "SMW_NS_PROPERTY",
|
|
"page": "Has name",
|
|
"contents": "[[Has type::Text]]"
|
|
},
|
|
{
|
|
"namespace": "SMW_NS_PROPERTY",
|
|
"page": "Has ID",
|
|
"contents": "[[Has type::Text]]"
|
|
},
|
|
{
|
|
"namespace": "SMW_NS_PROPERTY",
|
|
"page": "Name",
|
|
"contents": "[[Has type::Text]]"
|
|
},
|
|
{
|
|
"namespace": "SMW_NS_PROPERTY",
|
|
"page": "ID",
|
|
"contents": "[[Has type::Text]]"
|
|
},
|
|
{
|
|
"namespace": "NS_TEMPLATE",
|
|
"page": "Server",
|
|
"contents": "<includeonly>{{{Name}}} {{{ID}}} {{#declare: Has name=Name |Has ID=ID }}</includeonly>"
|
|
},
|
|
{
|
|
"namespace": "NS_TEMPLATE",
|
|
"page": "Server1",
|
|
"contents": "<includeonly>{{{Name}}} {{{ID}}} {{#declare: Name |ID }}</includeonly>"
|
|
},
|
|
{
|
|
"page": "Sulcorebutia data",
|
|
"contents": "{{Server |Name=Sulcorebutia |ID=9907 }}"
|
|
},
|
|
{
|
|
"page": "Sulcorebutia show query",
|
|
"contents": "{{#show: Sulcorebutia data |?Has name }}"
|
|
},
|
|
{
|
|
"page": "Sulcorebutia ask query",
|
|
"contents": "{{#ask: [[Sulcorebutia data]] |?Has ID= |mainlabel=- }}"
|
|
},
|
|
{
|
|
"page": "Test data",
|
|
"contents": "{{Server1 |Name=Test |ID=1100 }}"
|
|
},
|
|
{
|
|
"page": "Test data show query",
|
|
"contents": "{{#show: Test data |?Name }}"
|
|
},
|
|
{
|
|
"page": "Test data ask query",
|
|
"contents": "{{#ask: [[Test data]] |?ID= |mainlabel=- }}"
|
|
}
|
|
],
|
|
"tests": [
|
|
{
|
|
"type": "parser",
|
|
"about": "#0 query with `#show`",
|
|
"subject": "Sulcorebutia show query",
|
|
"assert-output": {
|
|
"to-contain": [
|
|
"Sulcorebutia"
|
|
],
|
|
"not-contain": [
|
|
"9907"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "parser",
|
|
"about": "#1 query with `#ask`",
|
|
"subject": "Sulcorebutia ask query",
|
|
"assert-output": {
|
|
"to-contain": [
|
|
"9907"
|
|
],
|
|
"not-contain": [
|
|
"Sulcorebutia"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "parser",
|
|
"about": "#2 query with `#show`",
|
|
"subject": "Test data show query",
|
|
"assert-output": {
|
|
"to-contain": [
|
|
"Test"
|
|
],
|
|
"not-contain": [
|
|
"1100"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "parser",
|
|
"about": "#3 query with `#ask`",
|
|
"subject": "Test data ask query",
|
|
"assert-output": {
|
|
"to-contain": [
|
|
"1100"
|
|
],
|
|
"not-contain": [
|
|
"Test"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"settings": {
|
|
"smwgNamespacesWithSemanticLinks": {
|
|
"NS_MAIN": true
|
|
}
|
|
},
|
|
"meta": {
|
|
"version": "2",
|
|
"is-incomplete": false,
|
|
"debug": false
|
|
}
|
|
}
|