See More

REVO5500 ö ExecTestFramework @  ½‡Š 5S • ÿÿÿÿ cRevStandaloneSettings &scriptLibraries Internet Geometry PrintingMacOSX true OSX,name ExecTestFrameworkUNIX,fileSelector trueWindows trueWindows,LegalCopyright #2012 All rights reserved worldwideUNIX,pageSetup trueOSX,documentType Linux trueinclusions searchWindows,documenticonFile aC:/Program Files/RunRev/LiveCode 5.5.3/Runtime/Windows/x86-32/Support/Sample Icons/genericdoc.ico answerDialog trueOSX,documentExtension Windows,FileDescription %ExecTestFramework 1.0.0.0 for WindowsOSX,longVersion ExecTestFramework 1.0.0.0UNIX,printerChooser trueOSX,copyright #2012 All rights reserved worldwideOSX,identifier com..exectestframeworkname ExecTestFrameworkOSX,shortVersion 1.0.0.0Windows,fileversion1 1Windows,fileversion2 0Windows,productversion1 1Windows,fileversion3 0Windows,productversion2 0Windows,fileversion4 0Windows,productversion3 0cursors falseWindows,productversion4 0 OSX,info !ExecTestFramework Version 1.0.0.0MacOSX PowerPC-32 false askDialog trueWindows,iconFile aC:/Program Files/RunRev/LiveCode 5.5.3/Runtime/Windows/x86-32/Support/Sample Icons/genericapp.icoOSX,signature ????Windows,ProductName ExecTestFrameworkUNIX,colorChooser trueMacOSX x86-32 falseWindows,companyname cREVGeometryCache stackID 1014 cREVGeneral breakpointconditions breakpoints breakpointstates stackfileversion 5.5AlreadyHidden false ê P!3on preOpenCard put "" & return & listModules() into button "Modules" end preOpenCard ---------------------------------------------------------------------------------------- command runTests pMode, pTestToRun put empty into field "Log" -- The path to the engine we want is a mode engine within the checked-out -- branch we have. local tBuildFolder, tInputEngine, tOutputEngine set the itemDelimiter to slash put item 1 to -4 of the filename of this stack & slash & "_build/" & pMode into tBuildFolder put tBuildFolder & "/standalone.exe" into tInputEngine put tBuildFolder & "/exec-tests.exe" into tOutputEngine if there is no file tInputEngine then answer "Cannot find standalone engine - " && tInputEngine exit runTests end if if there is a file tOutputEngine then delete file tOutputEngine if there is a file tOutputEngine then answer "Cannot build tests as cannot delete existing test engine - " & tOutputEngine exit runTests end if end if local tTestIndex put 1 into tTestIndex local tTestScript put the script of button "Template" & return after tTestScript local tModules if pTestToRun is empty then if the label of button "Modules" is "" then put listModules() into tModules else put the label of button "Modules" into tModules end if else set the itemDelimiter to "." put item 1 of pTestToRun into tModules set the itemDelimiter to comma end if local tSuccess put true into tSuccess repeat for each line tModule in tModules repeat for each line tTest in listTestsForModule(tModule) if pTestToRun is not empty and (pTestToRun & ".test") is not (tModule & "." & tTest) then next repeat end if get processTest(tModule, tTest, tTestIndex) if it is not empty then put it & return after tTestScript else put false into tSuccess end if end repeat end repeat if not tSuccess then exit runTests end if create stack "__TESTS__" set the script of stack "__TESTS__" to tTestScript copy button "revLibURL" of stack "revLibrary" to card 1 of stack "__TESTS__" set the name of it to "revLibUrl" save stack "__TESTS__" as tBuildFolder & slash & "exec-tests.livecode" delete stack "__TESTS__" local tDeployInfo put tInputEngine into tDeployInfo["engine"] put tBuildFolder & slash & "exec-tests.livecode" into tDeployInfo["stackfile"] put tOutputEngine into tDeployInfo["output"] _internal deploy windows tDeployInfo if the result is not empty then answer "Cannot build test engine due to -" && the result exit runTests end if /*local tNextTestIndex, tProcessOutputs put 1 into tNextTestIndex repeat forever repeat for each line tProcess in the openProcesses read from process tProcess until empty if it is not empty then put it after tProcessOutputs[tProcess] end if if the result is not empty then close process tProcess put tProcessOutputs[tProcess] after field "Log" delete variable tProcessOutputs[tProcess] end if end repeat repeat while the number of lines in the openProcesses < 16 if tNextTestIndex > tTestIndex then exit repeat end if open process (tOutputEngine && tNextTestIndex) for binary read add 1 to tNextTestIndex end repeat if the openProcesses is empty then exit repeat end if end repeat*/ set the hideConsoleWindows to true repeat with i = 1 to tTestIndex get shell(tOutputEngine && i) put it after field "Log" set the vScroll of field "log" to the formattedHeight of field "log" end repeat end runTests function processTest pModule, pTest, @pIndex local tInput, tOutput put url ("file:" & testsPath() & slash & pModule & slash & pTest) into tInput if tInput is empty then return return end if local tLineIndex put 1 into tLineIndex repeat for each line tLine in tInput switch word 1 of tLine case "setup" put "command runTest_" & pIndex & return after tOutput processTestSetupLine tOutput, pModule, pTest, tLineIndex, word 2 to -1 of tLine break case "teardown" processTestTeardownLine tOutput, pModule, pTest, tLineIndex, word 2 to -1 of tLine put "end runTest_" & pIndex & return & return after tOutput add 1 to pIndex break case "test" processTestTestLine tOutput, pModule, pTest, tLineIndex, word 2 to -1 of tLine break case "test-error" processTestTestErrorLine tOutput, pModule, pTest, tLineIndex, word 2 to -1 of tLine break case "test-no-error" processTestTestNoErrorLine tOutput, pModule, pTest, tLineIndex, word 2 to -1 of tLine break default put "/*"&tLineIndex&"*/" && tLine & return after tOutput break end switch add 1 to tLineIndex end repeat set the script of button "Test Compile" to tOutput if the result is not empty then put the result log pModule & "." & pTest & ", line " & char 3 to -3 of word 1 of line (item 2 of the result) of tOutput & ":" && "compile error" return empty end if return tOutput end processTest command processTestSetupLine @xOutput, pModule, pTest, pLineIndex, pLine put "local ___temp___, ___error___" & return after xOutput if pLine is empty then get "functionality" else get char 2 to -2 of pLine end if put "log" && quote & (pModule & "." & pTest) & ":" && it & quote & return after xOutput end processTestSetupLine command processTestTeardownLine @xOutput, pModule, pTest, pLineIndex, pLine end processTestTeardownLine command processTestTestLine @xOutput, pModule, pTest, pLineIndex, pLine put "/*"&pLineIndex&"*/ if not (" & pLine & ") then log" && quote & " failure - line" && pLineIndex & quote & ";else;end if;" & return after xOutput end processTestTestLine command processTestTestErrorLine @xOutput, pModule, pTest, pLineIndex, pLine put "put empty into ___error___" & return after xOutput put "try" & return after xOutput put "/*"&pLineIndex&"*/ put (" & pLine & ") into ___temp___" & return after xOutput put "catch ___error___" & return after xOutput put "end try" & return after xOutput put "if __error__ is empty then log" && quote & " failure - line" && pLineIndex & quote & ";else;end if;" & return after xOutput end processTestTestErrorLine command processTestTestNoErrorLine @xOutput, pModule, pTest, pLineIndex, pLine put "put empty into ___error___" & return after xOutput put "try" & return after xOutput put "/*"&pLineIndex&"*/ put (" & pLine & ") into ___temp___" & return after xOutput put "catch ___error___" & return after xOutput put "end try" & return after xOutput put "if ___error___ is not empty then log" && quote & " failure - line" && pLineIndex & quote & ";else;end if;" & return after xOutput end processTestTestNoErrorLine ---------------------------------------------------------------------------------------- command log pMessage put pMessage & return after field "Log" end log ---------------------------------------------------------------------------------------- function listModules return listFolders(testsPath()) end listModules function listTestsForModule pModule return listFiles(testsPath() & slash & pModule) end listTestsForModule function testsPath set the itemDelimiter to slash return item 1 to -2 of the filename of this stack end testsPath ---------------------------------------------------------------------------------------- function listFiles pFolder local tOldFolder put the folder into tOldFolder set the folder to pFolder get the files set the folder to tOldFolder return it end listFiles function listFolders pFolder local tOldFolder put the folder into tOldFolder set the folder to pFolder get the folders filter it without ".*" set the folder to tOldFolder return it end listFolders ---------------------------------------------------------------------------------------- € ‡Š  cREVGeneral scripteditorvscroll 1690scripteditorselection 7390 cREVGeometryCacheIDs 1337778958150 10061343307582076 10131337781157440 10091337778944808 10041337787028791 1011 cREVGeometrycache order total 5 ì î ñ ó õ ì Test àE‹p ,on mouseUp runTests "debug" end mouseUp € R 2 cREVGeneral revUniqueID 1337778944808scripteditorvscroll 0scripteditorselection 22 î Log ƒ)` € ˆn ¶ cREVGeneral scripteditorvscroll 0revUniqueID 1337778958150scripteditorselection 0 ê ï ` @ { l ´ ñ Template àE‹p;on startup create stack "Test" insert script of me into back --insert the script of button "revLibURL" of me into back send "postStartup" to me in 0 millisecs end startup on postStartup try dispatch "runTest_" & $1 to stack "Test" catch tError repeat for each line tLine in tError log " failure - " & tLine end repeat end try delete stack "Test" quit 0 end postStartup command log pMessage write pMessage & return to stdout end log command use pLib insert the script of button pLib of me into back end use € 8 R 6 cREVGeneral revUniqueID 1337781157440scripteditorvscroll 0scripteditorselection 311 ó Test Compile àE‹p«command runTest_12 local ___temp___, ___error___ log "network.ExecUnloadUrl.test: functionality" /*2*/ /*3*/ load URL "http://www.google.com/" /*4*/ /*5*/ ---wait until the cachedUrls contains "http://www.google.com/" with messages /*6*/ /*7*/ unload URL "http://www.google.com/" /*8*/ /*9*/ if not (not (the cachedURLs contains "http://www.google.com")) then log " failure - line 9";else;end if; /*10*/ end runTest_12 € â R 4 cREVGeneral revUniqueID 1337787028791scripteditorvscroll 0scripteditorselection 439 õ Modules Àåe € Z „ 2 arrays datetime engine files filters graphics ide interface legacy logic math multimedia network pasteboard scripting security strings text cREVGeneral revUniqueID 1343307582076scripteditorvscroll 0scripteditorselection 0