summaryrefslogtreecommitdiff
path: root/inttest/erlc/src
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2014-03-05 17:59:35 +0100
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2014-03-12 20:45:37 +0100
commitb2dfebab15cc92b337b9cc9e771cb7de3ed61e4a (patch)
treee796b6bd2451599cdd0143f0b58e4ae231b9e609 /inttest/erlc/src
parentfe9d328cb5133ee91dd3bbd45849e0772bf197c5 (diff)
erlc: add test suite
Diffstat (limited to 'inttest/erlc/src')
-rw-r--r--inttest/erlc/src/behaviour/foo_worker.erl14
-rw-r--r--inttest/erlc/src/first_xrl.xrl13
-rw-r--r--inttest/erlc/src/first_yrl.yrl9
-rw-r--r--inttest/erlc/src/foo.erl35
-rw-r--r--inttest/erlc/src/foo_app.erl10
-rw-r--r--inttest/erlc/src/foo_test_worker.erl34
6 files changed, 115 insertions, 0 deletions
diff --git a/inttest/erlc/src/behaviour/foo_worker.erl b/inttest/erlc/src/behaviour/foo_worker.erl
new file mode 100644
index 0000000..307c69a
--- /dev/null
+++ b/inttest/erlc/src/behaviour/foo_worker.erl
@@ -0,0 +1,14 @@
+-module(foo_worker).
+
+-ifdef(NO_CALLBACK_ATTRIBUTE).
+
+-export([behaviour_info/1]).
+
+behaviour_info(callbacks) -> [{status, 0}];
+behaviour_info(_) -> undefined.
+
+-else.
+
+-callback status() -> 'idle' | 'busy'.
+
+-endif.
diff --git a/inttest/erlc/src/first_xrl.xrl b/inttest/erlc/src/first_xrl.xrl
new file mode 100644
index 0000000..0de4c70
--- /dev/null
+++ b/inttest/erlc/src/first_xrl.xrl
@@ -0,0 +1,13 @@
+Definitions.
+
+D = [0-9]
+
+Rules.
+
+{D}+ :
+ {token,{integer,TokenLine,list_to_integer(TokenChars)}}.
+
+{D}+\.{D}+((E|e)(\+|\-)?{D}+)? :
+ {token,{float,TokenLine,list_to_float(TokenChars)}}.
+
+Erlang code.
diff --git a/inttest/erlc/src/first_yrl.yrl b/inttest/erlc/src/first_yrl.yrl
new file mode 100644
index 0000000..8ccdb0e
--- /dev/null
+++ b/inttest/erlc/src/first_yrl.yrl
@@ -0,0 +1,9 @@
+Nonterminals list elements element.
+Terminals atom '(' ')'.
+Rootsymbol list.
+list -> '(' ')'.
+list -> '(' elements ')'.
+elements -> element.
+elements -> element elements.
+element -> atom.
+element -> list.
diff --git a/inttest/erlc/src/foo.erl b/inttest/erlc/src/foo.erl
new file mode 100644
index 0000000..33e6cfc
--- /dev/null
+++ b/inttest/erlc/src/foo.erl
@@ -0,0 +1,35 @@
+-module(foo).
+
+-export([start_link/0,
+ start_link/1,
+ init/1,
+ terminate/2,
+ handle_info/2,
+ handle_call/3,
+ handle_cast/2,
+ code_change/3]).
+
+-behavior(gen_server).
+
+-include("foo_core.hrl").
+-include("foo_extra.hrl").
+-include_lib("kernel/include/file.hrl").
+
+-record(state, {node :: node()}).
+
+start_link() -> start_link(undefined).
+
+start_link(Args) ->
+ gen_server:start_link({local, ?MODULE}, ?MODULE, Args, []).
+
+init(_Args) -> {ok, #state{node=node()}}.
+
+terminate(_Reason, _Data) -> ok.
+
+handle_info(_Info, State) -> {noreply, State}.
+
+handle_cast(_Msg, State) -> {noreply, State}.
+
+handle_call(_Msg, _From, State) -> {reply, ok, State}.
+
+code_change(_OldVsn, State, _Extra) -> {ok, State}.
diff --git a/inttest/erlc/src/foo_app.erl b/inttest/erlc/src/foo_app.erl
new file mode 100644
index 0000000..a3c7a96
--- /dev/null
+++ b/inttest/erlc/src/foo_app.erl
@@ -0,0 +1,10 @@
+-module(foo_app).
+
+-behaviour(application).
+
+-export([start/2,
+ stop/1]).
+
+start(_Type, _Args) -> foo_sup:start_link().
+
+stop(_State) -> ok.
diff --git a/inttest/erlc/src/foo_test_worker.erl b/inttest/erlc/src/foo_test_worker.erl
new file mode 100644
index 0000000..96ae932
--- /dev/null
+++ b/inttest/erlc/src/foo_test_worker.erl
@@ -0,0 +1,34 @@
+-module(foo_test_worker).
+
+-behaviour(gen_server).
+-behaviour(foo_worker).
+
+-export([start_link/0,
+ start_link/1,
+ init/1,
+ handle_call/3,
+ handle_cast/2,
+ handle_info/2,
+ terminate/2,
+ code_change/3,
+ status/0]).
+
+-include_lib("kernel/include/inet.hrl").
+
+start_link() -> start_link(undefined).
+
+start_link(Args) -> gen_server:start_link(?MODULE, Args, []).
+
+init([]) -> {ok, undefined}.
+
+handle_call(_Event, _From, State) -> {reply, ok, State}.
+
+handle_cast(_Event, State) -> {noreply, State}.
+
+handle_info(_Info, State) -> {noreply, State}.
+
+terminate(_Reason, _State) -> ok.
+
+code_change(_OldVsn, State, _Extra) -> {ok, State}.
+
+status() -> busy.