Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/libtest-json/event.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
"type": "object",
"properties": {
"name": {
"description": "An identifier that is unique across the entire run",
"type": "string"
},
"mode": {
Expand Down Expand Up @@ -197,6 +198,7 @@
"type": "object",
"properties": {
"name": {
"description": "An identifier that is unique across the entire run",
"type": "string"
},
"elapsed_s": {
Expand Down Expand Up @@ -225,6 +227,7 @@
"type": "object",
"properties": {
"name": {
"description": "An identifier that is unique across the entire run",
"type": "string"
},
"kind": {
Expand Down Expand Up @@ -256,6 +259,7 @@
"type": "object",
"properties": {
"name": {
"description": "An identifier that is unique across the entire run",
"type": "string"
},
"elapsed_s": {
Expand Down
4 changes: 4 additions & 0 deletions crates/libtest-json/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ impl DiscoverStart {
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
pub struct DiscoverCase {
/// An identifier that is unique across the entire run
pub name: String,
#[cfg_attr(
feature = "serde",
Expand Down Expand Up @@ -265,6 +266,7 @@ impl RunStart {
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
pub struct CaseStart {
/// An identifier that is unique across the entire run
pub name: String,
#[cfg_attr(
feature = "serde",
Expand Down Expand Up @@ -308,6 +310,7 @@ impl CaseStart {
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
pub struct CaseMessage {
/// An identifier that is unique across the entire run
pub name: String,
pub kind: MessageKind,
#[cfg_attr(
Expand Down Expand Up @@ -369,6 +372,7 @@ impl CaseMessage {
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
pub struct CaseComplete {
/// An identifier that is unique across the entire run
pub name: String,
#[cfg_attr(
feature = "serde",
Expand Down
2 changes: 2 additions & 0 deletions crates/libtest2-harness/src/case.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ pub trait Case: Send + Sync + 'static {
/// By convention this follows the rules for rust paths; i.e., it should be a series of
/// identifiers separated by double colons. This way if some test runner wants to arrange the
/// tests hierarchically it may.
///
/// Must be unique across the entire test run.
fn name(&self) -> &str;
fn kind(&self) -> TestKind;
fn source(&self) -> Option<&Source>;
Expand Down
3 changes: 3 additions & 0 deletions crates/libtest2-mimic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ pub struct Trial {
}

impl Trial {
/// Define a test case
///
/// `name` must be unique across the entire test run.
pub fn test(
name: impl Into<String>,
runner: impl Fn(RunContext<'_>) -> Result<(), RunError> + Send + Sync + 'static,
Expand Down