fix tests

This commit is contained in:
Ihor Andrianov
2025-03-27 23:30:28 +02:00
parent 101dd51d7c
commit 92a745ca49
2 changed files with 2 additions and 13 deletions

View File

@@ -1392,7 +1392,7 @@ impl Jsonb {
b'f' => {
pos = self.deserialize_false(input, pos)?;
}
b'n' => {
b'n' | b'N' => {
pos = self.deserialize_null_or_nan(input, pos)?;
}
b'"' | b'\'' => {

View File

@@ -104,6 +104,7 @@ pub fn json_from_raw_bytes_agg(data: &[u8], raw: bool) -> crate::Result<OwnedVal
fn convert_dbtype_to_jsonb(val: &OwnedValue, strict: Conv) -> crate::Result<Jsonb> {
match val {
OwnedValue::Text(text) => {
println!("{:?}", text.as_str());
let res = if text.subtype == TextSubtype::Json || matches!(strict, Conv::Strict) {
// Parse directly as JSON if it's already JSON subtype or strict mode is on
let json = if matches!(strict, Conv::ToString) {
@@ -628,18 +629,6 @@ mod tests {
}
}
#[test]
fn test_get_json_valid_json5_double_single_quotes() {
let input = OwnedValue::build_text("{ key: ''value'' }");
let result = get_json(&input, None).unwrap();
if let OwnedValue::Text(result_str) = result {
assert!(result_str.as_str().contains("\"key\":\"value\""));
assert_eq!(result_str.subtype, TextSubtype::Json);
} else {
panic!("Expected OwnedValue::Text");
}
}
#[test]
fn test_get_json_valid_json5_infinity() {
let input = OwnedValue::build_text("{ \"key\": Infinity }");