Comma

Running code and tests in Comma

Running tests

First, create a run configuration for running the tests.

Create test configuration

Set up test configuration

Now, to run the tests, either:

Running tests

Running scripts

First, create a run configuration for running the script.

Add a run configuration

Set up run configuration

Now, to run the script, either:

Debugging scripts

At present, the debugger always shows Perl 6 data structures precisely as they exist. For example, if we take the code my $a = 42, then $a points to a Scalar, which has a $!value attribute, which in turn holds the Int 42. Each of those is represented and can be expanded in the values view. For convenience, however, the value will be rendered as $ = 42, immediately showing that this is a Scalar holding the value 42. Similar applies to arrays and hashes: Array has a $!reified containing the non-lazy elements, and Hash has a $!storage containing the hash values themselves. Comma may in the future provide an alternative, simplified, view to hide these details.

Generally, the more recent the version of Rakudo/MoarVM you are running is, the better things will work. For example, releases 2018.12 and earlier had some missing symbol information, meaning some parameters or bound variables could not be viewed in the debugger.

Test coverage

Note: This feature is only found in Comma Complete.

First, see the Running Tests section above. With a Perl 6 Test run configuration in place, all that remains is to pick Run with coverage from the Run menu. It is also possible to run a Perl 6 script/application with coverage, in which case you can use the tool to understand what code is touched by a typical usage of the application.

Coverage is presented:

Occasionally, tests have been seen to fail under coverage analysis, even if they run perfectly fine without it. This appears to be a MoarVM bug, and we’ll work with the MoarVM team to resolve it.

Profiling

Note: This feature is only found in Comma Complete.

If you don’t already have a run configuration for the program to profile, see Running Scripts above. Once that is done, the Run menu will then contain a Run with profiling option. Use this to run the program to profile. The results will be imported afterwards and displayed in a tool window.