summaryrefslogtreecommitdiff
path: root/t/dump-file.t
diff options
context:
space:
mode:
Diffstat (limited to 't/dump-file.t')
-rw-r--r--t/dump-file.t36
1 files changed, 36 insertions, 0 deletions
diff --git a/t/dump-file.t b/t/dump-file.t
new file mode 100644
index 0000000..8796ba5
--- /dev/null
+++ b/t/dump-file.t
@@ -0,0 +1,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;