Changeset 3342 in webkit for trunk/JavaScriptCore/kjs/testkjs.cpp


Ignore:
Timestamp:
Jan 16, 2003, 5:18:19 PM (22 years ago)
Author:
mjs
Message:

Reviewed by Darin.

  • 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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/testkjs.cpp

    r2772 r3342  
    2222
    2323#include <stdio.h>
     24#include <string.h>
    2425
    2526#include "value.h"
     
    4041{
    4142  fprintf(stderr,"--> %s\n",args[0].toString(exec).ascii());
     43  return Undefined();
     44}
     45
     46class VersionFunctionImp : public ObjectImp {
     47public:
     48  VersionFunctionImp() : ObjectImp() {}
     49  virtual bool implementsCall() const { return true; }
     50  virtual Value call(ExecState *exec, Object &thisObj, const List &args);
     51};
     52
     53Value VersionFunctionImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
     54{
     55  // We need this function for compatibility with the Mozilla JS tests but for now
     56  // we don't actually do any version-specific handling
    4257  return Undefined();
    4358}
     
    6681    // add "print" for compatibility with the mozilla js shell
    6782    global.put(interp.globalExec(), Identifier("print"), Object(new TestFunctionImp()));
     83    // add "version" for compatibility with the mozilla js shell
     84    global.put(interp.globalExec(), Identifier("version"), Object(new VersionFunctionImp()));
    6885
    6986    const int BufferSize = 200000;
     
    7289    for (int i = 1; i < argc; i++) {
    7390      const char *file = argv[i];
     91      if (strcmp(file, "-f") == 0)
     92        continue;
    7493      FILE *f = fopen(file, "r");
    7594      if (!f) {
     
    117136  Interpreter::finalCheck();
    118137#endif
    119   return ret ? 0 : 1;
     138  return ret ? 0 : 3;
    120139}
Note: See TracChangeset for help on using the changeset viewer.