File tree 1 file changed +7
-0
lines changed
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -1869,7 +1869,11 @@ impl Path {
1869
1869
///
1870
1870
/// let path = Path::new("/test/haha/foo.txt");
1871
1871
///
1872
+ /// assert_eq!(path.strip_prefix("/"), Ok(Path::new("test/haha/foo.txt")));
1872
1873
/// 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("")));
1873
1877
/// assert_eq!(path.strip_prefix("test").is_ok(), false);
1874
1878
/// assert_eq!(path.strip_prefix("/haha").is_ok(), false);
1875
1879
/// ```
@@ -1900,6 +1904,9 @@ impl Path {
1900
1904
/// let path = Path::new("/etc/passwd");
1901
1905
///
1902
1906
/// 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/"));
1903
1910
///
1904
1911
/// assert!(!path.starts_with("/e"));
1905
1912
/// ```
You can’t perform that action at this time.
0 commit comments