Permalink
Browse files

Added file directory to API for this

  • Loading branch information...
1 parent c107b71 commit b7d6ffa7f42bcbf8852aae0b131cfad01d1cb3ae Gianfranco Alongi committed Mar 8, 2012
Showing with 8 additions and 7 deletions.
  1. +6 −6 Two/Solution/src/port.erl
  2. +2 −1 Two/Solution/test/port_tests.erl
View
@@ -1,18 +1,18 @@
-module(port).
--export([open/2,
+-export([open/3,
close/1
]).
-record(port,{type :: echo,
socket :: gen_tcp:socket(),
number :: integer()
}).
--spec(open(integer(),atom() | string()) -> {ok,gen_tcp:socket()}).
-open(Port,echo) ->
+-spec(open(string(),integer(),atom() | string()) -> {ok,gen_tcp:socket()}).
+open(_,Port,echo) ->
{ok,Sock} = gen_tcp:listen(Port,[{active,false}]),
- {ok,#port{ type = echo,
- socket = Sock,
- number = Port}}.
+ {ok,#port{type = echo,
+ socket = Sock,
+ number = Port}}.
-spec(close(#port{}) -> ok).
close(Port) ->
@@ -4,7 +4,8 @@
echo_port_open_close_test() ->
Port = 50001,
Type = echo,
- {ok,Openport} = port:open(Port,Type),
+ FileDir = "./test/test_files/",
+ {ok,Openport} = port:open(FileDir,Port,Type),
assert_port_open(Port),
port:close(Openport),
assert_port_closed(Port).

0 comments on commit b7d6ffa

Please sign in to comment.