Changeset 335


Ignore:
Timestamp:
08/13/09 17:47:52 (15 years ago)
Author:
nanardon
Message:
  • add test over new features
File:
1 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts/t/05_utils.t

    r210 r335  
    11use strict; 
    22use warnings; 
    3 use Test::More tests => 2; 
     3use Test::More tests => 5; 
     4use File::Temp qw(mkstemp); 
    45 
    56use_ok('LATMOS::Accounts::Utils'); 
     
    78 
    89ok(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; 
     22 
     23# now testing 
     24is($attributes{'attr1'}, 'attr1', "can get attribute from file"); 
     25ok(eq_set($attributes{'attr'}, [ qw(val1 val2) ]), 
     26        "can get multiple values attribute"); 
     27 
     28$ENV{EDITOR} = 'sleep 1; /bin/touch'; 
     29 
     30ok(LATMOS::Accounts::Utils::dump_read_temp_file( 
     31        sub { 1; }, sub { 1; }), "Can edit temp file"); 
Note: See TracChangeset for help on using the changeset viewer.