Skip to content

Commit fff4644

Browse files
Improve entry macro tests (#471)
1 parent d3206d6 commit fff4644

16 files changed

+118
-86
lines changed

uefi-macros/tests/ui/entry.rs

Lines changed: 0 additions & 45 deletions
This file was deleted.

uefi-macros/tests/ui/entry.stderr

Lines changed: 0 additions & 41 deletions
This file was deleted.

uefi-macros/tests/ui/entry_bad_abi.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![allow(unused_imports)]
2+
#![no_main]
3+
#![feature(abi_efiapi)]
4+
5+
use uefi::prelude::*;
6+
use uefi_macros::entry;
7+
8+
#[entry]
9+
extern "C" fn main(_handle: Handle, _st: SystemTable<Boot>) -> Status {
10+
Status::SUCCESS
11+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
error: Entry method must have no ABI modifier
2+
--> tests/ui/entry_bad_abi.rs:9:1
3+
|
4+
9 | extern "C" fn main(_handle: Handle, _st: SystemTable<Boot>) -> Status {
5+
| ^^^^^^^^^^

uefi-macros/tests/ui/entry_bad_arg.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![allow(unused_imports)]
2+
#![no_main]
3+
#![feature(abi_efiapi)]
4+
5+
use uefi::prelude::*;
6+
use uefi_macros::entry;
7+
8+
#[entry]
9+
fn main(_handle: Handle, _st: SystemTable<Boot>, _x: usize) -> Status {
10+
Status::SUCCESS
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error[E0308]: mismatched types
2+
--> tests/ui/entry_bad_arg.rs:9:4
3+
|
4+
9 | fn main(_handle: Handle, _st: SystemTable<Boot>, _x: usize) -> Status {
5+
| ^^^^ incorrect number of function parameters
6+
|
7+
= note: expected fn pointer `extern "efiapi" fn(uefi::Handle, uefi::table::SystemTable<uefi::table::Boot>) -> uefi::Status`
8+
found fn item `extern "efiapi" fn(uefi::Handle, uefi::table::SystemTable<uefi::table::Boot>, usize) -> uefi::Status {main}`
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![allow(unused_imports)]
2+
#![no_main]
3+
#![feature(abi_efiapi)]
4+
5+
use uefi::prelude::*;
6+
use uefi_macros::entry;
7+
8+
#[entry]
9+
async fn main(_handle: Handle, _st: SystemTable<Boot>) -> Status {
10+
Status::SUCCESS
11+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
error: Entry method should not be async
2+
--> tests/ui/entry_bad_async.rs:9:1
3+
|
4+
9 | async fn main(_handle: Handle, _st: SystemTable<Boot>) -> Status {
5+
| ^^^^^
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![allow(unused_imports)]
2+
#![no_main]
3+
#![feature(abi_efiapi)]
4+
5+
use uefi::prelude::*;
6+
use uefi_macros::entry;
7+
8+
#[entry(some_arg)]
9+
fn main(_handle: Handle, _st: SystemTable<Boot>) -> Status {
10+
Status::SUCCESS
11+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
error: Entry attribute accepts no arguments
2+
--> tests/ui/entry_bad_attr_arg.rs:8:9
3+
|
4+
8 | #[entry(some_arg)]
5+
| ^^^^^^^^

0 commit comments

Comments
 (0)