Move test helpers into their own folder

This commit is contained in:
Max Brunsfeld 2019-01-25 16:40:26 -08:00
parent 5a12fbd927
commit af83e8034e
8 changed files with 21 additions and 14 deletions

View file

@ -1,7 +1,7 @@
use super::allocations;
use super::fixtures::{fixtures_dir, get_language, get_test_language};
use super::random::Rand;
use super::scope_sequence::ScopeSequence;
use super::helpers::allocations;
use super::helpers::fixtures::{fixtures_dir, get_language, get_test_language};
use super::helpers::random::Rand;
use super::helpers::scope_sequence::ScopeSequence;
use crate::generate;
use crate::test::{parse_tests, print_diff, print_diff_key, TestEntry};
use crate::util;
@ -127,7 +127,10 @@ fn test_real_language_corpus_files() {
// Check that the new tree is consistent.
check_consistent_sizes(&tree2, &input);
if let Err(message) = check_changed_ranges(&tree, &tree2, &input) {
println!("\nUnexpected scope change in trial {}\n{}\n\n", trial, message);
println!(
"\nUnexpected scope change in trial {}\n{}\n\n",
trial, message
);
failure_count += 1;
break;
}
@ -161,7 +164,10 @@ fn test_real_language_corpus_files() {
// Check that the edited tree is consistent.
check_consistent_sizes(&tree3, &input);
if let Err(message) = check_changed_ranges(&tree2, &tree3, &input) {
eprintln!("Unexpected scope change in trial {}\n{}\n\n", trial, message);
eprintln!(
"Unexpected scope change in trial {}\n{}\n\n",
trial, message
);
failure_count += 1;
break;
}

View file

@ -0,0 +1,4 @@
pub(super) mod allocations;
pub(super) mod fixtures;
pub(super) mod random;
pub(super) mod scope_sequence;

View file

@ -1,6 +1,3 @@
mod allocations;
mod corpuses;
mod fixtures;
mod random;
mod parser_api;
mod scope_sequence;
mod corpus_test;
mod helpers;
mod parser_api_test;

View file

@ -1,4 +1,4 @@
use super::fixtures::get_language;
use super::helpers::fixtures::get_language;
use std::thread;
use tree_sitter::{InputEdit, Language, LogType, Parser, Point, PropertySheet};
@ -453,7 +453,7 @@ fn test_editing() {
fn test_parallel_parsing() {
// Parse this source file so that each thread has a non-trivial amount of
// work to do.
let this_file_source = include_str!("parser_api.rs");
let this_file_source = include_str!("parser_api_test.rs");
let mut parser = Parser::new();
parser.set_language(rust()).unwrap();