Tests are once again passing.
This commit is contained in:
parent
830bb06a92
commit
756fdb7d00
22
src/bin.rs
22
src/bin.rs
@ -208,8 +208,16 @@ impl CompareContextElement for serde_json::Value {
|
||||
(
|
||||
serde_json::Value::Array(self_array),
|
||||
serde_json::Value::Array(other_array),
|
||||
) => convert_vec_to_context_element(self_array)
|
||||
.partial_cmp(&convert_vec_to_context_element(other_array)),
|
||||
) => {
|
||||
return self
|
||||
.render(&Vec::new())
|
||||
.unwrap_or("".to_owned())
|
||||
.partial_cmp(
|
||||
&other_json_value
|
||||
.render(&Vec::new())
|
||||
.unwrap_or("".to_owned()),
|
||||
)
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
}
|
||||
@ -371,10 +379,12 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_type_coercion_object_int() {
|
||||
fn test_nested_array_render() {
|
||||
let x: serde_json::Value =
|
||||
serde_json::from_str(r#"{"name": "cat"}"#).expect("Failed to parse json");
|
||||
let y: u64 = 7;
|
||||
// assert_eq!(x.partial_compare(&y), Some(Ordering::Greater));
|
||||
serde_json::from_str(r#"[3,5,[7,9]]"#).expect("Failed to parse json");
|
||||
assert_eq!(
|
||||
x.render(&Vec::new()),
|
||||
Ok::<_, RenderError>("3,5,7,9".to_owned())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ use std::fmt;
|
||||
/// Fatal errors while rendering.
|
||||
///
|
||||
/// A RenderError will halt rendering.
|
||||
#[derive(PartialEq)]
|
||||
pub enum RenderError {
|
||||
Generic(String),
|
||||
TemplateNotFound(String),
|
||||
|
Loading…
x
Reference in New Issue
Block a user