Skip to content
Draft
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
52 changes: 18 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ pub enum ActionOutcome {
Action,
/// Assertion passed
AssertPassed,
/// Assertion failed with details
AssertFailed(AssertFailure),
/// Assertion failed with details (may contain multiple failures)
AssertFailed(Vec<AssertFailure>),
}

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down
21 changes: 12 additions & 9 deletions src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,10 @@ impl<A: FlintAdapter> TestRunner<A> {
ActionOutcome::AssertPassed => {
result.add_assertion(AssertionResult::Success(tick));
}
ActionOutcome::AssertFailed(fail) => {
result.add_assertion(AssertionResult::Failure(fail));
result.success = false;
result.total_ticks = tick;
result.execution_time_ms = start_time.elapsed().as_millis() as u64;
return result;
ActionOutcome::AssertFailed(failures) => {
for fail in failures {
result.add_assertion(AssertionResult::Failure(fail));
}
}
}
}
Expand Down Expand Up @@ -175,6 +173,7 @@ impl<A: FlintAdapter> TestRunner<A> {
}

ActionType::Assert { checks } => {
let mut failures = Vec::new();
for check in checks {
match check {
AssertType::Block(block) => {
Expand All @@ -191,7 +190,7 @@ impl<A: FlintAdapter> TestRunner<A> {
.map(|b| b.to_command())
.collect::<Vec<_>>()
.join(" or ");
return ActionOutcome::AssertFailed(AssertFailure {
failures.push(AssertFailure {
tick: _tick,
error_message: format!(
"Block mismatch at {:?}: expected '{}', got '{}'",
Expand All @@ -217,7 +216,7 @@ impl<A: FlintAdapter> TestRunner<A> {
let actual = p.get_slot(inv.slot, data).unwrap_or(Item::empty());
let expected = inv.is.clone().unwrap_or(Item::empty());
if !item_matches(&actual, &expected) {
return ActionOutcome::AssertFailed(AssertFailure::new_item(
failures.push(AssertFailure::new_item(
_tick, &expected, &actual, inv.slot,
));
}
Expand All @@ -228,7 +227,11 @@ impl<A: FlintAdapter> TestRunner<A> {
}
}
}
ActionOutcome::AssertPassed
if failures.is_empty() {
ActionOutcome::AssertPassed
} else {
ActionOutcome::AssertFailed(failures)
}
}

ActionType::UseItemOn { pos, face, item } => {
Expand Down
5 changes: 1 addition & 4 deletions src/viz_link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ pub struct FailurePayload {
/// Optional relative path of the test file, for live-edit-on-disk in local dev.
/// flint-viz tries this first; on 404 it falls back to `spec`.
pub source_path: Option<PathBuf>,
/// Failing assertions from the run. Today's runner stops at the first
/// failure (so `len() == 1`); the type is a `Vec` so a future runner that
/// collects every assert at the failing tick is forward-compatible without
/// a schema bump.
/// All failing assertions collected during the run.
pub failures: Vec<AssertFailure>,
/// Total ticks executed before the run ended.
pub total_ticks: u32,
Expand Down
Loading