From 196740ae349fbf419a0e693040ead7b7b65ae360 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 16 May 2020 12:51:27 -0400 Subject: [PATCH] Starting the greater than helper tests. --- js/test_cases/helpers_gt/README.md | 3 +++ js/test_cases/helpers_gt/input1.json | 7 +++++++ js/test_cases/helpers_gt/main.dust | 21 +++++++++++++++++++++ js/test_cases/helpers_ne/README.md | 10 ---------- 4 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 js/test_cases/helpers_gt/README.md create mode 100644 js/test_cases/helpers_gt/input1.json create mode 100644 js/test_cases/helpers_gt/main.dust delete mode 100644 js/test_cases/helpers_ne/README.md diff --git a/js/test_cases/helpers_gt/README.md b/js/test_cases/helpers_gt/README.md new file mode 100644 index 0000000..09c6441 --- /dev/null +++ b/js/test_cases/helpers_gt/README.md @@ -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. diff --git a/js/test_cases/helpers_gt/input1.json b/js/test_cases/helpers_gt/input1.json new file mode 100644 index 0000000..ece58d2 --- /dev/null +++ b/js/test_cases/helpers_gt/input1.json @@ -0,0 +1,7 @@ +{ + "str": "master", + "int": 7, + "alpha": 21, + "beta": "21", + "null": null +} diff --git a/js/test_cases/helpers_gt/main.dust b/js/test_cases/helpers_gt/main.dust new file mode 100644 index 0000000..d752542 --- /dev/null +++ b/js/test_cases/helpers_gt/main.dust @@ -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} +!} diff --git a/js/test_cases/helpers_ne/README.md b/js/test_cases/helpers_ne/README.md deleted file mode 100644 index 42d393a..0000000 --- a/js/test_cases/helpers_ne/README.md +++ /dev/null @@ -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.