From 50bccdf5dad00681cdcbd3d1275c40f6689ac7f1 Mon Sep 17 00:00:00 2001 From: Patrick Thomson Date: Tue, 10 Nov 2020 16:20:51 -0500 Subject: [PATCH] rename Assertion.expected to expected_capture_name --- cli/src/query_testing.rs | 10 ++++++---- cli/src/test_highlight.rs | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cli/src/query_testing.rs b/cli/src/query_testing.rs index 8c6af706..fe4ec8a1 100644 --- a/cli/src/query_testing.rs +++ b/cli/src/query_testing.rs @@ -19,7 +19,7 @@ pub struct CaptureInfo { #[derive(Debug, PartialEq, Eq)] pub struct Assertion { pub position: Point, - pub expected: String, + pub expected_capture_name: String, } /// Parse the given source code, finding all of the comments that contain @@ -81,7 +81,7 @@ pub fn parse_position_comments( assertion_ranges.push((node.start_position(), node.end_position())); result.push(Assertion { position: position, - expected: mat.as_str().to_string(), + expected_capture_name: mat.as_str().to_string(), }); } } @@ -135,8 +135,10 @@ pub fn assert_expected_captures( let contents = fs::read_to_string(path)?; let pairs = parse_position_comments(parser, language, contents.as_bytes())?; - let per_position_index: HashMap = - pairs.iter().map(|a| (a.position, &a.expected)).collect(); + let per_position_index: HashMap = pairs + .iter() + .map(|a| (a.position, &a.expected_capture_name)) + .collect(); for info in &infos { if !per_position_index.contains_key(&info.position) { diff --git a/cli/src/test_highlight.rs b/cli/src/test_highlight.rs index 55a709aa..2517ea3c 100644 --- a/cli/src/test_highlight.rs +++ b/cli/src/test_highlight.rs @@ -100,7 +100,7 @@ pub fn test_highlight( let mut actual_highlights = Vec::<&String>::new(); for Assertion { position, - expected: expected_highlight, + expected_capture_name: expected_highlight, } in &assertions { let mut passed = false;