Skip to content

Commit

Permalink
Some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiw committed Sep 30, 2019
1 parent a07be24 commit 937ad2e
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 26 deletions.
12 changes: 6 additions & 6 deletions elisp/edts/edts-api-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@
(edts-test-case edts-api-suite edts-api-start-server-test ()
"Tests that the main server starts ok."
(edts-test-pre-cleanup-all-buffers)
(edts-test-wait-for (lambda () (not (edts-api-node-started-p "edts-server"))))
(edts-test-wait-for (lambda () (not (edts-api-node-started-p edts-api-server-name))))
(edts-api-start-server)
(edts-test-wait-for (lambda () (edts-api-node-started-p "edts-server")))
(kill-buffer "*edts-server*")
(edts-test-wait-for (lambda () (edts-api-node-started-p edts-api-server-name)))
(kill-buffer (concat "*" edts-api-server-name "*"))
(edts-test-wait-for
(lambda () (not (edts-api-node-started-p "edts-server")))))
(lambda () (not (edts-api-node-started-p edts-api-server-name)))))

(edts-test-case edts-api-suite edts-api-init-node-test ()
"Tests that it's possible to register nodes with the main server."
(edts-api-ensure-server-started)
(edts-test-wait-for (lambda () (edts-api-node-started-p "edts-server")))
(edts-test-wait-for (lambda () (edts-api-node-started-p edts-api-server-name)))
(edts-shell-make-comint-buffer "test-node"
"*test_node*"
(edts-test-project-directory 'temp-2)
Expand All @@ -79,7 +79,7 @@
(edts-test-case edts-api-suite edts-api-module-operations-test ()
"Tests that it's possible to perform module operations on a project node."
(edts-api-ensure-server-started)
(edts-test-wait-for (lambda () (edts-api-node-started-p "edts-server")))
(edts-test-wait-for (lambda () (edts-api-node-started-p edts-api-server-name)))
(let* (node-initialized
(edts-api-after-node-init-hook
(list (lambda () (setq node-initialized t)))))
Expand Down
6 changes: 3 additions & 3 deletions elisp/edts/edts-api.el
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ the node-name of the node that has gone down as the argument.")

(defvar edts-node-sname
(if (string= "" edts-erl-sname) edts-api-server-name edts-erl-sname)
"Use e`dts-erl-sname' if available. If not the sname will be
set to \"edts\". This makes it possible to have several edts
nodes on the same host.")
"Use `edts-erl-sname' if available. If not the sname will be
set to `edts-api-server-name'. This makes it possible to have
several edts nodes on the same host.")
(make-variable-buffer-local 'edts-node-sname)

(defun edts-api-ensure-server-started ()
Expand Down
1 change: 1 addition & 0 deletions lib/edts/src/edts_event.erl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
[{{class(), type()}, module()}]
}).

%% Don't include the otp_workarounds.hrl. That file is not sent to the node.
-ifdef(OTP_RELEASE). %% this implies 21 or higher
-define(EXCEPTION(Class, Reason, StackToken), Class:Reason:StackToken).
-define(GET_STACK(StackToken), StackToken).
Expand Down
19 changes: 5 additions & 14 deletions lib/edts/src/edts_mochiweb.erl
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ format_term(Term) ->
list_to_binary(lists:flatten(io_lib:format("~p", [Term]))).

do_handle_request(Req) ->
case [list_to_atom(E) || E <- string:tokens(mochiweb_request:get(path, Req), "/")] of
Path = mochiweb_request:get(path, Req),
case [list_to_atom(E) || E <- string:tokens(Path, "/")] of
[Command] ->
edts_cmd:run(Command, get_input_context(Req));
[lib, Plugin, Command] ->
edts_cmd:plugin_run(Plugin, Command, get_input_context(Req));
Path ->
BinPath = iolist_to_binary([atom_to_list(P) || P <- Path]),
{error, {not_found, [{path, BinPath}]}}
_ ->
{error, {not_found, [{path, list_to_binary(Path)}]}}
end.

get_input_context(Req) ->
Expand Down Expand Up @@ -145,19 +145,10 @@ respond(Req, Code, Data) ->
%%%_* Internal functions =======================================================

configured_port() ->
Port = getenv("EDTS_PORT", ?EDTS_PORT_DEFAULT),
Port = os:getenv("EDTS_PORT", ?EDTS_PORT_DEFAULT),
edts_log:debug("Using EDTS port ~p from file.", [Port]),
list_to_integer(Port).

%%% TODO: Remove this function when dropping R17 support. Use os:getenv/2.
getenv(Variable, Default) ->
case os:getenv(Variable) of
false ->
Default;
Value ->
Value
end.

%%%_* Emacs ====================================================================
%%% Local Variables:
%%% allout-layout: t
Expand Down
2 changes: 1 addition & 1 deletion test_data/edts-test-project-project-1/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ERL_LIBS = $(shell pwd)/lib

all:
@cd lib/one; erlc -o ebin -Iinclude +debug_info src/*.erl
@cd lib/one; erlc -o ebin +debug_info src/*.erl
@cd lib/two; erlc -o ebin +debug_info src/*.erl

clean:
Expand Down
2 changes: 1 addition & 1 deletion test_data/edts-test-project-project-1/lib/one/src/one.erl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-module(one).

-include_lib("eunit/include/eunit.hrl").
-include_lib("include/test.hrl").
-include("include/test.hrl").

-export([one/1]).

Expand Down
2 changes: 1 addition & 1 deletion test_data/load-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

(require 'edts-mode)

(dolist (file (f-glob (f-join edts-code-directory "*-test.el"))) ; (f-join edts-dir "elisp" "edts" "*-test.el")))
(dolist (file (f-glob (f-join edts-dir "elisp" "edts" "*-test.el")))
;; avoid symlinks created as emacs backups
(when (not (f-symlink? file))
(load file)))
Expand Down

0 comments on commit 937ad2e

Please sign in to comment.