]>
git.proxmox.com Git - rustc.git/blob - vendor/camino/src/tests.rs
1 // Copyright (c) The camino Contributors
2 // SPDX-License-Identifier: MIT OR Apache-2.0
4 // Test that all required impls exist.
6 use crate::{Utf8Path, Utf8PathBuf}
;
14 macro_rules
! all_into
{
15 ($t
:ty
, $x
:ident
) => {
16 test_into
::<$t
, Utf8PathBuf
>($x
.clone());
17 test_into
::<$t
, Box
<Utf8Path
>>($x
.clone());
18 test_into
::<$t
, Arc
<Utf8Path
>>($x
.clone());
19 test_into
::<$t
, Rc
<Utf8Path
>>($x
.clone());
20 test_into
::<$t
, Cow
<'_
, Utf8Path
>>($x
.clone());
21 test_into
::<$t
, PathBuf
>($x
.clone());
22 test_into
::<$t
, Box
<Path
>>($x
.clone());
23 test_into
::<$t
, Arc
<Path
>>($x
.clone());
24 test_into
::<$t
, Rc
<Path
>>($x
.clone());
25 test_into
::<$t
, Cow
<'_
, Path
>>($x
.clone());
30 fn test_borrowed_into() {
31 let utf8_path
= Utf8Path
::new("test/path");
32 all_into
!(&Utf8Path
, utf8_path
);
36 fn test_owned_into() {
37 let utf8_path_buf
= Utf8PathBuf
::from("test/path");
38 all_into
!(Utf8PathBuf
, utf8_path_buf
);
41 fn test_into
<T
, U
>(orig
: T
)
48 #[cfg(path_buf_deref_mut)]
51 // This test is mostly for miri.
52 let mut path_buf
= Utf8PathBuf
::from("foobar");
53 let _
: &mut Utf8Path
= &mut path_buf
;