diff --git a/js/test_cases/_helpers_gte/input1.json b/js/test_cases/_helpers_gte/input1.json index bfbbd94..de2ac09 100644 --- a/js/test_cases/_helpers_gte/input1.json +++ b/js/test_cases/_helpers_gte/input1.json @@ -11,6 +11,13 @@ 5, 7 ], + "array_lower_with_array": [ + 3, + 5, + [ + 7 + ] + ], "copy_array_lower": [ 3, 5, @@ -20,6 +27,11 @@ 8, 9 ], + "array_higher_longer": [ + 8, + 9, + 1 + ], "some_obj": { "name": "cat" }, diff --git a/js/test_cases/_helpers_gte/main.dust b/js/test_cases/_helpers_gte/main.dust index a3eb601..ed6938c 100644 --- a/js/test_cases/_helpers_gte/main.dust +++ b/js/test_cases/_helpers_gte/main.dust @@ -33,3 +33,6 @@ beta is {beta}{~n} {@gte key=array_of_some_obj value=array_of_some_obj}array_of_some_obj is greater than or equal to array_of_some_obj{:else}array_of_some_obj is less than array_of_some_obj{/gte}{~n} {@gte key=array_of_some_obj value=copy_array_of_some_obj}array_of_some_obj is greater than or equal to copy_array_of_some_obj{:else}array_of_some_obj is less than copy_array_of_some_obj{/gte}{~n} {@gte key=array_of_some_obj value=array_of_other_obj}array_of_some_obj is greater than or equal to array_of_other_obj{:else}array_of_some_obj is less than array_of_other_obj{/gte}{~n} +{@gte key=array_higher value=array_higher_longer}array_higher is greater than or equal to array_higher_longer{:else}array_higher is less than array_higher_longer{/gte}{~n} +{@gte key=array_lower value=array_lower_with_array}array_lower is greater than or equal to array_lower_with_array{:else}array_lower is less than array_lower_with_array{/gte}{~n} +{@gte key=array_lower_with_array value=array_lower}array_lower_with_array is greater than or equal to array_lower{:else}array_lower_with_array is less than array_lower{/gte}{~n} diff --git a/js/test_cases/_helpers_lt/input1.json b/js/test_cases/_helpers_lt/input1.json index bfbbd94..de2ac09 100644 --- a/js/test_cases/_helpers_lt/input1.json +++ b/js/test_cases/_helpers_lt/input1.json @@ -11,6 +11,13 @@ 5, 7 ], + "array_lower_with_array": [ + 3, + 5, + [ + 7 + ] + ], "copy_array_lower": [ 3, 5, @@ -20,6 +27,11 @@ 8, 9 ], + "array_higher_longer": [ + 8, + 9, + 1 + ], "some_obj": { "name": "cat" }, diff --git a/js/test_cases/_helpers_lt/main.dust b/js/test_cases/_helpers_lt/main.dust index 305c3c4..c1ab4e4 100644 --- a/js/test_cases/_helpers_lt/main.dust +++ b/js/test_cases/_helpers_lt/main.dust @@ -33,3 +33,6 @@ beta is {beta}{~n} {@lt key=array_of_some_obj value=array_of_some_obj}array_of_some_obj is less than array_of_some_obj{:else}array_of_some_obj is greater than or equal to array_of_some_obj{/lt}{~n} {@lt key=array_of_some_obj value=copy_array_of_some_obj}array_of_some_obj is less than copy_array_of_some_obj{:else}array_of_some_obj is greater than or equal to copy_array_of_some_obj{/lt}{~n} {@lt key=array_of_some_obj value=array_of_other_obj}array_of_some_obj is less than array_of_other_obj{:else}array_of_some_obj is greater than or equal to array_of_other_obj{/lt}{~n} +{@lt key=array_higher value=array_higher_longer}array_higher is less than array_higher_longer{:else}array_higher is greater than or equal to array_higher_longer{/lt}{~n} +{@lt key=array_lower value=array_lower_with_array}array_lower is less than array_lower_with_array{:else}array_lower is greater than or equal to array_lower_with_array{/lt}{~n} +{@lt key=array_lower_with_array value=array_lower}array_lower_with_array is less than array_lower{:else}array_lower_with_array is greater than or equal to array_lower{/lt}{~n} diff --git a/js/test_cases/_helpers_lte/input1.json b/js/test_cases/_helpers_lte/input1.json index bfbbd94..de2ac09 100644 --- a/js/test_cases/_helpers_lte/input1.json +++ b/js/test_cases/_helpers_lte/input1.json @@ -11,6 +11,13 @@ 5, 7 ], + "array_lower_with_array": [ + 3, + 5, + [ + 7 + ] + ], "copy_array_lower": [ 3, 5, @@ -20,6 +27,11 @@ 8, 9 ], + "array_higher_longer": [ + 8, + 9, + 1 + ], "some_obj": { "name": "cat" }, diff --git a/js/test_cases/_helpers_lte/main.dust b/js/test_cases/_helpers_lte/main.dust index dcf0ab5..2ea2f24 100644 --- a/js/test_cases/_helpers_lte/main.dust +++ b/js/test_cases/_helpers_lte/main.dust @@ -33,3 +33,6 @@ beta is {beta}{~n} {@lte key=array_of_some_obj value=array_of_some_obj}array_of_some_obj is less than or equal to array_of_some_obj{:else}array_of_some_obj is greater than array_of_some_obj{/lte}{~n} {@lte key=array_of_some_obj value=copy_array_of_some_obj}array_of_some_obj is less than or equal to copy_array_of_some_obj{:else}array_of_some_obj is greater than copy_array_of_some_obj{/lte}{~n} {@lte key=array_of_some_obj value=array_of_other_obj}array_of_some_obj is less than or equal to array_of_other_obj{:else}array_of_some_obj is greater than array_of_other_obj{/lte}{~n} +{@lte key=array_higher value=array_higher_longer}array_higher is less than or equal to array_higher_longer{:else}array_higher is greater than array_higher_longer{/lte}{~n} +{@lte key=array_lower value=array_lower_with_array}array_lower is less than or equal to array_lower_with_array{:else}array_lower is greater than array_lower_with_array{/lte}{~n} +{@lte key=array_lower_with_array value=array_lower}array_lower_with_array is less than or equal to array_lower{:else}array_lower_with_array is greater than array_lower{/lte}{~n} diff --git a/js/test_cases/helpers_gt/README.md b/js/test_cases/helpers_gt/README.md index f418aed..527bae3 100644 --- a/js/test_cases/helpers_gt/README.md +++ b/js/test_cases/helpers_gt/README.md @@ -2,6 +2,9 @@ Based on my tests, it appears dust is sorting based on ascii-table values. This Greater than follows the same pattern for not rendering when key is omitted or null. +Longer arrays are greater than shorter arrays if all preceding values match. + +Theory for comparing arrays: Compare the values, if theres any mismatched types then take the same action you would for non-matching scalar types. greater than ------------ diff --git a/js/test_cases/helpers_gt/input1.json b/js/test_cases/helpers_gt/input1.json index bfbbd94..de2ac09 100644 --- a/js/test_cases/helpers_gt/input1.json +++ b/js/test_cases/helpers_gt/input1.json @@ -11,6 +11,13 @@ 5, 7 ], + "array_lower_with_array": [ + 3, + 5, + [ + 7 + ] + ], "copy_array_lower": [ 3, 5, @@ -20,6 +27,11 @@ 8, 9 ], + "array_higher_longer": [ + 8, + 9, + 1 + ], "some_obj": { "name": "cat" }, diff --git a/js/test_cases/helpers_gt/main.dust b/js/test_cases/helpers_gt/main.dust index c7b3699..758b231 100644 --- a/js/test_cases/helpers_gt/main.dust +++ b/js/test_cases/helpers_gt/main.dust @@ -21,9 +21,9 @@ beta is {beta}{~n} {@gt key="a" value="A"}"a" is greater than "A"{:else}"a" is less than or equal to "A"{/gt}{~n} {@gt key="a" value="}"}"a" is greater than "}"{:else}"a" is less than or equal to "}"{/gt}{~n} {! -Commented out because unicode not working in rust implementation yet -{@gt key="☃" value="☄"}"☃" is greater than "☄"{:else}"☃" is less than or equal to "☄"{/gt}{~n} -!} + Commented out because unicode not working in rust implementation yet + {@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} @@ -36,3 +36,7 @@ Commented out because unicode not working in rust implementation yet {@gt key=array_of_some_obj value=array_of_some_obj}array_of_some_obj is greater than array_of_some_obj{:else}array_of_some_obj is less than or equal to array_of_some_obj{/gt}{~n} {@gt key=array_of_some_obj value=copy_array_of_some_obj}array_of_some_obj is greater than copy_array_of_some_obj{:else}array_of_some_obj is less than or equal to copy_array_of_some_obj{/gt}{~n} {@gt key=array_of_some_obj value=array_of_other_obj}array_of_some_obj is greater than array_of_other_obj{:else}array_of_some_obj is less than or equal to array_of_other_obj{/gt}{~n} + +{@gt key=array_higher value=array_higher_longer}array_higher is greater than array_higher_longer{:else}array_higher is less than or equal to array_higher_longer{/gt}{~n} +{@gt key=array_lower value=array_lower_with_array}array_lower is greater than array_lower_with_array{:else}array_lower is less than or equal to array_lower_with_array{/gt}{~n} +{@gt key=array_lower_with_array value=array_lower}array_lower_with_array is greater than array_lower{:else}array_lower_with_array is less than or equal to array_lower{/gt}{~n}