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

Organize library tests #3499

Merged
merged 3 commits into from
Feb 20, 2025
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 .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ jobs:
run: cargo clippy -p test_arch_feature
- name: Clippy test_array
run: cargo clippy -p test_array
- name: Clippy test_async
run: cargo clippy -p test_async
- name: Clippy test_bcrypt
run: cargo clippy -p test_bcrypt
- name: Clippy test_bindgen
Expand Down Expand Up @@ -193,6 +191,8 @@ jobs:
run: cargo clippy -p test_events_client
- name: Clippy test_extensions
run: cargo clippy -p test_extensions
- name: Clippy test_future
run: cargo clippy -p test_future
- name: Clippy test_handles
run: cargo clippy -p test_handles
- name: Clippy test_implement
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/raw-dylib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ jobs:
run: cargo clean
- name: Test test_array
run: cargo test -p test_array --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_async
run: cargo test -p test_async --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_bcrypt
run: cargo test -p test_bcrypt --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_bindgen
Expand Down Expand Up @@ -222,6 +220,8 @@ jobs:
run: cargo test -p test_events_client --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_extensions
run: cargo test -p test_extensions --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_future
run: cargo test -p test_future --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_handles
run: cargo test -p test_handles --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_implement
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ jobs:
run: cargo clean
- name: Test test_array
run: cargo test -p test_array --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_async
run: cargo test -p test_async --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_bcrypt
run: cargo test -p test_bcrypt --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_bindgen
Expand Down Expand Up @@ -219,6 +217,8 @@ jobs:
run: cargo test -p test_events_client --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_extensions
run: cargo test -p test_extensions --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_future
run: cargo test -p test_future --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_handles
run: cargo test -p test_handles --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_implement
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ members = [
"crates/samples/windows/*",
"crates/samples/components/*",
"crates/targets/*",
"crates/tests/bindgen",
"crates/tests/misc/*",
"crates/tests/winrt/*",
"crates/tests/libs/*",
"crates/tools/*",
]
exclude = [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ fn file_not_found() {
}

#[test]
#[should_panic(expected = "failed to read file lines `../../libs/bindgen/default/Windows.winmd`")]
#[should_panic(
expected = "failed to read file lines `../../../libs/bindgen/default/Windows.winmd`"
)]
fn not_text_file() {
bindgen("--etc ../../libs/bindgen/default/Windows.winmd");
bindgen("--etc ../../../libs/bindgen/default/Windows.winmd");
}

#[test]
Expand Down Expand Up @@ -106,15 +108,15 @@ fn input_directory_empty() {
}

#[test]
#[should_panic(expected = "failed to read .winmd format `../../libs/bindgen/default/readme.md`")]
#[should_panic(expected = "failed to read .winmd format `../../../libs/bindgen/default/readme.md`")]
fn invalid_input_format() {
bindgen("--in ../../libs/bindgen/default/readme.md --out out.txt --filter POINT");
bindgen("--in ../../../libs/bindgen/default/readme.md --out out.txt --filter POINT");
}

#[test]
#[should_panic(expected = "type not found: `POINT`")]
fn no_default() {
bindgen("--in ../../libs/bindgen/default/Windows.winmd --out out.txt --filter POINT");
bindgen("--in ../../../libs/bindgen/default/Windows.winmd --out out.txt --filter POINT");
}

#[test]
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "test_async"
name = "test_future"
version = "0.0.0"
edition = "2021"
publish = false
Expand Down
10 changes: 5 additions & 5 deletions crates/tools/bindgen/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Regenerates bindings sources for `crates/tests/bindgen`
//! Regenerates bindings sources for `crates/tests/libs/bindgen`

use std::path::Path;
use windows_bindgen::bindgen;
Expand All @@ -16,14 +16,14 @@ fn test_raw(args: &str) {
fn main() {
let time = std::time::Instant::now();

if !Path::new("crates/tests/bindgen/Cargo.toml").exists() {
if !Path::new("crates/tests/libs/bindgen/Cargo.toml").exists() {
println!("This tool must be run from the root of the repo.");
std::process::exit(1);
}

std::fs::remove_dir_all("crates/tests/bindgen/src").unwrap();
std::fs::create_dir_all("crates/tests/bindgen/src").unwrap();
std::env::set_current_dir("crates/tests/bindgen/src").unwrap();
std::fs::remove_dir_all("crates/tests/libs/bindgen/src").unwrap();
std::fs::create_dir_all("crates/tests/libs/bindgen/src").unwrap();
std::env::set_current_dir("crates/tests/libs/bindgen/src").unwrap();
std::fs::write("lib.rs", "").unwrap();

// Test interactions with core types and namespaces
Expand Down