From 91cd3f7a1872dcdaefb6dade1a35ddbc642d4ad4 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Thu, 14 May 2026 20:58:39 -0700 Subject: [PATCH] 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. --- tests/mktemp/mktemp.pl | 15 ++++++++++++--- 1 file 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",