Testing on the Wren track

Learn how to test your Wren exercises on Exercism


Execute the tests with:

$ wrenc exercise-name.spec.wren

For example for hello-world:

$ wrenc hello-world.spec.wren

Understanding Skip Tests

The skip method instructs the test suite to not run a particular test.

  • Why they are skipped ?

So as to enable users to concentrate on one test at a time and enable one by one as they evolve the solution.

  • How to enable them ?

A skipped test:

// this test will be skipped and not run
skip.test("title cased phrases") {
    Expect.value(Acronyms.parse("Portable Network Graphics")).toEqual("PNG")
}

Simply change skip.test to do.test.

// now the test will be run normally
do.test("title cased phrases") {
    Expect.value(Acronyms.parse("Portable Network Graphics")).toEqual("PNG")
}

Making Your First Wren Module

Tests on this track load your implementation by importing it as a Wren module: import "./bob" for Bob. There is no special syntax to export your implementation. Just name your class Bob to match the import statements for Bob and everything should just work.

class Bob {
  static hey(message) {
    // Your solution to the exercise goes here
  }
}

You can find more information about modules in the Wren Modularity documentation. To make it easier to get started, there is a skeleton Wren file in the directory for each exercise.