MarcelGarus / MarcelGarus/glados
Canonical way to share generators
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 51
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
Say I develop a package which provides a type Angle. As part of my test suite for my package I have created generators for this type like
extension AnyAngle on Any {
/// Generates a [Angle] in a certain range.
Generator<Angle> angleInRange(double min, double max) {
assert(min >= -180);
assert(min < max);
assert(max <= 180);
return any.doubleInRange(min, max).map(Angle.makeFrom180);
}
/// Generates a [Angle] in the full possible range.
Generator<Angle> get angle => angleInRange(-180, 180);
}
What is the intended way for me to share these generators with consumers of my package, so that they may use them in their unit tests?
I understand that this is more of a general dart question, but I was curious what you people here think about this question. For glados, providing generators along with types could be seen as part of the package interface.
Edit: This is more of a discussion than an issue. If the repo opens a discussion tab, then we can move the issue there.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the shown AnyAngle extension and the existing Any/Generator API. Decide whether generators such as angleInRange should be exposed as part of a package interface and record the canonical sharing approach; no file or test is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100