* Makefile

Add target for windows systems.
* runtests2.pl
  Add xpcshell option, no longer requires \n at end of list file.
* ecma/ExecutionContexts/10.1.3.js
  Reformatted.
This commit is contained in:
rginda@netscape.com
1999-11-23 22:35:35 +00:00
parent ed6e9ec932
commit 476a930cd1
3 changed files with 160 additions and 53 deletions
+4
View File
@@ -2,3 +2,7 @@
testmenu:
exec perl mklistpage.pl > menubody.html
cat menuhead.html menubody.html menufoot.html > menu.html
testmenu_dos:
perl mklistpage.pl > menubody.html
type menuhead.html menubody.html menufoot.html > menu.html
+118 -46
View File
@@ -27,60 +27,132 @@
Date: 11 september 1997
*/
var SECTION = "10.1.3";
var VERSION = "ECMA_1";
startTest();
var TITLE = "Variable instantiation";
var SECTION = "10.1.3";
var VERSION = "ECMA_1";
startTest();
var TITLE = "Variable instantiation";
writeHeaderToLog( SECTION + " "+ TITLE);
writeHeaderToLog( SECTION + " "+ TITLE);
var testcases = getTestCases();
test();
var testcases = getTestCases();
test();
function getTestCases() {
var array = new Array();
var item = 0;
// overriding a variable or function name with a function should succeed
array[item++] =
new TestCase(SECTION,
"function t() { return \"first\" };" +
"function t() { return \"second\" };t() ",
"second",
eval("function t() { return \"first\" };" +
"function t() { return \"second\" };t()"));
array[item++] =
new TestCase(SECTION,
"var t; function t() { return \"function\" }; typeof(t)",
"function",
eval("var t;function t() { return \"function\" }; " +
"typeof(t)"));
// overriding a variable or function name with a function should succeed
array[item++] = new TestCase( SECTION, "function t() { return \"first\" };function t() { return \"second\" };t() ", "second", eval("function t() { return \"first\" }; function t() { return \"second\" };t()") );
array[item++] = new TestCase( SECTION, "var t; function t() { return \"function\" }; typeof(t)", "function", eval("var t;function t() { return \"function\" }; typeof(t)") );
// formal parameter tests
array[item++] =
new TestCase(SECTION,
"function t1(a,b) { return b; }; t1( 4 );",
void 0,
eval("function t1(a,b) { return b; }; t1( 4 );") );
array[item++] =
new TestCase(SECTION,
"function t1(a,b) { return a; }; t1(4);",
4,
eval("function t1(a,b) { return a; }; t1(4)"));
array[item++] =
new TestCase(SECTION,
"function t1(a,b) { return a; }; t1();",
void 0,
eval("function t1(a,b) { return a; }; t1()"));
array[item++] =
new TestCase(SECTION,
"function t1(a,b) { return a; }; t1(1,2,4);",
1,
eval("function t1(a,b) { return a; }; t1(1,2,4)"));
/*
array[item++] =
new TestCase(SECTION, "function t1(a,a) { return a; }; t1( 4 );",
void 0,
eval("function t1(a,a) { return a; }; t1( 4 )"));
array[item++] =
new TestCase(SECTION,
"function t1(a,a) { return a; }; t1( 1,2 );",
2,
eval("function t1(a,a) { return a; }; t1( 1,2 )"));
*/
// variable declarations
array[item++] =
new TestCase(SECTION,
"function t1(a,b) { return a; }; t1( false, true );",
false,
eval("function t1(a,b) { return a; }; t1( false, true );"));
array[item++] =
new TestCase(SECTION,
"function t1(a,b) { return b; }; t1( false, true );",
true,
eval("function t1(a,b) { return b; }; t1( false, true );"));
array[item++] =
new TestCase(SECTION,
"function t1(a,b) { return a+b; }; t1( 4, 2 );",
6,
eval("function t1(a,b) { return a+b; }; t1( 4, 2 );"));
array[item++] =
new TestCase(SECTION,
"function t1(a,b) { return a+b; }; t1( 4 );",
Number.NaN,
eval("function t1(a,b) { return a+b; }; t1( 4 );"));
// formal parameter tests
array[item++] = new TestCase( SECTION, "function t1(a,b) { return b; }; t1( 4 );", void 0, eval("function t1(a,b) { return b; }; t1( 4 );") );
array[item++] = new TestCase( SECTION, "function t1(a,b) { return a; }; t1( 4 );", 4, eval("function t1(a,b) { return a; }; t1( 4 )") );
array[item++] = new TestCase( SECTION, "function t1(a,b) { return a; }; t1();", void 0, eval("function t1(a,b) { return a; }; t1()") );
array[item++] = new TestCase( SECTION, "function t1(a,b) { return a; }; t1(1,2,4);", 1, eval("function t1(a,b) { return a; }; t1(1,2,4)") );
// array[item++] = new TestCase( SECTION, "function t1(a,a) { return a; }; t1( 4 );", void 0, eval("function t1(a,a) { return a; }; t1( 4 )") );
// array[item++] = new TestCase( SECTION, "function t1(a,a) { return a; }; t1( 1,2 );", 2, eval("function t1(a,a) { return a; }; t1( 1,2 )") );
// overriding a function name with a variable should fail
array[item++] =
new TestCase(SECTION,
"function t() { return 'function' };" +
"var t = 'variable'; typeof(t)",
"string",
eval("function t() { return 'function' };" +
"var t = 'variable'; typeof(t)"));
// variable declarations
array[item++] = new TestCase( SECTION, "function t1(a,b) { return a; }; t1( false, true );", false, eval("function t1(a,b) { return a; }; t1( false, true );") );
array[item++] = new TestCase( SECTION, "function t1(a,b) { return b; }; t1( false, true );", true, eval("function t1(a,b) { return b; }; t1( false, true );") );
array[item++] = new TestCase( SECTION, "function t1(a,b) { return a+b; }; t1( 4, 2 );", 6, eval("function t1(a,b) { return a+b; }; t1( 4, 2 );") );
array[item++] = new TestCase( SECTION, "function t1(a,b) { return a+b; }; t1( 4 );", Number.NaN, eval("function t1(a,b) { return a+b; }; t1( 4 );") );
// function as a constructor
array[item++] =
new TestCase(SECTION,
"function t1(a,b) { var a = b; return a; } t1(1,3);",
3,
eval("function t1(a, b){ var a = b; return a;}; t1(1,3)"));
array[item++] =
new TestCase(SECTION,
"function t2(a,b) { this.a = b; } x = new t2(1,3); x.a",
3,
eval("function t2(a,b) { this.a = b; };" +
"x = new t2(1,3); x.a"));
array[item++] =
new TestCase(SECTION,
"function t2(a,b) { this.a = a; } x = new t2(1,3); x.a",
1,
eval("function t2(a,b) { this.a = a; };" +
"x = new t2(1,3); x.a"));
array[item++] =
new TestCase(SECTION,
"function t2(a,b) { this.a = b; this.b = a; } " +
"x = new t2(1,3);x.a;",
3,
eval("function t2(a,b) { this.a = b; this.b = a; };" +
"x = new t2(1,3);x.a;"));
array[item++] =
new TestCase(SECTION,
"function t2(a,b) { this.a = b; this.b = a; }" +
"x = new t2(1,3);x.b;",
1,
eval("function t2(a,b) { this.a = b; this.b = a; };" +
"x = new t2(1,3);x.b;") );
// overriding a function name with a variable should fail
array[item++] = new TestCase( SECTION, "function t() { return 'function' }; var t = 'variable'; typeof(t)", "string", eval("function t() { return 'function' }; var t = 'variable'; typeof(t)") );
// function as a constructor
array[item++] = new TestCase( SECTION, "function t1(a,b) { var a = b; return a; } t1(1,3);", 3, eval("function t1(a, b){ var a = b; return a;}; t1(1,3)") );
array[item++] = new TestCase( SECTION, "function t2(a,b) { this.a = b; } x = new t2(1,3); x.a", 3, eval("function t2(a,b) { this.a = b; }; x = new t2(1,3); x.a") );
array[item++] = new TestCase( SECTION, "function t2(a,b) { this.a = a; } x = new t2(1,3); x.a", 1, eval("function t2(a,b) { this.a = a; }; x = new t2(1,3); x.a") );
array[item++] = new TestCase( SECTION, "function t2(a,b) { this.a = b; this.b = a; } x = new t2(1,3);x.a;", 3, eval("function t2(a,b) { this.a = b; this.b = a; }; x = new t2(1,3);x.a;") );
array[item++] = new TestCase( SECTION, "function t2(a,b) { this.a = b; this.b = a; } x = new t2(1,3);x.b;", 1, eval("function t2(a,b) { this.a = b; this.b = a; }; x = new t2(1,3);x.b;") );
return ( array );
}
function test() {
for ( tc=0; tc < testcases.length; tc++ ) {
testcases[tc].passed = writeTestCaseResult(
testcases[tc].expect,
testcases[tc].actual,
testcases[tc].description +" = "+
testcases[tc].actual );
testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
}
stopTest();
return ( testcases );
return (array);
}
+38 -7
View File
@@ -56,15 +56,15 @@ local $opt_lxr_url = "http://lxr.mozilla.org/mozilla/source/js/tests/";
# command line option definition
local $options = "b=s bugurl>b c=s classpath>c d smdebug>d f=s file>f " .
"h help>h j=s javapath>j k confail>k l=s list>l o smopt>o p=s testpath>p " .
"r rhino>r s=s shellpath>s t trace>t x=s lxrurl>x";
"r rhino>r s=s shellpath>s t trace>t u=s lxrurl>u x xpcshell>x";
&parse_args;
local $os_type = &get_os_type;
local $engine_command = &get_engine_command;
local $user_exit = 0;
local $html = "";
local @failed_tests;
local $os_type = &get_os_type;
local $failures_reported = 0;
local $tests_completed = 0;
local @test_list = &get_test_list;
@@ -293,7 +293,7 @@ sub parse_args {
$opt_test_list_file = $value;
} elsif ($option eq "o") {
&dd ("opt: using smopt engine");
&dd ("opt: using smopt engine.");
$opt_engine_type = "smopt";
} elsif ($option eq "p") {
@@ -304,7 +304,7 @@ sub parse_args {
&dd ("opt: setting suite path to '$opt_suite_path'.");
} elsif ($option eq "r") {
&dd ("opt: using rhino engine");
&dd ("opt: using rhino engine.");
$opt_engine_type = "rhino";
} elsif ($option eq "s") {
@@ -319,9 +319,13 @@ sub parse_args {
$opt_console_failures = 1;
$opt_trace = 1;
} elsif ($option eq "x") {
} elsif ($option eq "u") {
&dd ("opt: setting lxr url to '$value'.");
$opt_lxr_url = $value;
} elsif ($option eq "x") {
&dd ("opt: using xpcshell.");
$opt_engine_type = "xpcshell";
} else {
&usage;
@@ -365,8 +369,9 @@ sub usage {
"(-r|--rhino) Test Rhino engine.\n" .
"(-s|--shellpath) <path> Location of JavaScript shell.\n" .
"(-t|--trace) Trace script execution.\n" .
"(-x|--lxrurl) <url> Complete URL to tests subdirectory on lxr.\n" .
"(-u|--lxrurl) <url> Complete URL to tests subdirectory on lxr.\n" .
" (default is $opt_lxr_url)\n\n");
"(-x|--xpcshell) Test xpcshell.\n" .
exit (1);
@@ -382,6 +387,9 @@ sub get_engine_command {
if ($opt_engine_type eq "rhino") {
&dd ("getting rhino engine command.");
$retval = &get_rhino_engine_command;
} elsif ($opt_engine_type eq "xpcshell") {
&dd ("getting xpcshell engine command.");
$retval = &get_xpc_engine_command;
} else {
&dd ("getting spidermonkey engine command.");
$retval = &get_sm_engine_command;
@@ -415,6 +423,29 @@ sub get_rhino_engine_command {
}
#
# get the shell command used to run xpcshell
#
sub get_xpc_engine_command {
local $m5_home = @ENV{"MOZILLA_FIVE_HOME"} ||
die ("You must set MOZILLA_FIVE_HOME to use the xpcshell" ,
($os_type eq "WIN") ? "." : ", also " .
"setting LD_LIBRARY_PATH to the same directory may get rid of " .
"any 'library not found' errors.\n");
if (($os_type ne "WIN") && (!@ENV{"LD_LIBRARY_PATH"})) {
print STDERR "-#- WARNING: LD_LIBRARY_PATH is not set, xpcshell may " .
"not be able to find the required components.\n";
}
if (!($m5_home =~ /[\/\\]$/)) {
$m5_home .= "/";
}
return $m5_home . "xpcshell";
}
#
# get the shell command used to run spidermonkey
#
@@ -534,7 +565,7 @@ sub get_user_test_list {
die("Error opening test list file '$list_file': $!\n");
while (<TESTLIST>) {
chop;
s/\n$//;
if (!(/\s*\#/)) {
$retval[$#retval + 1] = $_;
}