1 // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
12 // ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
13 // min-lldb-version: 310
17 // === GDB TESTS ===================================================================================
19 // gdbg-command:print 'c_style_enum::SINGLE_VARIANT'
20 // gdbr-command:print c_style_enum::SINGLE_VARIANT
21 // gdbg-check:$1 = TheOnlyVariant
22 // gdbr-check:$1 = c_style_enum::SingleVariant::TheOnlyVariant
24 // gdbg-command:print 'c_style_enum::AUTO_ONE'
25 // gdbr-command:print c_style_enum::AUTO_ONE
26 // gdbg-check:$2 = One
27 // gdbr-check:$2 = c_style_enum::AutoDiscriminant::One
29 // gdbg-command:print 'c_style_enum::AUTO_TWO'
30 // gdbr-command:print c_style_enum::AUTO_TWO
31 // gdbg-check:$3 = One
32 // gdbr-check:$3 = c_style_enum::AutoDiscriminant::One
34 // gdbg-command:print 'c_style_enum::AUTO_THREE'
35 // gdbr-command:print c_style_enum::AUTO_THREE
36 // gdbg-check:$4 = One
37 // gdbr-check:$4 = c_style_enum::AutoDiscriminant::One
39 // gdbg-command:print 'c_style_enum::MANUAL_ONE'
40 // gdbr-command:print c_style_enum::MANUAL_ONE
41 // gdbg-check:$5 = OneHundred
42 // gdbr-check:$5 = c_style_enum::ManualDiscriminant::OneHundred
44 // gdbg-command:print 'c_style_enum::MANUAL_TWO'
45 // gdbr-command:print c_style_enum::MANUAL_TWO
46 // gdbg-check:$6 = OneHundred
47 // gdbr-check:$6 = c_style_enum::ManualDiscriminant::OneHundred
49 // gdbg-command:print 'c_style_enum::MANUAL_THREE'
50 // gdbr-command:print c_style_enum::MANUAL_THREE
51 // gdbg-check:$7 = OneHundred
52 // gdbr-check:$7 = c_style_enum::ManualDiscriminant::OneHundred
56 // gdb-command:print auto_one
57 // gdbg-check:$8 = One
58 // gdbr-check:$8 = c_style_enum::AutoDiscriminant::One
60 // gdb-command:print auto_two
61 // gdbg-check:$9 = Two
62 // gdbr-check:$9 = c_style_enum::AutoDiscriminant::Two
64 // gdb-command:print auto_three
65 // gdbg-check:$10 = Three
66 // gdbr-check:$10 = c_style_enum::AutoDiscriminant::Three
68 // gdb-command:print manual_one_hundred
69 // gdbg-check:$11 = OneHundred
70 // gdbr-check:$11 = c_style_enum::ManualDiscriminant::OneHundred
72 // gdb-command:print manual_one_thousand
73 // gdbg-check:$12 = OneThousand
74 // gdbr-check:$12 = c_style_enum::ManualDiscriminant::OneThousand
76 // gdb-command:print manual_one_million
77 // gdbg-check:$13 = OneMillion
78 // gdbr-check:$13 = c_style_enum::ManualDiscriminant::OneMillion
80 // gdb-command:print single_variant
81 // gdbg-check:$14 = TheOnlyVariant
82 // gdbr-check:$14 = c_style_enum::SingleVariant::TheOnlyVariant
84 // gdbg-command:print 'c_style_enum::AUTO_TWO'
85 // gdbr-command:print AUTO_TWO
86 // gdbg-check:$15 = Two
87 // gdbr-check:$15 = c_style_enum::AutoDiscriminant::Two
89 // gdbg-command:print 'c_style_enum::AUTO_THREE'
90 // gdbr-command:print AUTO_THREE
91 // gdbg-check:$16 = Three
92 // gdbr-check:$16 = c_style_enum::AutoDiscriminant::Three
94 // gdbg-command:print 'c_style_enum::MANUAL_TWO'
95 // gdbr-command:print MANUAL_TWO
96 // gdbg-check:$17 = OneThousand
97 // gdbr-check:$17 = c_style_enum::ManualDiscriminant::OneThousand
99 // gdbg-command:print 'c_style_enum::MANUAL_THREE'
100 // gdbr-command:print MANUAL_THREE
101 // gdbg-check:$18 = OneMillion
102 // gdbr-check:$18 = c_style_enum::ManualDiscriminant::OneMillion
105 // === LLDB TESTS ==================================================================================
109 // lldb-command:print auto_one
110 // lldb-check:[...]$0 = One
112 // lldb-command:print auto_two
113 // lldb-check:[...]$1 = Two
115 // lldb-command:print auto_three
116 // lldb-check:[...]$2 = Three
118 // lldb-command:print manual_one_hundred
119 // lldb-check:[...]$3 = OneHundred
121 // lldb-command:print manual_one_thousand
122 // lldb-check:[...]$4 = OneThousand
124 // lldb-command:print manual_one_million
125 // lldb-check:[...]$5 = OneMillion
127 // lldb-command:print single_variant
128 // lldb-check:[...]$6 = TheOnlyVariant
130 #![allow(unused_variables)]
132 #![feature(omit_gdb_pretty_printer_section)]
133 #![omit_gdb_pretty_printer_section]
135 use self::AutoDiscriminant::{One, Two, Three};
136 use self::ManualDiscriminant::{OneHundred, OneThousand, OneMillion};
137 use self::SingleVariant::TheOnlyVariant;
139 #[derive(Copy, Clone)]
140 enum AutoDiscriminant {
146 #[derive(Copy, Clone)]
147 enum ManualDiscriminant {
153 #[derive(Copy, Clone)]
158 static SINGLE_VARIANT: SingleVariant = TheOnlyVariant;
160 static mut AUTO_ONE: AutoDiscriminant = One;
161 static mut AUTO_TWO: AutoDiscriminant = One;
162 static mut AUTO_THREE: AutoDiscriminant = One;
164 static mut MANUAL_ONE: ManualDiscriminant = OneHundred;
165 static mut MANUAL_TWO: ManualDiscriminant = OneHundred;
166 static mut MANUAL_THREE: ManualDiscriminant = OneHundred;
172 let auto_three = Three;
174 let manual_one_hundred = OneHundred;
175 let manual_one_thousand = OneThousand;
176 let manual_one_million = OneMillion;
178 let single_variant = TheOnlyVariant;
184 MANUAL_TWO = OneThousand;
185 MANUAL_THREE = OneMillion;
190 // Borrow to avoid an eager load of the constant value in the static.
191 let a = &SINGLE_VARIANT;
192 let a = unsafe { AUTO_ONE };
193 let a = unsafe { MANUAL_ONE };