Use unit tests to keep private things private

This commit is contained in:
Oli Scherer 2022-05-25 18:24:55 +00:00
parent 25b7a12625
commit a51ae9fb2c
4 changed files with 10 additions and 5 deletions

View File

@ -2,6 +2,9 @@ use std::path::Path;
use regex::Regex;
#[cfg(test)]
mod tests;
/// This crate supports various magic comments that get parsed as file-specific
/// configuration values. This struct parses them all in one go and then they
/// get processed by their respective use sites.

View File

@ -1,6 +1,6 @@
use std::path::Path;
use ui_test::Comments;
use super::Comments;
#[test]
fn parse_simple_comment() {

View File

@ -12,6 +12,8 @@ use regex::Regex;
pub use crate::comments::Comments;
mod comments;
#[cfg(test)]
mod tests;
#[derive(Debug)]
pub struct Config {
@ -171,7 +173,7 @@ pub fn run_tests(config: Config) {
}
#[derive(Debug)]
pub enum Error {
enum Error {
/// Got an invalid exit status for the given mode.
ExitStatus(Mode, ExitStatus),
PatternNotFound {
@ -191,7 +193,7 @@ pub enum Error {
},
}
pub type Errors = Vec<Error>;
type Errors = Vec<Error>;
fn run_test(
path: &Path,
@ -249,7 +251,7 @@ fn run_test(
(miri, errors)
}
pub fn check_annotations(
fn check_annotations(
unnormalized_stderr: &[u8],
errors: &mut Errors,
config: &Config,

View File

@ -1,6 +1,6 @@
use std::path::{Path, PathBuf};
use ui_test::{check_annotations, Comments, Config, Error, Mode, OutputConflictHandling};
use super::{check_annotations, Comments, Config, Error, Mode, OutputConflictHandling};
fn config() -> Config {
Config {