File: 04topic.t

package info (click to toggle)
libsyntax-keyword-match-perl 0.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 236 kB
  • sloc: perl: 902; ansic: 34; makefile: 3
file content (25 lines) | stat: -rw-r--r-- 421 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
#!/usr/bin/perl

use v5.14;
use warnings;

use Test2::V0;

use Syntax::Keyword::Match;

# `my` var inside expression works
{
   my $var = "outside";

   my $ok;
   match(my $var = 123 : ==) {
      case(123) {
         $ok++;
         is( $var, 123, '$var is topic inside case block' );
      }
   }
   ok( $ok, 'case block invoked' );
   is( $var, "outside", 'Topic var did not leak from match/case' );
}

done_testing;