diff --git a/Cargo.toml b/Cargo.toml index 43aa771..693d39a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,5 +16,5 @@ once_cell = "1.12.0" pretty_assertions = "1.3.0" serde = { version = "1.0.136", features = ["derive"] } serde_json = "1.0.79" -upon = "0.5.0" -yansi = "0.5.1" +upon = "0.8.1" +yansi = "1.0.1" diff --git a/README.md b/README.md index 71fc6c1..80f72c6 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ filename will be automatically determined based on the test file and test function name. Run tests with `GOLDIE_UPDATE=true` to automatically update golden files. -```rust +```no_run #[test] fn example() { let text = { /* ... run the test ... */ }; @@ -44,7 +44,7 @@ order to render the template. Values are rendered using You cannot use `GOLDIE_UPDATE=true` to automatically update templated golden files. -```rust +```no_run #[test] fn example() { let text = { /* ... run the test ... */ }; diff --git a/src/lib.rs b/src/lib.rs index 1af4081..528d622 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ //! function name. Run tests with `GOLDIE_UPDATE=true` to automatically update //! golden files. //! -//! ``` +//! ```no_run //! #[test] //! fn example() { //! let text = { /* ... run the test ... */ }; @@ -35,7 +35,7 @@ //! You cannot use `GOLDIE_UPDATE=true` to automatically update templated golden //! files. //! -//! ``` +//! ```no_run //! #[test] //! fn example() { //! let text = { /* ... run the test ... */ }; @@ -219,7 +219,8 @@ impl Goldie { let expected = ENGINE .compile(&contents) .with_context(|| self.error("failed to compile golden file template"))? - .render(&ctx) + .render(&ENGINE, &ctx) + .to_string() .with_context(|| self.error("failed to render golden file template"))?; pretty_assertions::assert_eq!( @@ -264,12 +265,12 @@ impl Goldie { } fn error(&self, msg: &str) -> String { - use yansi::Color; + use yansi::Paint; format!( "\n\n{}: {}\nrun with {} to regenerate the golden file\n\n", - Color::Red.paint(msg), + msg.red(), self.golden_file.display(), - Color::Blue.paint("GOLDIE_UPDATE=1").bold(), + "GOLDIE_UPDATE=1".blue().bold(), ) } }