c3c icon indicating copy to clipboard operation
c3c copied to clipboard

Support tests in a library project

Open pierrec opened this issue 2 years ago • 2 comments

As per discussion on Discord, it would be nice to add a way to run tests defined within a library project. Adding a test-lib command to the compiler would be provide that functionality.

pierrec avatar Nov 02 '23 15:11 pierrec

How should this work? Should it essentially work as just including the library and then running the files or? Can any other libraries be required etc?

lerno avatar Nov 02 '23 20:11 lerno

The use case I have is simply to be able to test the bindings for a library which is standalone. So I think that keeping it simple to simply include the library and running the tests should be good enough.

pierrec avatar Nov 02 '23 20:11 pierrec

I've revisited this now and looking at what's there I can't find a good way to do it that doesn't duplicate a lot of existing functionality. As a solution I'd recommend that one place a project.json in the library which then can support lot of these things. This works better now that c3l files can set the source directory, and I also added so that linked libs are places in a separate subdirectory.

So with this I think this kind of can be solved by a simple project.json in the same directory. If this doesn't work for some reason, file issues and we'll fix all of that.

lerno avatar Aug 26 '25 14:08 lerno

I'll mark this as rejected, but note that I am fullt supportive of having tests for libraries. I am also planning another feature where you can create a c3l from your project, which also sort of solves this (but in a different way from placing the project.json inside)

lerno avatar Aug 26 '25 14:08 lerno