Revision: 3687
          http://vexi.svn.sourceforge.net/vexi/?rev=3687&view=rev
Author:   mkpg2
Date:     2009-09-21 01:55:38 +0000 (Mon, 21 Sep 2009)

Log Message:
-----------
Feature. Prototype like behaviour via clones.
  - set properties on clones not clonee. get from clone or if key not present 
from clonee.
  - clone!=clonee

Modified Paths:
--------------
    trunk/core/buildcore/build_shared.ent
    trunk/core/org.ibex.js/src/org/ibex/js/Constants.java
    trunk/core/org.ibex.js/src/org/ibex/js/Fountain.java
    trunk/core/org.ibex.js/src/org/ibex/js/Interpreter.jpp
    trunk/core/org.ibex.js/src/org/ibex/js/JS.jpp
    trunk/core/org.ibex.js/src/org/ibex/js/JSArrayLike.java
    trunk/core/org.ibex.js/src/org/ibex/js/JSExn.jpp
    trunk/core/org.ibex.js/src/org/ibex/js/JSPojoWrapper.java
    trunk/core/org.ibex.js/src/org/ibex/js/JSU.jpp
    trunk/core/org.ibex.js/src/org/ibex/js/Parser.java
    trunk/core/org.ibex.js/src/org/ibex/js/Scheduler.java
    trunk/core/org.ibex.js/src_dev/org/ibex/js/RunJS.java
    trunk/core/org.ibex.js/src_junit/org/ibex/js/TestJSProxy.java
    trunk/core/org.ibex.js/src_junit/test/js/exec/JSTestCase.java
    
trunk/core/org.ibex.js/src_junit/test/js/exec/errors/java/TestJavaExceptions.java
    trunk/core/org.ibex.js/src_junit/test/js/exec/general/TestGeneral.java
    trunk/core/org.ibex.js/src_junit/test/js/exec/shared.js
    trunk/core/org.ibex.js/src_junit/test/js/exec/traps/override.js
    trunk/core/org.vexi.core/src/org/vexi/core/Resources.java

Added Paths:
-----------
    trunk/core/org.ibex.js/prep.xml
    trunk/core/org.ibex.js/src_junit/test/js/exec/errors/
    trunk/core/org.ibex.js/src_junit/test/js/exec/errors/java/
    trunk/core/org.ibex.js/src_junit/test/js/exec/general/clone.js
    trunk/core/org.vexi.core/prep.xml

Removed Paths:
-------------
    trunk/core/org.ibex.js/src_junit/test/js/exec/exceptions/java/
    trunk/core/org.vexi.core/src_junit/test/core/gut/cloneequals.t

Modified: trunk/core/buildcore/build_shared.ent
===================================================================
--- trunk/core/buildcore/build_shared.ent       2009-09-18 14:13:28 UTC (rev 
3686)
+++ trunk/core/buildcore/build_shared.ent       2009-09-21 01:55:38 UTC (rev 
3687)
@@ -7,10 +7,15 @@
     <description>
             Ant target/macro library for vexi core projects
     </description>
+       
        <!-- Default properties -->
        <import file="build_props.ent"/>
 
+       <import file="../build.vexi.common/build_common.ent"/>
+
+       
        <target name="build.init">
+               <tstamp/>
                <mkdir dir="${build_dir}"/>
                <mkdir dir="${jar_dir}"/>
                <mkdir dir="${srcjar_dir}"/>
@@ -18,8 +23,7 @@
        
        <target name="project.init" depends="build.init">
                <property name="src_version" value="1.3"/>              
-               
-               <tstamp/>
+
                <fail unless="proj_name"/>
                <property name="src_dir" location="src"/>
                <property name="compile_dir" 
location="${build_dir}/${proj_name}/class"/>
@@ -29,9 +33,9 @@
                <copy todir="${jar_dir}" flatten="true">
                        <fileset dir="." includes="lib/*.jar"/>
                </copy>
-       </target>
+       </target> 
        
-       <target name="project.preprocess" depends="project.init">
+       <target name="project.preprocess" >
        <Preprocess destdir="${generate_dir}" defines="${jpp.defines}">
                <fileset dir="src" includes="**/*.jpp"/>
        </Preprocess>
@@ -62,7 +66,7 @@
                        <fileset dir="${generate_dir}" includes="${resources}"/>
                </copy>
                
-    </target>
+    </target> 
        
        <target name="project.jar" depends="project.compile">
                <fail unless="build" message="please set the build property, so 
we don't create bastard jars"/>

Added: trunk/core/org.ibex.js/prep.xml
===================================================================
--- trunk/core/org.ibex.js/prep.xml                             (rev 0)
+++ trunk/core/org.ibex.js/prep.xml     2009-09-21 01:55:38 UTC (rev 3687)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!-- ====================================================================== 
+     Jun 3, 2006 8:33:15 PM                                                    
    
+     mike                                                                
+     ====================================================================== -->
+<project default="src_gen">
+       <import file="build.xml"/>
+</project>
+


Property changes on: trunk/core/org.ibex.js/prep.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/core/org.ibex.js/src/org/ibex/js/Constants.java
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/Constants.java       2009-09-18 
14:13:28 UTC (rev 3686)
+++ trunk/core/org.ibex.js/src/org/ibex/js/Constants.java       2009-09-21 
01:55:38 UTC (rev 3687)
@@ -32,9 +32,10 @@
        static final JS SC_null = JSU.S("null",true);
        static final JS SC_number = JSU.S("number",true);
        static final JS SC_object = JSU.S("object",true);
-       static final JS SC_remote = JSU.S("remote",true);
+       static final JS SC_parse = JSU.S("parse",true);
        static final JS SC_progress = JSU.S("progress",true);
        static final JS SC_Properties = JSU.S("Properties",true);
+       static final JS SC_remote = JSU.S("remote",true);
        static final JS SC_some = JSU.S("some",true);
        static final JS SC_start = JSU.S("start",true);
        static final JS SC_stream = JSU.S("stream",true);

Modified: trunk/core/org.ibex.js/src/org/ibex/js/Fountain.java
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/Fountain.java        2009-09-18 
14:13:28 UTC (rev 3686)
+++ trunk/core/org.ibex.js/src/org/ibex/js/Fountain.java        2009-09-21 
01:55:38 UTC (rev 3687)
@@ -685,7 +685,7 @@
        try {
                        final Set s = getKeySet();
                return new Keys(this){
-                       public JS contains(JS key){return 
JSU.B(s.contains(JSU.toString(key)));}
+                       public boolean contains(JS key){ return 
s.contains(JSU.toString(key)); }
                        public Enumeration iterator() throws JSExn{
                                return new Enumeration(null) {
                            private Iterator I = s.iterator(); 

Modified: trunk/core/org.ibex.js/src/org/ibex/js/Interpreter.jpp
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/Interpreter.jpp      2009-09-18 
14:13:28 UTC (rev 3686)
+++ trunk/core/org.ibex.js/src/org/ibex/js/Interpreter.jpp      2009-09-21 
01:55:38 UTC (rev 3687)
@@ -372,12 +372,6 @@
                 JS.Trap t = target.getTrap(key);
                 if(t != null) t = t.findWrite();
                 
-                if(t == null && target instanceof JS.Clone) {
-                    target = ((JS.Clone)target).clonee;
-                    t = target.getTrap(key);
-                    if(t != null) t = t.nextWrite();
-                }
-
                 stack.push(val);
                 
                 if(t != null) {
@@ -426,7 +420,7 @@
                                pc--; // we increment later
                                break;
                        }
-                       // Trap was an overide. Simply return the value. 
+                       // Trap was an override. Simply return the value. 
                        ret = f;
                 }
                 if(ret==null) ret = target.get(key);
@@ -635,12 +629,8 @@
                     boolean ret;
                     if(left == null && right == null) ret = true;
                     else if(left == null || right == null) ret = false;
-                    // optimise
                     else if(left == right) ret = true; // optimisation
-                    else if(left instanceof JSPrimitive || right instanceof 
JSPrimitive)
-                       ret = left.equals(right);
-                    // /optimise
-                    else ret = JSU.unclone(left).equals(JSU.unclone(right));
+                    else ret = left.equals(right);
                     stack.push(JSU.B(op == EQ ? ret : !ret)); break;
                 }
 

Modified: trunk/core/org.ibex.js/src/org/ibex/js/JS.jpp
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/JS.jpp       2009-09-18 14:13:28 UTC 
(rev 3686)
+++ trunk/core/org.ibex.js/src/org/ibex/js/JS.jpp       2009-09-21 01:55:38 UTC 
(rev 3687)
@@ -357,12 +357,17 @@
         }
         // Non-Trap methods forward to the clonee 
         public JS unclone() { return clonee.unclone(); }
-        public Keys keys() throws JSExn { return clonee.keys(); }
+        public Keys keys() throws JSExn { return keys(); }
         public JS callMethod(JS this_, JS method, JS[] args) throws JSExn {
             return clonee.callMethod(this_, method, args);
         }
-        public JS get(JS k) throws JSExn { return clonee.get(k); }
-        public void put(JS k, JS v) throws JSExn { clonee.put(k, v); }
+        public JS get(JS k) throws JSExn { 
+               if(hasKey(k)) return super.get(k);
+               return clonee.get(k); 
+        }
+        public void put(JS k, JS v) throws JSExn { 
+               super.put(k, v); 
+        }
         public String[] getFormalArgs() { return clonee.getFormalArgs(); }
         public int callType() { return clonee.callType(); }
         public String coerceToString() { return clonee.coerceToString(); }
@@ -373,6 +378,10 @@
             Trap t = super.getTrap(key);
             return t!=null ? t : clonee.getTrap(key);
         }
+        public boolean instanceOf(JS type) {
+               if(super.instanceOf(type)) return true;
+               return clonee.instanceOf(type);
+        }
     }
 
     static public class ConstructorList {
@@ -459,12 +468,13 @@
         }
 
         public boolean instanceOf(JS constructor) {
+               // HACK sort this out. Type system based on constructors not 
finalised yet
             for (ConstructorList cl=constructors; cl!=null; cl=cl.next) {
                 if (cl.value==constructor) {
                     return true;
                 }
             }
-            return false;
+            return constructor==this;
         }
         public void addConstructor(JS c) {
             constructors = new ConstructorList(c,constructors);
@@ -490,6 +500,9 @@
                     Obj.this.remove(key);
                     return r;
                 }
+                public boolean contains(JS key) throws JSExn {
+                       return Obj.this.hasKey(key);
+                }
                 public int size() throws JSExn { return Obj.this.size(); }
             };
         }
@@ -497,7 +510,6 @@
         
         /** Fetches any value stored against the given key. */
         public JS get(JS key) throws JSExn {
-            //#noswitch - leave, needed for jsdoc
             /*...@page(varname=Object,humanname=JS Object)
              * 
              * <p>The standard js object.</p>
@@ -511,7 +523,6 @@
              * properties, and so have a completely free keyspace.</p>
              *  
              * */
-            //#end
             return getSafe(key); 
         }
         final public JS getSafe(JS key) { // workaround, avoid JSExn in 
signature
@@ -533,6 +544,13 @@
             props.put(key, value);
         }
 
+        protected boolean hasKey(JS key) {
+               // SHOULD decide, do trapped properties have keys? Perhaps 
needs some
+               // mechanism, e.g. setting a property on the trap function.
+            if (props==null) return false;
+            return props.containsKey(key);
+        }
+        
         /** Removes a key and any value associated with it. */
         private void remove(JS key) {
             if (props==null) return;
@@ -704,11 +722,11 @@
 
         /** Places the given function as a trap on the given key, first 
validating the function. */
         public void addTrap(JS key, JS f) throws JSExn {
+               TrapHolder.validateFunction(f);
             if (!SC_Properties.equals(key)) {
                 super.addTrap(key, f);
                 return;
             }
-            TrapHolder.validateFunction(f);
             // ensure a trap is only be applied once to an object
             for (Trap t=propertiesTrap; t != null; t = t.next()) {
                 // REMARK: we are only interested in this JS object
@@ -892,11 +910,11 @@
         
         /** Places the given function as a trap on the given key, first 
validating the function. */
         public void addTrap(JS key, JS f) throws JSExn {
+               TrapHolder.validateFunction(f);
             if (!SC_Elements.equals(key)) {
                 super.addTrap(key, f);
                 return;
             }
-            TrapHolder.validateFunction(f);
             // ensure a trap is only be applied once to an object
             for (Trap t=elementsTrap; t != null; t = t.next()) {
                 // REMARK: we are only interested in this JS object
@@ -977,7 +995,9 @@
 
         /** throws an exception if JS f does not represent a valid trap 
function */
         static final void validateFunction(JS f) throws JSExn {
-            if (f instanceof JSFunction && !((JSFunction)f).validTrap) {
+//            if (! (f instanceof JSFunction))
+//             throw new JSExn("Trap must be a function");
+               if ((f instanceof JSFunction) && !((JSFunction)f).validTrap) {
                 // So we only see the error once
                 ((JSFunction)f).validTrap = true;
                 Scheduler.findCurrent().logger.warn(JS.class,"Trap function 
has no explicit cascade/return, defined at " + ((JSFunction)f).definedAt());
@@ -993,7 +1013,7 @@
     static abstract public class Keys extends Immutable {
         JS keysof;
         public Keys(JS keysof) { this.keysof = keysof; }
-        public JS contains(JS key) throws JSExn { throw new JSExn("Cannot call 
contains on keysof "  + name()); }
+        public boolean contains(JS key) throws JSExn { throw new JSExn("Cannot 
call contains on keysof "  + name()); }
         public Enumeration iterator() throws JSExn {throw new JSExn("Cannot 
iterate over "  + name()); }
         private JS size_() throws JSExn { return JSU.N(size()); }
         protected JS remove(JS key) throws JSExn { throw new JSExn("Cannot 
remove key from " + name()); }
@@ -1021,7 +1041,7 @@
         
         public JS callMethod(JS this_, JS method, JS[] args) throws JSExn {
             //#switch(JSU.toString(method))
-            case "contains": return contains(args[0]); 
+            case "contains": return JSU.B(contains(args[0])); 
             case "iterator": return iterator(); 
             case "remove": return remove(args[0]);
             case "toArray": return toArray();

Modified: trunk/core/org.ibex.js/src/org/ibex/js/JSArrayLike.java
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/JSArrayLike.java     2009-09-18 
14:13:28 UTC (rev 3686)
+++ trunk/core/org.ibex.js/src/org/ibex/js/JSArrayLike.java     2009-09-21 
01:55:38 UTC (rev 3687)
@@ -10,8 +10,8 @@
                super(obj);
                this.keysof = obj;
        }
-               public JS contains(JS key) throws JSExn {
-                       return JSU.B(JSU.isInt(key) && (JSU.toInt(key)< 
keysof.length()));
+               public boolean hasKey(JS key) throws JSExn {
+                       return JSU.isInt(key) && (JSU.toInt(key)< 
keysof.length());
                }
                public Enumeration iterator() throws JSExn {
                        return new Enumeration(null) {

Modified: trunk/core/org.ibex.js/src/org/ibex/js/JSExn.jpp
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/JSExn.jpp    2009-09-18 14:13:28 UTC 
(rev 3686)
+++ trunk/core/org.ibex.js/src/org/ibex/js/JSExn.jpp    2009-09-21 01:55:38 UTC 
(rev 3687)
@@ -33,12 +33,13 @@
        this(msg, SC_error, e);
     }
         
-    
+     
     public JSExn(String msg, JS type, Throwable e) {
        super(e);
        this.js = new ExnJSObj(JSU.S(msg), type); 
        fill(null);
     }
+    public JSExn(String msg, JS type){ this(JSU.S(msg), type); }
     public JSExn(String s) { this(JSU.S(s)); }
     public JSExn(JS msg) { this(msg,null); }
     public JSExn(JS msg, JS type) { this(msg,type,null); }
@@ -63,7 +64,7 @@
     public void printStackTrace() { printStackTrace(System.err); }
     public void printStackTrace(PrintStream ps) { printStackTrace(new 
PrintWriter(ps)); }
     public void printStackTrace(PrintWriter pw) { 
-       printStackTrace(pw, Logger.DEBUG); 
+       printStackTrace(pw, Logger.INFO); 
     }    
     public void printStackTrace(int level, Logger logger, Object o){
        if(level>=logger.getLevel()){

Modified: trunk/core/org.ibex.js/src/org/ibex/js/JSPojoWrapper.java
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/JSPojoWrapper.java   2009-09-18 
14:13:28 UTC (rev 3686)
+++ trunk/core/org.ibex.js/src/org/ibex/js/JSPojoWrapper.java   2009-09-21 
01:55:38 UTC (rev 3687)
@@ -17,8 +17,8 @@
     final Set keySet;
     
     final Keys keysObj = new Keys(this){
-       public JS contains(JS key) throws JSExn {
-               return JSU.B(keySet.contains(key));
+       public boolean contains(JS key) throws JSExn {
+               return keySet.contains(key);
        }
     };
     final static private String makeKey(int args, String method){

Modified: trunk/core/org.ibex.js/src/org/ibex/js/JSU.jpp
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/JSU.jpp      2009-09-18 14:13:28 UTC 
(rev 3686)
+++ trunk/core/org.ibex.js/src/org/ibex/js/JSU.jpp      2009-09-21 01:55:38 UTC 
(rev 3687)
@@ -66,7 +66,7 @@
     static public JSExn handleFountainExn(IOException e) {
        if(e instanceof HTTPErrorResponse) {
                HTTPErrorResponse he = (HTTPErrorResponse)e;
-               JSExn je = new JSExn(JSU.S(e.getMessage()),SC_http);
+               JSExn je = new JSExn(e.getMessage(),SC_http);
                Fountain.ByteArray stream = new Fountain.ByteArray(he.bytes);
                JS.Obj jeObj = je.getObject();
                jeObj.putSafe(SC_code,JSU.S(he.code));
@@ -78,7 +78,7 @@
                jeObj.putSafe(SC_mimetype, JSU.S(mimetype));
                return je;
        }
-       return new JSExn(e.getMessage());
+       return new JSExn(e.getMessage(),e);
     }
 
     /** Coerce a JS object into a boolean. */

Modified: trunk/core/org.ibex.js/src/org/ibex/js/Parser.java
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/Parser.java  2009-09-18 14:13:28 UTC 
(rev 3686)
+++ trunk/core/org.ibex.js/src/org/ibex/js/Parser.java  2009-09-21 01:55:38 UTC 
(rev 3687)
@@ -278,7 +278,7 @@
     // Parsing Logic /////////////////////////////////////////////////////////
     
     /** parse and compile a function */
-    public static JSFunction fromReader(String sourceName, int firstLine, 
Reader sourceCode, GlobalsChecker param) throws JSExn {
+    static public JSFunction fromReader(String sourceName, int firstLine, 
Reader sourceCode, GlobalsChecker param) throws JSExn {
        try{
                if (sourceCode == null) return new JSFunction(sourceName, 
firstLine, null);
                Parser p = new Parser(sourceCode, sourceName, firstLine, param);
@@ -286,12 +286,12 @@
        } catch(SourceException e) {
                // FEATURE create JSExn constructor that takes a 
SourceException -
                // and so pass on more information as exception properties.
-               throw new JSExn("Could not parse script, " + sourceName + ":" + 
firstLine+"\n"+e.getMessageSig()+ " " + e.getWhere()+ e.getMessage(), 
JSU.S("parse"), e);
+               throw new JSExn("Could not parse script, " + sourceName + ":" + 
firstLine+"\n"+e.getMessageSig()+ " " + e.getWhere()+" "+e.getMessage(), 
SC_parse);
        } catch (Exception e) {
                throw new JSExn("Unexpected error parsing " + sourceName + ":" 
+ firstLine, e);
        }
     }
-    
+
     public JSFunction parseScript(Scope scope) throws IOException{
        JSFunction ret = new JSFunction(sourceName, line, scope);
         scopeStack.clear();

Modified: trunk/core/org.ibex.js/src/org/ibex/js/Scheduler.java
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/Scheduler.java       2009-09-18 
14:13:28 UTC (rev 3686)
+++ trunk/core/org.ibex.js/src/org/ibex/js/Scheduler.java       2009-09-21 
01:55:38 UTC (rev 3687)
@@ -124,6 +124,7 @@
                 // if an Error is thrown it will cause the engine to quit
             }
         } finally {
+               scheduleWakeUp.interrupt();
             threadlocal.set(null);
         }
     }
@@ -440,7 +441,7 @@
 
     /** encapsulates a sleeper thread and its desired wakeup time in 
milliseconds
      * @author Charles Goodwin */
-    final private static class SleeperCallback {
+    static final private class SleeperCallback {
         final long wakeupms;
         final Callable callback;
         public SleeperCallback(int afterms, Callable callback) {

Modified: trunk/core/org.ibex.js/src_dev/org/ibex/js/RunJS.java
===================================================================
--- trunk/core/org.ibex.js/src_dev/org/ibex/js/RunJS.java       2009-09-18 
14:13:28 UTC (rev 3686)
+++ trunk/core/org.ibex.js/src_dev/org/ibex/js/RunJS.java       2009-09-21 
01:55:38 UTC (rev 3687)
@@ -82,16 +82,16 @@
        }
        
        
-       Fountain getFountainForFile(String fileName) throws JSExn, IOException{
+       Fountain getFountainForFile(String fileName) throws IOException, JSExn{
                Fountain r = (Fountain) jspath.get(JSU.S(fileName));
                if(r==null) return null;
                return r;
        }
        
-       public Reader getReaderForFile(String filename) throws JSExn, 
IOException{
+       public Reader getReaderForFile(String filename) throws IOException, 
JSExn{
                InputStream is = getFountainForFile(filename).getInputStream();
                if(is==null)
-                       throw new JSExn("Could not find file in path: " +  
filename);
+                       throw new IOException("Could not find file in path: " + 
 filename);
                InputStreamReader isr = new InputStreamReader(is);
                return isr;
        }

Modified: trunk/core/org.ibex.js/src_junit/org/ibex/js/TestJSProxy.java
===================================================================
--- trunk/core/org.ibex.js/src_junit/org/ibex/js/TestJSProxy.java       
2009-09-18 14:13:28 UTC (rev 3686)
+++ trunk/core/org.ibex.js/src_junit/org/ibex/js/TestJSProxy.java       
2009-09-21 01:55:38 UTC (rev 3687)
@@ -78,9 +78,9 @@
        
        public void testKeys() throws Exception {
                JSPojoWrapper js = new 
JSPojoWrapper("proxee",Interfase.class,new Proxee());
-        assertEquals(JSU.T,js.keys().contains(JSU.S("add")));
-        assertEquals(JSU.T,js.keys().contains(JSU.S("minus")));
-        assertEquals(JSU.F,js.keys().contains(JSU.S("asd")));
+        assertTrue(js.keys().contains(JSU.S("add")));
+        assertTrue(js.keys().contains(JSU.S("minus")));
+        assertFalse(js.keys().contains(JSU.S("asd")));
        }
        
        public static void main(String[] args) throws Exception {

Modified: trunk/core/org.ibex.js/src_junit/test/js/exec/JSTestCase.java
===================================================================
--- trunk/core/org.ibex.js/src_junit/test/js/exec/JSTestCase.java       
2009-09-18 14:13:28 UTC (rev 3686)
+++ trunk/core/org.ibex.js/src_junit/test/js/exec/JSTestCase.java       
2009-09-21 01:55:38 UTC (rev 3687)
@@ -39,7 +39,7 @@
                }
        }
        
-       public void printByteCode() throws Exception{
+       public void printByteCode() throws IOException, JSExn {
                Reader r = new RunJS(jspath).getReaderForFile(main);
                JSFunction f = Parser.fromReader(main,1,r,null);
                System.err.println(f.dump());

Modified: 
trunk/core/org.ibex.js/src_junit/test/js/exec/errors/java/TestJavaExceptions.java
===================================================================
--- 
trunk/core/org.ibex.js/src_junit/test/js/exec/exceptions/java/TestJavaExceptions.java
       2009-09-10 00:14:49 UTC (rev 3664)
+++ 
trunk/core/org.ibex.js/src_junit/test/js/exec/errors/java/TestJavaExceptions.java
   2009-09-21 01:55:38 UTC (rev 3687)
@@ -1,4 +1,4 @@
-package test.js.exec.exceptions.java;
+package test.js.exec.errors.java;
 
 import junit.framework.*;
 
@@ -7,7 +7,9 @@
 import test.js.exec.*;
 
 /**
- * @author mike
+ * A JS error is generally an unhandled java exception reaching
+ * user space.
+ * 
  */
 public class TestJavaExceptions extends JSTestSuite{
 

Modified: trunk/core/org.ibex.js/src_junit/test/js/exec/general/TestGeneral.java
===================================================================
--- trunk/core/org.ibex.js/src_junit/test/js/exec/general/TestGeneral.java      
2009-09-18 14:13:28 UTC (rev 3686)
+++ trunk/core/org.ibex.js/src_junit/test/js/exec/general/TestGeneral.java      
2009-09-21 01:55:38 UTC (rev 3687)
@@ -13,9 +13,13 @@
     }
     
     public static void main(String[] args) throws Throwable {
-       JSTestSuite jts = new JSTestSuite(TestGeneral.class);
-       JSTestCase t = jts.createTestCase(jts.getResourceDirs(), "forin2.js");
-       t.printByteCode();
-       t.runBare();
+       try{
+               JSTestSuite jts = new JSTestSuite(TestGeneral.class);
+               JSTestCase t = jts.createTestCase(jts.getResourceDirs(), 
"clone.js");
+               //t.printByteCode();
+               t.runBare();
+       }catch(Throwable t){
+               t.printStackTrace();
+       }       
     }
 }

Added: trunk/core/org.ibex.js/src_junit/test/js/exec/general/clone.js
===================================================================
--- trunk/core/org.ibex.js/src_junit/test/js/exec/general/clone.js              
                (rev 0)
+++ trunk/core/org.ibex.js/src_junit/test/js/exec/general/clone.js      
2009-09-21 01:55:38 UTC (rev 3687)
@@ -0,0 +1,27 @@
+
+
+
+var sword = { 
+    damage: 4 , 
+    image: "sword.png", 
+    attack: "swing"
+};
+
+var charm = function(o){
+       var r = sys.clone(o);
+       r.damage = o.damage+2;
+       r.attack ++= function(){
+               return "sparkle,"+cascade; 
+       };
+       return r;
+};
+
+var magicsword = charm(sword);
+assert(magicsword!=sword);
+assert(magicsword instanceof sword);
+
+assert(6==magicsword.damage);
+assert("sparkle,swing"==magicsword.attack);
+
+assert(4==sword.damage);
+assert("swing"==sword.attack);
\ No newline at end of file

Modified: trunk/core/org.ibex.js/src_junit/test/js/exec/shared.js
===================================================================
--- trunk/core/org.ibex.js/src_junit/test/js/exec/shared.js     2009-09-18 
14:13:28 UTC (rev 3686)
+++ trunk/core/org.ibex.js/src_junit/test/js/exec/shared.js     2009-09-21 
01:55:38 UTC (rev 3687)
@@ -56,3 +56,13 @@
        };
        return r;
 };     
+
+export.assertThrowsExn = function(f){
+       try{
+               f();
+       }catch(e){
+               return;
+       }
+       throw "Expected exception";
+       
+};

Modified: trunk/core/org.ibex.js/src_junit/test/js/exec/traps/override.js
===================================================================
--- trunk/core/org.ibex.js/src_junit/test/js/exec/traps/override.js     
2009-09-18 14:13:28 UTC (rev 3686)
+++ trunk/core/org.ibex.js/src_junit/test/js/exec/traps/override.js     
2009-09-21 01:55:38 UTC (rev 3687)
@@ -3,8 +3,5 @@
 var x = {};
 x.a = 1;
 assert(x.a==1);
-sys.log.info("here");
 x.a ++= 8;
-sys.log.info("here");
-assert(x.a==8);
-sys.log.info("here");
+assert(x.a==8);
\ No newline at end of file

Added: trunk/core/org.vexi.core/prep.xml
===================================================================
--- trunk/core/org.vexi.core/prep.xml                           (rev 0)
+++ trunk/core/org.vexi.core/prep.xml   2009-09-21 01:55:38 UTC (rev 3687)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!-- ====================================================================== 
+     Jun 4, 2006
+     mike                                                                
+     ====================================================================== -->
+<project name="org.vexi.core" default="src_gen">
+       <import file="build.xml"/>
+</project>
+


Property changes on: trunk/core/org.vexi.core/prep.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/core/org.vexi.core/src/org/vexi/core/Resources.java
===================================================================
--- trunk/core/org.vexi.core/src/org/vexi/core/Resources.java   2009-09-18 
14:13:28 UTC (rev 3686)
+++ trunk/core/org.vexi.core/src/org/vexi/core/Resources.java   2009-09-21 
01:55:38 UTC (rev 3687)
@@ -415,8 +415,8 @@
                }
                public Keys keys() throws JSExn {
                        return new Keys(installedFonts){
-                               public JS contains(JS key) throws JSExn {
-                                       return 
JSU.B(installedFonts.get(key)!=null);
+                               public boolean contains(JS key) throws JSExn {
+                                       return installedFonts.get(key)!=null;
                                }
                                public Enumeration iterator() throws JSExn {
                                        return new Enumeration(null) {

Deleted: trunk/core/org.vexi.core/src_junit/test/core/gut/cloneequals.t
===================================================================
--- trunk/core/org.vexi.core/src_junit/test/core/gut/cloneequals.t      
2009-09-18 14:13:28 UTC (rev 3686)
+++ trunk/core/org.vexi.core/src_junit/test/core/gut/cloneequals.t      
2009-09-21 01:55:38 UTC (rev 3687)
@@ -1,13 +0,0 @@
-<vexi xmlns:ui="vexi://ui" xmlns="">
-
-       
-    <ui:box>
-        var obj = {};
-        var clone = vexi.clone(obj);
-        
-        assert(clone==obj);
-        assert(obj==clone);
-        
-        
-    </ui:box>
-</vexi>


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to