Selaa lähdekoodia

Updated tests.

Mark Sibly 9 vuotta sitten
vanhempi
commit
ed54de368c

+ 1 - 1
tests/monkey/debugstack.monkey2

@@ -1,7 +1,7 @@
 
 Namespace test
 
-Class Ex Extends Throwable
+Class Ex Extends Exception
 End
 
 Function Test2( test:Int )

+ 2 - 2
tests/monkey/exceptions.monkey2

@@ -1,10 +1,10 @@
 
 Namespace test
 
-Class E1 'Extends Throwable
+Class E1 Extends Throwable
 End
 
-Class E2 'Extends Throwable
+Class E2 Extends Throwable
 End
 
 Function F1()

+ 1 - 53
tests/monkey/externs.cpp

@@ -1,57 +1,5 @@
 
 #include "externs.h"
 
-int G;
+int test::C::G;
 
-void F(){
-	puts( "::F()" );
-}
-
-C::C(){
-	puts( "C::C()" );
-}
-
-C::C( D *d ):_d( d ){
-	puts( "C::C( D* )" );
-}
-	
-void C::gcMark(){
-	bbGCMark( _d );
-}
-
-D::D(){
-	puts( "D::D()" );
-}
-
-void D::M(){
-	puts( "D::M()" );
-}
-
-const char *D::M2( const char *str ){
-	return "Goodbye!";
-}
-
-void D::gcMark(){
-	C::gcMark();
-}
-
-T::T(){
-	puts( "T::T()" );
-}
-	
-T::T( int x ){
-	puts( "T::T( int )" );
-}
-
-T::~T(){
-	puts( "T::~T()" );
-}
-
-bool T::operator==( T *that ){
-	puts( "T::operator==(T*)" );
-	return this==that;
-}
-
-void glue_E( C *c ){
-	puts( "::glue_E( C* )" );
-}

+ 35 - 54
tests/monkey/externs.h

@@ -1,60 +1,41 @@
 
-#ifndef BB_TEST_EXTERNS_H
-#define BB_TEST_EXTERNS_H
+#ifndef EXTERNS_H
+#define EXTERNS_H
 
-#include <bbmonkey.h>
+namespace test{
 
-class C;
-class D;
-class T;
-
-extern int G;
-
-extern void F();
-
-enum E{
-	E1,
-	E2,
-	E3
-};
-
-class C : public bbObject{
-
-	bbGCVar<D> _d;
-
-public:
-	
-	C();
-	C( D *d );
-	
-	void gcMark();
-};
-
-class D : public C{
-
-public:
-
-	D();
+	enum E{
+		V1,
+		V2
+	};
 	
-	void M();
+	namespace E2{
+		enum{
+			V1,
+			V2
+		};
+	}
 	
-	const char *M2( const char *str );
+	struct C{
 	
-	void gcMark();
-};
-
-class T{
-
-public:
-
-	T();
-	T( int x );
-	
-	~T();
-	
-	bool operator==( T *that );
-};
-
-void glue_E( C *c );
-
-#endif
+		int P;
+		
+		static int G;
+		
+		static const int T=0;
+		
+		void M(){}
+		
+		static void F(){}
+		
+		static inline void Update(){}
+		
+		struct D{
+		
+			static inline void F(){}
+		};
+	};
+
+}
+
+#endif

+ 27 - 51
tests/monkey/externs.monkey2

@@ -6,79 +6,55 @@ Namespace test
 
 Extern
 
-Global G:Float
+Enum E="test::E"
 
-Function F()
+	V1
+	V2
 
-Enum E
-	E1
-	E2
-	E3
 End
 
-'alternate way to do 'c-style' enums...
-Const E1:E="E::E1"
-Const E2:E="E::E2"
-Const E3:E="E::E3"
+Enum E2="test::E2::"
 
-Class C
+	V1
+	V2
 
-	Method New()
-	
-	Method New( d:D )
-	
-	Method E() Extension="glue_E"
-	
 End
 
-Class D Extends C
+Class C Extends Void="test::C"
 
-	Method New()
-	
-	Method M()
-	
-	Method M2:Void Ptr( str:CString )
+	Class D
+		Function F()
+	End
 	
-End
-
-Class T Extends Void
+	Field P:Int
 
-	Method New()
+	Global G:Int
 	
-	Method New( x:Int )
+	Const T:Int
 	
-	Operator=:Bool( t:T )="operator=="
-	
-	Function Destroy( t:T )="delete"
+	Method M()
 	
+	Function F()
 End
 
 Public
 
 Function Main()
 
-	Print Int( E.E1 )	'0
-	Print Int( E.E2 )	'1
-	Print Int( E.E3 )	'2
-
-	F()					'::F()
-
-	New C				'C::C()
-	New C( New D )		'C::C(), D::D(), C::C( D* )
-	New D				'C::C(), D::D()
+	Local c:=New C
 	
-	Local s:=String.FromCString( New D().M2( "Hello!" ) )	'C::C(), D::D()
-	Print s				'Goodbye!
-	
-	New T				'T::T()
-	New T( 10 )			'T::T( int )
-	
-	Local t:=New T		'T::T()
+	Local p:=c.P
+	Local g:=C.G
+	Local t:=C.T
+
+	c.M()
+	C.F()
+	C.D.F()
 	
-	If t=t Print "Yes"	'T::operator==(T*), "Yes"
+	Local v1:=E.V1
+	Local v2:=E.V2
 	
-	T.Destroy( t )		'T::~T()
+	Local t1:=E2.V1
+	Local t2:=E2.V2
 	
-	New C().E()			'C::C(), ::glue_E()
 End
-