Skip to content

Commit

Permalink
Got Eunit tests working with R12B-5.
Browse files Browse the repository at this point in the history
  • Loading branch information
Torbjorn Tornkvist committed Feb 8, 2009
1 parent e86df75 commit c10982c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions Emakefile
@@ -1,5 +1,6 @@
{ './src/*', [
{ i, "./include" },
{ outdir, "./ebin" },
{ d, 'TEST', true },
debug_info
]}.
7 changes: 7 additions & 0 deletions README.md
@@ -1,9 +1,16 @@
This is an implementation of OpenID version 1.1.

Requirements: R12B-5 and Mochiweb

To run the currently working parts:

erl -pa ./ebin -pa ~/svn/mochiweb-read-only/ebin -s inets

eopenid_v1:discover("www.tornkvist.org").

% To run the Unit Tests
eopenid_v1:test().




14 changes: 11 additions & 3 deletions src/eopenid_v1.erl
Expand Up @@ -6,9 +6,13 @@
-module(eopenid_v1).

-export([discover/1
,t/1
]).

-ifdef(TEST).
-export([t/1
]).
-endif.

-import(eopenid_lib,
[new/0
,in/2
Expand All @@ -21,7 +25,6 @@

-include_lib("xmerl/include/xmerl.hrl").

%%-define(TEST, true). % temporary
-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
-endif.
Expand Down Expand Up @@ -123,7 +126,11 @@ gelems([E|T], L, S) when is_list(L) ->
end, S, L);
gelems(_, _, S) -> S.




-ifdef(EUNIT).

gelem_test() ->
?assertMatch([{<<"link">>,
[{<<"rel">>,<<"openid.delegate">>},
Expand All @@ -135,7 +142,6 @@ gelem_test() ->
[]}],
t(1)).

-endif.

t(1) ->
gelems([<<"html">>,<<"head">>,<<"link">>], data()).
Expand Down Expand Up @@ -175,3 +181,5 @@ data() ->
[{<<"href">>,<<"http://domerl.tornkvist.org/">>}],
[<<"A Domerl Example">>]}]}]}]}]}]}.


-endif.

0 comments on commit c10982c

Please sign in to comment.