Fixing Rust formatting issue

This commit is contained in:
Niranjan Hasabnis 2021-05-21 15:43:10 +00:00
parent c31acb8fec
commit c0e2b43d34

View file

@ -255,15 +255,21 @@ fn test_node_field_name_for_child() {
let tree = parser.parse("x + y;", None).unwrap();
let translation_unit_node = tree.root_node();
let binary_expression_node = translation_unit_node
.named_child(0)
.unwrap()
.named_child(0)
.unwrap();
.named_child(0)
.unwrap()
.named_child(0)
.unwrap();
assert_eq!(binary_expression_node.field_name_for_child(0), Some("left"));
assert_eq!(binary_expression_node.field_name_for_child(1), Some("operator"));
assert_eq!(binary_expression_node.field_name_for_child(2), Some("right"));
// Negative test - Not a valid child index
assert_eq!(
binary_expression_node.field_name_for_child(1),
Some("operator")
);
assert_eq!(
binary_expression_node.field_name_for_child(2),
Some("right")
);
// Negative test - Not a valid child index
assert_eq!(binary_expression_node.field_name_for_child(3), None);
}