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

Cleanups #34

Merged
merged 4 commits into from Feb 10, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -11,3 +11,5 @@
## Internal

- Test Windows targets in CI (#46, @tommilligan)
- Bump `ansi_term` version to 0.12 (#34, @waywardmonkeys)
- Code health improvements (#34, @waywardmonkeys)
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -22,7 +22,7 @@ travis-ci = { repository = "colin-kiegel/rust-pretty-assertions" }

[dependencies]
difference = "2.0.0"
ansi_term = "0.11.0"
ansi_term = "0.12.1"

[target.'cfg(windows)'.dependencies]
output_vt100 = "0.1.2"
Expand Down
10 changes: 5 additions & 5 deletions src/format_changeset.rs
Expand Up @@ -76,7 +76,7 @@ macro_rules! join {
(
$elem:ident in ($iter:expr) {
$( $body:tt )*
} seperated by {
} separated by {
$( $separator:tt )*
}
) => (
Expand All @@ -103,15 +103,15 @@ pub fn format_replacement(f: &mut dyn fmt::Write, added: &str, removed: &str) ->
Difference::Same(ref word_diff) => {
join!(chunk in (word_diff.split('\n')) {
paint!(f, Red, "{}", chunk)?;
} seperated by {
} separated by {
writeln!(f)?;
paint!(f, Red, "{}", SIGN_LEFT)?;
});
}
Difference::Rem(ref word_diff) => {
join!(chunk in (word_diff.split('\n')) {
paint!(f, Red.on(Fixed(52)).bold(), "{}", chunk)?;
} seperated by {
} separated by {
writeln!(f)?;
paint!(f, Red.bold(), "{}", SIGN_LEFT)?;
});
Expand All @@ -128,15 +128,15 @@ pub fn format_replacement(f: &mut dyn fmt::Write, added: &str, removed: &str) ->
Difference::Same(ref word_diff) => {
join!(chunk in (word_diff.split('\n')) {
paint!(f, Green, "{}", chunk)?;
} seperated by {
} separated by {
writeln!(f)?;
paint!(f, Green, "{}", SIGN_RIGHT)?;
});
}
Difference::Add(ref word_diff) => {
join!(chunk in (word_diff.split('\n')) {
paint!(f, Green.on(Fixed(22)).bold(), "{}", chunk)?;
} seperated by {
} separated by {
writeln!(f)?;
paint!(f, Green.bold(), "{}", SIGN_RIGHT)?;
});
Expand Down
26 changes: 12 additions & 14 deletions src/lib.rs
Expand Up @@ -14,31 +14,29 @@
//!
//! Yep — and you only need **one line of code** to make it happen:
//!
//! ```rust,ignore
//! ```rust
//! use pretty_assertions::{assert_eq, assert_ne};
//! ```
//!
//! <details>
//! <summary>Show the example behind the screenshots above.</summary>
//!
//! ```rust,ignore
//! ```rust,should_panic
//! // 1. add the `pretty_assertions` dependency to `Cargo.toml`.
//! // 2. insert this line at the top of each module, as needed
//! use pretty_assertions::{assert_eq, assert_ne};
//!
//! fn main() {
//! #[derive(Debug, PartialEq)]
//! struct Foo {
//! lorem: &'static str,
//! ipsum: u32,
//! dolor: Result<String, String>,
//! }
//! #[derive(Debug, PartialEq)]
//! struct Foo {
//! lorem: &'static str,
//! ipsum: u32,
//! dolor: Result<String, String>,
//! }
//!
//! let x = Some(Foo { lorem: "Hello World!", ipsum: 42, dolor: Ok("hey".to_string())});
//! let y = Some(Foo { lorem: "Hello Wrold!", ipsum: 42, dolor: Ok("hey ho!".to_string())});
//! let x = Some(Foo { lorem: "Hello World!", ipsum: 42, dolor: Ok("hey".to_string())});
//! let y = Some(Foo { lorem: "Hello Wrold!", ipsum: 42, dolor: Ok("hey ho!".to_string())});
//!
//! assert_eq!(x, y);
//! }
//! assert_eq!(x, y);
//! ```
//! </details>
//!
Expand All @@ -50,7 +48,7 @@
//!
//! Also add `#[cfg(test)]` to your `use` statements, like this:
//!
//! ```rust,ignore
//! ```rust
//! #[cfg(test)]
//! use pretty_assertions::{assert_eq, assert_ne};
//! ```
Expand Down