From b1e51edd08c111b4ebf0d96965fb152ebb1f4eb0 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 4 Nov 2022 10:10:11 -0500 Subject: [PATCH] Revert "fix(trycmd): Error, instead of ignore, unknown bins" This reverts commit bd6922457c7b37b2a62b42a10de51f74dc96be21. When working on this, we forgot the case of conditionally existing examples. --- src/runner.rs | 15 ++++++++++----- tests/cmd/unresolved.trycmd | 5 +++++ 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 tests/cmd/unresolved.trycmd diff --git a/src/runner.rs b/src/runner.rs index 440ee9ec..be37f02c 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -322,11 +322,16 @@ impl Case { } match &step.bin { - // Will be handled by `Step::to_command` - Some(crate::schema::Bin::Path(_)) - | Some(crate::schema::Bin::Name(_)) - | Some(crate::schema::Bin::Error(_)) - | None => {} + Some(crate::schema::Bin::Path(_)) => {} + Some(crate::schema::Bin::Name(_name)) => { + // Unhandled by resolve + snapbox::debug!("bin={:?} not found", _name); + assert_eq!(output.spawn.status, SpawnStatus::Skipped); + return Ok(output); + } + Some(crate::schema::Bin::Error(_)) => {} + // Unlike `Name`, this always represents a bug + None => {} Some(crate::schema::Bin::Ignore) => { // Unhandled by resolve assert_eq!(output.spawn.status, SpawnStatus::Skipped); diff --git a/tests/cmd/unresolved.trycmd b/tests/cmd/unresolved.trycmd new file mode 100644 index 00000000..8405ad64 --- /dev/null +++ b/tests/cmd/unresolved.trycmd @@ -0,0 +1,5 @@ +Gracefully handle a non-existent name: +``` +$ non-existent-name + +```