CodeRunner Documentation (V3.0.0)

10.3 Extended column specifier syntax and the "Show differences" button

It was stated above that the values to be formatted by the format string (if given) were fields from the TestResult object. This is a slight simplification. The syntax actually allows for expressions of the form:

    filter(testResultField [,testResultField]... )

where filter is the name of a built-in filter function that filters the given testResult field(s) in some way. Currently the only such built-in filter function is diff: it takes two test result fields as parameters and returns an HTML string that represents the first test field with embedded HTML <ins> and <del> elements that show the insertions and deletions necessary to convert the first field into the second. This is intended for use with the Expected and Got fields, so the student can easily see where their output is wrong. It is used by the default result column display if an ExactMatch grader is used (see below).

If the diff filter is being used, the column specifier should have exactly three elements: the column header, the diff expression and a format specifier of '%h'.

The stylesheet by default displays <del> content in the same style as the surrounding text and hides the <ins> content so that the first field is displayed verbatim. If the question does not earn full marks, a "Show differences" button is added at the end of the results table. When this is clicked, any <del> content is highlighted. <ins> content remains hidden. The figure below shows the effect. With the default settings (see below) the highlighting in the Expected column thus shows what is missing in the Got column, while the highlighting in the Got column shows additional text that shouldn't be present.

Other filter functions may be added in the future if demand arises.