aboutsummaryrefslogtreecommitdiff
path: root/libeditor/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'libeditor/src/lib.rs')
-rw-r--r--libeditor/src/lib.rs20
1 files changed, 1 insertions, 19 deletions
diff --git a/libeditor/src/lib.rs b/libeditor/src/lib.rs
index a0c003fb5..ef31efe35 100644
--- a/libeditor/src/lib.rs
+++ b/libeditor/src/lib.rs
@@ -13,6 +13,7 @@ pub struct File {
13 inner: libsyntax2::File 13 inner: libsyntax2::File
14} 14}
15 15
16#[derive(Debug)]
16pub struct HighlightedRange { 17pub struct HighlightedRange {
17 pub range: TextRange, 18 pub range: TextRange,
18 pub tag: &'static str, 19 pub tag: &'static str,
@@ -102,22 +103,3 @@ impl<'f> Declaration<'f> {
102 self.0.range() 103 self.0.range()
103 } 104 }
104} 105}
105
106#[cfg(test)]
107mod tests {
108 use super::*;
109
110 #[test]
111 fn test_extend_selection() {
112 let text = r#"fn foo() {
113 1 + 1
114}
115"#;
116 let file = File::new(text);
117 let range = TextRange::offset_len(18.into(), 0.into());
118 let range = file.extend_selection(range).unwrap();
119 assert_eq!(range, TextRange::from_to(17.into(), 18.into()));
120 let range = file.extend_selection(range).unwrap();
121 assert_eq!(range, TextRange::from_to(15.into(), 20.into()));
122 }
123}