added some execution test

This commit is contained in:
Jeremy Ashkenas
2009-12-24 00:12:07 -08:00
parent 417753bd62
commit b743e3219a
12 changed files with 110 additions and 23 deletions

View File

@@ -0,0 +1,4 @@
nums: n * n for n in [1, 2, 3] if n % 2 aint 0.
result: n * 2 for n in nums.
print(result.join(',') is '2,18')

View File

@@ -0,0 +1,21 @@
(function(){
var nums;
var a = [1, 2, 3];
var d = [];
for (var b=0, c=a.length; b<c; b++) {
var n = a[b];
if (n % 2 !== 0) {
nums = d.push(n * n);
}
}
nums = d;
var result;
var e = nums;
var h = [];
for (var f=0, g=e.length; f<g; f++) {
n = e[f];
h[f] = n * 2;
}
result = h;
print(result.join(',') === '2,18');
})();

View File

@@ -0,0 +1,6 @@
result: try
nonexistent * missing
catch error
true.
print(result)

View File

@@ -0,0 +1,9 @@
(function(){
var result;
try {
result = nonexistent * missing;
} catch (error) {
result = true;
}
print(result);
})();

View File

@@ -0,0 +1,11 @@
a: b: d: true
c: false
result: if a
if b
if c then false
else
if d
true....
print(result)

View File

@@ -0,0 +1,6 @@
(function(){
var a = b = d = true;
var c = false;
var result = a ? b ? c ? false : d ? true : null : null : null;
print(result);
})();