Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Odd behavior with #ENDIF in #DEFINE
Message
From
11/09/2006 15:08:16
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Odd behavior with #ENDIF in #DEFINE
Miscellaneous
Thread ID:
01152849
Message ID:
01152849
Views:
68
Hi All,

I am developing a Test Suite class, and would like to devise my own command using Preprocessors. I have the following include file.
#IFNDEF TEST_SUITE

#DEFINE TEST_SUITE      #IF .F.
#DEFINE ENDTEST_SUITE   #ENDIF

#DEFINE TEST_CASE       *
#DEFINE ENDTEST_CASE

#ENDIF
In the various methods, I am define the test case in the actual code as such:
* Standard Method Header
*---------------------------------------

TEST_SUITE
TEST_CASE    First Test Case
    *- <Place Test Case code here>
ENDTEST_CASE
ENDTEST_SUITE

WAIT WINDOW "For something"

*- The remainder of the method is the actual code for the method.
Now for the problem.

When compiled and ran, the lines after of ENDTEST_SUITE (aka #ENDIF) are ignored at run-time, or something close to that. Here a simplified version of the same problem.
SET STEP ON 

#define kStart #IF .F.		&& text noshow
#define kEnding #ENDIF		&& endtext
WAIT WINDOW

kStart
? "Hello"
kEnding

WAIT WINDOW 
? "world"

RETURN
In this example, the debugger stops at the first "WAIT" statement, but it proceeds after it, it exits the routine. Now if you comment out the first WAIT statement and run it again, the behavior changes a little. Now the it stops at the "RETURN" statement after executing the SET STEP statement.

Has anyone encountered this before, and is there a fix or work-around to placing a "#ENDIF" is a constant?
Greg Reichert
Next
Reply
Map
View

Click here to load this message in the networking platform