codewars / codewars-runner-cli

Old CodeRunner project. See https://github.com/codewars/runner instead.
GNU Affero General Public License v3.0
402 stars 141 forks source link

Nim tests incorrectly shown as passing when actually faliing #806

Closed metagn closed 4 years ago

metagn commented 4 years ago

Describe the bug

When using check(), Nim checks are counted as passing instead of failing even when they're wrong.

To Reproduce

Do check(false) in Nim and check the test results

Expected Behavior

It should be shown as a failure

Screenshots

image

Voileexperiments commented 4 years ago

@kazk I found a way to reproduce this: whenever check is called inside another function called inside test block this happens. For instance:

Code:

proc multiply*(a, b: int): int = a + b

Test:

proc testing(a: int, b: int) = check(a == b)

suite "multiply":
  test "multiply(1, 1)":
    check(multiply(1, 1) == 1)
  test "multiply(1, 2)":
    testing(multiply(1, 2), 2)

Result: image

However, the exit code would still be non-zero anyway so this cannot be used to bypass the test cases.

kazk commented 4 years ago

https://github.com/codewars/codewars.com/issues/1087#issuecomment-325178981 ?

Voileexperiments commented 4 years ago

Oh, so there's no way to easily use wrap testing inside another procedure. Guess I'll have to actually rewrite the test code then.