Sha256: bbfea9bc9cbfe03d46d8e07cab81c9cb88d906338c99b97622fad983cedcc5da
Contents?: true
Size: 1.08 KB
Versions: 84
Compression:
Stored size: 1.08 KB
Contents
#! /usr/bin/env escript main( [] ) -> Examples = filelib:wildcard( "exercises/*/example.erl" ), Modules = [{X, compile(X)} || X <- Examples], [compile_tests(X) || X <- Modules], Results = [run_tests(X) || X <- Modules], erlang:halt( erlang:length([X || X <- Results, X =/= ok]) ); main( _ ) -> usage(). compile( File ) -> Compile = compile:file( File, [binary, return_errors] ), {compile, File, {ok, Module, Binary}} = {compile, File, Compile}, Load = code:load_binary( Module, File, Binary ), {load, Module, Load} = {load, Module, Load}, {Module, Binary}. compile_tests( {Example, {Example_module, _Binary}} ) -> Filename = erlang:atom_to_list(Example_module) ++ "_tests.erl", Filepath = filename:join( [filename:dirname(Example), Filename] ), compile( Filepath ). run_tests( {_Example, {Module, _Binary}} ) -> io:fwrite( "~p: ", [Module] ), eunit:test( Module, [verbose] ). usage() -> io:fwrite( "Usage: ~s~n", [escript:script_name()] ), io:fwrite( "~s will compile and run Erlang examples and test cases in sub directories of where it is started.~n", [escript:script_name()] ).
Version data entries
84 entries across 84 versions & 1 rubygems