Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Refactor whippit to be a set of traits instead of structs #40

Merged
merged 3 commits into from
Oct 31, 2023
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
17 changes: 6 additions & 11 deletions moz-webgpu-cts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod metadata;
mod shared;

use self::{
metadata::{AnalyzeableProps, Platform, SubtestOutcome, Test, TestOutcome},
metadata::{AnalyzeableProps, File, Platform, Subtest, SubtestOutcome, Test, TestOutcome},
shared::{Expectation, MaybeCollapsed},
};

Expand All @@ -24,10 +24,7 @@ use path_dsl::path;

use regex::Regex;
use wax::Glob;
use whippit::{
metadata::{SectionHeader, Subtest},
reexport::chumsky::prelude::Rich,
};
use whippit::{metadata::SectionHeader, reexport::chumsky::prelude::Rich};

#[derive(Debug, Parser)]
#[command(about, version)]
Expand Down Expand Up @@ -186,7 +183,7 @@ fn run(cli: Cli) -> ExitCode {
struct TaggedTest {
#[allow(unused)]
orig_path: Arc<PathBuf>,
inner: metadata::Test,
inner: Test,
}
let tests_by_name = {
let mut found_parse_err = false;
Expand All @@ -200,8 +197,8 @@ fn run(cli: Cli) -> ExitCode {
match chumsky::Parser::parse(&metadata::File::parser(), file_contents)
.into_result()
{
Ok(metadata::File { tests }) => Some(tests.into_iter().map(|inner| {
let SectionHeader(name) = &inner.name;
Ok(File { tests }) => Some(tests.into_iter().map(|(name, inner)| {
let SectionHeader(name) = &name;
(
SectionHeader(
name.strip_prefix("cts.https.html?q=").unwrap().to_owned(),
Expand Down Expand Up @@ -300,17 +297,15 @@ fn run(cli: Cli) -> ExitCode {
}

let mut analysis = Analysis::default();
for (_nice_name, test) in tests_by_name {
for (SectionHeader(test_name), test) in tests_by_name {
let TaggedTest {
orig_path: _,
inner: test,
} = test;

let Test {
name: SectionHeader(test_name),
properties,
subtests,
..
} = test;

let AnalyzeableProps {
Expand Down
Loading