File: 06-append-prepend.t

package info (click to toggle)
libdirectory-scratch-perl 0.15-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 332 kB
  • ctags: 135
  • sloc: perl: 2,308; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 753 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/perl
# 06-append-prepend.t 
# Copyright (c) 2006 Jonathan Rockway <jrockway@cpan.org>
use Directory::Scratch;
use Test::More tests=>8;
use strict;
use warnings;

my $t = Directory::Scratch->new;
ok($t->write('baz', qw(foo bar baz yay!)));
is(scalar $t->read('baz'), "foo\nbar\nbaz\nyay!");
is_deeply([$t->read('baz')], [qw(foo bar baz yay!)]);
ok($t->append('baz', qw(yay! again)));

is(scalar $t->read('baz'), "foo\nbar\nbaz\nyay!\nyay!\nagain");
is_deeply([$t->read('baz')], [qw(foo bar baz yay! yay! again)]);

SKIP: {
    skip "waiting for prepend from uri", 2;
    ok($t->prepend('baz', [qw(what are we gonna do tonight brain)]));
    is_deeply([$t->read('baz')], [qw(what are we gonna do tonight brain foo bar baz yay! yay! again)]);
}