background image
<< Porting Tests - Marking 4Test code as GUI-specific | Porting Tests - With global variables >>
Porting Tests - type statements
<< Porting Tests - Marking 4Test code as GUI-specific | Porting Tests - With global variables >>
User's Guide
267
13 P
ORTING
T
ESTS
TO
O
THER
GUI
S
Marking 4Test code as GUI-specific
// legal because no GUI specifier
// enclosing entire if statement:
if (i==j)
msw, motif Print ("hi")
mac Print ("bye")
// legal because msw is a subset of enclosing specifier:
msw, mac if (i==j)
msw Print("hi")
// legal for the same reason as preceding example:
msw, motif if (i==j)
Print ("hi")
msw else
Print ("Not the same")
// NOT legal because mac is not a subset
// of the enclosing GUI specifier msw:
msw if (i==j)
mac Print ("bye")
// Invalid GUI type
type statements
You can use a GUI specifier before a type ... is enum or type ... is set
statement, but not before an individual value within the declaration.
do...except statements
You can use GUI specifiers to enclose an entire do...except statement and
before individual statements, but you cannot use GUI specifiers before the
except clause.
// legal:
do
msw Verify (expr1,expr2)
motif Verify (expr3,expr4)
except
motif reraise
msw if (ExceptNum () == 1)
Print ("err, etc.")
// NOT legal:
msw do
Verify (expr,expr)
msw except
reraise
Class declarations
Be careful using GUI specifiers before class declarations; they can be
ambiguous. Any ambiguities must be resolvable at compile-time.
// bad style:
msw winclass myclass
mac winclass myclass
window myclass inst // Ambiguous. Is it an instance of