js/src/gdb/tests/test-jsval.cpp

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

michael@0 1 #include "gdb-tests.h"
michael@0 2 #include "jsapi.h"
michael@0 3
michael@0 4 FRAGMENT(jsval, simple) {
michael@0 5 JS::Rooted<jsval> fortytwo(cx, INT_TO_JSVAL(42));
michael@0 6 JS::Rooted<jsval> negone(cx, INT_TO_JSVAL(-1));
michael@0 7 JS::Rooted<jsval> undefined(cx, JSVAL_VOID);
michael@0 8 JS::Rooted<jsval> null(cx, JSVAL_NULL);
michael@0 9 JS::Rooted<jsval> js_true(cx, JSVAL_TRUE);
michael@0 10 JS::Rooted<jsval> js_false(cx, JSVAL_FALSE);
michael@0 11 JS::Rooted<jsval> elements_hole(cx, js::MagicValue(JS_ELEMENTS_HOLE));
michael@0 12
michael@0 13 JS::Rooted<jsval> empty_string(cx);
michael@0 14 empty_string.setString(JS_NewStringCopyZ(cx, ""));
michael@0 15 JS::Rooted<jsval> friendly_string(cx);
michael@0 16 friendly_string.setString(JS_NewStringCopyZ(cx, "Hello!"));
michael@0 17
michael@0 18 JS::Rooted<jsval> global(cx);
michael@0 19 global.setObject(*JS::CurrentGlobalOrNull(cx));
michael@0 20
michael@0 21 // Some interesting value that floating-point won't munge.
michael@0 22 JS::Rooted<jsval> onehundredthirtysevenonehundredtwentyeighths(cx, DOUBLE_TO_JSVAL(137.0 / 128.0));
michael@0 23
michael@0 24 breakpoint();
michael@0 25
michael@0 26 (void) fortytwo;
michael@0 27 (void) negone;
michael@0 28 (void) undefined;
michael@0 29 (void) js_true;
michael@0 30 (void) js_false;
michael@0 31 (void) null;
michael@0 32 (void) elements_hole;
michael@0 33 (void) empty_string;
michael@0 34 (void) friendly_string;
michael@0 35 (void) global;
michael@0 36 }

mercurial