Skip to content

Commit bf1abb1

Browse files
committed
Update tests
1 parent c7275f1 commit bf1abb1

6 files changed

Lines changed: 26 additions & 2 deletions

File tree

tests/unit/out/refcount/string_literals.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,12 @@ fn main_0() -> i32 {
6060
let _str: Ptr<u8> = (immutable_empty_arr.as_pointer() as Ptr<u8>);
6161
foo_const_1(_str)
6262
});
63+
let inited_through_init_list: Value<Box<[u8]>> = Rc::new(RefCell::new(Box::<[u8]>::from(
64+
b"papanasi cu smantana\0".as_slice(),
65+
)));
66+
({
67+
let _str: Ptr<u8> = (inited_through_init_list.as_pointer() as Ptr<u8>);
68+
foo_const_1(_str)
69+
});
6370
return 0;
6471
}

tests/unit/out/refcount/string_literals_c.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,12 @@ fn main_0() -> i32 {
9191
let _str: Ptr<u8> = (immutable_empty_arr.as_pointer() as Ptr<u8>);
9292
foo_const_1(_str)
9393
});
94+
let inited_through_init_list: Value<Box<[u8]>> = Rc::new(RefCell::new(Box::<[u8]>::from(
95+
b"papanasi cu smantana\0".as_slice(),
96+
)));
97+
({
98+
let _str: Ptr<u8> = (inited_through_init_list.as_pointer() as Ptr<u8>);
99+
foo_const_1(_str)
100+
});
94101
return 0;
95102
}

tests/unit/out/unsafe/string_literals.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,10 @@ unsafe fn main_0() -> i32 {
4949
let _str: *const u8 = immutable_empty_arr.as_ptr();
5050
foo_const_1(_str)
5151
});
52+
let inited_through_init_list: [u8; 21] = *b"papanasi cu smantana\0";
53+
(unsafe {
54+
let _str: *const u8 = inited_through_init_list.as_ptr();
55+
foo_const_1(_str)
56+
});
5257
return 0;
5358
}

tests/unit/out/unsafe/string_literals_c.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,10 @@ unsafe fn main_0() -> i32 {
8484
let _str: *const u8 = immutable_empty_arr.as_ptr();
8585
foo_const_1(_str)
8686
});
87+
let inited_through_init_list: [u8; 21] = *b"papanasi cu smantana\0";
88+
(unsafe {
89+
let _str: *const u8 = inited_through_init_list.as_ptr();
90+
foo_const_1(_str)
91+
});
8792
return 0;
8893
}

tests/unit/string_literals.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ int main() {
2323
foo_const(immutable_empty);
2424
foo_const(immutable_empty_arr);
2525

26-
const char inited_through_init_list[] = { "papanasi cu smantana" };
26+
const char inited_through_init_list[] = {"papanasi cu smantana"};
2727
foo_const(inited_through_init_list);
2828

2929
return 0;

tests/unit/string_literals_c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ int main() {
3232
foo_const(mutable_empty_arr);
3333
foo_const(immutable_empty_arr);
3434

35-
const char inited_through_init_list[] = { "papanasi cu smantana" };
35+
const char inited_through_init_list[] = {"papanasi cu smantana"};
3636
foo_const(inited_through_init_list);
3737

3838
return 0;

0 commit comments

Comments
 (0)