]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/pretty-std.rs
Rollup merge of #77368 - est31:apfloat_fix, r=varkor
[rust.git] / src / test / debuginfo / pretty-std.rs
1 // ignore-freebsd: gdb package too new
2 // only-cdb // "Temporarily" ignored on GDB/LLDB due to debuginfo tests being disabled, see PR 47155
3 // ignore-android: FIXME(#10381)
4 // compile-flags:-g
5 // min-gdb-version: 7.7
6 // min-lldb-version: 310
7
8 // === GDB TESTS ===================================================================================
9
10 // gdb-command: run
11
12 // gdb-command: print slice
13 // gdb-check:$1 = &[i32](len: 4) = {0, 1, 2, 3}
14
15 // gdb-command: print vec
16 // gdb-check:$2 = Vec<u64>(len: 4, cap: [...]) = {4, 5, 6, 7}
17
18 // gdb-command: print str_slice
19 // gdb-check:$3 = "IAMA string slice!"
20
21 // gdb-command: print string
22 // gdb-check:$4 = "IAMA string!"
23
24 // gdb-command: print some
25 // gdb-check:$5 = Some = {8}
26
27 // gdb-command: print none
28 // gdbg-check:$6 = None
29 // gdbr-check:$6 = core::option::Option::None
30
31 // gdb-command: print os_string
32 // gdb-check:$7 = "IAMA OS string ðŸ˜ƒ"
33
34 // gdb-command: print some_string
35 // gdb-check:$8 = Some = {"IAMA optional string!"}
36
37 // gdb-command: set print length 5
38 // gdb-command: print some_string
39 // gdb-check:$8 = Some = {"IAMA "...}
40
41
42 // === LLDB TESTS ==================================================================================
43
44 // lldb-command: run
45
46 // lldb-command: print slice
47 // lldb-check:[...]$0 = &[0, 1, 2, 3]
48
49 // lldb-command: print vec
50 // lldb-check:[...]$1 = vec![4, 5, 6, 7]
51
52 // lldb-command: print str_slice
53 // lldb-check:[...]$2 = "IAMA string slice!"
54
55 // lldb-command: print string
56 // lldb-check:[...]$3 = "IAMA string!"
57
58 // lldb-command: print some
59 // lldb-check:[...]$4 = Some(8)
60
61 // lldb-command: print none
62 // lldb-check:[...]$5 = None
63
64 // lldb-command: print os_string
65 // lldb-check:[...]$6 = "IAMA OS string ðŸ˜ƒ"[...]
66
67
68 // === CDB TESTS ==================================================================================
69
70 // cdb-command: g
71
72 // cdb-command: dx slice,d
73 // cdb-check:slice,d [...]
74 // NOTE: While slices have a .natvis entry that works in VS & VS Code, it fails in CDB 10.0.18362.1
75
76 // cdb-command: dx vec,d
77 // cdb-check:vec,d [...] : { size=4 } [Type: [...]::Vec<u64>]
78 // cdb-check:    [size]           : 4 [Type: [...]]
79 // cdb-check:    [capacity]       : [...] [Type: [...]]
80 // cdb-check:    [0]              : 4 [Type: unsigned __int64]
81 // cdb-check:    [1]              : 5 [Type: unsigned __int64]
82 // cdb-check:    [2]              : 6 [Type: unsigned __int64]
83 // cdb-check:    [3]              : 7 [Type: unsigned __int64]
84
85 // cdb-command: dx str_slice
86 // cdb-check:str_slice [...]
87 // NOTE: While string slices have a .natvis entry that works in VS & VS Code, it fails in CDB
88
89 // cdb-command: dx string
90 // cdb-check:string           : "IAMA string!" [Type: [...]::String]
91 // cdb-check:    [<Raw View>]     [Type: [...]::String]
92 // cdb-check:    [size]           : 0xc [Type: [...]]
93 // cdb-check:    [capacity]       : 0xc [Type: [...]]
94 // cdb-check:    [0]              : 73 'I' [Type: char]
95 // cdb-check:    [1]              : 65 'A' [Type: char]
96 // cdb-check:    [2]              : 77 'M' [Type: char]
97 // cdb-check:    [3]              : 65 'A' [Type: char]
98 // cdb-check:    [4]              : 32 ' ' [Type: char]
99 // cdb-check:    [5]              : 115 's' [Type: char]
100 // cdb-check:    [6]              : 116 't' [Type: char]
101 // cdb-check:    [7]              : 114 'r' [Type: char]
102 // cdb-check:    [8]              : 105 'i' [Type: char]
103 // cdb-check:    [9]              : 110 'n' [Type: char]
104 // cdb-check:    [10]             : 103 'g' [Type: char]
105 // cdb-check:    [11]             : 33 '!' [Type: char]
106
107 // cdb-command: dx os_string
108 // cdb-check:os_string        [Type: [...]::OsString]
109 // NOTE: OsString doesn't have a .natvis entry yet.
110
111 // cdb-command: dx some
112 // cdb-check:some             : { Some 8 } [Type: [...]::Option<i16>]
113 // cdb-command: dx none
114 // cdb-check:none             : { None } [Type: [...]::Option<i64>]
115 // cdb-command: dx some_string
116 // cdb-check:some_string      : { Some "IAMA optional string!" } [[...]::Option<[...]::String>]
117
118 #![allow(unused_variables)]
119 use std::ffi::OsString;
120
121
122 fn main() {
123
124     // &[]
125     let slice: &[i32] = &[0, 1, 2, 3];
126
127     // Vec
128     let vec = vec![4u64, 5, 6, 7];
129
130     // &str
131     let str_slice = "IAMA string slice!";
132
133     // String
134     let string = "IAMA string!".to_string();
135
136     // OsString
137     let os_string = OsString::from("IAMA OS string \u{1F603}");
138
139     // Option
140     let some = Some(8i16);
141     let none: Option<i64> = None;
142
143     let some_string = Some("IAMA optional string!".to_owned());
144
145     zzz(); // #break
146 }
147
148 fn zzz() { () }