Files
Stefan Holderbach 9da0f41ebb Fix easy clippy lints from latest stable (#16053)
1.88.0 was released today, clippy now lints (machine-applicable)
against:
- format strings with empty braces that could be inlined
  - easy win
- `manual_abs_diff`
- returning of a stored result of the last expression.
  - this can be somewhat contentious but touched only a few places
2025-06-29 17:37:17 +02:00

45 lines
1.2 KiB
Rust

use nu_path::AbsolutePath;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn creates_temp_file() {
Playground::setup("mktemp_test_1", |dirs, _| {
let output = nu!(
cwd: dirs.test(),
"mktemp"
);
let loc = AbsolutePath::try_new(&output.out).unwrap();
println!("{loc:?}");
assert!(loc.exists());
})
}
#[test]
fn creates_temp_file_with_suffix() {
Playground::setup("mktemp_test_2", |dirs, _| {
let output = nu!(
cwd: dirs.test(),
"mktemp --suffix .txt tempfileXXX"
);
let loc = AbsolutePath::try_new(&output.out).unwrap();
assert!(loc.exists());
assert!(loc.is_file());
assert!(output.out.ends_with(".txt"));
assert!(output.out.starts_with(dirs.test().to_str().unwrap()));
})
}
#[test]
fn creates_temp_directory() {
Playground::setup("mktemp_test_3", |dirs, _| {
let output = nu!(
cwd: dirs.test(),
"mktemp -d"
);
let loc = AbsolutePath::try_new(&output.out).unwrap();
assert!(loc.exists());
assert!(loc.is_dir());
})
}