diff options
author | Joe Wilm <joe@jwilm.com> | 2017-04-03 20:21:55 -0700 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-04-03 20:44:23 -0700 |
commit | 79576b6c0b45868caeef36c5255720a7de6e57de (patch) | |
tree | 4edf7dc740601c75bf83dabeb0247c5145753d45 /tests | |
parent | a66d19f6337e1dfc756680b8fcb960f84453e783 (diff) | |
download | alacritty-79576b6c0b45868caeef36c5255720a7de6e57de.tar.gz alacritty-79576b6c0b45868caeef36c5255720a7de6e57de.zip |
Add better printing for ref test failure
The previous format was extremely difficult for a human to parse.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ref.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/ref.rs b/tests/ref.rs index 98f1ed4a..7a78ec73 100644 --- a/tests/ref.rs +++ b/tests/ref.rs @@ -7,9 +7,11 @@ use std::path::Path; use alacritty::Grid; use alacritty::Term; +use alacritty::ansi; +use alacritty::index::{Line, Column}; use alacritty::term::Cell; use alacritty::term::SizeInfo; -use alacritty::ansi; +use alacritty::util::fmt::{Red, Green}; macro_rules! ref_tests { ($($name:ident)*) => { @@ -71,5 +73,19 @@ fn ref_test(dir: &Path) { parser.advance(&mut terminal, byte, &mut io::sink()); } + if grid != *terminal.grid() { + for (i, row) in terminal.grid().iter_rows().enumerate() { + for (j, cell) in row.iter().enumerate() { + let original_cell = &grid[Line(i)][Column(j)]; + if *original_cell != *cell { + println!("[{i}][{j}] {original:?} => {now:?}", + i=i, j=j, original=Green(original_cell), now=Red(cell)); + } + } + } + + panic!("Ref test failed; grid doesn't match"); + } + assert_eq!(grid, *terminal.grid()); } |