| 1 |
use super::*; |
| 2 |
|
| 3 |
#[test] |
| 4 |
fn as_path_str() { |
| 5 |
let path = Path::new("./test/file.txt"); |
| 6 |
let as_path = "./test/file.txt".as_path(); |
| 7 |
|
| 8 |
assert_eq!(path, as_path); |
| 9 |
} |
| 10 |
|
| 11 |
#[test] |
| 12 |
fn as_path_string() { |
| 13 |
let path = Path::new("./test/file.txt"); |
| 14 |
|
| 15 |
let path_string = "./test/file.txt".to_string(); |
| 16 |
let as_path = path_string.as_path(); |
| 17 |
|
| 18 |
assert_eq!(path, as_path); |
| 19 |
} |
| 20 |
|
| 21 |
#[test] |
| 22 |
fn as_path_path() { |
| 23 |
let path = Path::new("./test/file.txt"); |
| 24 |
let as_path = path.as_path(); |
| 25 |
|
| 26 |
assert_eq!(path, as_path); |
| 27 |
} |
| 28 |
|
| 29 |
#[test] |
| 30 |
fn as_path_path_buf() { |
| 31 |
let path = Path::new("./test/file.txt"); |
| 32 |
|
| 33 |
let mut path_buf = PathBuf::new(); |
| 34 |
path_buf.push("."); |
| 35 |
path_buf.push("test"); |
| 36 |
path_buf.push("file.txt"); |
| 37 |
let as_path = path_buf.as_path(); |
| 38 |
|
| 39 |
assert_eq!(path, as_path); |
| 40 |
} |