summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCollin Funk <collin.funk1@gmail.com>2026-05-14 20:58:39 -0700
committerCollin Funk <collin.funk1@gmail.com>2026-05-14 20:58:55 -0700
commit91cd3f7a1872dcdaefb6dade1a35ddbc642d4ad4 (patch)
tree8ac62b3443b18919964ebeb229f62cfa872a18f3
parent32d1c41c88e8a35542f572700ea891ce9d6e830b (diff)
downloadcoreutils-91cd3f7a1872dcdaefb6dade1a35ddbc642d4ad4.tar.gz
coreutils-91cd3f7a1872dcdaefb6dade1a35ddbc642d4ad4.zip
test: mktemp: test creation of a directory with a subdirectory template
* tests/mktemp/mktemp.pl (@Tests): Remove an unlink call handled in the previous call to check_tmp. Add a test case.
-rwxr-xr-xtests/mktemp/mktemp.pl15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/mktemp/mktemp.pl b/tests/mktemp/mktemp.pl
index c137f8eba..42b053aee 100755
--- a/tests/mktemp/mktemp.pl
+++ b/tests/mktemp/mktemp.pl
@@ -174,13 +174,22 @@ my @Tests =
check_tmp $f, 'F'; }}],
- # Test template with subdirectory
- ['tmp-w-slash', '--tmpdir=. a/bXXXX',
+ # Test creation of a file where the template has a subdirectory.
+ ['tmp-w-slash1', '--tmpdir=. a/bXXXX',
{PRE => sub {mkdir 'a',0755 or die "a: $!\n"}},
{OUT_SUBST => 's,b....$,bZZZZ,'},
{OUT => "./a/bZZZZ\n"},
{POST => sub { my ($f) = @_; defined $f or return; chomp $f;
- check_tmp $f, 'F'; unlink $f; rmdir 'a' or die "rmdir a: $!\n" }}
+ check_tmp $f, 'F'; rmdir 'a' or die "rmdir a: $!\n" }}
+ ],
+
+ # Likewise, but create a directory.
+ ['tmp-w-slash2', '--tmpdir=. -d a/bXXXX',
+ {PRE => sub {mkdir 'a',0755 or die "a: $!\n"}},
+ {OUT_SUBST => 's,b....$,bZZZZ,'},
+ {OUT => "./a/bZZZZ\n"},
+ {POST => sub { my ($f) = @_; defined $f or return; chomp $f;
+ check_tmp $f, 'D'; rmdir 'a' or die "rmdir a: $!\n" }}
],
['priority-t-tmpdir', "-t -p $bad_dir foo.XXX",