1#!/usr/bin/perl
2# touch.t
3# Copyright (c) 2006 Jonathan Rockway <jrockway@cpan.org>
4
5use Test::More tests => 8;
6use Directory::Scratch;
7use strict;
8use warnings;
9use Path::Tiny;
10
11my $tmp = Directory::Scratch->new;
12ok($tmp, 'created $tmp');
13ok($tmp->touch('foo', qw(foo bar baz)), 'created foo');
14ok($tmp->exists('foo'), 'foo exists');
15my @lines = path($tmp->exists('foo')->stringify)->lines;
16is(chomp @lines, 3, 'right number of lines');
17is_deeply(\@lines, [qw(foo bar baz)], 'foo has correct contents');
18ok($tmp->touch('bar'), 'created bar');
19ok($tmp->exists('bar'), 'bar exists');
20ok(!path($tmp->exists('bar')->stringify)->slurp, 'bar has no content');
21