Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 1ad14e6911
Fetching contributors…

Cannot retrieve contributors at this time

59 lines (49 sloc) 2.102 kb
-export([given/3, 'when'/3, then/3]).
given([a,module,that,has,a,binary,representatino], _State, _) ->
Source = <<"(ns jxat-binary-test
(use (erlang :only (==/2 and/2))))
(defn internal-test ()
<<\\a \\b \\c>>)
(defn internal-test2 ()
(let* (a 1
b 17
c 42)
<<a b (c :size 16)>>))
(defn+ do-test1 ()
(case (internal-test)
(<<a b c>>
{a b c})))
(defn+ do-test2 ()
(case (internal-test2)
(<<a b (c :size 16)>>
{a b c})))
(defn+ do-test3 ()
(case (internal-test2)
(<<(d :size 16) e (f :binary)>>
{d e f})))
(defn+ do-test4 ()
<<\"This is a test\">>)">>,
{ok, Source}.
'when'([joxa,is,called,on,this,module], Source, _) ->
Result = 'joxa-compiler':forms(Source, []),
{ok, Result}.
then([a,beam,binary,is,produced], Ctx, _) ->
?assertMatch(true, is_binary('joxa-compiler':'get-context'(result, Ctx))),
{ok, Ctx};
then([the,described,function,can,be,called,'and',works,correctly], State, _) ->
?assertMatch({97,98,99}, 'jxat-binary-test':'do-test1'()),
?assertMatch({1,17,42}, 'jxat-binary-test':'do-test2'()),
?assertMatch({273,0,<<"*">>}, 'jxat-binary-test':'do-test3'()),
?assertMatch(<<"This is a test">>, 'jxat-binary-test':'do-test4'()),
{ok, State}.
Jump to Line
Something went wrong with that request. Please try again.