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

Consider removing the restriction that the generator is public. #525

Closed
teo-tsirpanis opened this issue Jul 29, 2020 · 2 comments
Closed

Comments

@teo-tsirpanis
Copy link

Consider a library like this:

[<assembly:InternalsVisibleTo("MyLibraryTests")>]

type internal MyDataStructure = ...

type LibraryAPI = ...

This library contains an internal data structure class, which despite being an implementation detail (as opined in the fourth bullet of #152 (comment)), but it's still a type whose behavior is worth verifying by itself, but irrelevant to the purpose of the library to warrant making it public.

Now, let's write a generator:

// We are at the MyLibraryTests assembly.

type Generators() =
    static member MyDataStructure() = Arb.generate |> ...

The code above raises a compiler error because Generators is public but one of its methods returns an internal type. We could make Generators internal but FsCheck would complain, forcing us to make MyDataStructure internal.


The best way to actually solve such problems is to make FsCheck allow nonpublic generator classes. It might be done with a single-line change in Runner.fs but I'm not sure whether it would suffice.

@kurtschelfthout
Copy link
Member

See #401

@kurtschelfthout
Copy link
Member

Closed as dup.

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

No branches or pull requests

2 participants