Files
harbour-core/harbour/tests/parexpr.prg
Viktor Szakats e788d6d3e8 2012-07-18 13:54 UTC+0200 Viktor Szakats (harbour syenar.net)
+ contrib/hbgt/tests
  + contrib/hbgt/tests/test.prg
  + contrib/hbmisc/tests/rtfclass.prg
  - tests/rtfclass.prg
  - tests/test10.prg
  - tests/testgt.prg
  * tests/ac_test.prg
  * tests/alias.prg
  * tests/begin.prg
  * tests/boxtest.prg
  * tests/cdow.prg
  * tests/clasinh.prg
  * tests/dates.prg
  * tests/dates2.prg
  * tests/dates3.prg
  * tests/dates4.prg
  * tests/ddate.prg
  * tests/debugtst.prg
  * tests/delimtst.prg
  * tests/devtest.prg
  * tests/disptest.prg
  * tests/foreach.prg
  * tests/gtstdtst.prg
  * tests/ipclnt.prg
  * tests/ipsvr.prg
  * tests/langapi.prg
  * tests/memtst.prg
  * tests/memvar.prg
  * tests/menutest.prg
  * tests/mousetst.prg
  * tests/multiarg.prg
  * tests/newrdd.prg
  * tests/nums.prg
  * tests/objarr.prg
  * tests/objasign.prg
  * tests/objects.prg
  * tests/omacro.prg
  * tests/onidle.prg
  * tests/os.prg
  * tests/output.prg
  * tests/overload.prg
  * tests/parexpr.prg
  * tests/passref.prg
  * tests/procline.prg
  * tests/procname.prg
  * tests/recursiv.prg
  * tests/returns.prg
  * tests/round.prg
  * tests/say.prg
  * tests/sbartest.prg
  * tests/scroll.prg
  * tests/sdf_test.prg
  * tests/seconds.prg
  * tests/server.prg
  * tests/set_num.prg
  * tests/set_test.prg
  * tests/setkeys.prg
  * tests/sound.prg
  * tests/speed.prg
  * tests/statfun.prg
  * tests/statics.prg
  * tests/statics1.prg
  * tests/statics2.prg
  * tests/statinit.prg
  * tests/strdelim.prg
  * tests/stripem.prg
  * tests/switch.prg
  * tests/symbolt.prg
  * tests/t1.prg
  * tests/tb1.prg
  * tests/testbrdb.prg
  * tests/testbrw.prg
  * tests/testcdx.prg
  * tests/testcls.prg
  * tests/testdbf.prg
  * tests/testdecl.prg
  * tests/testerro.prg
  * tests/testfor.prg
  * tests/testget.prg
  * tests/testhrb.prg
  * tests/testhtml.prg
  * tests/testidle.prg
  * tests/testmem.prg
  * tests/testpers.prg
  * tests/testtok.prg
  * tests/testwarn.prg
  * tests/tstalias.prg
  * tests/tstasort.prg
  * tests/tstblock.prg
  * tests/tstdbi.prg
  * tests/tstmacro.prg
  * tests/varparam.prg
  * tests/wvt_fs.prg
    * cleaning up tests
2012-07-18 12:00:10 +00:00

95 lines
1.8 KiB
Plaintext

/*
* $Id$
*/
// The following code tests harbour's ability to cope with parenthesized
// expressions.
// These tests were written by Dave Pearson <davep@hagbard.demon.co.uk> and
// are placed into the public domain.
// This file is OK to have warnings.
#ifdef __HARBOUR__
#pragma -es0
#endif
PROCEDURE Main()
Local x
Local y
// Simple one to start with.
x := ( 1 )
? x
// Now with a little more complex:
x := ( 1, 2 )
? x
// And a little more, this is really the same as the previous one.
x := ( 1, 2, 3 )
? x
// Expression within expression
x := ( ( 1, 2, 3 ) )
? x
// And a little more:
x := ( ( 1, 2, 3 ), ( 1, 2, 3 ) )
? x
// Some inline assignments
x := ( y := 10, y )
? x
x := ( ( y := ( 1, 2, 3) ), y * ( 10, 20, 30 ) )
? x
// Now mix with statements and functions
? ( 1, 2, 3 )
If ( y := .t. )
? "Working"
Else
? "Borken"
EndIf
If ( x := 10, y := ( x == 10 ) )
? "Working"
Else
? "Broken"
EndIf
If ( Something( 1, 2, 3 ), .T. )
? "Working"
Else
? "Broken"
EndIf
?
// Now even some more testing of related code
// placed into public domain by Ryszard Glab
? IF( (.F.,0,.T.), ("some", "text", "IF Working"), ("some", "text", "Broken") )
? IF( (.T.,1,.F.), ("some", "text", "Broken"), ("some", "text", "IF Working") )
? IF( (.T. .OR. .F.), IF( .T., "Working", "Broken" ), IF( .F., "Broken", "Working" ) )
/* The following code should generate syntax error if uncommented
* because IF token followed by any three expressions is interpreted
* as IIF inline
*/
// IF( .T., .F., .T. )
// ? "Working"
// ELSE
// ? "Broken"
// ENDIF
Return
Static Function Something( x, y, z )
// This does something and it does it well/
Return( NIL )