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

Function test_regexp_function

src/functions/regex_functions.rs:84–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

register_regex_functionsFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected