summaryrefslogtreecommitdiff
path: root/t/dump-file.t
blob: 8796ba5eb6080715a8cc0546eba170a615f647c6 (plain)
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
use strict;
use lib -e 't' ? 't' : 'test';
my $t = -e 't' ? 't' : 'test';

use lib 'inc';
use Test::YAML();
BEGIN {
    @Test::YAML::EXPORT =
        grep { not /^(Dump|Load)(File)?$/ } @Test::YAML::EXPORT;
}
use TestYAML tests => 3;

use YAML 'DumpFile';

ok defined &DumpFile,
    'Dumpfile exported';

my $file = "$t/dump-file-$$.yaml";

DumpFile($file, [1..3]);

ok -e $file,
    'Output file exists';

open IN, $file or die $!;
my $yaml = join '', <IN>;
close IN;

is $yaml, <<'...', 'DumpFile YAML is correct';
---
- 1
- 2
- 3
...

unlink $file;