MCPcopy Create free account
hub / github.com/erans/pgsqlite / test_validate_value_within_constraint

Function test_validate_value_within_constraint

src/validator/string_constraints.rs:220–237  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 3

setup_test_dbFunction · 0.70
executeMethod · 0.45

Tested by

no test coverage detected