[librsvg: 4/7] Add test for PathOrUrl("")
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 4/7] Add test for PathOrUrl("")
- Date: Mon, 15 Feb 2021 19:52:35 +0000 (UTC)
commit d62fce56383c8a630a02e63b6e39a42c906447e8
Author: Sven Neumann <sven svenfoo org>
Date: Fri Feb 12 23:19:59 2021 +0100
Add test for PathOrUrl("")
This test shows our expectations, and it fails because the GFile we
get from PathOrUrl::get_gfile() actually points to the current working
directory.
Just adding this here for discussion, eventually this needs to be
fixed elsewhere, or we need to adjust our expectations.
src/c_api/handle.rs | 15 +++++++++++++++
1 file changed, 15 insertions(+)
---
diff --git a/src/c_api/handle.rs b/src/c_api/handle.rs
index c25e3630..d1218956 100644
--- a/src/c_api/handle.rs
+++ b/src/c_api/handle.rs
@@ -2312,6 +2312,21 @@ mod tests {
}
}
+ #[test]
+ fn path_or_url_empty_str() {
+ unsafe {
+ let path = PathOrUrl::new(b"\0" as *const u8 as *const _);
+
+ match &path {
+ PathOrUrl::Path(_) => (),
+ _ => panic!("empty string should be a PathOrUrl::Path"),
+ }
+
+ let file = path.get_gfile();
+ assert_eq!(file.get_basename(), Some(PathBuf::new()))
+ }
+ }
+
#[test]
fn base_url_works() {
let mut u = BaseUrl::default();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]