Yes, it's working, thank you very much

PS: i had to modify it a little and its working for just one method at a time,  but if i call it multiple times for different methods its freezing again

Do $$$AssertEquals(strExpectedResult,strOutputRechtsinfo)

strExpectedResult,  this was a %Library.DynamicObject i converted with %ToJSON()

strOutputRechtsinfo this is what the method i'm trying to test returns

I dont know how to get the INT fragments you speak of

I had to modify it a little and now its freezing because of the $$$AssertEquals. How can i make it work with the asserts?


ClassMethod WriteCapture(vstrCommand As %String, Output strOutput As %String, Output status As %Status) [ ProcedureBlock = 0 ]
    set tOldIORedirected = ##class(%Device).ReDirectIO()
    set tOldMnemonic = ##class(%Device).GetMnemonicRoutine()
    set tOldIO = $io
    try {
        set strOutput=""

        //Redirect IO to the current routine - makes use of the labels defined below
        use $io::("^"_$ZNAME)

        //Enable redirection
        do ##class(%Device).ReDirectIO(1)

        XECUTE (vstrCommand, .status)
    catch ex {
        set strOutput = ""

    //Return to original redirection/mnemonic routine settings
    if (tOldMnemonic '= "") {
        use tOldIO::("^"_tOldMnemonic)
    else {
        use tOldIO
    do ##class(%Device).ReDirectIO(tOldIORedirected)

    //Labels that allow for IO redirection
    //Read Character - we don't care about reading
rchr(c) quit
    //Read a string - we don't care about reading
rstr(sz,to) quit
    //Write a character - call the output label
wchr(s) do output($char(s)) quit
    //Write a form feed - call the output label
wff() do output($char(12)) quit
    //Write a newline - call the output label
wnl() do output($char(13,10)) quit
    //Write a string - call the output label
wstr(s) do output(s) quit
    //Write a tab - call the output label
wtab(s) do output($char(9)) quit
    //Output label - this is where you would handle what you actually want to do.
    // in our case, we want to write to str
output(s) set strOutput=strOutput_s   quit

Mihai has no followers yet.
Mihai has not followed anybody yet.
Global Masters badges:
Mihai has no Global Masters badges yet.