From 30ca9ad72c4e3c6e6c43d251f486cf69728fae13 Mon Sep 17 00:00:00 2001 From: Phuntsok Drak-pa Date: Thu, 14 Feb 2019 01:03:51 +0100 Subject: [PATCH 1/5] added output_vt100 and ctor dependencies --- Cargo.toml | 2 ++ src/lib.rs | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 8f33a04..3488504 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,3 +18,5 @@ travis-ci = { repository = "colin-kiegel/rust-pretty-assertions" } [dependencies] difference = "2.0.0" ansi_term = "0.11" +output_vt100 = { git = "https://github.com/Phundrak/output-vt100-rs", branch = "master" } +ctor = "0.1.7" diff --git a/src/lib.rs b/src/lib.rs index a388b3c..e22208b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,7 @@ //! //! When writing tests in Rust, you'll probably use `assert_eq!(a, b)` _a lot_. //! -//! If such a test fails, it will present all the details of `a` and `b`. +//! If such a test fails, it will present all the details of `a` and `b`. //! But you have to spot the differences yourself, which is not always straightforward, //! like here: //! @@ -67,6 +67,8 @@ extern crate difference; extern crate ansi_term; +extern crate output_vt100; +extern crate ctor; mod format_changeset; use std::fmt::{self, Debug, Display}; @@ -75,6 +77,12 @@ use difference::Changeset; use format_changeset::format_changeset; pub use ansi_term::Style; +use ctor::*; +#[ctor] +fn init() { + output_vt100::init(); +} + #[doc(hidden)] pub struct Comparison(Changeset); From 50cadaf75731b1ff98f9476a6e1c7d6f6b6a4fac Mon Sep 17 00:00:00 2001 From: Phuntsok Drak-pa Date: Thu, 14 Feb 2019 02:13:34 +0100 Subject: [PATCH 2/5] changed dependency to crates.io --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 3488504..fd0bcd1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,5 +18,5 @@ travis-ci = { repository = "colin-kiegel/rust-pretty-assertions" } [dependencies] difference = "2.0.0" ansi_term = "0.11" -output_vt100 = { git = "https://github.com/Phundrak/output-vt100-rs", branch = "master" } +output_vt100 = "0.1.0" ctor = "0.1.7" From 98182f70112da489ba3aaa4b826f942b573d75a4 Mon Sep 17 00:00:00 2001 From: Phuntsok Drak-pa Date: Thu, 14 Feb 2019 13:59:31 +0100 Subject: [PATCH 3/5] Updated dependency `output_vt100` --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index fd0bcd1..73e89d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,5 +18,5 @@ travis-ci = { repository = "colin-kiegel/rust-pretty-assertions" } [dependencies] difference = "2.0.0" ansi_term = "0.11" -output_vt100 = "0.1.0" +output_vt100 = "0.1" ctor = "0.1.7" From b2c70fe450911bc2611e91ae0d45f1681cfb2262 Mon Sep 17 00:00:00 2001 From: nbouteme Date: Wed, 20 Feb 2019 14:17:58 +0100 Subject: [PATCH 4/5] Enable output_vt100 and ctor on Windows targets only --- Cargo.toml | 2 ++ src/lib.rs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 73e89d2..a8f7e45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,5 +18,7 @@ travis-ci = { repository = "colin-kiegel/rust-pretty-assertions" } [dependencies] difference = "2.0.0" ansi_term = "0.11" + +[target.'cfg(windows)'.dependencies] output_vt100 = "0.1" ctor = "0.1.7" diff --git a/src/lib.rs b/src/lib.rs index e22208b..057349e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -67,8 +67,12 @@ extern crate difference; extern crate ansi_term; + +#[cfg(windows)] extern crate output_vt100; +#[cfg(windows)] extern crate ctor; + mod format_changeset; use std::fmt::{self, Debug, Display}; @@ -77,7 +81,9 @@ use difference::Changeset; use format_changeset::format_changeset; pub use ansi_term::Style; +#[cfg(windows)] use ctor::*; +#[cfg(windows)] #[ctor] fn init() { output_vt100::init(); From f33286c3ae2669a2b5d8a72b81860c4f9c51e54d Mon Sep 17 00:00:00 2001 From: nbouteme Date: Wed, 20 Feb 2019 14:21:54 +0100 Subject: [PATCH 5/5] Update notes --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d07cf7f..e593348 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,8 @@ extern crate pretty_assertions; you include. * `assert_ne` is also switched to multi-line presentation, but does _not_ show a diff. +* Under Windows, the terminal state is modified to properly handle VT100 + escape sequences, which may break display for certain use cases. ## License