4 // Tests ensuring that `dbg!(expr)` has the expected run-time behavior.
5 // as well as some compile time properties we expect.
7 #[derive(Copy, Clone, Debug)]
10 #[derive(Copy, Clone, Debug, PartialEq)]
16 #[derive(Debug, PartialEq)]
20 let a: Unit = dbg!(Unit);
21 let _: Unit = dbg!(a);
22 // We can move `a` because it's Copy.
25 // `Point<T>` will be faithfully formatted according to `{:#?}`.
26 let a = Point { x: 42, y: 24 };
27 let b: Point<u8> = dbg!(Point { x: 42, y: 24 }); // test stringify!(..)
28 let c: Point<u8> = dbg!(b);
29 // Identity conversion:
32 // We can move `b` because it's Copy.
35 // Without parameters works as expected.
38 // Test that we can borrow and that successive applications is still identity.
40 let b: &NoCopy = dbg!(dbg!(&a));
43 // Test involving lifetimes of temporaries:
44 fn f<'a>(x: &'a u8) -> &'a u8 { x }
45 let a: &u8 = dbg!(f(&42));
50 assert_eq!(7331, dbg!({
57 // Test trailing comma:
58 assert_eq!(("Yeah",), dbg!(("Yeah",)));
60 // Test multiple arguments:
61 assert_eq!((1u8, 2u32), dbg!(1,
64 // Test multiple arguments + trailing comma:
65 assert_eq!((1u8, 2u32, "Yeah"), dbg!(1u8, 2u32,