|
1 // |reftest| skip -- obsolete test |
|
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
3 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 |
|
8 /** |
|
9 Filename: Function_object.js |
|
10 Description: 'Testing Function objects' |
|
11 |
|
12 Author: Nick Lerissa |
|
13 Date: April 17, 1998 |
|
14 */ |
|
15 |
|
16 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; |
|
17 var VERSION = 'no version'; |
|
18 startTest(); |
|
19 var TITLE = 'functions: Function_object'; |
|
20 |
|
21 writeHeaderToLog('Executing script: Function_object.js'); |
|
22 writeHeaderToLog( SECTION + " "+ TITLE); |
|
23 |
|
24 |
|
25 function a_test_function(a,b,c) |
|
26 { |
|
27 return a + b + c; |
|
28 } |
|
29 |
|
30 f = a_test_function; |
|
31 |
|
32 |
|
33 new TestCase( SECTION, "f.name", |
|
34 'a_test_function', f.name); |
|
35 |
|
36 new TestCase( SECTION, "f.length", |
|
37 3, f.length); |
|
38 |
|
39 new TestCase( SECTION, "f.arity", |
|
40 3, f.arity); |
|
41 |
|
42 new TestCase( SECTION, "f(2,3,4)", |
|
43 9, f(2,3,4)); |
|
44 |
|
45 var fnName = (version() == 120) ? '' : 'anonymous'; |
|
46 |
|
47 new TestCase( SECTION, "(new Function()).name", |
|
48 fnName, (new Function()).name); |
|
49 |
|
50 new TestCase( SECTION, "(new Function()).toString()", |
|
51 'function ' + fnName + '() {\n}', (new Function()).toString()); |
|
52 |
|
53 test(); |
|
54 |