]> git.lizzy.rs Git - rust.git/blob - tests/ui/deriving/deriving-show.rs
Auto merge of #105716 - chriswailes:ndk-update-redux, r=pietroalbini
[rust.git] / tests / ui / deriving / deriving-show.rs
1 // run-pass
2 #![allow(dead_code)]
3 #[derive(Debug)]
4 struct Unit;
5
6 #[derive(Debug)]
7 struct Tuple(isize, usize);
8
9 #[derive(Debug)]
10 struct Struct { x: isize, y: usize }
11
12 #[derive(Debug)]
13 enum Enum {
14     Nullary,
15     Variant(isize, usize),
16     StructVariant { x: isize, y : usize }
17 }
18
19 #[derive(Debug)]
20 struct Pointers(*const dyn Send, *mut dyn Sync);
21
22 macro_rules! t {
23     ($x:expr, $expected:expr) => {
24         assert_eq!(format!("{:?}", $x), $expected.to_string())
25     }
26 }
27
28 pub fn main() {
29     t!(Unit, "Unit");
30     t!(Tuple(1, 2), "Tuple(1, 2)");
31     t!(Struct { x: 1, y: 2 }, "Struct { x: 1, y: 2 }");
32     t!(Enum::Nullary, "Nullary");
33     t!(Enum::Variant(1, 2), "Variant(1, 2)");
34     t!(Enum::StructVariant { x: 1, y: 2 }, "StructVariant { x: 1, y: 2 }");
35 }