Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emoun/duplicate
Easy code duplicate with substitution for Rust
https://github.com/emoun/duplicate
Last synced: 1 day ago
JSON representation
Easy code duplicate with substitution for Rust
- Host: GitHub
- URL: https://github.com/emoun/duplicate
- Owner: Emoun
- License: apache-2.0
- Created: 2020-03-26T18:18:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-17T10:04:42.000Z (8 months ago)
- Last Synced: 2024-04-18T00:31:04.073Z (8 months ago)
- Language: Rust
- Size: 265 KB
- Stars: 220
- Watchers: 4
- Forks: 9
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
duplicate
=============================[![Rust](https://github.com/Emoun/duplicate/actions/workflows/rust.yml/badge.svg)](https://github.com/Emoun/duplicate/actions)
[![Latest Version](https://img.shields.io/crates/v/duplicate.svg)](https://crates.io/crates/duplicate)
[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/duplicate)macros for code duplication with substitution.
This document is meant for contributors to the crate. The documentation is hosted at [docs.rs](https://docs.rs/duplicate).
# Testing
#### Setup
This crate uses [macrotest](https://crates.io/crates/macrotest) for testing expansions.
Therefore, before running these tests the nightly compiler must be installed together with `rustfmt` and `cargo-expand`:```
cargo install --locked cargo-expand
rustup toolchain install nightly
rustup component add rustfmt
```The tests can then be run normally using `cargo test` as seen below.
#### Test Groups
Tests are divided into the following groups:
- `No Features`:
Tests the minimal API of the crate with no features enabled.```
cargo test --no-default-features
```- `Default Features`:
Test that the features that are enabled by default.```
cargo test
```- `All Feature Combinations`:
Tests any combination of features. After `--features` add a comma separated list of features to test:```
cargo test --no-default-features --features module_disambiguation,pretty_errors
```- `documentation`:
Tests code in the documentation. Even though some of the other test groups might test some of the documentaion code, they are not guaranteed to run all tests. E.g. the test of the cargo readme file (`cargo-readme.md` are only run when this command is used.
```
cargo test --doc --all-features
```#### Warnings
Compilation warnings are prohibited in this crate and cause CI failure.
However, this prohibition of off by default in the code to allow for warnings while work is still in progress.To make compilation fail on warnings, simply add `--features=fail-on-warnings` to your build/test command. E.g.:
```
cargo test --features=fail-on-warnings
```# Formatting
We use `rustfmt` to manage the formatting of this crate's code.
To have cargo format the code for you, you must have the nightly compiler installed (but not necessarily the default) and then run the command:```
cargo +nightly fmt
```The CI/CD will check the formatting and fail if it isn't formatted correctly.
# Release Deployment
Deployment of new versions of this crate is managed by CI/CD using git tags.
To trigger a new release, simply push a tag to the repository containing only the version number:```
git tag 1.0.0
git push --tags
```We do not use the `Cargo.toml` to manage the versioning of this crate.
The version given in it should not be changed!
It must remain as `0.0.0` so CI/CD can correctly modify it for every release.CI/CD will also reset the change log as part of the release, so do not change the `## [Unreleased]` line nor add an entry for new releases yourself.
CI/CD will also add the new release's changes to `cargo-readme.md` under the `Changelog` section. So do not touch that either.
#### License
Licensed under either of Apache License, Version
2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in this crate by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.