summaryrefslogtreecommitdiff
path: root/fml/lib/IO/t/file_read.pl
blob: 801d6bed3d89cc12430e227416302dd9b7ae2b98 (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
#-*- perl -*-
#
#  Copyright (C) 2001 Ken'ichi Fukamachi
#   All rights reserved. This program is free software; you can
#   redistribute it and/or modify it under the same terms as Perl itself.
#
# $FML: file_map.pl,v 1.6 2002/04/01 23:41:14 fukachan Exp $
#

use strict;
use Carp;

my $file   = "/etc/passwd";
my $map    = "file:$file";

use FML::Test::Utils;
my $tool = new FML::Test::Utils;
$tool->set_title("file read");

my $orgbuf = $tool->get_content($file);
my $buf    = '';

use IO::Adapter;
my $obj = new IO::Adapter $map;
$obj->open || $tool->error("cannot open $map");
if ($obj->error) { $tool->error( $obj->error );}
while (my $x = $obj->getline) { $buf .= $x; }
$obj->close;

$tool->diff($orgbuf, $buf);

exit 0;