Skip to content

Commit fca2260

Browse files
committed
default input
1 parent 06c7bd3 commit fca2260

File tree

6 files changed

+28
-7
lines changed

6 files changed

+28
-7
lines changed

crates/libs/bindgen/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ where
145145
}
146146

147147
if input.is_empty() {
148-
panic!("at least one `--in` is required");
148+
input.push("default");
149149
};
150150

151151
if output.is_empty() {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![allow(
2+
non_snake_case,
3+
non_upper_case_globals,
4+
non_camel_case_types,
5+
dead_code,
6+
clippy::all
7+
)]
8+
9+
windows_targets::link!("kernel32.dll" "system" fn GetTickCount() -> u32);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![allow(
2+
non_snake_case,
3+
non_upper_case_globals,
4+
non_camel_case_types,
5+
dead_code,
6+
clippy::all
7+
)]
8+
9+
windows_targets::link!("kernel32.dll" "system" fn GetTickCount() -> u32);

crates/tests/bindgen/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ pub mod core_sys_flat_no_core;
1212
pub mod core_sys_no_core;
1313
pub mod core_win;
1414
pub mod core_win_flat;
15+
pub mod default_assumed;
16+
pub mod default_default;
1517
pub mod delegate;
1618
pub mod delegate_generic;
1719
pub mod deps;

crates/tests/bindgen/tests/panic.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1+
#[track_caller]
12
fn bindgen(args: &str) {
23
windows_bindgen::bindgen(args.split_whitespace());
34
}
45

5-
#[test]
6-
#[should_panic(expected = "at least one `--in` is required")]
7-
fn at_least_one_input() {
8-
bindgen("");
9-
}
10-
116
#[test]
127
#[should_panic(expected = "exactly one `--out` is required")]
138
fn at_least_one_output() {

crates/tools/bindgen/src/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ fn main() {
132132
// Tests for sort order
133133
test("--out sort.rs --filter E_FAIL S_FALSE E_OUTOFMEMORY ERROR_OUTOFMEMORY Windows.Foundation.Rect RECT GetTickCount FatalExit --sys --no-core");
134134

135+
// Tests input defaults
136+
test_raw(
137+
"--out default_default.rs --filter GetTickCount --sys --flat --no-comment --in default",
138+
);
139+
test_raw("--out default_assumed.rs --filter GetTickCount --sys --flat --no-comment");
140+
135141
// Tests for header elements
136142
test_raw("--out comment.rs --in default --filter GetTickCount --sys --flat");
137143
test_raw(

0 commit comments

Comments
 (0)