anoma / juvix

A language for intent-centric and declarative decentralised applications
https://docs.juvix.org
GNU General Public License v3.0
457 stars 53 forks source link

Add `test` field to `Package` in Package.juvix for running tests with `juvix test` #2980

Open paulcadman opened 2 months ago

paulcadman commented 2 months ago

Users can write tests for their Juvix packages using (for example) juvix-test.

A script is required to run the test using juvix eval or juvix compile followed by running the native binary.

This issue proposes adding:

For example:

module Package;

import PackageDescription.V2 open;

package : Package :=
  defaultPackage@{
    name := "MyProject";
    version := mkVersion 0 1 0;
    test := "juvix eval tests/Main.juvix"
  };

To run natively compiled tests you could use:

test := "juvix compile native tests/Main.juvix && ./Main"