Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions crates/fhir-validator/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1117,11 +1117,23 @@ mod tests {
let mut patient = donald();
add_element(resolver, "Patient", &mut patient, &[], "active").unwrap();

set_value(resolver, "Patient", &mut patient, &path_from_string("active"), "true");
set_value(
resolver,
"Patient",
&mut patient,
&path_from_string("active"),
"true",
);
assert_eq!(patient["active"], json!(true));

// Clearing a field removes it rather than storing "".
set_value(resolver, "Patient", &mut patient, &path_from_string("active"), "");
set_value(
resolver,
"Patient",
&mut patient,
&path_from_string("active"),
"",
);
assert!(patient.get("active").is_none());
}

Expand All @@ -1134,7 +1146,13 @@ mod tests {
// A year-precision date is legal FHIR and must stay a string, even
// though it parses as an integer.
add_element(resolver, "Patient", &mut patient, &[], "birthDate").unwrap();
set_value(resolver, "Patient", &mut patient, &path_from_string("birthDate"), "1974");
set_value(
resolver,
"Patient",
&mut patient,
&path_from_string("birthDate"),
"1974",
);
assert_eq!(patient["birthDate"], json!("1974"));

// Same for string-typed elements whose content merely looks numeric.
Expand Down
Loading