Debian Codegraph @

rhino/testsrc/tests/js1_5/Regress/regress-477758.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 var gTestfile = 'regress-477758.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 477758;
9 var summary = 'TM: RegExp source';
10 var actual = '';
11 var expect = '';
12
13
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
17
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
23
24 jit(true);
25
26 function map(array, func) {
27 var result = [];
28 for(var i=0;i<array.length;i++) {
29 result.push(func(array[i]));
30 }
31 return result;
32 }
33
34 function run() {
35 var patterns = [/foo/, /bar/];
36 function getSource(r) { return r.source; }
37 var patternStrings = map(patterns, getSource);
38 print(actual += [patterns[0].source, patternStrings[0]] + '');
39 }
40
41 expect = 'foo,foo';
42
43 for (var i = 0; i < 4; i++)
44 {
45 actual = '';
46 run();
47 reportCompare(expect, actual, summary + ': ' + i);
48 }
49
50 jit(false);
51
52 exitFunc ('test');
53 }