Fix crash w/ goto_previous_sibling when parent node has leading extra child (#4472)
* Fix crash w/ goto_previous_sibling when parent node has leading extra child Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> * Fix lint Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
This commit is contained in:
parent
06537fda83
commit
f91255a201
7 changed files with 90 additions and 46 deletions
|
|
@ -6,7 +6,10 @@ use super::{
|
|||
helpers::fixtures::{fixtures_dir, get_language, get_test_language},
|
||||
Rand,
|
||||
};
|
||||
use crate::{parse::perform_edit, tests::generate_parser};
|
||||
use crate::{
|
||||
parse::perform_edit,
|
||||
tests::{generate_parser, helpers::fixtures::get_test_fixture_language},
|
||||
};
|
||||
|
||||
const JSON_EXAMPLE: &str = r#"
|
||||
|
||||
|
|
@ -308,19 +311,8 @@ fn test_parent_of_zero_width_node() {
|
|||
|
||||
#[test]
|
||||
fn test_next_sibling_of_zero_width_node() {
|
||||
let grammar_json = load_grammar_file(
|
||||
&fixtures_dir()
|
||||
.join("test_grammars")
|
||||
.join("next_sibling_from_zwt")
|
||||
.join("grammar.js"),
|
||||
None,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let (parser_name, parser_code) = generate_parser(&grammar_json).unwrap();
|
||||
|
||||
let mut parser = Parser::new();
|
||||
let language = get_test_language(&parser_name, &parser_code, None);
|
||||
let language = get_test_fixture_language("next_sibling_from_zwt");
|
||||
parser.set_language(&language).unwrap();
|
||||
|
||||
let tree = parser.parse("abdef", None).unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue