Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

get 'make test' working

  • Loading branch information...
commit fc13ef78f57d40729cc52dcd91d9f4c2a10c65b7 1 parent c9da037
@trung authored
Showing with 43 additions and 2 deletions.
  1. +4 −0 Makefile
  2. +39 −2 test/record_utils_test.erl
View
4 Makefile
@@ -1,5 +1,9 @@
all:
(cd src;$(MAKE))
+ (cd test;$(MAKE))
+
+test: all
+ $(foreach var, $(patsubst ebin/%.beam,%,$(wildcard ebin/*_test.beam)), erl -noshell -pa ebin -s $(var) test -s init stop)
docs:
erl -pa `pwd`/ebin \
View
41 test/record_utils_test.erl
@@ -39,9 +39,46 @@ new_record(command_message) ->
operation = ?UNKNOWN_OPERATION
}.
-%% Test setters
abstract_message_set_clientId_test() ->
NewValue = 2,
{ok, NewR, _} = record_utils:set(new_record(abstract_message), clientId, NewValue),
?assert(is_record(NewR, abstract_message)),
- ?assert(NewR#abstract_message.clientId =:= NewValue).
+ ?assert(NewR#abstract_message.clientId =:= NewValue).
+
+abstract_message_set_destination_test() ->
+ NewValue = "new dest",
+ {ok, NewR, _} = record_utils:set(new_record(abstract_message), destination, NewValue),
+ ?assert(is_record(NewR, abstract_message)),
+ ?assert(NewR#abstract_message.destination =:= NewValue).
+
+abstract_message_set_messageId_test() ->
+ NewValue = "some value",
+ {ok, NewR, _} = record_utils:set(new_record(abstract_message), messageId, NewValue),
+ ?assert(is_record(NewR, abstract_message)),
+ ?assert(NewR#abstract_message.messageId =:= NewValue).
+
+abstract_message_set_timestamp_test() ->
+ NewValue = 9,
+ {ok, NewR, _} = record_utils:set(new_record(abstract_message), timestamp, NewValue),
+ ?assert(is_record(NewR, abstract_message)),
+ ?assert(NewR#abstract_message.timestamp =:= NewValue).
+
+abstract_message_set_timeToLive_test() ->
+ NewValue = 9,
+ {ok, NewR, _} = record_utils:set(new_record(abstract_message), timeToLive, NewValue),
+ ?assert(is_record(NewR, abstract_message)),
+ ?assert(NewR#abstract_message.timeToLive =:= NewValue).
+
+abstract_message_set_headers_test() ->
+ NewValue = [{newheader1}, {newheader2}],
+ {ok, NewR, _} = record_utils:set(new_record(abstract_message), headers, NewValue),
+ ?assert(is_record(NewR, abstract_message)),
+ ?assert(NewR#abstract_message.headers =:= NewValue).
+
+abstract_message_set_body_test() ->
+ NewValue = ["some body"],
+ {ok, NewR, _} = record_utils:set(new_record(abstract_message), body, NewValue),
+ ?assert(is_record(NewR, abstract_message)),
+ ?assert(NewR#abstract_message.body =:= NewValue).
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.