Skip to content

Instantly share code, notes, and snippets.

// 1: how could you rewrite the following to make it shorter?
if (foo) {
bar.doSomething(el);
} else {
bar.doSomethingElse(el);
}
this is the same gist but after edited it
// * @description: transferring to the String objects;
//CHECK#1
try{
var s1 = new String();
s1.toString = Boolean.prototype.toString;
var v1 = s1.toString();
$ERROR('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError');
}
var __re = new RegExp(x,"g");
var __instance = String("asdf");
var __str = "1";
//////////////////////////////////////////////////////////////////////////////
//CHECK#1
"use strict"
var __instance = new Number(100111122133144155);
Number.prototype.split = String.prototype.split;
var __split = __instance.split(1);
var __expected = ["","00","","","","22","33","44","60"];
"use strict"
var __obj = {
valueOf:function(){},
toString:void 0
};
var __split = new String(__obj).split(function(){}());
if (__split.length !== 2) {
//15.5.4.17 String.prototype.toLocaleLowerCase ( )
// This function works exactly the same as toLowerCase except that its result is intended to
// yield the correct result for the host environment’s current locale, rather
// than a locale independent result.
//////////////////////////////////////////////////////////////////////////////
//CHECK#1
if (String.prototype.toLocaleUpperCase.length !== 0) {
// Running sputniktests from the command line.
$> ./tools/sputnik.py --command ~/gsoc/2010/besen/shell/BESENShellLinux386
Traceback (most recent call last):
File "./tools/sputnik.py", line 515, in <module>
Main()
File "./tools/sputnik.py", line 510, in Main
options.full_summary)
File "./tools/sputnik.py", line 412, in Run
//CHECK#1
try {
var x = [];
x.length = NaN;
$ERROR('#1.1: x = []; x.length = NaN throw RangeError. Actual: x.length === ' + (x.length));
} catch(e) {
if ((e instanceof RangeError) !== true) {
$ERROR('#1.2: x = []; x.length = NaN throw RangeError. Actual: ' + (e));
}
}
Array.prototype[1] = 1;
var x = [0];
x.length = 2;
var arr = x.concat();
//CHECK#1
if (arr[0] !== 0) {
$ERROR('#1: Array.prototype[1] = 1; x = [0]; x.length = 2; var arr = x.concat(); arr[0] === 0. Actual: ' + (arr[0]));
}