File: empty_else

package info (click to toggle)
libdevel-cover-perl 1.52-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,096 kB
  • sloc: perl: 11,568; sh: 1,030; makefile: 7
file content (29 lines) | stat: -rw-r--r-- 570 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/perl

# Copyright 2025-2026, Paul Johnson (paul@pjcj.net)

# This software is free.  It is licensed under the same terms as Perl itself.

# The latest version of this software should be available from my homepage:
# https://pjcj.net

# Test for empty else blocks optimized away by Perl 5.43.4+
# See GH-362 and Perl PR #23367

use strict;
use warnings;

# Main level - exercises: $false->name eq "null"
if ($ARGV[0]) {
} else {
}

# Subroutine - exercises: B::class($false) eq "NULL"
sub test_sub {
  my $x = shift;
  if ($x) {
  } else {
  }
}

test_sub(1);