aboutsummaryrefslogtreecommitdiff
path: root/src/term
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2017-06-17 10:29:59 -0700
committerJoe Wilm <jwilm@users.noreply.github.com>2017-06-19 21:31:50 -0700
commitf12fd880fe0b60de050aa23097df59237452a40c (patch)
treee21e91157078de297356bb6e146ff3ea6a3e6288 /src/term
parent6b081dcc95f08ac61e7f29033bbf0394ccff3472 (diff)
downloadr-alacritty-f12fd880fe0b60de050aa23097df59237452a40c.tar.gz
r-alacritty-f12fd880fe0b60de050aa23097df59237452a40c.tar.bz2
r-alacritty-f12fd880fe0b60de050aa23097df59237452a40c.zip
Update tests for new Selection API
Diffstat (limited to 'src/term')
-rw-r--r--src/term/mod.rs20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs
index cd7ffadd..8563be54 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -1841,21 +1841,18 @@ mod tests {
mem::swap(&mut term.semantic_escape_chars, &mut escape_chars);
{
- let mut selection = Selection::new(grid.num_lines(), grid.num_cols());
- term.semantic_selection(&mut selection, Point { line: Line(0), col: Column(1) });
- assert_eq!(term.string_from_selection(&selection.span().unwrap()), "aa");
+ let selection = Selection::semantic(Point { line: Line(0), col: Column(1) }, &term);
+ assert_eq!(term.string_from_selection(&selection.to_span(&term).unwrap()), "aa");
}
{
- let mut selection = Selection::new(grid.num_lines(), grid.num_cols());
- term.semantic_selection(&mut selection, Point { line: Line(0), col: Column(4) });
- assert_eq!(term.string_from_selection(&selection.span().unwrap()), "aaa");
+ let selection = Selection::semantic(Point { line: Line(0), col: Column(4) }, &term);
+ assert_eq!(term.string_from_selection(&selection.to_span(&term).unwrap()), "aaa");
}
{
- let mut selection = Selection::new(grid.num_lines(), grid.num_cols());
- term.semantic_selection(&mut selection, Point { line: Line(1), col: Column(1) });
- assert_eq!(term.string_from_selection(&selection.span().unwrap()), "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");
}
}
@@ -1880,9 +1877,8 @@ mod tests {
mem::swap(&mut term.grid, &mut grid);
- let mut selection = Selection::new(grid.num_lines(), grid.num_cols());
- term.line_selection(&mut selection, Point { line: Line(0), col: Column(3) });
- match selection.span() {
+ let selection = Selection::lines(Point { line: Line(0), col: Column(3) });
+ match selection.to_span(&term) {
Some(span) => assert_eq!(term.string_from_selection(&span), "\"aa\"a"),
_ => ()
}