Skip to content

Commit

Permalink
Merge pull request #86 from legendiguess/line-str-unit-tests
Browse files Browse the repository at this point in the history
test: add unit tests for LineIndex::line_str
  • Loading branch information
baszalmstra committed Jan 22, 2020
2 parents a204e63 + 88aad0f commit f237702
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/mun_hir/src/line_index.rs
Expand Up @@ -63,4 +63,13 @@ mod tests {
assert_eq!(index.line_col(6.into()), LineCol { line: 1, col: 0 });
assert_eq!(index.line_col(7.into()), LineCol { line: 1, col: 1 });
}
#[test]
fn test_line_str() {
let text = "ℱ٥ℜ\n†ěṦτ\nℙน尺קő$ع";
let index = LineIndex::new(text);
assert_eq!(index.line_str(0, &text), Some("ℱ٥ℜ"));
assert_eq!(index.line_str(1, &text), Some("†ěṦτ"));
assert_eq!(index.line_str(2, &text), Some("ℙน尺קő$ع"));
assert_eq!(index.line_str(3, &text), None);
}
}

0 comments on commit f237702

Please sign in to comment.