diff test_pydertron.py @ 31:3897ed8a350d

Added NullFileSystem and test for it.
author Atul Varma <avarma@mozilla.com>
date Mon, 10 May 2010 01:54:59 -0700
parents
children e3fcfa2bf3bc
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test_pydertron.py	Mon May 10 01:54:59 2010 -0700
@@ -0,0 +1,18 @@
+import unittest
+from StringIO import StringIO
+
+import pydertron
+
+class PydertronTests(unittest.TestCase):
+    def testNullFilesystem(self):
+        stderr = StringIO()
+        sandbox = pydertron.JsSandbox(pydertron.NullFileSystem())
+        sandbox.set_globals()
+        sandbox.run_script("require('hi');", stderr=stderr)
+        self.assertEqual(stderr.getvalue(),
+                         'Traceback (most recent call last):\n'
+                         '  File "<string>", line 1, in <module>\n'
+                         'Module not found: hi\n')
+
+if __name__ == '__main__':
+    unittest.main()