aboutsummaryrefslogtreecommitdiff
path: root/libeditor/tests/test.rs
diff options
context:
space:
mode:
Diffstat (limited to 'libeditor/tests/test.rs')
-rw-r--r--libeditor/tests/test.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/libeditor/tests/test.rs b/libeditor/tests/test.rs
index ab8254d16..2a84c5080 100644
--- a/libeditor/tests/test.rs
+++ b/libeditor/tests/test.rs
@@ -3,7 +3,7 @@ extern crate itertools;
3 3
4use std::fmt; 4use std::fmt;
5use itertools::Itertools; 5use itertools::Itertools;
6use libeditor::{File, TextRange}; 6use libeditor::{ast, highlight, runnables, extend_selection, TextRange};
7 7
8#[test] 8#[test]
9fn test_extend_selection() { 9fn test_extend_selection() {
@@ -12,9 +12,9 @@ fn test_extend_selection() {
12} 12}
13"#); 13"#);
14 let range = TextRange::offset_len(18.into(), 0.into()); 14 let range = TextRange::offset_len(18.into(), 0.into());
15 let range = file.extend_selection(range).unwrap(); 15 let range = extend_selection(&file, range).unwrap();
16 assert_eq!(range, TextRange::from_to(17.into(), 18.into())); 16 assert_eq!(range, TextRange::from_to(17.into(), 18.into()));
17 let range = file.extend_selection(range).unwrap(); 17 let range = extend_selection(&file, range).unwrap();
18 assert_eq!(range, TextRange::from_to(15.into(), 20.into())); 18 assert_eq!(range, TextRange::from_to(15.into(), 20.into()));
19} 19}
20 20
@@ -25,7 +25,7 @@ fn test_highlighting() {
25fn main() {} 25fn main() {}
26 println!("Hello, {}!", 92); 26 println!("Hello, {}!", 92);
27"#); 27"#);
28 let hls = file.highlight(); 28 let hls = highlight(&file);
29 dbg_eq( 29 dbg_eq(
30 &hls, 30 &hls,
31 r#"[HighlightedRange { range: [1; 11), tag: "comment" }, 31 r#"[HighlightedRange { range: [1; 11), tag: "comment" },
@@ -49,7 +49,7 @@ fn test_foo() {}
49#[ignore] 49#[ignore]
50fn test_foo() {} 50fn test_foo() {}
51"#); 51"#);
52 let runnables = file.runnables(); 52 let runnables = runnables(&file);
53 dbg_eq( 53 dbg_eq(
54 &runnables, 54 &runnables,
55 r#"[Runnable { range: [1; 13), kind: Bin }, 55 r#"[Runnable { range: [1; 13), kind: Bin },
@@ -58,8 +58,8 @@ fn test_foo() {}
58 ) 58 )
59} 59}
60 60
61fn file(text: &str) -> File { 61fn file(text: &str) -> ast::File {
62 File::new(text) 62 ast::File::parse(text)
63} 63}
64 64
65fn dbg_eq(actual: &impl fmt::Debug, expected: &str) { 65fn dbg_eq(actual: &impl fmt::Debug, expected: &str) {