From c691df5ae22ff1ed3e20685186fcafc5adb163bf Mon Sep 17 00:00:00 2001 From: Patrick Thomson Date: Wed, 21 Oct 2020 12:56:11 -0400 Subject: [PATCH] reading in the source correctly --- cli/src/query/assert.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cli/src/query/assert.rs b/cli/src/query/assert.rs index d4140f23..35a7f4b7 100644 --- a/cli/src/query/assert.rs +++ b/cli/src/query/assert.rs @@ -1,6 +1,7 @@ use super::super::error::Result; use lazy_static::lazy_static; use regex::Regex; +use std::fs; use tree_sitter::Point; // TODO: It would be cooler to do this with a comments query rather than with a regex @@ -21,6 +22,10 @@ struct Assertion { capture_type: String, } -pub fn assert_expected_captures(_captures: Vec, _path: String) -> Result<()> { +pub fn assert_expected_captures(_captures: Vec, path: String) -> Result<()> { + let contents = fs::read_to_string(path)?; + for m in METADATA_PAIR_REGEX.captures_iter(&contents) { + println!("pair: {:?}", m); + } Ok(()) }