Skip to content

Commit

Permalink
[nextest-runner] move miette JSON structs to test-helpers module
Browse files Browse the repository at this point in the history
Going to use this for setup scripts soon.
  • Loading branch information
sunshowers committed Sep 26, 2023
1 parent 61624f8 commit 8d4fc7e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
18 changes: 0 additions & 18 deletions nextest-runner/src/config/overrides.rs
Original file line number Diff line number Diff line change
Expand Up @@ -757,24 +757,6 @@ mod tests {
assert_eq!(overrides.retries(), RetryPolicy::new_without_delay(0));
}

#[derive(Clone, Debug, Deserialize, Eq, PartialEq)]
struct MietteJsonReport {
message: String,
labels: Vec<MietteJsonLabel>,
}

#[derive(Clone, Debug, Deserialize, Eq, PartialEq)]
struct MietteJsonLabel {
label: String,
span: MietteJsonSpan,
}

#[derive(Clone, Debug, Deserialize, Eq, PartialEq)]
struct MietteJsonSpan {
offset: usize,
length: usize,
}

#[test_case(
indoc! {r#"
[[profile.default.overrides]]
Expand Down
19 changes: 19 additions & 0 deletions nextest-runner/src/config/test_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::{
};
use camino::{Utf8Path, Utf8PathBuf};
use guppy::{graph::PackageGraph, MetadataCommand};
use serde::Deserialize;
use std::{io::Write, path::PathBuf, process::Command};
use target_spec::{Platform, TargetFeatures};

Expand Down Expand Up @@ -57,3 +58,21 @@ pub(super) fn custom_test_group(name: &str) -> CustomTestGroup {
CustomTestGroup::new(name.into())
.unwrap_or_else(|error| panic!("invalid custom test group {name}: {error}"))
}

#[derive(Clone, Debug, Deserialize, Eq, PartialEq)]
pub(super) struct MietteJsonReport {
pub(super) message: String,
pub(super) labels: Vec<MietteJsonLabel>,
}

#[derive(Clone, Debug, Deserialize, Eq, PartialEq)]
pub(super) struct MietteJsonLabel {
pub(super) label: String,
pub(super) span: MietteJsonSpan,
}

#[derive(Clone, Debug, Deserialize, Eq, PartialEq)]
pub(super) struct MietteJsonSpan {
pub(super) offset: usize,
pub(super) length: usize,
}

0 comments on commit 8d4fc7e

Please sign in to comment.