]> git.proxmox.com Git - rustc.git/blob - src/test/debuginfo/c-style-enum.rs
2305d7bc5c245039cc603c631ca2ddf6107d1807
[rustc.git] / src / test / debuginfo / c-style-enum.rs
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.
4 //
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.
10
11 // min-lldb-version: 310
12
13 // compile-flags:-g
14
15 // === GDB TESTS ===================================================================================
16
17 // gdb-command:print 'c-style-enum::SINGLE_VARIANT'
18 // gdb-check:$1 = TheOnlyVariant
19
20 // gdb-command:print 'c-style-enum::AUTO_ONE'
21 // gdb-check:$2 = One
22
23 // gdb-command:print 'c-style-enum::AUTO_TWO'
24 // gdb-check:$3 = One
25
26 // gdb-command:print 'c-style-enum::AUTO_THREE'
27 // gdb-check:$4 = One
28
29 // gdb-command:print 'c-style-enum::MANUAL_ONE'
30 // gdb-check:$5 = OneHundred
31
32 // gdb-command:print 'c-style-enum::MANUAL_TWO'
33 // gdb-check:$6 = OneHundred
34
35 // gdb-command:print 'c-style-enum::MANUAL_THREE'
36 // gdb-check:$7 = OneHundred
37
38 // gdb-command:run
39
40 // gdb-command:print auto_one
41 // gdb-check:$8 = One
42
43 // gdb-command:print auto_two
44 // gdb-check:$9 = Two
45
46 // gdb-command:print auto_three
47 // gdb-check:$10 = Three
48
49 // gdb-command:print manual_one_hundred
50 // gdb-check:$11 = OneHundred
51
52 // gdb-command:print manual_one_thousand
53 // gdb-check:$12 = OneThousand
54
55 // gdb-command:print manual_one_million
56 // gdb-check:$13 = OneMillion
57
58 // gdb-command:print single_variant
59 // gdb-check:$14 = TheOnlyVariant
60
61 // gdb-command:print 'c-style-enum::AUTO_TWO'
62 // gdb-check:$15 = Two
63
64 // gdb-command:print 'c-style-enum::AUTO_THREE'
65 // gdb-check:$16 = Three
66
67 // gdb-command:print 'c-style-enum::MANUAL_TWO'
68 // gdb-check:$17 = OneThousand
69
70 // gdb-command:print 'c-style-enum::MANUAL_THREE'
71 // gdb-check:$18 = OneMillion
72
73
74 // === LLDB TESTS ==================================================================================
75
76 // lldb-command:run
77
78 // lldb-command:print auto_one
79 // lldb-check:[...]$0 = One
80
81 // lldb-command:print auto_two
82 // lldb-check:[...]$1 = Two
83
84 // lldb-command:print auto_three
85 // lldb-check:[...]$2 = Three
86
87 // lldb-command:print manual_one_hundred
88 // lldb-check:[...]$3 = OneHundred
89
90 // lldb-command:print manual_one_thousand
91 // lldb-check:[...]$4 = OneThousand
92
93 // lldb-command:print manual_one_million
94 // lldb-check:[...]$5 = OneMillion
95
96 // lldb-command:print single_variant
97 // lldb-check:[...]$6 = TheOnlyVariant
98
99 #![allow(unused_variables)]
100 #![allow(dead_code)]
101 #![omit_gdb_pretty_printer_section]
102
103 use self::AutoDiscriminant::{One, Two, Three};
104 use self::ManualDiscriminant::{OneHundred, OneThousand, OneMillion};
105 use self::SingleVariant::TheOnlyVariant;
106
107 #[derive(Copy)]
108 enum AutoDiscriminant {
109 One,
110 Two,
111 Three
112 }
113
114 #[derive(Copy)]
115 enum ManualDiscriminant {
116 OneHundred = 100,
117 OneThousand = 1000,
118 OneMillion = 1000000
119 }
120
121 #[derive(Copy)]
122 enum SingleVariant {
123 TheOnlyVariant
124 }
125
126 static SINGLE_VARIANT: SingleVariant = TheOnlyVariant;
127
128 static mut AUTO_ONE: AutoDiscriminant = One;
129 static mut AUTO_TWO: AutoDiscriminant = One;
130 static mut AUTO_THREE: AutoDiscriminant = One;
131
132 static mut MANUAL_ONE: ManualDiscriminant = OneHundred;
133 static mut MANUAL_TWO: ManualDiscriminant = OneHundred;
134 static mut MANUAL_THREE: ManualDiscriminant = OneHundred;
135
136 fn main() {
137
138 let auto_one = One;
139 let auto_two = Two;
140 let auto_three = Three;
141
142 let manual_one_hundred = OneHundred;
143 let manual_one_thousand = OneThousand;
144 let manual_one_million = OneMillion;
145
146 let single_variant = TheOnlyVariant;
147
148 unsafe {
149 AUTO_TWO = Two;
150 AUTO_THREE = Three;
151
152 MANUAL_TWO = OneThousand;
153 MANUAL_THREE = OneMillion;
154 };
155
156 zzz(); // #break
157
158 let a = SINGLE_VARIANT;
159 let a = unsafe { AUTO_ONE };
160 let a = unsafe { MANUAL_ONE };
161 }
162
163 fn zzz() { () }