summaryrefslogtreecommitdiffstats
path: root/js/src/tests/js1_2/function/Function_object.js
blob: a6af708e2a516cc9ca968653eaa1c8ecd96830ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// |reftest| skip -- obsolete test
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


/**
   Filename:     Function_object.js
   Description:  'Testing Function objects'

   Author:       Nick Lerissa
   Date:         April 17, 1998
*/

var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
var VERSION = 'no version';
startTest();
var TITLE = 'functions: Function_object';

writeHeaderToLog('Executing script: Function_object.js');
writeHeaderToLog( SECTION + " "+ TITLE);


function a_test_function(a,b,c)
{
  return a + b + c;
}

f = a_test_function;


new TestCase( SECTION, "f.name",
	      'a_test_function',  f.name);

new TestCase( SECTION, "f.length",
	      3,  f.length);

new TestCase( SECTION, "f.arity",
	      3,  f.arity);

new TestCase( SECTION, "f(2,3,4)",
	      9,  f(2,3,4));

var fnName = (version() == 120) ? '' : 'anonymous';

new TestCase( SECTION, "(new Function()).name",
	      fnName, (new Function()).name);

new TestCase( SECTION, "(new Function()).toString()",
	      'function ' + fnName + '() {\n}',  (new Function()).toString());

test();