with a more comprehensive execution test that uncovered some missing spots

This commit is contained in:
Jeremy Ashkenas
2009-12-24 00:41:12 -08:00
parent b743e3219a
commit fb13a303f2
5 changed files with 67 additions and 8 deletions

View File

@@ -0,0 +1,23 @@
func: =>
a: 3
b: []
while a >= 0
b.push('o')
a--.
c: {
text: b
}
c: 'error' unless 42 > 41
c.text: if false
'error'
else
c.text + '---'.
c.list: let for let in c.text.split('') if let is '-'.
c.single: c.list[1, 1][0].
print(func() == '-')

View File

@@ -0,0 +1,29 @@
(function(){
var func = function() {
var a = 3;
var b = [];
while (a >= 0) {
b.push('o');
a--;
}
var c = {
text: b
};
if (!(42 > 41)) {
c = 'error';
}
c.text = false ? 'error' : c.text + '---';
var d = c.text.split('');
var g = [];
for (var e=0, f=d.length; e<f; e++) {
var let = d[e];
if (let === '-') {
c.list = g.push(let);
}
}
c.list = g;
c.single = c.list.slice(1, 1 + 1)[0];
return c.single;
};
print(func() === '-');
})();