source: LATMOS-Accounts/t/05_utils.t @ 517

Last change on this file since 517 was 338, checked in by nanardon, 15 years ago
  • unlink test file
File size: 733 bytes
Line 
1use strict;
2use warnings;
3use Test::More tests => 5;
4use File::Temp qw(mkstemp);
5
6use_ok('LATMOS::Accounts::Utils');
7use LATMOS::Accounts::Log;
8
9ok(la_log(LA_NOTICE, "a notice"), "can run la_log");
10
11my ($fh, $file) = mkstemp( "tmpfileXXXXX" );
12print $fh <<EOF;
13attr1: attr1
14attr: val1
15attr: val2
16EOF
17
18seek($fh, 0, 0);
19
20my %attributes = LATMOS::Accounts::Utils::parse_obj_file($fh);
21$fh = undef;
22unlink($file);
23
24# now testing
25is($attributes{'attr1'}, 'attr1', "can get attribute from file");
26ok(eq_set($attributes{'attr'}, [ qw(val1 val2) ]),
27        "can get multiple values attribute");
28
29$ENV{EDITOR} = 'sleep 1; /bin/touch';
30
31ok(LATMOS::Accounts::Utils::dump_read_temp_file(
32        sub { 1; }, sub { 1; }), "Can edit temp file");
Note: See TracBrowser for help on using the repository browser.