-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
563f58e
commit 66efe95
Showing
6 changed files
with
109 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "erlang", | ||
"request": "launch", | ||
"name": "Debug Erlang", | ||
"cwd": "${workspaceFolder}", | ||
"startmodule": "web_server_request_listener", | ||
"args": [] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>First web page </title> | ||
</head> | ||
<body> | ||
<h1>Hello World</h1> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
{erl_opts, [debug_info]}. | ||
|
||
{deps, []}. | ||
{deps, [ | ||
{meck, "0.9.2"} | ||
]}. | ||
|
||
{shell, [ | ||
%% {config, "config/sys.config"}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
[]. | ||
{"1.2.0", | ||
[{<<"meck">>,{pkg,<<"meck">>,<<"0.9.2">>},0}]}. | ||
[ | ||
{pkg_hash,[ | ||
{<<"meck">>, <<"85CCBAB053F1DB86C7CA240E9FC718170EE5BDA03810A6292B5306BF31BAE5F5">>}]}, | ||
{pkg_hash_ext,[ | ||
{<<"meck">>, <<"81344F561357DC40A8344AFA53767C32669153355B626EA9FCBC8DA6B3045826">>}]} | ||
]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-module(web_server_request_listener_tests). | ||
-include_lib("eunit/include/eunit.hrl"). | ||
|
||
%% Testa a inicialização do gen_server | ||
start_link_test_() -> | ||
{setup, | ||
fun setup/0, % executada antes dos testes | ||
fun cleanup/1, % executada após os testes | ||
fun tests/1}. % executa o teste | ||
|
||
setup() -> | ||
{ok, Pid} = web_server_request_listener:start_link(), | ||
io:format("Starting gen_server PID %s", Pid), | ||
Pid. | ||
|
||
%% Função de cleanup: para o gen_server | ||
cleanup(Pid) -> | ||
web_server_request_listener:stop(), | ||
io:format("Ending the gen_server PID %s", Pid), | ||
ok. | ||
|
||
%% Testes | ||
tests(Pid) -> | ||
[?_assert(erlang:is_process_alive(Pid)), | ||
?_test(test_handle_call(Pid)), | ||
?_test(test_handle_cast(Pid))]. | ||
|
||
%% Testa uma chamada síncrona (handle_call/3) | ||
test_handle_call(Pid) -> | ||
{reply, ok, _State} = gen_server:call(Pid, test_call), | ||
?assertEqual(ok, ok). | ||
|
||
%% Testa uma mensagem assíncrona (handle_cast/2) | ||
test_handle_cast(Pid) -> | ||
gen_server:cast(Pid, test_cast), | ||
?assertEqual(ok, ok). |