-
Notifications
You must be signed in to change notification settings - Fork 482
test: add regression guard for (wrapped (transition ...)) libraries #14307
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
test/blackbox-tests/test-cases/per-module-lib-deps/wrapped-with-transition.t
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| Per-module tight deps and [(wrapped (transition ...))] libraries. | ||
|
|
||
| A library declaring [(wrapped (transition ...))] exposes both wrapped | ||
| and bare-name entry modules for its public modules, so consumers can | ||
| refer to a module either as [Foo.Bar] or as [Bar]. Such libraries are | ||
| still wrapped ([Wrapped.to_bool] returns [true]), so per-module tight | ||
| deps do not apply: the bare-name compat shim reaches internal modules | ||
| whose cmis are not in the directly-named set. They must fall through | ||
| to the glob. | ||
|
|
||
| Regression guard: verify that a consumer of such a library builds | ||
| correctly. | ||
|
|
||
| See: https://github.com/ocaml/dune/issues/4572 | ||
|
|
||
| $ cat > dune-project <<EOF | ||
| > (lang dune 3.22) | ||
| > EOF | ||
|
|
||
| base is wrapped with a transition period, exposing both [Base.Alpha] | ||
| and bare [Alpha]: | ||
|
|
||
| $ mkdir base | ||
| $ cat > base/dune <<EOF | ||
| > (library (name base) (wrapped (transition "transition description"))) | ||
| > EOF | ||
| $ cat > base/alpha.ml <<EOF | ||
| > let v = 1 | ||
| > EOF | ||
| $ cat > base/alpha.mli <<EOF | ||
| > val v : int | ||
| > EOF | ||
| $ cat > base/beta.ml <<EOF | ||
| > let v = 2 | ||
| > EOF | ||
| $ cat > base/beta.mli <<EOF | ||
| > val v : int | ||
| > EOF | ||
|
|
||
| Consumer references the library via the wrapper. The transition | ||
| machinery emits deprecation alerts for the bare-name access, so we | ||
| silence them in the consumer flags and only exercise the wrapper | ||
| path here: | ||
|
robinbb marked this conversation as resolved.
Outdated
|
||
|
|
||
| $ mkdir consumer | ||
| $ cat > consumer/dune <<EOF | ||
| > (library | ||
| > (name consumer) | ||
| > (libraries base) | ||
| > (flags (:standard -alert -deprecated))) | ||
| > EOF | ||
| $ cat > consumer/c.ml <<EOF | ||
| > let via_wrapper = Base.Alpha.v | ||
| > let via_bare = Beta.v | ||
| > EOF | ||
|
|
||
| $ dune build @check | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.