()
| 82 | |
| 83 | #[test] |
| 84 | fn test_regexp_function() { |
| 85 | let conn = Connection::open_in_memory().unwrap(); |
| 86 | register_regex_functions(&conn).unwrap(); |
| 87 | |
| 88 | // Test basic match |
| 89 | let result: bool = conn |
| 90 | .query_row("SELECT regexp('^test', 'testing')", [], |row| row.get(0)) |
| 91 | .unwrap(); |
| 92 | assert!(result); |
| 93 | |
| 94 | // Test no match |
| 95 | let result: bool = conn |
| 96 | .query_row("SELECT regexp('^test', 'nottest')", [], |row| row.get(0)) |
| 97 | .unwrap(); |
| 98 | assert!(!result); |
| 99 | |
| 100 | // Test email pattern |
| 101 | let result: bool = conn |
| 102 | .query_row("SELECT regexp('@gmail\\.com$', 'user@gmail.com')", [], |row| row.get(0)) |
| 103 | .unwrap(); |
| 104 | assert!(result); |
| 105 | } |
| 106 | |
| 107 | #[test] |
| 108 | fn test_regexpi_function() { |
nothing calls this directly
no test coverage detected