msg dieseltest.this.shouldparse (p1, p2?, p3:Number?, p4 :Array?)
$when::
dieseltest.rule1 (a, b)
. (rule1ab
=(a + b)
)
$when::
dieseltest.rule1 (a, b, c)
. (rule1abc
=((a + b) + c)
)
$when::
dieseltest.rule1 (a, b, d)
. (rule1abd
=((a + b) + d)
)
$when::
*.sendtest
. (rule12
=true
)
$when::
dieseltestsendtest.*
. (rule16
=true
)
$when::
dieseltest.send.multiple.*
. (rule18
=true
)
$when::
dieseltest.send.*
. (rule18a
=true
)
$when::
/dieseltestJ..*/.
. (rule19
=true
)
$when::
/dieseltestMM.*/.
ctx.echo (diesel.msg.entity, diesel.msg.action)
. (rule19a
=true
)
$when::
dieseltest.comment1
. (rule22
=22
)
$when::
dieseltest.engmsg25
. (rule25
=((diesel[="msg"][="entity"] + diesel[="msg"][="action"]) + diesel[="msg"][="ea"])
)
$when::
dieseltest.engmsg27
. (rule27a
=((diesel[="msg"][="entity"] + diesel[="msg"][="action"]) + diesel[="msg"][="ea"])
)
ctx.echo (rule27)
. (rule27
=((diesel[="msg"][="entity"] + diesel[="msg"][="action"]) + diesel[="msg"][="ea"])
)
0 $mock::
dieseltest.nonexcl1
. (dieselScope[="rule69"]
=(rule69 + 1)
)
0 $mock::
dieseltest.nonexcl1 (a, b)
. (dieselScope[="rule69"]
=(rule69 + 2)
)
0 $mock::
dieseltest.excl1
. (dieselScope[="rule69"]
=(rule69 + 1)
)
0 exclusive::
dieseltest.excl1 (a, b)
. (dieselScope[="rule69"]
=(rule69 + 2)
)
$when::
dieseltest.rnonexcl1
. (dieselScope[="rule69"]
=(rule69 + 1)
)
$when::
dieseltest.rnonexcl1 (a, b)
. (dieselScope[="rule69"]
=(rule69 + 2)
)
$when::
dieseltest.rexcl1
. (dieselScope[="rule69"]
=(rule69 + 1)
)
exclusive::
dieseltest.rexcl1 (a, b)
. (dieselScope[="rule69"]
=(rule69 + 2)
)
$when::
dieseltest.opt1 (a?, b?)
. (rule61
=(a + b)
)
$when::
dieseltest.opt2 (a? ?= 1
, b?)
. (rule64
=(a + b)
)
$when::
dieseltest.ifelse (a? ?= 1
, b?)
$ifc:: (a > b) . (rule67
=1
)
$else:: . (rule67
=2
)
$when::
dieseltest.testcatchNoerr
diesel.try
step no errors...
. (x97
="oops"
)
diesel.catch
. (x97
="haha"
)
$when::
dieseltest.testcatchWithErr
diesel.try
dieseltest.failplease
. (x97
="oops"
)
diesel.catch
. (x97
="haha"
)
$when::
dieseltest.testcatchWithThrow
diesel.try
dieseltest.throwplease
. (x97
="oops"
)
diesel.catch
. (x97
="haha"
)
$when::
dieseltest.testcatchnothrow
diesel.try
dieseltest.notfail
. (x99
="oops"
)
diesel.catch
. (x99
="haha"
)
. (x99
="haha"
)
$when::
dieseltest.failplease
diesel.props.file (path="nosuch file.*"
="nosuch fi...)
$when::
dieseltest.throwplease
diesel.throw (msg="opa!"
="opa!")
This is a big deal, has weird side-effects if engine behavior changes: expr like diesel.msg.ea
or diesel.msg.attrs
will have unexpected values down the trace.
$when::
dieseltest.evalonce.a1
dieseltest.evalonce2 (a=diesel[="m...)
$when::
dieseltest.evalonce2 (a)
dieseltest.evalonce3 (a)
$when::
dieseltest.evalonce3 (a)
. (res77
=a
)
$when::
dieseltest.evalonce.*
dieseltest.evalonce2 (event=diesel[="m..., env, source, deviceId, deviceType, message, eventInfo=diesel[="m...)
$when::
dieseltest.indetedLambda
. (aFlag
=true
)
$ifc:: aFlag diesel.lambda
. (embedded91
=true
)
dieseltest.embedded
dieseltest.afterLambda
$when::
testdiesel.else (branch)
$ifc:: branch testdiesel.else.if
$else:: testdiesel.else.else
$when::
testdiesel.else1 (branch)
$ifc:: branch do.this
testdiesel.else.if
. (res131
="if"
)
$else:: do.this
testdiesel.else.else
. (res131
="else"
)
Testing value in multi-level decmopositions
$when::
testdiesel.expand1
testdiesel.expand2
$when::
testdiesel.expand2
testdiesel.expand3
$when::
testdiesel.expand3
. (res147
="ok"
)
$when::
testdiesel.expand4
testdiesel.expand2
testdiesel.expand3
. (res152
="ok"
)
$when::
testdiesel.fback1 (r156 == 3
)
. (r156
=(r156 + 2)
)
fallback::
testdiesel.fback1 (r156)
. (r156
=(r156 + 1)
)
Variable once expanded is not overwritten inside the rest of the rule, as most would expect - the result of applying BOTH rules below will be 2
, not 3
as one might expect. Think of each as its own separate function call.
$when::
testdiesel.inc (r193 == 1
)
. (dieselScope[="r193"]
=(r193 + 1)
)
$when::
testdiesel.inc (r193)
. (dieselScope[="r193"]
=(r193 + 1)
)
This version also
$when::
testdiesel.incLOCAL (r202 == 1
)
diesel.nop
. (r202
=(r202 + 1)
)
$when::
testdiesel.incLOCAL (r202)
diesel.nop
. (r202
=(r202 + 1)
)
However, the result of these will be 3
:
$when::
testdiesel.incInContext (r196 == 1
)
. (r196
=(r196 + 1)
)
$when::
testdiesel.incInContext (r196 is defined
)
. (r196
=(r196 + 1)
)
$when::
testdiesel.incInContext
. (r196
=(r196 + 1)
)
Test: overwriting local variables should be allowed.
$when::
testdiesel.bug.overwriteLocalVar (v183)
. (v183
="184"
)
. (payload
=v183
)
msg testdiesel.expr.autoexport
$when::
testdiesel.expr.autoexport
nothing.eh
. (a189
=189
)
. (a190
=189
)
0 $mock::
dtest.l251 (stream)
. (g253
=253
)
diesel.stream.put (stream)
diesel.stream.done (stream)
0 $mock::
dtest.l270
. (payload
=245
)
ctx.sleep (duration:Number=1000
=1000)
$when::
testdiesel.engine.guardedrule1 (x)
. (a251
=251
)
$when::
testdiesel.engine.guardedrule1 $ifc:: (x is 4)
. (a253
=253
)
$when::
diesel.rest (path ~= "/dieseltest/resource1/read"
)
. (payload
=(payload + "r1-read")
)
$when::
diesel.rest (path ~= "/dieseltest/resource1/update"
)
. (payload
=(payload + "r1-update")
)
before::
diesel.rest (path ~= "/dieseltest/resource1/.*"
)
. (payload
="before-"
)
after::
diesel.rest (path ~= "/dieseltest/resource1/.*"
)
. (payload
=(payload + "-after")
)
$when::
testdiesel.erasepayload
. (payload
=null)
$when::
testdiesel.api.hidden
. (payload
="default is private, this should not work"
)
public::
testdiesel.api.public
. (payload
="yeah"
)
You need to log in to post a comment!