]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
test: mktemp: test creation of a directory with a subdirectory template
authorCollin Funk <collin.funk1@gmail.com>
Fri, 15 May 2026 03:58:39 +0000 (20:58 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Fri, 15 May 2026 03:58:55 +0000 (20:58 -0700)
* 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

index c137f8eba7ed94ace5e78ba9496c993dee0caa8b..42b053aee01d75d34702cbd39e13add9dd6c907a 100755 (executable)
@@ -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",