-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquick.erl
50 lines (39 loc) · 1.65 KB
/
quick.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
%%%----------------------------------------------------------------------------
%%% File : quick.erl
%%% Description : Quick Start for erlunit.erl
%%% Type : Documentation
%%% Version : 0.2.8.2/alpha
%%% Status : alpha
%%%----------------------------------------------------------------------------
%%%
%%% Usage:
%%%
%%% # erl
%%% 1> c(erlunit), c(quick), quick:run().
%%%
%%%----------------------------------------------------------------------------
-module(quick).
-import(erlunit).
-export([run/0, run2/0]).
%%%****************************************************************************
%%% QUICK START - SEQUENTIAL CALL STYLE
%%%****************************************************************************
run() ->
erlunit:start(),
erlunit:equal(1, 1),
erlunit:execute().
% TRY: Alter it to ... erlunit:equal(1, 2) ... and run again.
%%%****************************************************************************
%%% QUICK START - MESSAGE PASSING STYLE
%%%****************************************************************************
%%% Same as above, different notation. Allows for concurrent tests.
run2() ->
Test = erlunit:start(),
Test ! { equal, 1, 1 },
erlunit:execute().
% TRY: Alter it to ... Test ! { fail(fun() -> 1 / 0 end)) } ... and run again.
%%%----------------------------------------------------------------------------
%%% Also: equal, true, false, bigger, lesser, pass, fail, throws, error, exits.
%%% More: read sample.erl next. It's written to be read top down. Or MANUAL.
%%% Home: http://github.com/Eonblast/Erlunit
%%%----------------------------------------------------------------------------