These are chat archives for etorreborre/specs2

10th
May 2016
Marius B. Kotsbak
@mkotsbak
May 10 2016 12:08
@etorreborre I miss a combination of beRight/beSome and the matchA macro
Eric Torreborre
@etorreborre
May 10 2016 12:09
Can you write a small gist with what you would like to do?
Marius B. Kotsbak
@mkotsbak
May 10 2016 12:15
Eric Torreborre
@etorreborre
May 10 2016 12:18
Did you try must beSome { t : Test => t.a must_== 1 } or must beSome { t : Test => t must matchA[Test].a(1)}?
Marius B. Kotsbak
@mkotsbak
May 10 2016 12:42
First works, but not with "must contain" instead of _==
Second repeats "Test", so it is not DRY
For the first to work in my case, I had to use beSome[T].like
Eric Torreborre
@etorreborre
May 10 2016 12:54
must contain only works with collections so I don’t see how it applies to Test. Then I don’t know how to avoid repeating Test in the 2nd case because of the way type inference works. We could provide a beSome[T] matcher which works like matchA[T] but for Option[T] but that would necessitate some code duplication since matchA is a macro.
so maybe beSome[T].like is the only option here
Marius B. Kotsbak
@mkotsbak
May 10 2016 12:58
Well, in my case "a" would be of type String
Probably, if the implementations could not share some common code, but it would be nice to have
the contains would probably not be supported I assume anyway
Eric Torreborre
@etorreborre
May 10 2016 13:02
I generally go with the first form: must beSome { t : Test => t.a must contain(“abc”) } if a is a string
Marius B. Kotsbak
@mkotsbak
May 10 2016 13:14
I didn't get that to compile. Maybe one of the many IntelliJ bugs though
Eric Torreborre
@etorreborre
May 10 2016 13:31
This compiles ok for me
which specs2 version do you have?
what’s your error message?
Marius B. Kotsbak
@mkotsbak
May 10 2016 14:44
Japp, it works, but not with paranteses. Why is that?
And with curly brackets it warns me about "Scala compiler will replace this argument list with tuple". Is that right?
Eric Torreborre
@etorreborre
May 10 2016 15:01
I don’t know really, can you paste the exact full expression that you have?
Marius B. Kotsbak
@mkotsbak
May 10 2016 15:03
Nah, it uses some internal case classes here