moz-test-fixes.patch.txt   [plain text]


Index: ChangeLog
===================================================================
RCS file: /local/home/cvs/Labyrinth/JavaScriptCore/ChangeLog,v
retrieving revision 1.245
diff -u -p -r1.245 ChangeLog
--- ChangeLog	2003/01/13 18:27:27	1.245
+++ ChangeLog	2003/01/14 02:46:47
@@ -1,3 +1,15 @@
+2003-01-13  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by LUCKY WINNER.
+
+	- made minor tweaks to work better with Mozilla's JavaScript tests.
+
+        * kjs/testkjs.cpp:
+        (VersionFunctionImp::call): Implemented 
+        (main): Ignore files named -f (hack to match -f <filename syntax
+	that moz JavaScript tests expect). Also use return code 3 instead
+	of 1 for uncaught exception.
+
 2003-01-13  Darin Adler  <darin@apple.com>
 
         * kjs/ustring.h: Fix spelling of occurrence.
Index: kjs/testkjs.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/JavaScriptCore/kjs/testkjs.cpp,v
retrieving revision 1.6
diff -u -p -r1.6 kjs/testkjs.cpp
--- kjs/testkjs.cpp	2002/11/20 02:35:01	1.6
+++ kjs/testkjs.cpp	2003/01/14 02:46:47
@@ -21,6 +21,7 @@
  */
 
 #include <stdio.h>
+#include <string.h>
 
 #include "value.h"
 #include "object.h"
@@ -42,6 +43,20 @@ Value TestFunctionImp::call(ExecState *e
   return Undefined();
 }
 
+class VersionFunctionImp : public ObjectImp {
+public:
+  VersionFunctionImp() : ObjectImp() {}
+  virtual bool implementsCall() const { return true; }
+  virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+};
+
+Value VersionFunctionImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
+{
+  // We need this function for compatibility with the Mozilla JS tests but for now
+  // we don't actually do any version-specific handling
+  return Undefined();
+}
+
 class GlobalImp : public ObjectImp {
 public:
   virtual UString className() const { return "global"; }
@@ -65,12 +80,16 @@ int main(int argc, char **argv)
     global.put(interp.globalExec(), Identifier("debug"), Object(new TestFunctionImp()));
     // add "print" for compatibility with the mozilla js shell
     global.put(interp.globalExec(), Identifier("print"), Object(new TestFunctionImp()));
+    // add "version" for compatibility with the mozilla js shell 
+    global.put(interp.globalExec(), Identifier("version"), Object(new VersionFunctionImp()));
 
     const int BufferSize = 200000;
     char code[BufferSize];
 
     for (int i = 1; i < argc; i++) {
       const char *file = argv[i];
+      if (strcmp(file, "-f") == 0)
+	continue;
       FILE *f = fopen(file, "r");
       if (!f) {
         fprintf(stderr, "Error opening %s.\n", file);
@@ -116,5 +135,5 @@ int main(int argc, char **argv)
 #ifdef KJS_DEBUG_MEM
   Interpreter::finalCheck();
 #endif
-  return ret ? 0 : 1;
+  return ret ? 0 : 3;
 }