js/src/tests/js1_5/extensions/regress-231518.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 //-----------------------------------------------------------------------------
michael@0 7 var BUGNUMBER = 231518;
michael@0 8 var summary = 'decompiler must quote keywords and non-identifier property names';
michael@0 9 var actual = '';
michael@0 10 var expect = 'no error';
michael@0 11 var status;
michael@0 12 var object;
michael@0 13 var result;
michael@0 14
michael@0 15 printBugNumber(BUGNUMBER);
michael@0 16 printStatus (summary);
michael@0 17
michael@0 18
michael@0 19 if (typeof uneval != 'undefined')
michael@0 20 {
michael@0 21 status = inSection(1) + ' eval(uneval({"if": false}))';
michael@0 22
michael@0 23 try
michael@0 24 {
michael@0 25 object = {'if': false };
michael@0 26 result = uneval(object);
michael@0 27 printStatus('uneval returns ' + result);
michael@0 28 eval(result);
michael@0 29 actual = 'no error';
michael@0 30 }
michael@0 31 catch(e)
michael@0 32 {
michael@0 33 actual = 'error';
michael@0 34 }
michael@0 35
michael@0 36 reportCompare(expect, actual, status);
michael@0 37
michael@0 38 status = inSection(2) + ' eval(uneval({"if": "then"}))';
michael@0 39
michael@0 40 try
michael@0 41 {
michael@0 42 object = {'if': "then" };
michael@0 43 result = uneval(object);
michael@0 44 printStatus('uneval returns ' + result);
michael@0 45 eval(result);
michael@0 46 actual = 'no error';
michael@0 47 }
michael@0 48 catch(e)
michael@0 49 {
michael@0 50 actual = 'error';
michael@0 51 }
michael@0 52
michael@0 53 reportCompare(expect, actual, status);
michael@0 54
michael@0 55 status = inSection(3) + ' eval(uneval(f))';
michael@0 56
michael@0 57 try
michael@0 58 {
michael@0 59 result = uneval(f);
michael@0 60 printStatus('uneval returns ' + result);
michael@0 61 eval(result);
michael@0 62 actual = 'no error';
michael@0 63 }
michael@0 64 catch(e)
michael@0 65 {
michael@0 66 actual = 'error';
michael@0 67 }
michael@0 68
michael@0 69 reportCompare(expect, actual, status);
michael@0 70
michael@0 71 status = inSection(2) + ' eval(uneval(g))';
michael@0 72
michael@0 73 try
michael@0 74 {
michael@0 75 result = uneval(g);
michael@0 76 printStatus('uneval returns ' + result);
michael@0 77 eval(result);
michael@0 78 actual = 'no error';
michael@0 79 }
michael@0 80 catch(e)
michael@0 81 {
michael@0 82 actual = 'error';
michael@0 83 }
michael@0 84
michael@0 85 reportCompare(expect, actual, status);
michael@0 86 }
michael@0 87
michael@0 88 function f()
michael@0 89 {
michael@0 90 var obj = new Object();
michael@0 91
michael@0 92 obj['name'] = 'Just a name';
michael@0 93 obj['if'] = false;
michael@0 94 obj['some text'] = 'correct';
michael@0 95 }
michael@0 96
michael@0 97 function g()
michael@0 98 {
michael@0 99 return {'if': "then"};
michael@0 100 }
michael@0 101

mercurial