Skip to content

dune init project should have the generated test depend on generated library #12716

@xvw

Description

@xvw

Talking with @nrinaudo, who practices OCaml recreationally.

Desired Behavior

Currently, dune init is a bit frustrating in the way it initializes a project (in the reference libraries for testing). For example:

# dune init proj myproject
# cd myproject
# tree  -I '_opam|_build' .

.
├── bin
│   ├── dune
│   └── main.ml
├── dune-project
├── lib
│   └── dune
├── myproject.opam
└── test
    ├── dune
    └── test_myproject.ml
# cat test/dune
(test
 (name test_myproject))

The library myproject is not referenced in the test.
From my perspective, we assume that a person who initiates a project would probably want to attach the library to the tests by default:

 (test
- (name test_myproject))
+ (name test_myproject)
+ (libraries myproject))

Allowing a newcomer to avoid having to thoroughly research “how dune works” in order to start a project in a relaxed manner.

Same behaviour for with --kind=lib.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions