diff options
author | Dmitry Sharshakov | 2021-08-28 11:59:26 +0000 |
---|---|---|
committer | Dmitry Sharshakov | 2021-08-28 11:59:26 +0000 |
commit | e3153946311b189bd5e10e816acbdda508ded31c (patch) | |
tree | 304e0b8c0b869cc239d8c0ce9b0f328fe589bd93 /helix-core/src/syntax.rs | |
parent | 8df6739759396b45d06356dd78c39117590b062b (diff) | |
parent | d6a9c2c0f6f4af98146b52d1c886a1ca99d15676 (diff) |
Merge remote-tracking branch 'origin/master' into debug
Diffstat (limited to 'helix-core/src/syntax.rs')
-rw-r--r-- | helix-core/src/syntax.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index ae99a159..a7410203 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -1831,15 +1831,14 @@ mod test { #[test] fn test_input_edits() { - use crate::State; use tree_sitter::InputEdit; - let state = State::new("hello world!\ntest 123".into()); + let doc = Rope::from("hello world!\ntest 123"); let transaction = Transaction::change( - &state.doc, + &doc, vec![(6, 11, Some("test".into())), (12, 17, None)].into_iter(), ); - let edits = LanguageLayer::generate_edits(state.doc.slice(..), transaction.changes()); + let edits = LanguageLayer::generate_edits(doc.slice(..), transaction.changes()); // transaction.apply(&mut state); assert_eq!( @@ -1865,13 +1864,13 @@ mod test { ); // Testing with the official example from tree-sitter - let mut state = State::new("fn test() {}".into()); + let mut doc = Rope::from("fn test() {}"); let transaction = - Transaction::change(&state.doc, vec![(8, 8, Some("a: u32".into()))].into_iter()); - let edits = LanguageLayer::generate_edits(state.doc.slice(..), transaction.changes()); - transaction.apply(&mut state.doc); + Transaction::change(&doc, vec![(8, 8, Some("a: u32".into()))].into_iter()); + let edits = LanguageLayer::generate_edits(doc.slice(..), transaction.changes()); + transaction.apply(&mut doc); - assert_eq!(state.doc, "fn test(a: u32) {}"); + assert_eq!(doc, "fn test(a: u32) {}"); assert_eq!( edits, &[InputEdit { |