mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
17 lines
428 B
JavaScript
17 lines
428 B
JavaScript
var tests = 0;
|
|
var testsPass = 0;
|
|
|
|
function test(item, value) {
|
|
tests++;
|
|
if (eval(item) !== value) {
|
|
console.log('ERROR:', item, 'should be', value, 'but found', '' + eval(item));
|
|
} else testsPass++;
|
|
}
|
|
|
|
test("({}).toString()","[object Object]");
|
|
test('({toString:function() { return "Hello"; }}).toString()', "Hello");
|
|
test('({toString:function() { return "Hello"; }})+5',"Hello5");
|
|
|
|
|
|
result = testsPass == tests;
|