diffplug / diffplug/selfie

fluent API for snapshotting only specific subsets of a snapshot

Aperta
#482 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Kotlin
Stelle
101
Fork
18
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

It would be nice to be able to truncate a snapshot to only certain specific lines. Something like:

```java
expectSelfie(blah).lines(1).toBe_TODO() // first line
expectSelfie(blah).lines(2).toBe_TODO() // first two lines
expectSelfie(blah).lines(-2).toBe_TODO() // last two lines
expectSelfie(blah).lines(-1).toBe_TODO() // last one line

var snapshot = expectSelfie(blah)
snapshot.lines(2).toBe_TODO() // first two lines
snapshot.lines(-2).toBe_TODO() // last two lines
```

I have also sometimes wanted to match a certain regex, like maybe

```
expectSelfie(blah).withinRegex("(?m)^.*$\n?^.*$").toBe_TODO()
```

So far, each time that I have wanted this, I have found a better way to solve this by filtering before the snapshot gets taken...

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.