File: verify.t

package info (click to toggle)
libsmart-comments-perl 1.06-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 228 kB
  • sloc: perl: 303; makefile: 2
file content (64 lines) | stat: -rw-r--r-- 1,143 bytes parent folder | download | duplicates (5)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
use Smart::Comments;
use Test::More 'no_plan';




close *STDERR;
my $STDERR = q{};
open *STDERR, '>', \$STDERR;

my $x = 0;
### verify: $x < 1

ok length $STDERR == 0           => 'True verify is silent';

$ASSERTION = << 'END_ASSERT';

# $x < 0 was not true at FILE line 26.
#     $x was: 0

END_ASSERT

$ASSERTION =~ s/#/###/g;

eval {
### verify: $x < 0
};

ok !$@                           => 'False verify not deadly';


$STDERR =~ s/ at \S+ line / at FILE line /;

ok length $STDERR != 0           => 'False verify is loud';
is $STDERR, $ASSERTION           => 'False verify is loudly correct';

close *STDERR;
$STDERR = q{};
open *STDERR, '>', \$STDERR;

my $y = [];
   $x = 10;

my $ASSERTION2 = << 'END_ASSERTION2';

# $y < $x was not true at FILE line 55.
#     $y was: []
#     $x was: 10

END_ASSERTION2

$ASSERTION2 =~ s/#/###/g;

eval {
### verify: $y < $x
};

ok !$@                           => 'False two-part verify not deadly';


$STDERR =~ s/ at \S+ line / at FILE line /;

ok length $STDERR != 0           => 'False two-part verify is loud';
is $STDERR, $ASSERTION2          => 'False two-part verify is loudly correct';