Closed mmikeww closed 3 years ago
Hi out of the blue. :) The key lines in that commit may be:
- for k,v in cls
+ for k,v in cls.prototype.OwnMethods()
{
- if Type(v) = "Func" ;test
The purpose of the loop is to iterate all the methods (tests) and call them. I guess OwnMethods
is a shortcut to get just the methods out of the prototype, so to do it without OwnMethods
I suppose just iterating the prototype keys and checking if their corresponding values are functions is enough.
I tried changing it to:
for k,v in cls.prototype.OwnProps()
{
msgbox("k=" k "`nv=" v "`ncount=" ObjOwnPropCount(cls.prototype))
if !(v is Func)
continue
but the Test file is ending up blank
its weird because that for
loop is only showing 3 iterations, but the OwnPropCount is correctly seeing the test methods (6 and 8 and 8 respectively)
this line also probably needs to be changed:
https://github.com/Uberi/Yunit/blob/baf809c4ecda56ab9090449d737c9c0334b5fa4c/Yunit.ahk#L22
I tried changing to this("")
but i get an error "Yunit.Tester has no method defined for Call"
probably related to this:
Static New is renamed to Call, so use MyClass() to instantiate classes. However, an implication of the way methods work is that MyClass.NestedClass() will pass MyClass as this, which ends up being the first parameter of __New. (MyClass.NestedClass)() and MyClass.NestedClass.Call() will work as MyClass.NestedClass.New() did before.
making progress
i'm trying to update the
v2
branch to support v2-beta1, but getting this error:according to this link: https://www.autohotkey.com/boards/viewtopic.php?f=37&t=86283
So I'm not really sure how to update this file here: https://github.com/Uberi/Yunit/blob/baf809c4ecda56ab9090449d737c9c0334b5fa4c/Yunit.ahk#L45
@Lexikos or @sswwaagg can you advise?
initially Lexikos added the changes in this commit: https://github.com/Uberi/Yunit/commit/21591c563f37cbaa838cbd529f6062dbe1ea9c2f
and the comparable v1 code here: https://github.com/Uberi/Yunit/blob/master/Yunit.ahk#L44