Line | |
---|
1 | use strict; |
---|
2 | use warnings; |
---|
3 | use Test::More tests => 5; |
---|
4 | use File::Temp qw(mkstemp); |
---|
5 | |
---|
6 | use_ok('LATMOS::Accounts::Utils'); |
---|
7 | use LATMOS::Accounts::Log; |
---|
8 | |
---|
9 | ok(la_log(LA_NOTICE, "a notice"), "can run la_log"); |
---|
10 | |
---|
11 | my ($fh, $file) = mkstemp( "tmpfileXXXXX" ); |
---|
12 | print $fh <<EOF; |
---|
13 | attr1: attr1 |
---|
14 | attr: val1 |
---|
15 | attr: val2 |
---|
16 | EOF |
---|
17 | |
---|
18 | seek($fh, 0, 0); |
---|
19 | |
---|
20 | my %attributes = LATMOS::Accounts::Utils::parse_obj_file($fh); |
---|
21 | $fh = undef; |
---|
22 | unlink($file); |
---|
23 | |
---|
24 | # now testing |
---|
25 | is($attributes{'attr1'}, 'attr1', "can get attribute from file"); |
---|
26 | ok(eq_set($attributes{'attr'}, [ qw(val1 val2) ]), |
---|
27 | "can get multiple values attribute"); |
---|
28 | |
---|
29 | $ENV{EDITOR} = 'sleep 1; /bin/touch'; |
---|
30 | |
---|
31 | ok(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.