MCPcopy Create free account
hub / github.com/baerwang/openapi-rs / test_pattern_with_non_string_values

Function test_pattern_with_non_string_values

src/validator/pattern_test.rs:307–327  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

305
306 #[test]
307 fn test_pattern_with_non_string_values() {
308 let test_cases = [
309 ("number", Value::Number(123.into())),
310 ("boolean", Value::Bool(true)),
311 ("null", Value::Null),
312 (
313 "array",
314 Value::Array(vec![Value::String("test".to_string())]),
315 ),
316 ("object", Value::Object(serde_json::Map::new())),
317 ];
318
319 for (name, value) in test_cases.iter() {
320 let result = validate_pattern(name, value, Some(&"^\\d+$".to_string()));
321 assert!(
322 result.is_ok(),
323 "Non-string value {} should pass pattern validation",
324 name
325 );
326 }
327 }
328
329 #[test]
330 fn test_pattern_validation_edge_cases() {

Callers

nothing calls this directly

Calls 1

validate_patternFunction · 0.85

Tested by

no test coverage detected