All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rhino1.7.7.testsrc.tests.js1_2.function.Function_object.js Maven / Gradle / Ivy

Go to download

Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically embedded into Java applications to provide scripting to end users.

There is a newer version: 1.7.15
Show newest version
/* -*- 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/. */

gTestfile = 'Function_object.js';

/**
   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();





© 2015 - 2024 Weber Informatics LLC | Privacy Policy