File: basic.t

package info (click to toggle)
libsyntax-infix-smartmatch-perl 0.011-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 676 kB
  • sloc: perl: 52; makefile: 3
file content (28 lines) | stat: -rw-r--r-- 394 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
#!perl

use strict;
use warnings;

use Test::More;

use Syntax::Infix::Smartmatch;

package overloaded;

use overload "~~" => sub { $_[1] == 1 };

package main;

ok 1 ~~ 1;
ok !("1.0" ~~ 1);
ok (1 ~~ [1, 2, 3]);
ok !([1, 2, 3] ~~ [1, 2, 3]);
ok 1 ~~ sub { $_[0] };
ok 1 ~~ qr/1/;
ok !(1 ~~ undef);
ok !({ a => 1 } ~~ { a => 2 });

my $foo = bless {}, "overloaded";
ok 1 ~~ $foo;

done_testing;