Comments (7)
withChars
with varargs is easy. I'll do that.
Could you define which chars you would consider to belong to whitespace()
and punctuation()
?
BTW, are you aware that you can easily define your own annotations so that you might not need manual code at all in an example like yours above? Here's the section from the user guide:
http://jqwik.net/user-guide.html#self-made-annotations
from jqwik.
Cool, looking forward to the varargs functionality. :)
Defining the chars for whitespace could be tricky, since the question is wether to include newlines or not. Other than that I would check which characters are whitespace in Java and use them. For punctuation, I would suggest the usual characters occuring in written language.
Yes, I am aware that I can write my own annotations, but I think that the suggested methods might be beneficial for other users of jqwik.
from jqwik.
Implemented withChars(char... chars)
in 4c36f1c
Change is available from maven ('https://oss.sonatype.org/content/repositories/snapshots') in version 0.8.15-SNAPSHOT
from jqwik.
Implemented StringArbitrary.whitespace()
in d96b0a5
Change is available from maven ('https://oss.sonatype.org/content/repositories/snapshots') in version 0.8.15-SNAPSHOT
from jqwik.
Punctuation is a different beast since there is no standard way in Java to determine what a punctuation character is (comparable to Character.isWhitespace(char)
.
Using all unicode chars allowed according to https://en.wikipedia.org/wiki/General_Punctuation would probably generate characters most people wouldn't expect. Writing your own convenience method like
StringArbitrary punctuation(StringArbitrary arbitrary) {
return arbitrary.withChars('.', ',', ':', ';', '?', '!');
}
seems not too much of a hassle.
Therefore, if you don't bring up a strong argument for implementing it despite the general specification problem, I will close this issue as fixed.
from jqwik.
Ok. Thanks for the quick reaction!
from jqwik.
Fixed. Will be publicly available in release 0.8.15
from jqwik.
Related Issues (20)
- StackOverflowError when shrinking large arrays HOT 14
- question: any way to imperatively summon a pre-configured arbitrary? HOT 15
- Make nested groups work for JDK >= 18 HOT 31
- Combinators.combine.as nullability of arguments HOT 4
- Can't figure out how to create an Arbitrary I want HOT 10
- Bug: Arbitraries.strings().uniqueChars() will sometimes shrink to values with duplicate chars HOT 5
- Bug: Uniform Distribution of Integers does not work if range is >= Integer.MAX_VALUE HOT 2
- Kotlin K2 Support HOT 24
- Time Module: Support generating java.sql.Timestamp
- adding `jqwik-kotlin` causes existing tests written in java to fail with NPE HOT 18
- Potential idea for running `SAMPLE_FIRST`/`SAMPLE_ONLY` for stateful tests HOT 2
- Lifecycle method called twice when subclassing HOT 4
- Cannot use Arbitrary.generator() outside jqwik HOT 6
- Is Arbitrary<@Nullable T> correct/intended under JSpecify semantics? HOT 32
- TypeUsage example from user guide fails in 1.8.x HOT 8
- Right Way to Integrate jqwik with DataFaker HOT 23
- Generic @Provide methods are sensitive to the type variables' names HOT 3
- Allowing Sampling of Arbitraries with Injected Seed HOT 4
- TestEngine with ID 'jqwik' failed to discover tests [BUG] HOT 4
- `@Spy` fields initalized by `closable = MockitoAnnotations.openMocks(this)` is not cleared by `closable.close()` for Jqwik HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jqwik.