Merge pull request #46 from ericbmerritt/master

fix testing for erlware_commons
This commit is contained in:
Tristan Sloughter 2013-10-14 14:23:22 -07:00
commit 2e61eb481d
11 changed files with 46 additions and 49 deletions

View file

@ -227,7 +227,7 @@ colorize_(Color, Bold, Msg) when is_integer(Color), is_integer(Bold)->
%%% Test Functions
%%%===================================================================
-ifndef(NOTEST).
-ifdef(DEV_ONLY).
-include_lib("eunit/include/eunit.hrl").
should_test() ->

View file

@ -33,7 +33,7 @@
is_true/1,
is_false/1]).
-ifndef(NOTEST).
-ifdef(DEV_ONLY).
-include_lib("proper/include/proper.hrl").
-endif.
@ -218,10 +218,10 @@ to_atom(X) ->
to_atom(to_list(X)).
%%%===================================================================
%%% API
%%% Tests
%%%===================================================================
-ifndef(NOTEST).
-ifdef(DEV_ONLY).
-include_lib("eunit/include/eunit.hrl").
force_proper_test_() ->

View file

@ -671,14 +671,14 @@ pad2(X) when is_float(X) ->
ltoi(X) ->
list_to_integer(X).
%%
%% TEST FUNCTIONS
%%
%% c(dh_date,[{d,'TEST'}]).
%-define(NOTEST, 1).
%%%===================================================================
%%% Tests
%%%===================================================================
-ifdef(DEV_ONLY).
-include_lib("eunit/include/eunit.hrl").
-define(DATE, {{2001,3,10},{17,16,17}}).
-define(DATEMS, {{2001,3,10},{17,16,17,123456}}).
-define(DATE_NOON, {{2001,3,10},{12,0,0}}).
@ -938,3 +938,4 @@ zulu_test_() ->
?_assertEqual(format("Y-m-d\\TH:i:s",nparse("2001-03-10T15:16:17-04:00")),
"2001-03-10T19:16:17")
].
-endif.

View file

@ -298,7 +298,7 @@ sub_files(From) ->
%%% Test Functions
%%%===================================================================
-ifndef(NOTEST).
-ifdef(DEV_ONLY).
-include_lib("eunit/include/eunit.hrl").
setup_test() ->

View file

@ -154,7 +154,7 @@ keys(Data) ->
%%%===================================================================
-ifndef(NOTEST).
-ifdef(DEV_ONLY).
-include_lib("eunit/include/eunit.hrl").
%% For me unit testing initially is about covering the obvious case. A

View file

@ -68,7 +68,7 @@ fetch(Fun, List) when is_list(List), is_function(Fun) ->
%%% Test Functions
%%%===================================================================
-ifndef(NOTEST).
-ifdef(DEV_ONLY).
-include_lib("eunit/include/eunit.hrl").
find1_test() ->

View file

@ -314,7 +314,7 @@ internal_pes(Vsn, LVsn) ->
%%% Test Functions
%%%===================================================================
-ifndef(NOTEST).
-ifdef(DEV_ONLY).
-include_lib("eunit/include/eunit.hrl").
eql_test() ->

View file

@ -1,4 +1,3 @@
%%% vi:ts=4 sw=4 et
-module(ec_semver_parser).
-export([parse/1,file/1]).
-compile({nowarn_unused_function,[p/4, p/5, p_eof/0, p_optional/1, p_not/1, p_assert/1, p_seq/1, p_and/1, p_choose/1, p_zero_or_more/1, p_one_or_more/1, p_label/2, p_string/1, p_anything/0, p_charclass/1, p_regexp/1, p_attempt/4, line/1, column/1]}).
@ -6,7 +5,7 @@
-compile(export_all).
-spec file(file:name()) -> any().
file(Filename) -> {ok, Bin} = file:read_file(Filename), parse(Bin).
file(Filename) -> case file:read_file(Filename) of {ok,Bin} -> parse(Bin); Err -> Err end.
-spec parse(binary() | list()) -> any().
parse(List) when is_list(List) -> parse(list_to_binary(List));

View file

@ -43,8 +43,6 @@
type/0,
supported/0]).
-include_lib("eunit/include/eunit.hrl").
%%============================================================================
%% Types
%%============================================================================
@ -202,6 +200,9 @@ get_string(String) ->
%%%====================================================================
%%% tests
%%%====================================================================
-ifdef(DEV_ONLY).
-include_lib("eunit/include/eunit.hrl").
general_test_() ->
[?_test(42 == get_integer("42")),
?_test(500211 == get_integer("500211")),
@ -216,3 +217,5 @@ general_test_() ->
?_test(false == get_boolean("False")),
?_test(false == get_boolean("No")),
?_test(false == get_boolean("no"))].
-endif.

View file

@ -1,6 +1,8 @@
%%% @copyright Erlware, LLC.
-module(ec_plists_tests).
-ifdef(DEV_ONLY).
-include_lib("eunit/include/eunit.hrl").
%%%===================================================================
@ -73,3 +75,5 @@ ftmap_bad_test() ->
lists:seq(1, 5)),
?assertMatch([{value, 1}, {error,{throw,test_exception}}, {value, 3},
{value, 4}, {value, 5}] , Results).
-endif.

View file

@ -1,10 +0,0 @@
-module(mock).
-export([new_dictionary/0]).
new_dictionary() ->
meck:new(ec_dictionary_proper),
meck:expect(ec_dictionary_proper, dictionary, fun() ->
proper_types:union([ec_dict])
end).