Permalink
Browse files

* Modified makefile to include src/ as hrl source

* command.hrl
  hrl with command types to be used internally

* command_tests.erl
  New testcase for parsing binging list command

* command.erl
  implementation for the test
  • Loading branch information...
Gianfranco Alongi
Gianfranco Alongi committed Mar 9, 2012
1 parent c80c538 commit 555724830693ad54576d7ce39ac6ece3ff06f278
Showing with 13 additions and 2 deletions.
  1. +1 −1 Two/Solution/Makefile
  2. +6 −1 Two/Solution/src/command.erl
  3. +1 −0 Two/Solution/src/command.hrl
  4. +5 −0 Two/Solution/test/command_tests.erl
View
@@ -1,5 +1,5 @@
all:
- erlc -o ebin/ src/*.erl test/*.erl
+ erlc -o ebin/ -I src/ src/*.erl test/*.erl
eunit:
erl -pa ebin/ -eval 'eunit:test(port,[verbose]),\
@@ -1,6 +1,11 @@
-module(command).
-export([parse/1]).
+-include("command.hrl").
-spec(parse(string()) -> {error,empty_command}).
parse("") ->
- {error,empty_command}.
+ {error,empty_command};
+
+parse("list bind") ->
+ #binding{type = list}.
+
@@ -0,0 +1 @@
+-record(binding,{type :: list}).
@@ -1,7 +1,12 @@
-module(command_tests).
-include_lib("eunit/include/eunit.hrl").
+-include("command.hrl").
empty_command_test() ->
Command = "",
?assertEqual({error,empty_command},command:parse(Command)).
+
+list_bindings_test() ->
+ Command = "list bind",
+ ?assertMatch(#binding{type = list},command:parse(Command)).

0 comments on commit 5557248

Please sign in to comment.