Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit a569cb4

Browse files
committed
Fix test
1 parent 9a3d98d commit a569cb4

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

example/mini_core_hello_world.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ unsafe extern "C" fn my_puts(s: *const i8) {
1111
puts(s);
1212
}
1313

14+
macro_rules! assert {
15+
($e:expr) => {
16+
if !$e {
17+
panic(stringify!(! $e));
18+
}
19+
};
20+
}
21+
22+
macro_rules! assert_eq {
23+
($l:expr, $r: expr) => {
24+
if $l != $r {
25+
panic(stringify!($l != $r));
26+
}
27+
}
28+
}
29+
1430
#[lang = "termination"]
1531
trait Termination {
1632
fn report(self) -> i32;
@@ -20,8 +36,9 @@ impl Termination for () {
2036
fn report(self) -> i32 {
2137
unsafe {
2238
NUM = 6 * 7 + 1 + (1u8 == 1u8) as u8; // 44
23-
*NUM_REF as i32
39+
assert_eq!(*NUM_REF as i32, 44);
2440
}
41+
0
2542
}
2643
}
2744

@@ -82,29 +99,12 @@ fn start<T: Termination + 'static>(
8299
unsafe { puts(*((argv as usize + 2 * intrinsics::size_of::<*const u8>()) as *const *const i8)); }
83100
}
84101

85-
main().report();
86-
0
102+
main().report() as isize
87103
}
88104

89105
static mut NUM: u8 = 6 * 7;
90106
static NUM_REF: &'static u8 = unsafe { &NUM };
91107

92-
macro_rules! assert {
93-
($e:expr) => {
94-
if !$e {
95-
panic(stringify!(! $e));
96-
}
97-
};
98-
}
99-
100-
macro_rules! assert_eq {
101-
($l:expr, $r: expr) => {
102-
if $l != $r {
103-
panic(stringify!($l != $r));
104-
}
105-
}
106-
}
107-
108108
struct Unique<T: ?Sized> {
109109
pointer: *const T,
110110
_marker: PhantomData<T>,

0 commit comments

Comments
 (0)