Begin adding typespecs

This commit is contained in:
Michael Santos
2014-03-02 12:56:15 -05:00
parent 742b7eccf0
commit 04f93d22fe
3 changed files with 24 additions and 5 deletions

View File

@@ -32,10 +32,10 @@ $(DEPSOLVER_PLT):
--apps erts kernel stdlib crypto
dialyzer: $(DEPSOLVER_PLT)
@dialyzer --plt $(DEPSOLVER_PLT) -Wrace_conditions --src src test examples
@dialyzer -I include --plt $(DEPSOLVER_PLT) -Wrace_conditions --src src test
typer: $(DEPSOLVER_PLT)
@typer --plt $(DEPSOLVER_PLT) -r ./src
@typer -I include --plt $(DEPSOLVER_PLT) -r ./src
distclean: clean
@rm $(DEPSOLVER_PLT)

View File

@@ -234,7 +234,8 @@ call(Port, Command) ->
static({call,3}) ->
"
call(Port, execvp, Arg) when is_port(Port), is_list(Arg) ->
alcove_drv:cast(Port, alcove_drv:encode(command(execvp), Arg));
alcove_drv:cast(Port, alcove_drv:encode(command(execvp), Arg)),
ok;
call(Port, Command, Arg) when is_port(Port), is_list(Arg) ->
case alcove_drv:call(Port, alcove_drv:encode(command(Command), Arg)) of
badarg ->
@@ -249,4 +250,22 @@ includes(Header) ->
% FIXME hack for hard coding typespecs
specs() ->
"".
"
-spec stdin(port(),binary()) -> 'true'.
-spec stdout(port()) -> any().
-spec stdout(port(),'infinity' | non_neg_integer()) -> any().
-spec stderr(port()) -> any().
-spec stderr(port(),'infinity' | non_neg_integer()) -> any().
-spec recv(port()) -> any().
-spec recv(port(),'infinity' | non_neg_integer()) -> any().
-spec setrlimit(port(),non_neg_integer(),#rlimit{}) -> 'ok' | {'error', file:posix()}.
-spec chdir(port(),iodata()) -> 'ok' | {'error', file:posix()}.
-spec chroot(port(),iodata()) -> 'ok' | {'error', file:posix()}.
-spec execvp(port(),iodata(),iodata()) -> 'ok'.
-spec getrlimit(port(),non_neg_integer()) -> {'ok', #rlimit{}} | {'error', file:posix()}.
-spec setgid(port(),non_neg_integer()) -> 'ok' | {'error', file:posix()}.
-spec setns(port(),iodata()) -> 'ok' | {'error', file:posix()}.
-spec setrlimit(port(),non_neg_integer(),non_neg_integer(),non_neg_integer()) -> 'ok' | {'error', file:posix()}.
-spec setuid(port(),non_neg_integer()) -> 'ok' | {'error', file:posix()}.
-spec version(port()) -> binary().
".

View File

@@ -38,4 +38,4 @@ stop(Port) ->
version(Port) ->
Version = alcove:version(Port),
?_assertMatch(true, is_binary(Version)).
?_assertEqual(true, is_binary(Version)).