()
| 218 | |
| 219 | #[test] |
| 220 | fn test_validate_value_within_constraint() { |
| 221 | let validator = StringConstraintValidator::new(); |
| 222 | let conn = setup_test_db(); |
| 223 | |
| 224 | // Add a constraint |
| 225 | conn.execute( |
| 226 | "INSERT INTO __pgsqlite_string_constraints (table_name, column_name, max_length, is_char_type) |
| 227 | VALUES ('users', 'name', 10, 0)", |
| 228 | [], |
| 229 | ).unwrap(); |
| 230 | |
| 231 | // Load constraints |
| 232 | validator.load_table_constraints(&conn, "users").unwrap(); |
| 233 | |
| 234 | // Valid value |
| 235 | assert!(validator.validate_value("users", "name", "John").is_ok()); |
| 236 | assert!(validator.validate_value("users", "name", "1234567890").is_ok()); // Exactly 10 |
| 237 | } |
| 238 | |
| 239 | #[test] |
| 240 | fn test_validate_value_exceeds_constraint() { |
nothing calls this directly
no test coverage detected