diff options
author | Joe Wilm <joe@jwilm.com> | 2018-03-09 13:49:47 -0800 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2018-06-02 09:56:50 -0700 |
commit | b0f655ac85ab6d86e9e482cbb9035200c6f08d40 (patch) | |
tree | 7cc0ec0a6d7f855557886bf0ab36b6217421af66 /src/term/mod.rs | |
parent | 688cabefc0bfc3224189c10235668eae5e5b0101 (diff) | |
download | alacritty-b0f655ac85ab6d86e9e482cbb9035200c6f08d40.tar.gz alacritty-b0f655ac85ab6d86e9e482cbb9035200c6f08d40.zip |
Make tests compile again
Some tests are still not passing, though.
A migration script was added to migrate serialized grids from
pre-scrollback to the current format. The script is included with this
commit for completeness, posterity, and as an example to be used in the
future.
A few tests in grid/tests.rs were removed due to becoming irrelevant.
Diffstat (limited to 'src/term/mod.rs')
-rw-r--r-- | src/term/mod.rs | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs index 198f8cea..7a50810e 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -2004,7 +2004,7 @@ mod tests { padding_y: 0.0, }; let mut term = Term::new(&Default::default(), size); - let mut grid: Grid<Cell> = Grid::new(Line(3), Column(5), &Cell::default()); + let mut grid: Grid<Cell> = Grid::new(Line(3), Column(5), 0, Cell::default()); for i in 0..5 { for j in 0..2 { grid[Line(j)][Column(i)].c = 'a'; @@ -2021,18 +2021,18 @@ mod tests { mem::swap(&mut term.semantic_escape_chars, &mut escape_chars); { - let selection = Selection::semantic(Point { line: Line(0), col: Column(1) }, &term); - assert_eq!(term.string_from_selection(&selection.to_span(&term).unwrap()), "aa"); + *term.selection_mut() = Some(Selection::semantic(Point { line: 2, col: Column(1) }, &term)); + assert_eq!(term.selection_to_string(), Some(String::from("aa"))); } { - let selection = Selection::semantic(Point { line: Line(0), col: Column(4) }, &term); - assert_eq!(term.string_from_selection(&selection.to_span(&term).unwrap()), "aaa"); + *term.selection_mut() = Some(Selection::semantic(Point { line: 2, col: Column(4) }, &term)); + assert_eq!(term.selection_to_string(), Some(String::from("aaa"))); } { - let selection = Selection::semantic(Point { line: Line(1), col: Column(1) }, &term); - assert_eq!(term.string_from_selection(&selection.to_span(&term).unwrap()), "aaa"); + *term.selection_mut() = Some(Selection::semantic(Point { line: 1, col: Column(1) }, &term)); + assert_eq!(term.selection_to_string(), Some(String::from("aaa"))); } } @@ -2047,7 +2047,7 @@ mod tests { padding_y: 0.0, }; let mut term = Term::new(&Default::default(), size); - let mut grid: Grid<Cell> = Grid::new(Line(1), Column(5), &Cell::default()); + let mut grid: Grid<Cell> = Grid::new(Line(1), Column(5), 0, Cell::default()); for i in 0..5 { grid[Line(0)][Column(i)].c = 'a'; } @@ -2057,10 +2057,8 @@ mod tests { mem::swap(&mut term.grid, &mut grid); - let selection = Selection::lines(Point { line: Line(0), col: Column(3) }); - if let Some(span) = selection.to_span(&term) { - assert_eq!(term.string_from_selection(&span), "\"aa\"a\n"); - } + *term.selection_mut() = Some(Selection::lines(Point { line: 0, col: Column(3) })); + assert_eq!(term.selection_to_string(), Some(String::from("\"aa\"a\n"))); } /// Check that the grid can be serialized back and forth losslessly @@ -2071,7 +2069,7 @@ mod tests { fn grid_serde() { let template = Cell::default(); - let grid = Grid::new(Line(24), Column(80), &template); + let grid: Grid<Cell> = Grid::new(Line(24), Column(80), 0, template); let serialized = serde_json::to_string(&grid).expect("ser"); let deserialized = serde_json::from_str::<Grid<Cell>>(&serialized) .expect("de"); |