Skip to content

Latest commit

 

History

History
103 lines (73 loc) · 2.23 KB

File metadata and controls

103 lines (73 loc) · 2.23 KB

Running the Tests

Download an Exercise

Use the Exercism CLI to download the exercise you want to work on.

exercism download --track=rescript --exercise=hello-world

Then change into the exercise directory.

cd /path/to/exercism/rescript/hello-world

Install Dependencies

Before running the tests, install the exercise dependencies.

npm install

Run the Tests

Compile and run the provided test suite using either exercism test or npm install.

Understanding Test Results

The test runner shows each test run with a pass/fail status.

1/3: no name given
  PASS - no name given
2/3: a name given
  FAIL - a name given
    ---
    operator: equal
    left:  One for you, one for me.
    right: One for Alice, one for me.
    ...
3/3: another name given
  FAIL - another name given
    ---
    operator: equal
    left:  One for you, one for me.
    right: One for Bob, one for me.
    ...

# Ran 3 tests (3 assertions)
# 1 passed
# 2 failed

left is what your code returned. right is what the test expected.

Understanding the Exercise Structure

two-fer/
├── src/
│   ├── TwoFer.res   // your solution goes here
│   └── TwoFer.resi  // the optional interface file containing signatures
├── tests/
│   └── TwoFer_test.res // your test suite
├── package.json // used to install project dependencies
└── ...

TwoFer.resi here is an optional interface file. When present, it defines the function signatures your solution must satisfy and can serve as a hint for what to implement.

For example, if the interface declares:

let hello: unit => string

Your implementation should define:

let hello = () => "Hello, World!"

Compiler Errors

If your code doesn't compile, ReScript's compiler produces detailed error messages with the exact location and expected types.

  We've found a bug for you!

  1 │ let x: string = 42

  This has type: int
  But it's expected to have type: string

  You can convert int to string with Int.toString.

Read the error message carefully because it usually points directly to the problem.