
DEFINE CLASS wwScriptingTests as FxuTestCase OF FxuTestCase.prg


*** SETUP AND CONFIGURATION *** 

************************************************************************
*  Setup
****************************************
***  Function:
***    Assume:
***      Pass:
***    Return:
************************************************************************
FUNCTION Setup()

	*** Make sure libraries are loaded
	DO wconnect

ENDFUNC
*   Setup

************************************************************************
*  TearDown
****************************************
***  Function:
***    Assume:
***      Pass:
***    Return:
************************************************************************
FUNCTION TearDown()

ENDFUNC
*   TearDown

************************************************************************
*  CreatewwScripting
****************************************
***  Function:
***    Assume:
***      Pass:
***    Return:
************************************************************************
FUNCTION CreatewwScripting(llDebugMode)

loScript = CREATEOBJECT("wwScripting")

*loScript.cScriptResponseClass = "wwPageResponse"
loScript.lNoVersionCheck = .F.
loScript.lEditErrors = .F.
loScript.lSaveVfpSourceCode = .F.
loScript.lShowFullErrorInfo = .F.
loScript.cBasePath = "c:\webconnection\fox\tests"

*** Write output directly into this Response object
*loScript.oResponse = CREATEOBJECT("wwPageResponse")

IF llDebugMode
	loScript.lShowFullErrorInfo = .T.
	loScript.lEditErrors = .T.
	loScript.lStopOnError = .T.
ELSE
    *** We want the exception to bubble up to Web Connection error handler
    loScript.lThrowException = .T.	
ENDIF

RETURN loScript
ENDFUNC
*   CreatewwScripting


************************************************************************
*  TestwwScripting
****************************************
***  Function:
***    Assume:
***      Pass:
***    Return:
************************************************************************
FUNCTION TestChr10Text

lcText = "This " +CHR(10)+ "is one line of text" + CHR(10) + " separated by CHR(10)s <%= VERSION() %>" + CHR(10) + CHR(10) 

TEXT TO lcText2 NOSHOW
<%  x = 1 
    x = x + 2
%>

Value is: <%= x %>    
ENDTEXT

lcText = lcText + lcText2

lcFile = "c:\webconnection\fox\tests\test.wcs"
STRTOFILE(lcText,lcFile)

loScript = THIS.CreatewwScripting()
loScript.lSaveVfpSourceCode = .t.

lcOutput = loScript.RenderAspScript(lcFile)

THIS.MessageOut(lcOutput)
ENDFUNC
*   TestwwScripting

************************************************************************
*  MultilineCode
****************************************
***  Function:
***    Assume:
***      Pass:
***    Return:
************************************************************************
FUNCTION MultilineCode()

lcText =  REPLICATE("1 ",139) +  CHR(13) + "not enough"

lcFile = "c:\webconnection\fox\tests\test.wcs"
STRTOFILE(lcText,lcFile)

loScript = THIS.CreatewwScripting()
loScript.lSaveVfpSourceCode = .t.

lcOutput = loScript.RenderAspScript(lcFile)

THIS.MessageOut(lcOutput)

ENDFUNC
*   MultilineCode

ENDDEFINE