Ignore:
Timestamp:
04/11/10 19:19:02 (22 months ago)
Author:
dom
Message:

Two improvements (and new start API): multiple directories watched, and slave started if no node given

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/compiler_test.erl

    r94 r95  
    1818-export ([reset_includes_none/0]). 
    1919-export ([reset_includes_found/0]). 
     20-export ([can_be_given_several_directories/0]). 
    2021-include_lib("stdlib/include/ms_transform.hrl"). 
    2122 
     
    2526     
    2627compiles_and_reports_progress_warnings_and_errors (Root, _) -> 
    27     Compiler = spawn_link (compiler, init, [notify_me (), Root]), 
     28    Compiler = spawn_link (compiler, init, [notify_me (), [Root]]), 
    2829    Compiler ! check, 
    2930    Ms = receive_all (), 
     
    3536 
    3637stops (Root, _) -> 
    37     Compiler = spawn_link (compiler, init, [notify_me (), Root]), 
     38    Compiler = spawn_link (compiler, init, [notify_me (), [Root]]), 
    3839    Compiler ! check, 
    3940    receive_all (), 
     
    6869    ok = fixtures: use_tree (Tree, F). 
    6970 
     71can_be_given_several_directories () -> 
     72    Tree = [{directory, "src1", good_erl_tree ()}, 
     73            {directory, "src2", [{file, "yo.erl", "-module(yo)."}]}], 
     74    ok = fixtures: use_tree (Tree, fun can_be_given_several_directories/2). 
     75 
     76can_be_given_several_directories (Root, _) -> 
     77    Dirs = [filename: join (Root, D) || D <- ["src1", "src2"]], 
     78    Compiler = spawn_link (compiler, init, [notify_me (), Dirs]), 
     79    Compiler ! check, 
     80    Ms = receive_all (), 
     81    Compiler ! stop, 
     82    [{3, 0, 0}, _, _, {3, 3, 3}, {{binaries, _}, _}] = Ms, 
     83    ok. 
     84     
    7085can_be_given_include_directories () -> 
    7186    Src = "-module(inc).\n-include(\"inc.hrl\").", 
     
    91106 
    92107adds_root_to_include_path (Root, _) -> 
    93     Compiler = spawn_link (compiler, init, [notify_me (), Root]), 
     108    Compiler = spawn_link (compiler, init, [notify_me (), [Root]]), 
    94109    Compiler ! check, 
    95110    Ms = receive_all (), 
     
    113128 
    114129discovers_hrl (Root, _) -> 
    115     Compiler = spawn_link (compiler, init, [notify_me (), Root]), 
     130    Compiler = spawn_link (compiler, init, [notify_me (), [Root]]), 
    116131    Compiler ! check, 
    117132    Ms = receive_all (), 
     
    121136 
    122137provides_binaries_when_all_compiled (Root, _) -> 
    123     Compiler = spawn_link (compiler, init, [notify_me (), Root]), 
     138    Compiler = spawn_link (compiler, init, [notify_me (), [Root]]), 
    124139    Compiler ! check, 
    125140    Ms = receive_all (), 
     
    133148 
    134149provides_all_binaries_not_just_latest_when_all_compiled (Root, [_, File]) -> 
    135     Compiler = spawn_link (compiler, init, [notify_me (), Root]), 
     150    Compiler = spawn_link (compiler, init, [notify_me (), [Root]]), 
    136151    Compiler ! check, 
    137152    [{2, 0, 0}, _, _, {2, 2, 1}] = receive_all (), 
     
    144159 
    145160recompiles_minimally_after_change (Root, _) -> 
    146     Compiler = spawn_link (compiler, init, [notify_me (), Root]), 
     161    Compiler = spawn_link (compiler, init, [notify_me (), [Root]]), 
    147162    Compiler ! check, 
    148163    receive_all (), 
     
    158173 
    159174can_start_empty_and_add_files (Root, []) -> 
    160     Compiler = spawn_link (compiler, init, [notify_me (), Root]), 
     175    Compiler = spawn_link (compiler, init, [notify_me (), [Root]]), 
    161176    Compiler ! check, 
    162177    [timeout] = receive_all (), 
     
    170185 
    171186notifies_removed_files (Root, [F, _]) -> 
    172     Compiler = spawn_link (compiler, init, [notify_me (), Root]), 
     187    Compiler = spawn_link (compiler, init, [notify_me (), [Root]]), 
    173188    Compiler ! check, 
    174189    receive_all (), 
     
    181196 
    182197notifies_removed_files_even_if_never_compiled (Root, [F]) -> 
    183     Compiler = spawn_link (compiler, init, [notify_me (), Root]), 
     198    Compiler = spawn_link (compiler, init, [notify_me (), [Root]]), 
    184199    Compiler ! check, 
    185200    [{1, 0, 0}, {_, _}, {1, 1, 0}] = receive_all (), 
     
    195210include_no_directory (Root, _) -> 
    196211    Src = filename: join (Root, "src"), 
    197     Compiler = spawn_link (compiler, init, [notify_me (), Src]), 
     212    Compiler = spawn_link (compiler, init, [notify_me (), [Src]]), 
    198213    Compiler ! check, 
    199214    [{1, 0, 0}, {_, _}, {1, 1, 0}] = receive_all (), 
     
    204219    Src = filename: join (Root, "src"), 
    205220    Inc = filename: join (Root, "include"), 
    206     Compiler = spawn_link (compiler, init, [notify_me (), Src, [{i, Inc}]]), 
     221    Compiler = spawn_link (compiler, init, [notify_me (), [Src], [{i, Inc}]]), 
    207222    Compiler ! check, 
    208223    [{1, 0, 0}, {1, 1, 1}, {{binaries, _}, _}] = receive_all (), 
Note: See TracChangeset for help on using the changeset viewer.