Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fix for standalone generation of individual enumerators #2434

Merged
merged 1 commit into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/libs/bindgen/src/standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn standalone(names: &[&str]) -> String {

let mut type_names = BTreeSet::new();
let mut core_types = BTreeSet::new();
let mut enums = BTreeMap::new();
let mut enums = BTreeSet::new();

for name in names {
let type_name = TypeName::parse(name);
Expand Down Expand Up @@ -95,7 +95,7 @@ pub fn standalone(names: &[&str]) -> String {
found = true;
let enum_name = gen.reader.type_def_type_name(def);
type_names.insert(enum_name);
enums.insert(enum_name, type_name.name);
enums.insert((enum_name, type_name.name));
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion crates/tests/standalone/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ fn main() {

write(
"src/b_enumerator.rs",
&["Windows.Win32.Foundation.WAIT_IO_COMPLETION"],
&[
"Windows.Win32.Foundation.WAIT_IO_COMPLETION",
"Windows.Win32.Foundation.WAIT_TIMEOUT",
],
);

write(
Expand Down
1 change: 1 addition & 0 deletions crates/tests/standalone/src/b_enumerator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
)]
pub type WIN32_ERROR = u32;
pub const WAIT_IO_COMPLETION: WIN32_ERROR = 192u32;
pub const WAIT_TIMEOUT: WIN32_ERROR = 258u32;
6 changes: 6 additions & 0 deletions crates/tests/standalone/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ fn unknown() {
}
}

#[test]
fn enumerator() {
assert_eq!(b_enumerator::WAIT_IO_COMPLETION, 192);
assert_eq!(b_enumerator::WAIT_TIMEOUT, 258);
}

#[test]
fn test() {
use b_test::*;
Expand Down