rev 543 - in trunk: . pr/test src

SVN User <[email protected]> Mon, 24 May 2004 17:23:57 -0400
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: mark
Date: 2004-05-24 17:23:55 -0400 (Mon, 24 May 2004)
New Revision: 543

Added:
   trunk/pr/test/adict.pr
Modified:
   trunk/STATUS.txt
   trunk/pr/test/test.pr
   trunk/src/builtins-core.c
Log:
changed protoList to protoChain

Modified: trunk/STATUS.txt
===================================================================
--- trunk/STATUS.txt	2004-05-24 20:44:53 UTC (rev 542)
+++ trunk/STATUS.txt	2004-05-24 21:23:55 UTC (rev 543)
@@ -3,7 +3,7 @@
 
 --- allow strings to compare with symbols
 
---- Add properties methods: get_,  set_, delete_, rename protoList
+--- Add properties methods: get_,  set_, delete_, rename protoChain
 
 --- Add attrs_ & protos_ functionality.
 

Added: trunk/pr/test/adict.pr
===================================================================
--- trunk/pr/test/adict.pr	2004-05-24 20:44:53 UTC (rev 542)
+++ trunk/pr/test/adict.pr	2004-05-24 21:23:55 UTC (rev 543)
@@ -0,0 +1,24 @@
+#!/usr/bin/env prothon
+
+def err(n):
+	print "failure number",n
+	Sys.exit(1)
+
+x = 1
+if Len(x.attrs_) != 0: err(0)
+x.attrs_ = {`a:1, `b:2}
+if x.a != 1 or x.b != 2: err(1)
+x.c = 3
+if x.attrs_[`c] != 3: err(2)
+if x.attrs_['c'] != 3: err(3)
+if Len(x.attrs_) != 3: err(4)
+del x.attrs_['c']
+del x.attrs_[`b]
+if Len(x.attrs_) != 1: err(5)
+if x.attrs_.str_() != "{`a:1}": err(6)
+x.attrs_[`b] = 22
+if x.b != 22: err(7)
+
+print """
+all tests passed
+"""
Modified: trunk/pr/test/test.pr
===================================================================
--- trunk/pr/test/test.pr	2004-05-24 20:44:53 UTC (rev 542)
+++ trunk/pr/test/test.pr	2004-05-24 21:23:55 UTC (rev 543)
@@ -1,8 +1,16 @@
 #!/usr/bin/env prothon
 
-x = 1
+object X:
+    def call_():
+        if self.call_ is super.call_:
+            print "Error: self.call_ is super.call_"
+            Sys.exit(1)
+        return super.call_()
 
-x.attrs_ = {`a:1, `b:2}
-print x.attrs_, x.a, x.b
-x.attrs_.clear!()
-print x.attrs_
+Y = X()
+X()
+Y()
+    
+print """
+test passed
+"""

Modified: trunk/src/builtins-core.c
===================================================================
--- trunk/src/builtins-core.c	2004-05-24 20:44:53 UTC (rev 542)
+++ trunk/src/builtins-core.c	2004-05-24 21:23:55 UTC (rev 543)
@@ -268,7 +268,7 @@
 	return NULL;
 }
 
-DEF(Object, protoList, NULL) {
+DEF(Object, protoChain, NULL) {
 	return proto_list(ist, self);
 }
 
@@ -821,7 +821,7 @@
 	MODULE_ADD_SYM(Object, hasProto_QUES);
 	MODULE_ADD_SYM(Object, setProto);
 	MODULE_ADD_SYM(Object, addProto);
-	MODULE_ADD_SYM(Object, protoList);
+	MODULE_ADD_SYM(Object, protoChain);
 	MODULE_ADD_SYM(Object, Cmp);
 	MODULE_ADD_SYM(Object, Len);
 	MODULE_ADD_SYM(Object, Max);