Add tests for copied values.

This commit is contained in:
Tom Alexander
2020-05-16 14:48:04 -04:00
parent 6dbeb77a28
commit d751df6fd5
7 changed files with 162 additions and 2 deletions

View File

@@ -8,3 +8,8 @@ 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.
Non-Scalar Values
-----------------
For non-scalar values, it seems that dust does mark two values as true if they have the same path, but otherwise they are not equal.

View File

@@ -4,13 +4,57 @@
"alpha": 21,
"beta": "21",
"null": null,
"true_value": true,
"false_value": false,
"array_lower": [
3,
5,
7
],
"copy_array_lower": [
3,
5,
7
],
"array_higher": [
8,
9
],
"some_obj": {
"name": "cat"
},
"copy_some_obj": {
"name": "cat"
},
"other_obj": {
"name": "dog"
},
"array_of_some_obj": [
{
"name": "cat"
},
{
"name": "cat"
}
],
"copy_array_of_some_obj": [
{
"name": "cat"
},
{
"name": "cat"
}
],
"array_of_other_obj": [
{
"name": "dog"
},
{
"name": "dog"
}
],
"array_of_strings": [
"cat",
"dog"
]
}

View File

@@ -17,4 +17,12 @@ beta is {beta}{~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}
{! non-scalar and copied value tests !}
{@eq key=array_lower value=array_lower}array_lower is equal to array_lower{:else}array_lower does not equal array_lower{/eq}{~n}
{@eq key=array_lower value=copy_array_lower}array_lower is equal to copy_array_lower{:else}array_lower does not equal copy_array_lower{/eq}{~n}
{@eq key=some_obj value=some_obj}some_obj is equal to some_obj{:else}some_obj does not equal some_obj{/eq}{~n}
{@eq key=some_obj value=copy_some_obj}some_obj is equal to copy_some_obj{:else}some_obj does not equal copy_some_obj{/eq}{~n}
{@eq key=some_obj value=other_obj}some_obj is equal to other_obj{:else}some_obj does not equal other_obj{/eq}{~n}
{@eq key=array_of_some_obj value=array_of_some_obj}array_of_some_obj is equal to array_of_some_obj{:else}array_of_some_obj does not equal array_of_some_obj{/eq}{~n}
{@eq key=array_of_some_obj value=copy_array_of_some_obj}array_of_some_obj is equal to copy_array_of_some_obj{:else}array_of_some_obj does not equal copy_array_of_some_obj{/eq}{~n}
{@eq key=array_of_some_obj value=array_of_other_obj}array_of_some_obj is equal to array_of_other_obj{:else}array_of_some_obj does not equal array_of_other_obj{/eq}{~n}