+ 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
248 lines
4.0 KiB
Plaintext
248 lines
4.0 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
// This file is OK to have warnings.
|
|
#ifdef __HARBOUR__
|
|
#pragma -es0
|
|
#else
|
|
#translate AS ARRAY [OF <type>] =>
|
|
#translate AS STRING =>
|
|
#translate AS CLASS <ClassName> =>
|
|
#translate AS NUMERIC =>
|
|
#translate AS DATE =>
|
|
#translate AS CODEBLOCK =>
|
|
#translate AS OBJECT =>
|
|
#translate AS LOGICAL =>
|
|
#translate AS USUAL =>
|
|
|
|
#command DECLARE <*x*> =>
|
|
#endif
|
|
|
|
DECLARE nMyFunc( cVar AS STRING, @nVar AS NUMERIC ) AS NUMERIC
|
|
|
|
DECLARE cOtherFunc( ) AS STRING
|
|
|
|
DECLARE cOtherFunc( @cVar as string, optional nVar as numeric, optional other /*as variant*/ ) AS STRING
|
|
|
|
DECLARE Seconds() AS NUMERIC
|
|
|
|
DECLARE Int( n AS NUMERIC ) AS NUMERIC
|
|
|
|
DECLARE TEST() AS NUMERIC
|
|
|
|
DECLARE MyClass ;
|
|
nMyFunc( nVal AS NUMERIC) AS NUMERIC
|
|
|
|
DECLARE MyClass ;
|
|
nMyFunc( nVal AS NUMERIC ) AS NUMERIC ;
|
|
nMyFunc( nVal AS NUMERIC ) AS NUMERIC ;
|
|
cMyData ;
|
|
aInstances AS Array Of Object MyClass ;
|
|
oNext( oInstance AS Class MyClass ) As Class MyClass
|
|
|
|
DECLARE OtherClass ;
|
|
nMyFunc( nVal AS NUMERIC ) AS NUMERIC ;
|
|
nMyFunc( nVal AS NUMERIC ) AS NUMERIC ;
|
|
cMyData ;
|
|
aInstances AS Array Of Object MyClass ;
|
|
oNext( oInstance AS Class OtherClass ) As Class MyClass
|
|
|
|
FIELD a AS STRING
|
|
FIELD b AS STRING
|
|
|
|
MEMVAR Var1 AS STRING
|
|
|
|
STATIC lGlobal AS LOGICAL
|
|
|
|
PROCEDURE Main( optional )
|
|
|
|
STATIC lStatic := 0, oMyObj As Class WrongClass
|
|
|
|
LOCAL cVar AS STRING := [declare function]
|
|
|
|
LOCAL a As STRING, oB AS Class MyClass, c AS STRING, oD AS Class OtherClass
|
|
|
|
FIELD b AS NUMERIC
|
|
|
|
MEMVAR Var1 AS NUMERIC
|
|
|
|
PRIVATE TEST AS STRING
|
|
|
|
USE TEMP
|
|
|
|
oMyObj:MyMethod( 2, 3, 4 )
|
|
|
|
a := b:nMyFunc(2,3)
|
|
a := b:nMyFunc(2)
|
|
|
|
a := oB:oNext( 1 ):cMyData
|
|
a := oB:oNext( c ):cMyData2
|
|
a := oB:oNext( d ):cMyData
|
|
a := oB:oNext( oD ):cMyData
|
|
|
|
a := oB:aInstances[1]:oNext:cMyData2
|
|
a := oB:aInstances[1]:oNext:cMyData
|
|
|
|
x := cOtherFunc( 'A' )
|
|
x := cOtherFunc( @Test )
|
|
x := cOtherFunc( 'A', 'A', 'A' )
|
|
|
|
M->TEST := "TEST"
|
|
|
|
a := 'A'
|
|
|
|
oB := 'a'
|
|
|
|
if lStatic
|
|
Var1 := .F.
|
|
endif
|
|
|
|
IF lGlobal
|
|
Var1 := .T.
|
|
ENDIF
|
|
|
|
RETURN
|
|
|
|
PROCEDURE SOMEPROC()
|
|
|
|
PRIVATE TEST AS NUMERIC
|
|
|
|
M->TEST := 1
|
|
|
|
FOR M->TEST := 1 TO M->TEST + 10
|
|
? "Correct warnings for FOR/NEXT"
|
|
NEXT
|
|
|
|
REPLACE a WITH 1
|
|
|
|
M->public_var := 0
|
|
|
|
b := 0
|
|
|
|
Var1 := 1
|
|
|
|
if lGlobal = 0
|
|
? 'lGlobal is NOT Numeric'
|
|
endif
|
|
|
|
RETURN
|
|
|
|
PROC MAIN1()
|
|
|
|
PRIVATE OTHER, TEST AS STRING
|
|
|
|
Var1 := M->TEST
|
|
|
|
Var2 := Test()
|
|
|
|
? Var1 + 2
|
|
|
|
M->TEST := 1
|
|
M->TEST := "No Warning"
|
|
|
|
Test[ 1 ][ 2 ] := "Correct warning"
|
|
|
|
RETURN
|
|
|
|
Function Test()
|
|
RETURN .T.
|
|
|
|
Function Main2()
|
|
Local n As Numeric, lVar AS LOGICAL
|
|
|
|
n := IIF( lVar, 'A', 3 ) //IIF() needs to be completed.
|
|
n := 2
|
|
n := 'a'
|
|
n := Seconds() + 2
|
|
n := Int( seconds() + 2 )
|
|
|
|
Return( NIL )
|
|
|
|
FUNCTION Main3()
|
|
|
|
LOCAL n AS NUMERIC, cVar AS STRING, a[5,5,5] AS ARRAY OF STRING
|
|
|
|
cVar := a[1]
|
|
|
|
n := &SomeFun( 2, 3 )
|
|
|
|
n := ExtFun()
|
|
|
|
cVar := cOtherFunc( 3 )
|
|
|
|
n := nMyFunc( a, cVar ) + 3
|
|
|
|
n := &(cVar)
|
|
|
|
n := "&SomeVar"
|
|
|
|
n := &Var.1
|
|
|
|
n := V&SomeVar.1
|
|
|
|
n[2] := 4
|
|
|
|
cVar := {|nb AS NUMERIC , cb AS STRING, db AS DATE| n := .F., nb := 'A', cb := 1, db := 0, n := 'wrong type', 0 }
|
|
|
|
? "This is a compiler test."
|
|
|
|
n := 'C is Wrong Type for n'
|
|
|
|
n := {1,2,3}
|
|
|
|
n := a
|
|
|
|
IIF( n, 2, 3 )
|
|
|
|
RETURN NIL
|
|
|
|
FUNCTION SomeTest( lVar AS LOGICAL )
|
|
|
|
LOCAL nVar AS NUMERIC, cVar AS STRING, lVar2 AS LOGICAL, nNoType := 3
|
|
PRIVATE cMemVar1 AS STRING
|
|
|
|
nVar := .T.
|
|
|
|
nVar := 1
|
|
|
|
nVar := 'A'
|
|
|
|
cVar := 2
|
|
|
|
cVar := 'B'
|
|
|
|
cVar := 2
|
|
|
|
lVar := .T.
|
|
|
|
lVar := nNoType
|
|
|
|
cVar := nVar
|
|
|
|
M->cMemVar1 := 2
|
|
|
|
NondDeclared := 2
|
|
|
|
cVar := {|n AS NUMERIC , c AS STRING, d AS DATE| n := nMyFunc( n,c,d ), c := 2 }
|
|
|
|
nVar := 8 + cVar
|
|
|
|
IF 1
|
|
|
|
ENDIF
|
|
|
|
RETURN NIL
|
|
|
|
Function nMyFunc( cVar AS STRING, nVar AS NUMERIC )
|
|
|
|
nVar := Val(cVar)
|
|
|
|
RETURN nVar + 1
|
|
|
|
Function cOtherFunc( )
|
|
RETURN 'Hello'
|
|
|
|
Function ExtFun()
|
|
RETURN 1
|