-
Notifications
You must be signed in to change notification settings - Fork 0
Syntax
Tim edited this page Sep 19, 2015
·
2 revisions
Assertions, Assumptions and Matcher can be accessed by
their environment local assert/assume/match or their references in cubictest.
The statements are constructed by using one of these, a selection of optional modifiers for a natural description, optional negation modifiers, and the assertion statement itself.
[assert|assume|match].[(is|are|was|has|does)(.|_)][(no|not)(.|_)]<expectation>
For example:
assert.equal("a", "a")
assert.is.equal(1, 1)
assume.are_not_equal(os.time(), now)Modifiers and Expectations are case insensitive and can be chained using either . or _.
This allows us using lua keywords like true, false, nil or not without causing syntax errors:
assert.is.Not.True()
assert.is_not.True()
assert.is_not_true()
assert.is_not.True()
assert.is.NOT_True()
-- avoid:
assert.is.not.true()