File: assert_is.t

package info (click to toggle)
libcarp-assert-more-perl 2.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 376 kB
  • sloc: perl: 2,482; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 667 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!perl

use warnings;
use strict;

use Test::More tests => 8;

use Carp::Assert::More;

use Test::Exception;

throws_ok   { assert_is( 4, 3 ) }       qr/Assertion.*failed/, "4 is not 3";
throws_ok   { assert_is( undef, "" ) }  qr/Assertion.*failed/, "Undef is not space";
throws_ok   { assert_is( "", undef ) }  qr/Assertion.*failed/, "Space is not undef";

lives_ok    { assert_is( undef, undef ) }   "Undef only matches undef";
lives_ok    { assert_is( "a", "a" ) }       "a is a";
lives_ok    { assert_is( 4, 4 ) }           "4 is 4";
lives_ok    { assert_is( "", "" ) }         "space is space";
lives_ok    { assert_is( "14", 14 ) }       "14 is 14 as strings";