diff --git a/js/test_cases/helpers_eq/input1.json b/js/test_cases/helpers_eq/input1.json index ece58d2..0c96e44 100644 --- a/js/test_cases/helpers_eq/input1.json +++ b/js/test_cases/helpers_eq/input1.json @@ -3,5 +3,14 @@ "int": 7, "alpha": 21, "beta": "21", - "null": null + "null": null, + "array_lower": [ + 3, + 5, + 7 + ], + "array_higher": [ + 8, + 9 + ] } diff --git a/js/test_cases/helpers_eq/main.dust b/js/test_cases/helpers_eq/main.dust index ab68cf3..fd065f8 100644 --- a/js/test_cases/helpers_eq/main.dust +++ b/js/test_cases/helpers_eq/main.dust @@ -16,3 +16,5 @@ beta is {beta}{~n} {@eq key=null}null equals a missing value{:else}null does not equal a missing value{/eq}{~n} {@eq key=null value=gamma}null equals a non-existent value{:else}null does not equal a non-existent value{/eq}{~n} {@eq}no parameters is true{:else}no parameters is false{/eq}{~n} +{@eq key=array_lower value=array_higher}[3,5,7] is equal to [8,9]{:else}[3,5,7] does not equal [8,9]{/eq}{~n} +{@eq key=array_lower value=array_lower}[3,5,7] is equal to [3,5,7]{:else}[3,5,7] does not equal [3,5,7]{/eq}{~n} diff --git a/js/test_cases/helpers_gt/README.md b/js/test_cases/helpers_gt/README.md index d982ece..29c57b3 100644 --- a/js/test_cases/helpers_gt/README.md +++ b/js/test_cases/helpers_gt/README.md @@ -2,4 +2,6 @@ Based on my tests, it appears dust is sorting based on ascii-table values. This All comparisons between non-matching types (for example, int vs string) appear to render the else block. +Comparisons between non-scalar types (like arrays) appears to render the else block. + Greater than follows the same pattern for not rendering when key is omitted or null. diff --git a/js/test_cases/helpers_gt/input1.json b/js/test_cases/helpers_gt/input1.json index 3a631f3..4de7a58 100644 --- a/js/test_cases/helpers_gt/input1.json +++ b/js/test_cases/helpers_gt/input1.json @@ -5,5 +5,14 @@ "beta": "21", "null": null, "true_value": true, - "false_value": false + "false_value": false, + "array_lower": [ + 3, + 5, + 7 + ], + "array_higher": [ + 8, + 9 + ] } diff --git a/js/test_cases/helpers_gt/main.dust b/js/test_cases/helpers_gt/main.dust index d92bc99..894cc88 100644 --- a/js/test_cases/helpers_gt/main.dust +++ b/js/test_cases/helpers_gt/main.dust @@ -22,3 +22,5 @@ beta is {beta}{~n} {@gt key="a" value="}"}"a" is greater than "}"{:else}"a" is less than or equal to "}"{/gt}{~n} {@gt key="☃" value="☄"}"☃" is greater than "☄"{:else}"☃" is less than or equal to "☄"{/gt}{~n} {@gt key=true_value value=false_value}true is greater than false{:else}true is less than or equal to false{/gt}{~n} +{@gt key=array_lower value=array_higher}[3,5,7] is greater than [8,9]{:else}[3,5,7] is less than or equal to [8,9]{/gt}{~n} +{@gt key=array_higher value=array_lower}[8,9] is greater than [3,5,7]{:else}[8,9] is less than or equal to [3,5,7]{/gt}{~n} diff --git a/js/test_cases/helpers_ne/input1.json b/js/test_cases/helpers_ne/input1.json index ece58d2..0c96e44 100644 --- a/js/test_cases/helpers_ne/input1.json +++ b/js/test_cases/helpers_ne/input1.json @@ -3,5 +3,14 @@ "int": 7, "alpha": 21, "beta": "21", - "null": null + "null": null, + "array_lower": [ + 3, + 5, + 7 + ], + "array_higher": [ + 8, + 9 + ] } diff --git a/js/test_cases/helpers_ne/main.dust b/js/test_cases/helpers_ne/main.dust index 67f8644..9796b47 100644 --- a/js/test_cases/helpers_ne/main.dust +++ b/js/test_cases/helpers_ne/main.dust @@ -16,3 +16,5 @@ beta is {beta}{~n} {@ne key=null}null does not equal a missing value{:else}null equals a missing value{/ne}{~n} {@ne key=null value=gamma}null does not equal non-existent value{:else}null equals a non-existent value{/ne}{~n} {@ne}no parameters is true{:else}no parameters is false{/ne}{~n} +{@ne key=array_lower value=array_higher}[3,5,7] does not equal [8,9]{:else}[3,5,7] is equal to [8,9]{/ne}{~n} +{@ne key=array_lower value=array_lower}[3,5,7] does not equal [3,5,7]{:else}[3,5,7] is equal to [3,5,7]{/ne}{~n} diff --git a/src/bin.rs b/src/bin.rs index 659faf5..2971ffa 100644 --- a/src/bin.rs +++ b/src/bin.rs @@ -212,6 +212,7 @@ impl CompareContextElement for serde_json::Value { serde_json::Value::String(self_string), serde_json::Value::String(other_string), ) => self_string.partial_cmp(other_string), + // TODO: Non-scalar types _ => None, }; }