-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: impl basic test suite loader and runner
Signed-off-by: peefy <xpf6677@163.com>
- Loading branch information
Showing
12 changed files
with
451 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pub mod fix; | ||
pub mod format; | ||
pub mod lint; | ||
pub mod testing; | ||
pub mod util; | ||
pub mod vet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//! [kclvm_tools::test] module mainly contains some functions of language testing tool. | ||
pub use crate::testing::suite::{load_test_suites, TestSuite}; | ||
use anyhow::{Error, Result}; | ||
use indexmap::IndexMap; | ||
use kclvm_runner::ExecProgramArgs; | ||
use std::time::Duration; | ||
|
||
mod suite; | ||
|
||
#[cfg(test)] | ||
mod tests; | ||
|
||
pub trait TestRun { | ||
type Options; | ||
type Result; | ||
fn run(&self, opts: &Self::Options) -> Result<Self::Result>; | ||
} | ||
|
||
pub trait TestRunner { | ||
type Suite: TestRun; | ||
type Result; | ||
type Options; | ||
fn look_up_test_suites(&self, path: &str, opts: &Self::Options) -> Result<Vec<Self::Suite>>; | ||
fn run(&self, suites: &[Self::Suite], opts: &Self::Options) -> Vec<Result<Self::Result>>; | ||
} | ||
|
||
#[derive(Debug, Default)] | ||
pub struct TestResult { | ||
pub log_message: String, | ||
pub info: IndexMap<String, TestCaseInfo>, | ||
} | ||
|
||
#[derive(Debug, Default)] | ||
pub struct TestCaseInfo { | ||
pub error: Option<Error>, | ||
pub duration: Duration, | ||
} | ||
|
||
#[derive(Debug, Default, Clone)] | ||
pub struct TestOptions { | ||
pub exec_args: ExecProgramArgs, | ||
pub run_regexp: String, | ||
pub fail_fast: bool, | ||
} |
Oops, something went wrong.