oneronaut/brsHamcrest

Matching an instance of an object

Closed this issue · 0 comments

Is it currently possible to match an instance of an object from two unique references? Something like:

AssertThat(objectRef1, is(objectRef2))

An example of the requirement would be when checking that a particular getter would always return the same instance of an object every time it was called. I've just built this into my unit tests so far with the following test method:

isSame: function (ref1 as Object, ref2 as Object) as Boolean
    ref1.uniqueTestId = "uniqueTestId"
    isSame = (ref1.uniqueTestId = ref2.uniqueTestId)
    ref1.delete("uniqueTestId")
    return isSame
end function