diff options
author | Aleksey Kladov <[email protected]> | 2018-08-10 15:49:45 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-10 15:49:45 +0100 |
commit | 2e165ae82eed1dc62f1f4c68e45440c143c7c8ef (patch) | |
tree | 4148d68878bbd05a0c7b7f4ace803083f23293fd /libeditor/tests | |
parent | d7c5a6f3081c2e7266620779d3c32067f947b959 (diff) |
logging
Diffstat (limited to 'libeditor/tests')
-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) { |