Changeset 3


Ignore:
Timestamp:
05/01/07 08:43:31 (5 years ago)
Author:
dom
Message:

Fix testing_server and add a nice plain logger

Location:
trunk/src
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/testing_server.erl

    r2 r3  
    3131 
    3232-export([start/3,stop/0,loop/5]). 
     33-export([start/2, stop/1]). 
    3334 
    34 start(Dir,Notification,Options) -> 
     35start (Dir, Notification, Options) when is_function (Notification) -> 
    3536    Pid = spawn (?MODULE, loop, [Dir, Notification, Options, no_monitor, init]), 
    3637    register(testing_server,Pid), 
     
    4243    Pid. 
    4344 
     45start (Dir, File) -> 
     46    Logger = spawn (plain_file_logger, start, [File, write]), 
     47    Notify = fun(E) -> Logger ! E end, 
     48    Server = start (Dir, Notify, [{report_function, Notify}]), 
     49    {Server, Logger}. 
     50 
    4451stop()-> 
    4552    testing_server ! stop. 
     53 
     54stop ({Server, Logger}) -> 
     55    Server ! stop, 
     56    Logger ! stop, 
     57    bye. 
    4658 
    4759loop (Dir, Notification, Options, no_monitor, State) -> 
     
    5971        stop -> 
    6072            file_monitor:stop(Monitor); 
    61         {Monitor, _, _} -> 
    62             New_state = xpdojo:test_files (Dir, Options), 
    63             notify (Notification, New_state, State), 
     73        {Monitor, _, File} -> 
     74            case filename:extension (File) of 
     75                ".erl" -> 
     76                    New_state = xpdojo:test_files (Dir, Options), 
     77                    Notification (New_state); 
     78                _ -> 
     79                    New_state = State 
     80            end, 
    6481            loop (Dir, Notification, Options, Monitor, New_state); 
    6582        _ -> 
    6683            loop (Dir, Notification, Options, Monitor, State) 
    6784    end. 
    68  
    69 notify (_, unchanged, _) -> 
    70     ok; 
    71 notify (_, State, State) -> 
    72     ok; 
    73 notify (Notify, New_state, _) -> 
    74     Notify (New_state). 
    7585 
    7686purge_monitor_message(Monitor) -> 
Note: See TracChangeset for help on using the changeset viewer.