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

Version Path
trackler-2.0.6.28 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.27 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.26 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.25 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.24 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.23 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.22 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.21 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.20 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.19 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.18 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.17 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.16 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.15 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.14 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.13 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.12 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.11 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.10 tracks/erlang/_test/check-exercises.escript
trackler-2.0.6.9 tracks/erlang/_test/check-exercises.escript