-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python code generation bug in switch statement #55
Comments
Let me know if you would rather open the Issue since you know more about the code base. I have not had time to look into what the Async() and Sync() cases actually are doing or where they are defined. |
Thanks for reporting, it should be a python bug probably, but can you try with 3.3 as well, now when it's in RC, to see if it's fixed there already? |
I was making an update anyway, so I added this fix in the latest version. Can you confirm that it works? |
Hi Andreas, The update is working for me. Thank you for the quick turnaround! I have 2 unrelated questions for you whenever you have time. No rush.
Traceback (most recent call last): If I wrap everything in a try/catch the error is apparent. Is there a better way I should be doing this? Or would this try/catch method be preferable?
import Setup; class RunTests implements Buddy<[
]> class DummySuite extends BuddySuite { public function new() {} } Basically I can then compile with “–D Suite1” or “–D all” to run different suites. What I am wondering here is if there is a way to dynamically create a list of suites to feed into RunTests to clean this up a bit and remove the need for the DummySuite. As you can imagine this gets increasingly complex with more suites Thank you so much for all your work on this project. I truly appreciate it. From: Andreas [mailto:[email protected]] I was making an update anyway, so I added this fix in the latest version. Can you confirm that it works? — |
Thanks for the catch! It was a problem in the before/after error handling actually. I've fixed it and have released a new version. The dynamically suite creation is interesting, how would you like it to work? Where should it happen? |
Oh wow great! Thank you for taking care of that so quickly. I am out on vacation through the weekend, but I'll be thinking of how this could work. I would imagine passing an array of suites to some function would work, but I'm not sure how that would look. Thanks again! Joel From: Andreas <[email protected]mailto:[email protected]> Thanks for the catch! It was a problem in the before/after error handling actually. I've fixed it and have released a new version. The dynamically suite creation is interesting, how would you like it to work? Where should it happen? You are receiving this because you authored the thread. |
Forgot to ask if there is a way to fail a test if the before fails. Thanks! Get Outlook for iOShttps://aka.ms/o0ukef On Thu, Jun 9, 2016 at 6:15 AM -0600, "Andreas" <[email protected]mailto:[email protected]> wrote: Thanks for the catch! It was a problem in the before/after error handling actually. I've fixed it and have released a new version. The dynamically suite creation is interesting, how would you like it to work? Where should it happen? You are receiving this because you authored the thread. |
Not at the moment, for now I'd like to regard failures outside the actual test as a deeper issue that won't be handled by Buddy. I'll put it on the list for future features. |
In SuitesRunner.hx the following function is defined.
private function isSync(funcs : Iterable) : Bool {
for (f in funcs) switch f {
case Async(): return false;
case Sync():
}
return true;
}
On my Windows Server 2008 machine, this gets turned into the below in python:
def isSync(self,funcs):
# C:\HaxeToolkit\haxe\lib\buddy/2,2,0/buddy/SuitesRunner.hx:306
# C:\HaxeToolkit\haxe\lib\buddy/2,2,0/buddy/SuitesRunner.hx:306
tmp = HxOverrides.iterator(funcs)
while tmp.hasNext():
if ((tmp.next().index) == 0):
return False
elif ((tmp.next().index) == 1):
pass
else:
pass
# C:\HaxeToolkit\haxe\lib\buddy/2,2,0/buddy/SuitesRunner.hx:310
return True
When run I get this error do to the multiple tmp.next() calls:
File "C:\Users\administrator.HOSTINTEGRATION\Desktop\Haxe\solidfire-sdk-haxe\bin\RunTests.py", line 8040, in isSync
elif ((tmp.next().index) == 1):
AttributeError: 'NoneType' object has no attribute 'index'
Updating the code to the following fixes the issue:
private function isSync(funcs : Iterable) : Bool {
for (f in funcs) switch f {
case Async(_): return false;
default:
}
return true;
}
This does not happen on my Windows 10 PC or on Mac.
Using Python 3.5 and Buddy 2.2.0, and Haxe 3.2 on all machines.
I will open a bug with the haxe project, but I wasnt sure if you wanted to work around the issue in the mean time.
The text was updated successfully, but these errors were encountered: