Walk query files recursively in tree-sitter test.

We were only walking one level of depth into the `queries/` folder
during invocations of `test`, which made us attempt to open folders
rather than recurse into them.

We have to pull in the `walkdir` crate, which is required for
cross-platform walking of directories.

Fixes #938.
This commit is contained in:
Patrick Thomson 2021-02-25 10:24:54 -05:00
parent 225e15cb9f
commit 44010d69ea
4 changed files with 56 additions and 13 deletions

View file

@ -2,6 +2,7 @@ use super::test_highlight;
use std::fmt::Write;
use std::io;
use tree_sitter::{QueryError, QueryErrorKind};
use walkdir;
#[derive(Debug)]
pub struct Error(pub Vec<String>);
@ -121,3 +122,9 @@ impl From<String> for Error {
Error::new(error)
}
}
impl From<walkdir::Error> for Error {
fn from(error: walkdir::Error) -> Self {
Error::new(error.to_string())
}
}