diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 33c9a5c902..619164cb87 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -184,6 +184,8 @@ jobs: run: cargo clippy -p test_interop - name: Clippy test_lib run: cargo clippy -p test_lib + - name: Clippy test_linux + run: cargo clippy -p test_linux - name: Clippy test_literals run: cargo clippy -p test_literals - name: Clippy test_match @@ -216,8 +218,6 @@ jobs: run: cargo clippy -p test_return_struct - name: Clippy test_riddle run: cargo clippy -p test_riddle - - name: Clippy test_simple_component - run: cargo clippy -p test_simple_component - name: Clippy test_standalone run: cargo clippy -p test_standalone - name: Clippy test_string_param diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 6b8008b00b..9b520b21f6 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -19,5 +19,5 @@ jobs: uses: actions/checkout@v4 - name: Update toolchain run: rustup update --no-self-update stable && rustup default stable - - name: Run cargo build - run: cargo build -p test_simple_component --target x86_64-unknown-linux-gnu + - name: Run cargo test + run: cargo test -p test_linux --target x86_64-unknown-linux-gnu diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ef7c99562f..6b1d7685a7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -210,6 +210,8 @@ jobs: run: cargo test -p test_interop --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_lib run: cargo test -p test_lib --target ${{ matrix.target }} ${{ matrix.etc }} + - name: Test test_linux + run: cargo test -p test_linux --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_literals run: cargo test -p test_literals --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_match @@ -242,8 +244,6 @@ jobs: run: cargo test -p test_return_struct --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_riddle run: cargo test -p test_riddle --target ${{ matrix.target }} ${{ matrix.etc }} - - name: Test test_simple_component - run: cargo test -p test_simple_component --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_standalone run: cargo test -p test_standalone --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_string_param diff --git a/crates/tests/simple_component/Cargo.toml b/crates/tests/linux/Cargo.toml similarity index 71% rename from crates/tests/simple_component/Cargo.toml rename to crates/tests/linux/Cargo.toml index 489720165f..07160329f3 100644 --- a/crates/tests/simple_component/Cargo.toml +++ b/crates/tests/linux/Cargo.toml @@ -1,14 +1,12 @@ [package] -name = "test_simple_component" +name = "test_linux" version = "0.0.0" edition = "2021" publish = false -[lib] -crate-type = ["cdylib"] - [dependencies.windows] path = "../../libs/windows" features = [ + "Foundation", "Win32_Foundation", ] diff --git a/crates/tests/linux/src/lib.rs b/crates/tests/linux/src/lib.rs new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/crates/tests/linux/src/lib.rs @@ -0,0 +1 @@ + diff --git a/crates/tests/linux/tests/strings.rs b/crates/tests/linux/tests/strings.rs new file mode 100644 index 0000000000..e02d3cc681 --- /dev/null +++ b/crates/tests/linux/tests/strings.rs @@ -0,0 +1,13 @@ +use windows::core::*; + +#[test] +fn test() { + unsafe { + let s: PCSTR = s!("hello world"); + assert_eq!(s.to_string().unwrap(), "hello world"); + + // TODO: https://github.com/microsoft/windows-rs/pull/3004 should enable the following test. + // let w: PCWSTR = w!("wide world"); + // assert_eq!(w.to_string().unwrap(), "wide world"); + } +} diff --git a/crates/tests/simple_component/src/lib.rs b/crates/tests/simple_component/src/lib.rs deleted file mode 100644 index 8b5aac26fd..0000000000 --- a/crates/tests/simple_component/src/lib.rs +++ /dev/null @@ -1,10 +0,0 @@ -use windows::{core::*, Win32::Foundation::*}; - -#[no_mangle] -unsafe extern "system" fn DllGetActivationFactory( - _name: std::mem::ManuallyDrop, - result: *mut *mut std::ffi::c_void, -) -> HRESULT { - *result = std::ptr::null_mut(); - CLASS_E_CLASSNOTAVAILABLE -}