Skip to content

Commit

Permalink
Add more test cases for unquoted strings in objects (#1054)
Browse files Browse the repository at this point in the history
<!-- ELLIPSIS_HIDDEN -->



> [!IMPORTANT]
> Add test case for handling unquoted strings with spaces in JSON-like
objects in `test_class.rs`.
> 
>   - **Tests**:
> - Add `test_string_field_with_spaces` in `test_class.rs` to handle
unquoted strings with spaces in JSON-like objects.
> - Validates deserialization of strings with spaces and newline
characters.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup>
for abeceb6. It will automatically
update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->
  • Loading branch information
hellovai authored Oct 21, 2024
1 parent 00082e8 commit 2d1b700
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions engine/baml-lib/jsonish/src/tests/test_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1201,3 +1201,27 @@ test_deserializer!(
FieldType::Class("Foo".to_string()),
{"a": "", "b": "", "res": []}
);

test_deserializer!(
test_string_field_with_spaces,
r#"
class Foo {
a string
b string
res string[]
}
"#,
r#"{
a: Hi friends!,
b: hey world lets do something kinda cool
so that we can test this out,
res: [hello,
world]
}"#,
FieldType::Class("Foo".to_string()),
{
"a": "Hi friends!",
"b": "hey world lets do something kinda cool\n so that we can test this out",
"res": ["hello", "world"]
}
);

0 comments on commit 2d1b700

Please sign in to comment.