Commit 7950867d authored by Jakob Moser's avatar Jakob Moser
Browse files

Add Test#handInEnabled field

parent 0447db8c
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -243,10 +243,12 @@ class Test {
    /**
     * @param {string} name Human-readable name of the test
     * @param {Exercise[]} exercises The exercises this test consists of
     * @param {boolean} handInEnabled If handing in is enabled (usually yes, but maybe not for practice tests)
     */
    constructor(name, exercises) {
    constructor(name, exercises, handInEnabled) {
        this.name = name
        this.exercises = exercises
        this.handInEnabled = handInEnabled
    }

    /**
@@ -275,8 +277,9 @@ class Test {
 */
export function test(name, exerciseCreationFunction) {

    const exerciseCollector = {
    const testConfigCollector = {
        exercises: [],
        handInEnabled: true,

        /**
         * Add an exercise.
@@ -291,7 +294,7 @@ export function test(name, exerciseCreationFunction) {
        }
    }

    exerciseCreationFunction.bind(exerciseCollector)()
    exerciseCreationFunction.bind(testConfigCollector)()

    return new Test(name, exerciseCollector.exercises)
    return new Test(name, testConfigCollector.exercises, testConfigCollector.handInEnabled)
}