Sign in to follow this  
Followers 0
Uten

StringRegExpReplace and extended

4 posts in this topic

#1 ·  Posted (edited)

I would expect @extended to be something else than 0 in the StringRegExpReplace helpfile sample (autoit-v3.2.11.0).

Maybe a minor bug that has sneaked in a again as it seems to have been addressed before?

Before I report this as a bug could someone verify that I have understood the docs right. Or, horror, if I have goofed in my code.

testStringRegExpReplace()
Func assert($test, $msg="", $line=@ScriptLineNumber, $error= @error, $extended=@extended)
    If Not $test Then ConsoleWrite("(" & $line & ") := (" & $error & ")(" & $extended & ")FAILED::$msg:=" & $msg & @crlf)
EndFunc
func testStringRegExpReplace()
    Local $data = StringRegExpReplace("Where have all the flowers gone, long time passing?", "[aeiou]", "@")
    Local $error = @error
    Local $extended = @extended

    assert( "Wh@r@ h@v@ @ll th@ fl@w@rs g@n@, l@ng t@m@ p@ss@ng?" = $data, $data)
    assert(15 = $extended, "@extended:=" & $extended)
    assert(0 = $error, "@error:=" & $error)
EndFunc

EDIT: AS it turns out I had placed an assert call before I saved @extended :)

Corrected the provided code. And modified assert to the proper version and not the lazy one. Thanks to w@eaponx and @Siao for pointing out the obvious.

Edited by Uten

Share this post


Link to post
Share on other sites



Well you are calling a function which contains ConsoleWrite() after your StringRegExpReplace so @Extended should be overwritten at that point.

Share this post


Link to post
Share on other sites

At the start of ANY function (internal or user defined) error flags are reset to 0.


"be smart, drink your wine"

Share this post


Link to post
Share on other sites

*Grumble*, *grumble*. The weakest link is always behind the keyboard :)

Knew it was a reason I usually used to pass on @extended and @error to the assert function.

Thanks both of you..:)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0