mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-23 08:55:40 +01:00
fix tests
This commit is contained in:
@@ -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'\'' => {
|
||||
|
||||
@@ -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 }");
|
||||
|
||||
Reference in New Issue
Block a user