esy / pesy

Project configuration for esy
MIT License
141 stars 17 forks source link

Figure out a Module_test.re convention as seen in the JS world #48

Open ManasJayanth opened 5 years ago

ManasJayanth commented 5 years ago

Dune let's us abstract a package by using a module of the same name as the package. If Foo.re is present in a package namespaced under Foo, other modules can be hidden

pesy currently doesn't do this, but it would be really ideal if it could do this using Index.re. (idea credits jaredly)

FooBar = require('foo/bar')

... and automatically expect everything from Index.re to be imported.

In its, current state, Index.re has to be accessed as FooBar.Index

ulrikstrid commented 5 years ago

In this vein, it would be cool if something could be figured out for a Module_test.re convention like many are used to in the JS world.

jordwalke commented 5 years ago

@ulrikstrid what do you have in mind?

ulrikstrid commented 5 years ago

@jordwalke maybe we could create a alias and have pesy add all files named *_test.{re,ml} to that alias. I'm not sure about this but dune might allow to have multiple libraries in the same file, pesy would have to keep track of the files that should be in each library if we go down this road but it would be really cool.

I'm not sure how it would work exactly but I think the tools are there for this to work.

ManasJayanth commented 5 years ago

Renamed the issue so that the discussion can go on

ulrikstrid commented 5 years ago

Something like this would work:

(library
 (name morph)
 (public_name morph)
 (libraries lwt lwt.unix logs opium_core hmap magic-mime)
 (modules (:standard \ integration_test response_test)))

(library
 (name Morph_test)
 (public_name morph.test)
 (libraries lwt morph morph_client morph_server.http morph.test_framework
   rely.lib)
 (modules integration_test response_test)
 (flags -linkall -g -w -9))

pesy would then have to keep track of all files named module_test and inject them in the dune files.

ulrikstrid commented 5 years ago

@prometheansacrifice and @jordwalke do you have any thoughts about the above?

ulrikstrid commented 5 years ago

Example of how this would look like: https://github.com/ulrikstrid/hello-reason/tree/_test-convetion-example