-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpreserve-spaces.t
executable file
·57 lines (45 loc) · 1.03 KB
/
preserve-spaces.t
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
#!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib';
use Test::Differences qw( eq_or_diff );
use TestHelper qw( doc );
use Test::More import => [ 'done_testing', 'subtest' ];
use Test::Needs qw( HTTP::Status );
subtest 'tidy_whitespace' => sub {
my $expected = <<'EOF';
use strict;
use warnings;
use Carp ();
use HTTP::Status qw( HTTP_FOUND );
print HTTP_FOUND;
EOF
my ($doc) = doc(
filename => 'test-data/preserve-spaces.pl',
tidy_whitespace => 1,
);
eq_or_diff(
$doc->tidied_document,
$expected,
'arbitrary spacing is not preserved'
);
};
subtest 'disable tidy_whitespace' => sub {
my $expected = <<'EOF';
use strict;
use warnings;
use Carp ();
use HTTP::Status qw ( HTTP_FOUND );
print HTTP_FOUND;
EOF
my ($doc) = doc(
filename => 'test-data/preserve-spaces.pl',
tidy_whitespace => 0,
);
eq_or_diff(
$doc->tidied_document,
$expected,
'arbitrary spacing is preserved'
);
};
done_testing();