Skip to main content

fidius_test/
lib.rs

1// Copyright 2026 Colliery, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Testing helpers for Fidius plugin authors and hosts.
16//!
17//! This crate provides the infrastructure the Fidius codebase uses internally
18//! for its own tests, now exposed so downstream users don't have to reinvent
19//! the wheel. Add it under `[dev-dependencies]` and you get:
20//!
21//! - [`dylib_fixture`] — build a plugin crate's cdylib via `cargo build`,
22//!   cached across tests in the same process. Optional signing via
23//!   [`DylibFixtureBuilder::signed_with`].
24//! - [`signing::fixture_keypair`] — deterministic Ed25519 keypair for tests.
25//! - [`signing::sign_dylib`] — produce a `.sig` file next to a dylib.
26//!
27//! # Example
28//!
29//! ```ignore
30//! use fidius_test::dylib_fixture;
31//! use fidius_host::PluginHost;
32//!
33//! #[test]
34//! fn loads_plugin() {
35//!     let fixture = dylib_fixture("./path/to/my-plugin").build();
36//!     let host = PluginHost::builder()
37//!         .search_path(fixture.dir())
38//!         .build()
39//!         .unwrap();
40//!     let plugins = host.discover().unwrap();
41//!     assert!(!plugins.is_empty());
42//! }
43//! ```
44
45pub mod dylib;
46pub mod signing;
47
48pub use dylib::{dylib_fixture, DylibFixture, DylibFixtureBuilder};
49pub use signing::{fixture_keypair, fixture_keypair_with_seed, sign_dylib};