Chapel: The introduction to testing in docs of Mason is outdated

Created on 6 Mar 2020  路  6Comments  路  Source: chapel-lang/chapel

Here in Testing your package presents an example:

use UnitTest;

config const testParam: bool = true;

proc myTest(test: Test) {
  test.assertTrue(testParam);
}

But this won't work with the current version. I tried adding the example above and got this:

$ mason test

Updating mason-registry

----------------------------------------------------------------------
No Tests Found

The solution is in UnitTest. Previous example seems to be using the old grammar.

I think we can use this new example in the page of mason instead:

use UnitTest;

config const testParam: bool = true;

proc myTest(test: borrowed Test) throws{
  test.assertTrue(testParam);
}

UnitTest.main()
Docs Bug

All 6 comments

Thanks @Rapiz1 - would you be interested in opening a PR with the following?

  1. A fix for the docs
  2. An added test with the exact test from the docs (to help us identify if the test case from the docs breaks in the future)

@ben-albrecht Sure. Sorry if I'm being naive, where can I start from to add a test for the docs?

I would put it in test/library/packages/UnitTest/docs/.

See here for docs on test system:

https://github.com/chapel-lang/chapel/blob/master/doc/rst/developer/bestPractices/TestSystem.rst#creating-a-simple-test

See other tests in test/library/packages/UnitTest/ for examples to start from.

Thanks. I will look into it soon.

Actually, this may make more sense to put intotest/mason/mason-test/docs

Thanks for pointing this out. I saw it earlier but forgot about it.

Was this page helpful?
0 / 5 - 0 ratings