cli: Update examples to use new `fail` decorator

This commit is contained in:
Alexis Sellier 2023-05-12 12:54:21 +02:00
parent 87ae8cfb62
commit dd7d86abb0
No known key found for this signature in database
6 changed files with 5 additions and 11 deletions

View File

@ -8,9 +8,6 @@ use snapbox::cmd::{Command, OutputAssert};
use snapbox::{Assert, Substitutions}; use snapbox::{Assert, Substitutions};
use thiserror::Error; use thiserror::Error;
/// Error lines in the CLI are prefixed with this string.
const ERROR_PREFIX: &str = "";
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum Error { pub enum Error {
#[error("parsing failed")] #[error("parsing failed")]
@ -160,9 +157,6 @@ impl TestFormula {
}, },
}); });
} else if let Some(a) = test.assertions.last_mut() { } else if let Some(a) = test.assertions.last_mut() {
if line.starts_with(ERROR_PREFIX) {
a.exit = ExitStatus::Failure;
}
a.expected.push_str(line.as_str()); a.expected.push_str(line.as_str());
a.expected.push('\n'); a.expected.push('\n');
} else { } else {

View File

@ -1,6 +1,6 @@
Trying to clone a repository that is not in our routing table returns an error: Trying to clone a repository that is not in our routing table returns an error:
``` ``` (fail)
$ rad clone rad:zVNuptPuk5XauitpCWSNVCXGGfXW $ rad clone rad:zVNuptPuk5XauitpCWSNVCXGGfXW
✓ Tracking relationship established for rad:zVNuptPuk5XauitpCWSNVCXGGfXW ✓ Tracking relationship established for rad:zVNuptPuk5XauitpCWSNVCXGGfXW
✗ Clone failed: no seeds found for rad:zVNuptPuk5XauitpCWSNVCXGGfXW ✗ Clone failed: no seeds found for rad:zVNuptPuk5XauitpCWSNVCXGGfXW

View File

@ -237,7 +237,7 @@ Note that a warning was emitted:
If we attempt to commit this revision, the command will fail: If we attempt to commit this revision, the command will fail:
``` ``` (fail)
$ rad id commit 3f6ae4f8645c8b0cbcd35ea924df7b13aca52774 --no-confirm $ rad id commit 3f6ae4f8645c8b0cbcd35ea924df7b13aca52774 --no-confirm
! Warning: Revision is out of date ! Warning: Revision is out of date
! Warning: d96f425412c9f8ad5d9a9a05c9831d0728e2338d =/= 475cdfbc8662853dd132ec564e4f5eb0f152dd7f ! Warning: d96f425412c9f8ad5d9a9a05c9831d0728e2338d =/= 475cdfbc8662853dd132ec564e4f5eb0f152dd7f

View File

@ -1,6 +1,6 @@
The `rad inspect` command can be run without being authenticated with radicle: The `rad inspect` command can be run without being authenticated with radicle:
``` ``` (fail)
$ rad self $ rad self
✗ Self failed: Could not load radicle profile ✗ Self failed: Could not load radicle profile
✗ Hint: To setup your radicle profile, run `rad auth`. ✗ Hint: To setup your radicle profile, run `rad auth`.

View File

@ -23,7 +23,7 @@ $ rad ls
Attempting to remove a repository that doesn't exist gives us an error message: Attempting to remove a repository that doesn't exist gives us an error message:
``` ``` (fail)
$ rad rm rad:z2Jk1mNqyX7AjT4K83jJW9vQoHn4f $ rad rm rad:z2Jk1mNqyX7AjT4K83jJW9vQoHn4f
✗ Remove failed: repository rad:z2Jk1mNqyX7AjT4K83jJW9vQoHn4f was not found ✗ Remove failed: repository rad:z2Jk1mNqyX7AjT4K83jJW9vQoHn4f was not found
``` ```

View File

@ -18,7 +18,7 @@ $ rad sync
If we try to sync again after the nodes have synced, we will get a timeout If we try to sync again after the nodes have synced, we will get a timeout
after one second, since the nodes will not emit any message: after one second, since the nodes will not emit any message:
``` ``` (fail)
$ rad sync --timeout 1 $ rad sync --timeout 1
✗ Syncing with 2 node(s).. ✗ Syncing with 2 node(s)..
! Seed z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk timed out.. ! Seed z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk timed out..