Espruino/tests/test_settimeout_with_objects.js
Michael Duerinckx 7f5308590b Rename numbered tests to something more descriptive - closes #16
test077 is the only one I really couldn't figure out what it was meant
to test.
2014-03-01 22:15:28 +00:00

15 lines
408 B
JavaScript

// test setTimeout with objects
var a = { cmd : "result=1;", w : "world", foo: function() { print('hello '+this.w); eval(this.cmd); } };
print("1x intentional error ------");
setTimeout(a,100);
print("---------------------------");
// shouldn't work - but used to assert fail!
//setTimeout("a.foo()",100); // works
//setTimeout(a.foo,100); // shouldn't work
setTimeout(function() { a.foo(); },100);