1#!/usr/bin/perl
2# other_output_seperator.t
3# Copyright (c) 2006 Jonathan Rockway <jrockway@cpan.org>
4
5use Test::More tests => 8;
6use Directory::Scratch;
7use Path::Tiny;
8
9my $tmp = Directory::Scratch->new;
10
11local $, = '!';
12local $/ = '!';
13
14ok($tmp->touch('foo', qw(these are some lines)), 'create foo');
15my $file = path(''. $tmp->exists('foo'))->slurp;
16ok($file, 'read it back in');
17is($file, 'these!are!some!lines!', 'lines end in !');
18
19my @file = $tmp->read('foo');
20is_deeply(\@file, [qw(these are some lines)], 'works in array context too');
21
22ok($tmp->append('foo', qw(now there are more)), 'add more lines');
23
24$file = path(''. $tmp->exists('foo'))->slurp;
25ok($file, 'read it back in');
26is($file, 'these!are!some!lines!now!there!are!more!', 'lines end in !');
27
28@file = $tmp->read('foo');
29is_deeply(\@file, [qw(these are some lines now there are more)],
30	  'works in array context too');
31