Closed Jason2605 closed 1 year ago
@briandowns before going much further with this one I was wondering what you think of this ^?
Seems simple and straightforward. 2 👍 from me!
@briandowns Do the stack tests fail for you locally? I'm not seeing this happen and I'm currently unsure why
@briandowns Do the stack tests fail for you locally? I'm not seeing this happen and I'm currently unsure why
Ah okay I got it, there is a problem with both the stack and queue modules. We are storing references to values within the abstract data type that will never get marked by the GC
Didn't see anything weird locally. My bad on missing the GC.
It's all good, it's quite a nasty issue actually! None of the abstracts have a way of graying any values so was a needed change. I also didn't see anything locally, but I noticed the tests are mainly using numbers, if we change a test to say:
testStackShrink() {
this.assertEquals(this.stack.cap(), this.defaultStackSize);
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16].forEach(def (x) => this.stack.push(x.toString()));
this.assertEquals(this.stack.cap(), 32);
const res = this.stack.pop();
this.assertEquals(res, 16);
this.assertEquals(this.stack.cap(), 32);
this.stack.pop();
this.stack.pop();
this.stack.pop();
this.stack.pop();
this.stack.pop();
this.stack.pop();
this.stack.pop();
this.assertEquals(this.stack.cap(), 16);
}
And we have objects that we actually get wiped by the GC I see the segfault come through
Mocking
Resolves: #630
What's Changed:
Adds a new
mock()
function to the UnitTest module that will allow us to mock certain Values. In the current implementation it will allow us to mock a given class and also return given values on certain method calls.If no return values are specified via the second argument dictionary then it will implicitly create an empty method that returns nil.
Example script:
#
Type of Change:
#
Housekeeping:
#
Screenshots (If Applicable):