Skip to content

Commit

Permalink
[docs] Update documentation on assert for its enabling and disabling.
Browse files Browse the repository at this point in the history
close #820

Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Jul 26, 2018
1 parent 5cf11be commit 3d8cd14
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
Expand Up @@ -57,6 +57,46 @@ The message string follows the condition, with a coma character between them.
}
}
[:End:]
# Enable and Disable Assertions.

By default, assertions are disabled. It means that they are not evaluated at run-time.
In this way, if someone is launching your application, the application is running quickly, and
the assert errors cannot occur. It is compliant with the fact that assertions are tests by and for
the application's developers: the final user of the application is not care about the implementation
constraints.

For enabling and disabling the assertions, you must change the launch configuration within the SARL product,
or use an option that is provided by the SARL run-time environment.

## Inside the SARL Development Environment

Within the SARL development environment, you must define a launch configuration for running a SARL application.
Two launch configurations are available:
* "SARL Agent" for launching an agent, and
* "SARL Application" for launching a standard application (based on the definition of a `main` method), which will launch the SARL framework later.

Both of these launch configurations allow you to enable or disable the assertions.
On the figure below, you could see the "Enable assertions in run mode" and "Enable assertions in debug mode"
checkboxes within the "Launch Options" section.
If the first (resp. second) box is checked, assertions will be enabled when you application was launched in run (resp. debug) mode.

![Screenshot of the dialog box of a SARL launch configuration](./enableassertions.png)

## Launching the Janus framework

The Janus framework is one implementation of a SARL run-time environment. You have to use one of its command-line
options for enabling assertions. All the command-line options are detailed on a [dedicated page](../../tools/Janus.md).
Usually, the option for enabling the assertions is the same as the one of the Java virtual machine: [:shorteaopt!].

## Launching the Java virtual machine

If you want to run your SARL application by launching the Java virtual machine, you could use the standard command
line options [:longeaopt:] and [:shorteaopt:] that are provided by this virtual machine:

java [ [:longeaopt](-enableassertions) | [:shorteaopt](-ea) ] <class name>



[:Include:](../generalsyntaxref.inc)

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions main/targetplatform/io.sarl.lang.targetplatform.target
Expand Up @@ -36,8 +36,8 @@
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="http://download.eclipse.org/modeling/tmf/xtext/updates/composite/latest/"/>
<unit id="org.eclipse.xtend.sdk.feature.group" version="2.15.0.v20180723-0209"/>
<unit id="org.eclipse.xtext.sdk.feature.group" version="2.15.0.v20180723-0209"/>
<unit id="org.eclipse.xtend.sdk.feature.group" version="2.15.0.v20180724-0209"/>
<unit id="org.eclipse.xtext.sdk.feature.group" version="2.15.0.v20180724-0209"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="aopalliance" version="1.0.0"/>
Expand Down

0 comments on commit 3d8cd14

Please sign in to comment.