Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
422 changes: 402 additions & 20 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ criterion = "0.5.1"
difference = "2.0.0"
glob = "0.3.1"
serde = { version = "1.0.197", features = ["derive"] }
snapbox = { version = "0.5.8", features = ["diff", "harness", "path", "term-svg"] }
toml = "0.5.11"

[[bench]]
name = "simple"
harness = false

[[test]]
name = "fixtures"
harness = false

[features]
default = []
testing-colors = []
63 changes: 0 additions & 63 deletions tests/diff/mod.rs

This file was deleted.

File renamed without changes.
33 changes: 33 additions & 0 deletions tests/fixtures/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
mod deserialize;

use crate::deserialize::Fixture;
use annotate_snippets::{Renderer, Snippet};
use snapbox::data::DataFormat;
use snapbox::Data;
use std::error::Error;

fn main() {
#[cfg(not(windows))]
snapbox::harness::Harness::new("tests/fixtures/", setup, test)
.select(["*/*.toml"])
.action_env("SNAPSHOTS")
.test();
}

fn setup(input_path: std::path::PathBuf) -> snapbox::harness::Case {
let name = input_path.file_name().unwrap().to_str().unwrap().to_owned();
let expected = input_path.with_extension("svg");
snapbox::harness::Case {
name,
fixture: input_path,
expected,
}
}

fn test(input_path: &std::path::Path) -> Result<Data, Box<dyn Error>> {
let src = std::fs::read_to_string(input_path)?;
let (renderer, snippet): (Renderer, Snippet<'_>) =
toml::from_str(&src).map(|a: Fixture| (a.renderer.into(), a.snippet.into()))?;
let actual = renderer.render(snippet).to_string();
Ok(Data::from(actual).coerce_to(DataFormat::TermSvg))
}
35 changes: 35 additions & 0 deletions tests/fixtures/no-color/issue_52.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 0 additions & 7 deletions tests/fixtures/no-color/issue_52.txt

This file was deleted.

45 changes: 45 additions & 0 deletions tests/fixtures/no-color/issue_9.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 0 additions & 12 deletions tests/fixtures/no-color/issue_9.txt

This file was deleted.

49 changes: 49 additions & 0 deletions tests/fixtures/no-color/multiline_annotation.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 0 additions & 14 deletions tests/fixtures/no-color/multiline_annotation.txt

This file was deleted.

39 changes: 39 additions & 0 deletions tests/fixtures/no-color/multiline_annotation2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 0 additions & 9 deletions tests/fixtures/no-color/multiline_annotation2.txt

This file was deleted.

39 changes: 39 additions & 0 deletions tests/fixtures/no-color/multiline_annotation3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 0 additions & 9 deletions tests/fixtures/no-color/multiline_annotation3.txt

This file was deleted.

Loading