use super::*;
#[test]
fn test_extract_sqlite_file_path_from_url() {
assert_eq!(
extract_sqlite_file_path_from_url("sqlite:/tmp/test.db"),
Some("/tmp/test.db".to_string())
);
assert_eq!(
extract_sqlite_file_path_from_url("sqlite:./test.db"),
Some("./test.db".to_string())
);
assert_eq!(
extract_sqlite_file_path_from_url("sqlite:file:/tmp/test.db"),
Some("/tmp/test.db".to_string())
);
assert_eq!(
extract_sqlite_file_path_from_url("sqlite:file:/tmp/test.db?mode=rwc&cache=shared"),
Some("/tmp/test.db".to_string())
);
assert_eq!(
extract_sqlite_file_path_from_url("sqlite:file:test?mode=memory&cache=shared"),
Some("test".to_string())
);
assert_eq!(extract_sqlite_file_path_from_url("sqlite::memory:"), None);
assert_eq!(
extract_sqlite_file_path_from_url("sqlite:file:test_integrated?mode=memory&cache=shared"),
Some("test_integrated".to_string())
);
assert_eq!(
extract_sqlite_file_path_from_url("sqlite:file::memory:?cache=shared"),
None
);
assert_eq!(
extract_sqlite_file_path_from_url("postgresql://localhost/test"),
None
);
assert_eq!(extract_sqlite_file_path_from_url(""), None);
assert_eq!(
extract_sqlite_file_path_from_url("sqlite:///tmp/test.db"),
Some("/tmp/test.db".to_string())
);
}