Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

writing test when using "source": "src" #233

Open
1 task
tonyfettes opened this issue Aug 29, 2024 · 0 comments
Open
1 task

writing test when using "source": "src" #233

tonyfettes opened this issue Aug 29, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@tonyfettes
Copy link
Contributor

Feature Request

Summary

It's an often case of mine that I need to write some standalone test programs that I don't want them to be in the source directory. Therefore, I want to be able to write/run test program outside the source directory.

Motivation

I have written a tensor library my self at tonyfettes/torch.mbt, and now I want to try my tensor library to build a model, and train it on the infamous iris dataset.

I don't want any code related to the iris model to be inside the src directory since they are totally unrelated to the implementation of the tensor library.

Detailed Description

I want to be able to develop MoonBit program with such project structure,

.
├── LICENSE
├── README.md
├── moon.mod.json
├── src
│   ├── distributions.mbt
│   ├── moon.pkg.json
│   ├── nn.mbt
│   ├── random.mbt
│   ├── tensor.mbt
│   ├── value.mbt
│   └── value_test.mbt
└── test
    └── iris
        ├── iris.mbt
        └── moon.pkg.json

4 directories, 12 files

with some extra properties such as:

  • Any user of mine won't be able to use the @test or @test/iris package. They should be internal/private.

Circumvents

  1. Put all source at top-level of the directory and remove "source": "src" in the moon.mod.json, and move the test directory to internal/test.
  2. Move the test directory to src/internal/test.

Possible Implementations

  1. Provided an extra option to set "test-directory", for example:

    {
      // ...
      "test-directory": "test"
    }
  2. Allow multiple directory to be used as "source directory", for example:

    {
      // ...
      "source": ["src", "test"]
    }
  3. Treat any directory that is not the source directory as internal package.

Related Issues

Checklist

  • I have added all necessary details to make it easy for the maintainers to understand my request.
@tonyfettes tonyfettes added the enhancement New feature or request label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant