go to post Mihai Radu · Sep 1, 2017 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 returnsI dont know how to get the INT fragments you speak of
go to post Mihai Radu · Sep 1, 2017 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 readingrchr(c) quit //Read a string - we don't care about readingrstr(sz,to) quit //Write a character - call the output labelwchr(s) do output($char(s)) quit //Write a form feed - call the output labelwff() do output($char(12)) quit //Write a newline - call the output labelwnl() do output($char(13,10)) quit //Write a string - call the output labelwstr(s) do output(s) quit //Write a tab - call the output labelwtab(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 stroutput(s) set strOutput=strOutput_s quit}
go to post Mihai Radu · Aug 31, 2017 Yes, it's working, thank you very muchPS: 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