mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 15:11:52 +02:00
Add job tags (#15555)
# Description This PR implements job tagging through the usage of a new `job tag` command and a `--tag` for `job spawn` Closes #15354 # User-Facing Changes - New `job tag` command - Job list may now have an additional `tag` column for the tag of jobs (rows representing jobs without tags do not have this column filled) - New `--tag` flag for `job spawn` # Tests + Formatting Integration tests are provided to test the newly implemented features # After Submitting Possibly document job tagging in the jobs documentation
This commit is contained in:
@ -215,3 +215,53 @@ fn job_extern_into_pipe_is_not_silent() {
|
||||
assert_eq!(actual.out, "11");
|
||||
assert_eq!(actual.err, "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn job_list_returns_no_tag_when_job_is_untagged() {
|
||||
let actual = nu!(r#"
|
||||
job spawn { sleep 10sec }
|
||||
job spawn { sleep 10sec }
|
||||
job spawn { sleep 10sec }
|
||||
|
||||
('tag' in (job list | columns)) | to nuon"#);
|
||||
|
||||
assert_eq!(actual.out, "false");
|
||||
assert_eq!(actual.err, "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn job_list_returns_tag_when_job_is_spawned_with_tag() {
|
||||
let actual = nu!(r#"
|
||||
job spawn { sleep 10sec } --tag abc
|
||||
job list | where id == 1 | get tag.0
|
||||
"#);
|
||||
|
||||
assert_eq!(actual.out, "abc");
|
||||
assert_eq!(actual.err, "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn job_tag_modifies_untagged_job_tag() {
|
||||
let actual = nu!(r#"
|
||||
job spawn { sleep 10sec }
|
||||
|
||||
job tag 1 beep
|
||||
|
||||
job list | where id == 1 | get tag.0"#);
|
||||
|
||||
assert_eq!(actual.out, "beep");
|
||||
assert_eq!(actual.err, "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn job_tag_modifies_tagged_job_tag() {
|
||||
let actual = nu!(r#"
|
||||
job spawn { sleep 10sec } --tag abc
|
||||
|
||||
job tag 1 beep
|
||||
|
||||
job list | where id == 1 | get tag.0"#);
|
||||
|
||||
assert_eq!(actual.out, "beep");
|
||||
assert_eq!(actual.err, "");
|
||||
}
|
||||
|
Reference in New Issue
Block a user