[PATCH] vbscript: Fixed CBool(try 2)
Piotr Caban
piotr.caban at gmail.com
Thu May 1 09:38:27 CDT 2014
On 05/01/14 15:22, Shuai Meng wrote:
> I have changed the tests like this and they can pass on wine with no
> failure.
> 481 Sub testCBoolError
> 482 on error resume next
> 483
> 484 Call Err.clear()
> 485 Call CBool("")
> 486 Call ok(Err.number = 13, "Err.number = " & Err.number)
> 487
> 488 Call Err.clear()
> 489 Call CBool("#False#")
> 490 Call ok(Err.number = 13, "Err.number = " & Err.number)
> 491
> 492 Call Err.clear()
> 493 Call CBool("#True#")
> 494 Call ok(Err.number = 13, "Err.number = " & Err.number)
> 495
> 496 Call Err.clear()
> 497 Call CBool("MyObject")
> 498 Call ok(Err.number = 13, "Err.number = " & Err.number)
> 499 End Sub
I think that previous way of implementing this tests was nicer. The
results are different because you're testing different things (e.g.
"MyObject" instead of MyObject, "#True#" instead of "#TRUE#").
> These are the failing tests:
> Call testCBoolError("#TRUE#", 458)
> Call testCBoolError("#FALSE#", 458)
> Call testCBoolError(MyObject, 458)
In order to fix it you need to change the implementation. Probably you
need to check if string equals to "#TRUE#" and return early without
calling VariantChangeType. I'm not sure what needs to be done in
MyObject case.
> As showed above, I have changed 458 into 13, and can pass on winxp.
> However there two failures come nowhere like this:
> run.c:1013: Test failed: api.vbs: L"Err.number = 0"
> run.c:1013: Test failed: api.vbs: L"Err.number = 0"
> I can't understand it: if Err.number = 0 then everything is right, why
> does it come out?
It's happening because on wine the test is succeeding while it's
supposed to fail.
> Could you please also add following tests:
> MyObject.myval = 1
> Call ok(CBool(MyObject) = True, "CBool(MyObject) = " & CBool(MyObject))
> MyObject.myval = 0
> Call ok(CBool(MyObject) = False, "CBool(MyObject) = " & CBool(MyObject))
>
> Ok, but does this mean I am testing object in the proper way?
Currently you're only testing what happens if default value is unset
(variant VT_EMPTY). This is just testing what happens if other values
are returned.
More information about the wine-devel
mailing list