diff options
Diffstat (limited to 'libeditor/tests/test.rs')
-rw-r--r-- | libeditor/tests/test.rs | 14 |
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 | ||
4 | use std::fmt; | 4 | use std::fmt; |
5 | use itertools::Itertools; | 5 | use itertools::Itertools; |
6 | use libeditor::{File, TextRange}; | 6 | use libeditor::{ast, highlight, runnables, extend_selection, TextRange}; |
7 | 7 | ||
8 | #[test] | 8 | #[test] |
9 | fn test_extend_selection() { | 9 | fn 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() { | |||
25 | fn main() {} | 25 | fn 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] |
50 | fn test_foo() {} | 50 | fn 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 | ||
61 | fn file(text: &str) -> File { | 61 | fn file(text: &str) -> ast::File { |
62 | File::new(text) | 62 | ast::File::parse(text) |
63 | } | 63 | } |
64 | 64 | ||
65 | fn dbg_eq(actual: &impl fmt::Debug, expected: &str) { | 65 | fn dbg_eq(actual: &impl fmt::Debug, expected: &str) { |