String matchers highlighting feature

13 views
Skip to first unread message

Ender TUNÇ

unread,
Apr 13, 2016, 7:55:07 PM4/13/16
to specs2-users
Hi everyone,

Is there any "highlighting" feature for string matchers?
Sometimes, missing/additional \n or space end of the string makes my test fail and I find myself checking every character to be sure they are same. If they are same then I start to search for the which character causing the  'end of the string problem'.

It would be very nice to such a highlighting system for string matcher.

I do not know this can be implemented but I would be very happy to help If someone can help me or show me the rabbit hole.

Have a nice day...

etorreborre

unread,
Apr 14, 2016, 1:29:09 AM4/14/16
to specs2-users
Hi Ender,

If the strings are > 20 characters, you should see a diff on them:

"abcdefghijklmnopqrstuvwxyz" must be_==("abcdefghijklmnopqrstuvwxyz ")

[error]  x test
[error]  'abcdefghijklmnopqrstuvwxyz' is not equal to 'abcdefghijklmnopqrstuvwxyz ' (TestSpec.scala:12)
[error] Actual:   ...vwxyz[]
[error] Expected: ...vwxyz[ ]


E.

Ender TUNÇ

unread,
Apr 14, 2016, 11:12:54 AM4/14/16
to specs2-users
It is my fault that I did not make myself clear. I updated the question.

Ender TUNÇ

unread,
Apr 14, 2016, 11:22:18 AM4/14/16
to specs2-users
I think edit is not enabled so I need to post another post :(

I was using matcher like this:

var result = Some("String")
result must beSome("String")

If strings are not same, as you know,  it gives something like this;

bla bla bla is Some but bla bla bla is not equal to bla bla bal and does not tell you where they differ.

In this case especially characters like \n or space it is hard to find.

Please let me know If I am wrong this too :)

etorreborre

unread,
Apr 14, 2016, 11:25:50 AM4/14/16
to specs2-users
You can try that:

Some("x"*26) must beSome("x"*26+" ")

[error]  x test
[error]  'Some(xxxxxxxxxxxxxxxxxxxxxxxxxx)' is Some but 'xxxxxxxxxxxxxxxxxxxxxxxxxx' is not equal to 'xxxxxxxxxxxxxxxxxxxxxxxxxx ' (TestSpec.scala:12)
[error] Actual:   ...xxxxx[]
[error] Expected: ...xxxxx[ ]

Eric.
Reply all
Reply to author
Forward
0 new messages