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

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

Open
ManasJayanth opened this issue Sep 17, 2019 · 7 comments
Open

Comments

@ManasJayanth
Copy link
Member

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
Copy link
Contributor

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
Copy link
Member

@ulrikstrid what do you have in mind?

@ulrikstrid
Copy link
Contributor

@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 ManasJayanth changed the title ### Comparison with Dune's namespacing behaviour Figured out a Module_test.re convention as seen in the JS world Sep 20, 2019
@ManasJayanth
Copy link
Member Author

Renamed the issue so that the discussion can go on

@ulrikstrid
Copy link
Contributor

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
Copy link
Contributor

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

@ManasJayanth ManasJayanth changed the title Figured out a Module_test.re convention as seen in the JS world Figure out a Module_test.re convention as seen in the JS world Sep 24, 2019
@ulrikstrid
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants