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