Deleted extra tests, as have now updated original tests so they are properly javascript compliant - thanks Armin!

master
pur3mail 13 years ago
parent 1baee8b066
commit 91b9188045

@ -1,8 +0,0 @@
// functions in variables
// 42-tiny-js change begin --->
//var bob; // in JavaScript it's not allowed to add a child to a var with type "undefined"
var bob = {};
//<--- 42-tiny-js change end
bob.add = function(x,y) { return x+y; };
result = bob.add(3,6)==9;

@ -1,17 +0,0 @@
// Variable creation and scope from http://en.wikipedia.org/wiki/JavaScript_syntax
x = 0; // A global variable
var y = 'Hello!'; // Another global variable
// 42-tiny-js change begin --->
z = 0; // a var is only created automated by assignment
//<--- 42-tiny-js change end
function f(){
var z = 'foxes'; // A local variable
twenty = 20; // Global because keyword var is not used
return x; // We can use x here because it is global
}
// The value of z is no longer available
// testing
blah = f();
result = blah==0 && z!='foxes' && twenty==20;

@ -1,15 +0,0 @@
// references for arrays
// 42-tiny-js change begin --->
//var a; // in JavaScript it's not allowed to add properies to a var with type "undefined"
var a = [];
//<--- 42-tiny-js change end
a[0] = 10;
a[1] = 22;
b = a;
b[0] = 5;
result = a[0]==5 && a[1]==22 && b[1]==22;

@ -1,21 +0,0 @@
// references with functions
var a = 42;
// 42-tiny-js change begin --->
//var b; // in JavaScript it's not allowed to add properties to a var with type "undefined"
var b = [];
//<--- 42-tiny-js change end
b[0] = 43;
function foo(myarray) {
myarray[0]++;
}
function bar(myvalue) {
myvalue++;
}
foo(b);
bar(a);
result = a==42 && b[0]==44;

@ -1,8 +0,0 @@
// mikael.kindborg@mobilesorcery.com - Function symbol is evaluated in bracket-less body of false if-statement
// 42-tiny-js change begin --->
var foo; // a var is only created automated by assignment
//<--- 42-tiny-js change end
if (foo !== undefined) foo();
result = 1;
Loading…
Cancel
Save