Skip to content

Commit a46748a

Browse files
committed
Update tests
1 parent 5429624 commit a46748a

4 files changed

Lines changed: 115 additions & 4 deletions

File tree

‎tests/unit/out/refcount/keywords.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@ use std::io::prelude::*;
66
use std::io::{Read, Seek, Write};
77
use std::os::fd::AsFd;
88
use std::rc::{Rc, Weak};
9+
pub fn report_0(mut Err_: i32) -> i32 {
10+
return (Err_ + 1);
11+
}
912
pub fn main() {
1013
__cpp2rust_init_globals();
1114
std::process::exit(main_0());
1215
}
1316
fn main_0() -> i32 {
1417
let mut in_: i32 = 123;
1518
assert!((in_ == 123));
19+
let mut Err_: i32 = 1;
20+
assert!((({ report_0(Err_,) }) == 2));
1621
return 0;
1722
}
1823
pub fn __cpp2rust_init_globals() {}

‎tests/unit/out/refcount/reserved_keywords.rs‎

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,19 @@ pub struct S {
8686
#[offset(148)]
8787
pub vec_: i32,
8888
}
89+
#[derive(Clone, Record, ByteRepr, VaArg, FnPtrArg, Default)]
90+
#[byte_size(4)]
91+
pub struct type_ {
92+
#[offset(0)]
93+
pub v: i32,
94+
}
95+
#[derive(Clone, Record, ByteRepr, VaArg, FnPtrArg, Default)]
96+
#[byte_size(4)]
97+
pub struct loop_ {
98+
#[offset(0)]
99+
#[byte_size(4)]
100+
pub t: type_,
101+
}
89102
pub fn foo_0(
90103
mut as_: i32,
91104
mut async_: i32,
@@ -212,10 +225,49 @@ fn main_0() -> i32 {
212225
let mut raw_: i32 = 0;
213226
let mut safe_: i32 = 0;
214227
let mut vec_: i32 = 0;
228+
let mut l: loop_ = loop_ { t: type_ { v: 3 } };
229+
let mut t: type_ = l.t.clone();
215230
return ({
216231
foo_0(
217-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
218-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
232+
0,
233+
0,
234+
0,
235+
0,
236+
0,
237+
0,
238+
0,
239+
0,
240+
0,
241+
0,
242+
0,
243+
0,
244+
0,
245+
0,
246+
0,
247+
0,
248+
0,
249+
0,
250+
0,
251+
0,
252+
0,
253+
0,
254+
0,
255+
0,
256+
0,
257+
0,
258+
0,
259+
0,
260+
0,
261+
0,
262+
0,
263+
0,
264+
0,
265+
0,
266+
0,
267+
0,
268+
0,
269+
0,
270+
(t.v - 3),
219271
)
220272
});
221273
}

‎tests/unit/out/unsafe/keywords.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ use std::collections::BTreeMap;
66
use std::io::{Read, Seek, Write};
77
use std::os::fd::{AsFd, FromRawFd, IntoRawFd};
88
use std::rc::Rc;
9+
pub unsafe fn report_0(mut Err_: i32) -> i32 {
10+
return ((Err_) + (1));
11+
}
912
pub fn main() {
1013
unsafe {
1114
__cpp2rust_init_globals();
@@ -15,6 +18,8 @@ pub fn main() {
1518
unsafe fn main_0() -> i32 {
1619
let mut in_: i32 = 123;
1720
assert!(((in_) == (123)));
21+
let mut Err_: i32 = 1;
22+
assert!(((unsafe { report_0(Err_,) }) == (2)));
1823
return 0;
1924
}
2025
pub unsafe fn __cpp2rust_init_globals() {}

‎tests/unit/out/unsafe/reserved_keywords.rs‎

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ pub struct S {
4848
pub safe_: i32,
4949
pub vec_: i32,
5050
}
51+
#[repr(C)]
52+
#[derive(Copy, Clone, VaArg, FnPtrArg, Default)]
53+
pub struct type_ {
54+
pub v: i32,
55+
}
56+
#[repr(C)]
57+
#[derive(Copy, Clone, VaArg, FnPtrArg, Default)]
58+
pub struct loop_ {
59+
pub t: type_,
60+
}
5161
pub unsafe fn foo_0(
5262
mut as_: i32,
5363
mut async_: i32,
@@ -176,10 +186,49 @@ unsafe fn main_0() -> i32 {
176186
let mut raw_: i32 = 0;
177187
let mut safe_: i32 = 0;
178188
let mut vec_: i32 = 0;
189+
let mut l: loop_ = loop_ { t: type_ { v: 3 } };
190+
let mut t: type_ = l.t;
179191
return (unsafe {
180192
foo_0(
181-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
182-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
193+
0,
194+
0,
195+
0,
196+
0,
197+
0,
198+
0,
199+
0,
200+
0,
201+
0,
202+
0,
203+
0,
204+
0,
205+
0,
206+
0,
207+
0,
208+
0,
209+
0,
210+
0,
211+
0,
212+
0,
213+
0,
214+
0,
215+
0,
216+
0,
217+
0,
218+
0,
219+
0,
220+
0,
221+
0,
222+
0,
223+
0,
224+
0,
225+
0,
226+
0,
227+
0,
228+
0,
229+
0,
230+
0,
231+
((t.v) - (3)),
183232
)
184233
});
185234
}

0 commit comments

Comments
 (0)