Skip to content

Commit

Permalink
Prepare for crates.io upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarcho committed Jan 24, 2020
1 parent 8c90a82 commit 575c39b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ version = "1.0.0"
authors = ["Jason Newcomb <jsnewcomb@pm.me>"]
edition = "2018"
license = "MIT OR Apache-2.0"
repository = "https://github.com/Jarcho/test-cdylib-rs"
repository = "https://github.com/Jarcho/test-cdylib"
description = "Library for dynamically linking to cdylib projects from test code."
exclude = [
"test-self-as-cdylib/*",
".github/*",
]
readme = "README.md"

[workspace]
Expand All @@ -14,7 +19,7 @@ members = ["test-self-as-cdylib"]
serde = { version = "1.0.103", features = ["derive"] }
serde_json = "1.0"
toml = "0.5.2"
cargo_metadata = "0.9"
cargo_metadata = "0.9.0"

[dev-dependencies]
dlopen = "0.1.8"
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# test-cdylib

![Build Status](https://github.com/Jarcho/test-cdylib/workflows/Continuous%20integration/badge.svg?branch=master&event=push)
[![Rustc Version 1.31+](https://img.shields.io/badge/rustc-1.31+-lightgray.svg)](https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html)

test-cdylib is a library for dynamically linking to cdylib projects from
test code. This allows testing for the existence of exported items.

Expand All @@ -13,7 +16,7 @@ A cdylib project can be tested like this:
```rust
#[test]
fn api_test() {
let dylib_path = test_cdylib::build_project();
let dylib_path = test_cdylib::build_current_project();

// Or load the shared library using any other method of your choice.
let dylib = dlopen::symbor::Library::open(&dylib_path).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//! ```no_run
//! #[test]
//! fn api_test() {
//! let dylib_path = test_cdylib::build_project();
//! let dylib_path = test_cdylib::build_current_project();
//!
//! // Or load the shared library using any other method of your choice.
//! let dylib = dlopen::symbor::Library::open(&dylib_path).unwrap();
Expand Down Expand Up @@ -61,6 +61,6 @@ pub fn build_file<P: AsRef<Path>>(path: P) -> PathBuf {
}

/// Builds the current project as a cdylib and returns the path to the compiled object.
pub fn build_project() -> PathBuf {
pub fn build_current_project() -> PathBuf {
cargo::build_self_cdylib().unwrap()
}
2 changes: 1 addition & 1 deletion test-self-as-cdylib/tests/tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[test]
pub fn load_lib() {
let dylib = test_cdylib::build_project();
let dylib = test_cdylib::build_current_project();
let dylib = dlopen::symbor::Library::open(&dylib)
.expect(&format!("failed to open library: {}", dylib.display()));
let identity = unsafe {
Expand Down

0 comments on commit 575c39b

Please sign in to comment.