<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/modules/assert.js</filename>
    </added>
    <added>
      <filename>test/modules/jsunit.js</filename>
    </added>
    <added>
      <filename>test/modules/jsunit_sample.js</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -49,6 +49,7 @@ class Test(unittest.TestCase):
 
     #---------------------------------------------------------------
     def test_simple(self):
+        log(&quot;$f&quot;)
         baseName = &quot;simple&quot;
 
         ofilename1 = &quot;__test__%s__1__.js&quot; % baseName
@@ -71,12 +72,13 @@ result = mod.a
             dump_exception(e, ctx)
             self.assertTrue(False)
 
-        self.assertTrue(11, val)
+        self.assertEquals(11, val)
 
         os.remove(ofilename1)        
         
     #---------------------------------------------------------------
     def test_simple2(self):
+        log(&quot;$f&quot;)
         baseName = &quot;simple2&quot;
 
         ofilename1 = &quot;__test__%s__1__.js&quot; % baseName
@@ -106,28 +108,29 @@ result = mod.b
             dump_exception(e, ctx)
             self.assertTrue(False)
 
-        self.assertTrue(22, val)
+        self.assertEquals(22, val)
 
         os.remove(ofilename1)        
         os.remove(ofilename2)        
 
     #---------------------------------------------------------------
     def test_recurse(self):
+        log(&quot;$f&quot;)
         baseName = &quot;recurse&quot;
 
         ofilename1 = &quot;__test__%s__1__.js&quot; % baseName
         ofilename2 = &quot;__test__%s__2__.js&quot; % baseName
 
         ofile = open(ofilename1,&quot;w&quot;)
-        ofile.write(&quot;other = require('%s')\n&quot; % ofilename2)
         ofile.write(&quot;exports.a = 11\n&quot;)
+        ofile.write(&quot;other = require('%s')\n&quot; % ofilename2)
         ofile.write(&quot;exports.b = other.b\n&quot;)
         ofile.close()
 
         ofile = open(ofilename2,&quot;w&quot;)
+        ofile.write(&quot;exports.b = 22\n&quot;)
         ofile.write(&quot;other = require('%s')\n&quot; % ofilename1)
         ofile.write(&quot;exports.a = other.a\n&quot;)
-        ofile.write(&quot;exports.b = 22\n&quot;)
         ofile.close()
 
         ctx = self.ctx
@@ -145,31 +148,34 @@ result = [mod1.a, mod1.b, mod2.a, mod2.b]
             dump_exception(e, ctx)
             self.assertTrue(False)
 
-        self.assertTrue(11, val.getPropertyAtIndex(ctx,0).toNumber(ctx))
-        self.assertTrue(22, val.getPropertyAtIndex(ctx,1).toNumber(ctx))
-        self.assertTrue(11, val.getPropertyAtIndex(ctx,2).toNumber(ctx))
-        self.assertTrue(22, val.getPropertyAtIndex(ctx,3).toNumber(ctx))
+        mod2a = val.getPropertyAtIndex(ctx,2)
+        
+        self.assertEquals(11, val.getPropertyAtIndex(ctx,0).toNumber(ctx))
+        self.assertEquals(22, val.getPropertyAtIndex(ctx,1).toNumber(ctx))
+        self.assertEquals(11, val.getPropertyAtIndex(ctx,2).toNumber(ctx))
+        self.assertEquals(22, val.getPropertyAtIndex(ctx,3).toNumber(ctx))
 
         os.remove(ofilename1)        
         os.remove(ofilename2)        
 
     #---------------------------------------------------------------
     def test_recurse_change(self):
+        log(&quot;$f&quot;)
         baseName = &quot;recurse_change&quot;
 
         ofilename1 = &quot;__test__%s__1__.js&quot; % baseName
         ofilename2 = &quot;__test__%s__2__.js&quot; % baseName
 
         ofile = open(ofilename1,&quot;w&quot;)
+        ofile.write(&quot;exports.a = [11]\n&quot;)
         ofile.write(&quot;other = require('%s')\n&quot; % ofilename2)
-        ofile.write(&quot;exports.a = 1\n&quot;)
         ofile.write(&quot;exports.b = other.b\n&quot;)
         ofile.close()
 
         ofile = open(ofilename2,&quot;w&quot;)
+        ofile.write(&quot;exports.b = [22]\n&quot;)
         ofile.write(&quot;other = require('%s')\n&quot; % ofilename1)
         ofile.write(&quot;exports.a = other.a\n&quot;)
-        ofile.write(&quot;exports.b = 2\n&quot;)
         ofile.close()
 
         ctx = self.ctx
@@ -178,8 +184,8 @@ result = [mod1.a, mod1.b, mod2.a, mod2.b]
         script = &quot;&quot;&quot;
 mod1 = require('%s')
 mod2 = require('%s')
-mod1.a = 33
-result = mod2.a
+mod1.a[0] = 33
+result = mod2.a[0]
 &quot;&quot;&quot; % (ofilename1, ofilename2)
 
         try:
@@ -188,12 +194,46 @@ result = mod2.a
             dump_exception(e, ctx)
             self.assertTrue(False)
 
-        self.assertTrue(33, val.toNumber(ctx))
+        self.assertEquals(33, val.toNumber(ctx))
 
         os.remove(ofilename1)        
         os.remove(ofilename2)        
 
+    #---------------------------------------------------------------
+    def test_no_leakage(self):
+        log(&quot;$f&quot;)
+        baseName = &quot;no_leakage&quot;
+
+        ofilename1 = &quot;__test__%s__1__.js&quot; % baseName
+
+        ofile = open(ofilename1,&quot;w&quot;)
+        ofile.write(&quot;exports.a   = 11;&quot;)
+        ofile.write(&quot;global_var  = 33;&quot;)
+        ofile.write(&quot;var var_var = 55;&quot;)
+        ofile.close()
+
+        ctx = self.ctx
+        ctx.addBuiltins()
+
+        script = &quot;&quot;&quot;
+mod = require('%s');
+result = [this.global_var, this.var_var]
+&quot;&quot;&quot; % (ofilename1)
+
+        try:
+            val = ctx.eval(script, None, &quot;test_%s&quot; % baseName).asJSObjectRef(ctx)
+        except JSException, e:
+            dump_exception(e, ctx)
+            self.assertTrue(False)
+
+        self.assertTrue(val.getPropertyAtIndex(ctx,0).isUndefined(ctx))
+        self.assertTrue(val.getPropertyAtIndex(ctx,1).isUndefined(ctx))
+
+        os.remove(ofilename1)        
+
 #-------------------------------------------------------------------
 if __name__ == '__main__':
+    NitroLogging(not True)
+    logging(not True)
     unittest.main()
 </diff>
      <filename>test/test_require.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>489b4237b05d80013cddfbca8957c6116a4f4f82</id>
    </parent>
  </parents>
  <author>
    <name>Patrick Mueller</name>
    <email>pmuellr@yahoo.com</email>
  </author>
  <url>http://github.com/pmuellr/nitro_pie/commit/6088d71d4eda02c30c663fdc323d2fd34a9eef7d</url>
  <id>6088d71d4eda02c30c663fdc323d2fd34a9eef7d</id>
  <committed-date>2009-05-15T09:59:17-07:00</committed-date>
  <authored-date>2009-05-15T09:59:17-07:00</authored-date>
  <message>wops; my require() tests weren't testing the right thing, now they are, and fixed some bugs</message>
  <tree>89f8fdb38566a1c4f0c18e568f6ae1b9a8f03bc7</tree>
  <committer>
    <name>Patrick Mueller</name>
    <email>pmuellr@yahoo.com</email>
  </committer>
</commit>
