File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -1869,7 +1869,11 @@ impl Path {
18691869 ///
18701870 /// let path = Path::new("/test/haha/foo.txt");
18711871 ///
1872+ /// assert_eq!(path.strip_prefix("/"), Ok(Path::new("test/haha/foo.txt")));
18721873 /// assert_eq!(path.strip_prefix("/test"), Ok(Path::new("haha/foo.txt")));
1874+ /// assert_eq!(path.strip_prefix("/test/"), Ok(Path::new("haha/foo.txt")));
1875+ /// assert_eq!(path.strip_prefix("/test/haha/foo.txt"), Ok(Path::new("")));
1876+ /// assert_eq!(path.strip_prefix("/test/haha/foo.txt/"), Ok(Path::new("")));
18731877 /// assert_eq!(path.strip_prefix("test").is_ok(), false);
18741878 /// assert_eq!(path.strip_prefix("/haha").is_ok(), false);
18751879 /// ```
@@ -1900,6 +1904,9 @@ impl Path {
19001904 /// let path = Path::new("/etc/passwd");
19011905 ///
19021906 /// assert!(path.starts_with("/etc"));
1907+ /// assert!(path.starts_with("/etc/"));
1908+ /// assert!(path.starts_with("/etc/passwd"));
1909+ /// assert!(path.starts_with("/etc/passwd/"));
19031910 ///
19041911 /// assert!(!path.starts_with("/e"));
19051912 /// ```
You can’t perform that action at this time.
0 commit comments