Starting the greater than helper tests.

This commit is contained in:
Tom Alexander 2020-05-16 12:51:27 -04:00
parent ed7b1f5b3e
commit 196740ae34
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
4 changed files with 31 additions and 10 deletions

View File

@ -0,0 +1,3 @@
Since "master" is greater than "7", dust is probably ordering based on either alphabetic sorting or ascii values.
All comparisons between non-matching types (for example, int vs string) appear to render the else block.

View File

@ -0,0 +1,7 @@
{
"str": "master",
"int": 7,
"alpha": 21,
"beta": "21",
"null": null
}

View File

@ -0,0 +1,21 @@
Testing helpers:{~n}
str is {str}{~n}
int is {int}{~n}
alpha is {alpha}{~n}
beta is {beta}{~n}
{@gt key=str value="master"}str is greater than "master"{:else}str is less than or equal to "master"{/gt}{~n}
{@gt key=str value="7"}str is greater than "7"{:else}str is less than or equal to "7"{/gt}{~n}
{@gt key=int value="7"}int is greater than "7"{:else}int is less than or equal to "7"{/gt}{~n}
{@gt key=int value=7}int is greater than 7{:else}int is less than or equal to 7{/gt}{~n}
{@gt key=int value=6}int is greater than 6{:else}int is less than or equal to 6{/gt}{~n}
{@gt key=alpha value=beta}alpha is greater than beta{:else}alpha is less than or equal to beta{/gt}{~n}
{!
{@gt value=beta}missing key is true{:else}missing key is false{/gt}{~n}
{@gt value=gamma}missing key and non-existent value is true{:else}missing key and non-existent value is false{/gt}{~n}
{@gt key=alpha}missing value is true{:else}missing value is false{/gt}{~n}
{@gt key=gamma}missing value and non-existent key is true{:else}missing value and non-existent key is false{/gt}{~n}
{@gt key="master" value="master"}"master" is equal to "master"{:else}"master" does not equal "master"{/gt}{~n}
{@gt key=null}null equals a missing value{:else}null does not equal a missing value{/gt}{~n}
{@gt key=null value=gamma}null equals a non-existent value{:else}null does not equal a non-existent value{/gt}{~n}
{@gt}no parameters is true{:else}no parameters if false{/gt}{~n}
!}

View File

@ -1,10 +0,0 @@
Without a key parameter, neither the main block nor the else block is rendered.
Literal values work in both keys and values.
Can't Walk Theory
-----------------
Assuming a missing value = cantwalk and a non-existent key = cantwalk then their equality makes sense.
The null tests have proven that absent parameters and missing values do not equal null and therefore it is not just making all falsey values equal.