Add a test case for type casting to the equality helper tests.
This commit is contained in:
parent
4731ddaa6b
commit
5dff03bb37
@ -30,4 +30,11 @@ Do objects with different paths referencing the same variable match?{~n}
|
||||
|
||||
Floating point equality{~n}
|
||||
======================={~n}
|
||||
{@eq key=int value=7.0}int is equal to 7.0{:else}int is not equal to 7.0{/eq}
|
||||
{@eq key=int value=7.0}int is equal to 7.0{~n}{:else}int is not equal to 7.0{~n}{/eq}
|
||||
|
||||
Type cast{~n}
|
||||
========={~n}
|
||||
{@eq key=int value="7"}int is equal to "7"{~n}{:else}int is not equal to "7"{~n}{/eq}
|
||||
{@eq key=int value="7" type="number"}int is equal to "7"::number{~n}{:else}int is not equal to "7"::number{~n}{/eq}
|
||||
{@eq key=beta value=21 type="string"}beta is equal to 21::string{~n}{:else}beta is not equal to 21::string{~n}{/eq}
|
||||
{@eq key=beta value="21" type="string"}beta is equal to "21"::string{~n}{:else}beta is not equal to "21"::string{~n}{/eq}
|
||||
|
@ -1012,6 +1012,7 @@ impl<'a> DustRenderer<'a> {
|
||||
|
||||
let left_side = self.tap(breadcrumbs, ¶m_map, "key");
|
||||
let right_side = self.tap(breadcrumbs, ¶m_map, "value");
|
||||
let type_cast = self.tap(breadcrumbs, ¶m_map, "type");
|
||||
|
||||
let left_side_ce = left_side.as_ref().map(|maybe_ice| {
|
||||
maybe_ice
|
||||
@ -1023,6 +1024,15 @@ impl<'a> DustRenderer<'a> {
|
||||
.as_ref()
|
||||
.map(|ice| ice.get_context_element_reference())
|
||||
});
|
||||
let type_rendered = match type_cast.as_ref().map(|maybe_ice| {
|
||||
maybe_ice
|
||||
.as_ref()
|
||||
.map(|ice| ice.get_context_element_reference())
|
||||
.map(|ce| ce.render(&Vec::new()))
|
||||
}) {
|
||||
Some(Ok(Ok(val))) => Some(val),
|
||||
_ => None,
|
||||
};
|
||||
if left_side_ce.is_none() {
|
||||
// If key did not exist at all, return None
|
||||
return None;
|
||||
|
Loading…
Reference in New Issue
Block a user