MithrilJS / ospec

Noiseless testing framework
MIT License
48 stars 13 forks source link

Failed assertion reporting does unnecessary string substitution #57

Closed LeXofLeviafan closed 1 year ago

LeXofLeviafan commented 1 year ago

Suppose I have a test like this:

o('%foo').equals('%ioo')("%doo")

When evaluated, I'd expect for this expression to produce the following output:

%doo

'%foo'
  should equal
'%ioo'

What I'm getting instead is this:

0oo

'NaNoo'
  should equal
'NaNoo'

Now I'm guessing this has to do with format placeholders, but I'm fairly sure that any such substitution should only be performed once (so that it does not affect the inserted text).

Edit: checked o.spec("%foo", () => o("%foo", () => {/* … */})) – these strings are also affected.

pygy commented 1 year ago

@LeXofLeviafan Thanks for the report, this is indeed a bug and I suspect your analysis is correct. I'll look into it.

pygy commented 1 year ago

This will be published soon, probably this evening.