The reason for this error is that in order to get printing to stdout
working (in order to get oUnit working) I had to add a primitive to
the SpiderMonkey Javascript interpreter; the built-in print primitive
adds a newline to everything. The patch follows (against SpiderMonkey
1.60).
I'm not sure what is the right way to handle this so that everybody
can run the tests. As far as I know there is no way to extend
SpiderMonkey without recompiling it. The only other thing I can think
of is some ungodly hack like pipe the js output through a filter that
strips the extra newlines. Or ship a patched SpiderMonkey (or some
other Javascript interpreter) with ocamljs.
Jake
diff -r js/src/js.c js.patched/src/js.c
689a690,705
> Print_verbatim(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
> {
> uintN i, n;
> JSString *str;
>
> for (i = n = 0; i < argc; i++) {
> str = JS_ValueToString(cx, argv[i]);
> if (!str)
> return JS_FALSE;
> fprintf(gOutFile, "%s", JS_GetStringBytes(str));
> }
> n++;
> return JS_TRUE;
> }
>
> static JSBool
1620a1637
> {"print_verbatim", Print_verbatim, 0},
> --
>
> You received this message because you are subscribed to the Google Groups
> "ocamljs discuss" group.
> To post to this group, send email to ocamljs...@googlegroups.com.
> To unsubscribe from this group, send email to
> ocamljs-discu...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/ocamljs-discuss?hl=en.
>