Pretty-print [new String("")] as "[ '' ]" not "[]"
This commit is contained in:
@@ -7492,7 +7492,7 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
|
|||||||
this.emitScalar('<global>');
|
this.emitScalar('<global>');
|
||||||
} else if (value.jasmineToString) {
|
} else if (value.jasmineToString) {
|
||||||
this.emitScalar(value.jasmineToString(this.pp_));
|
this.emitScalar(value.jasmineToString(this.pp_));
|
||||||
} else if (typeof value === 'string') {
|
} else if (j$.isString_(value)) {
|
||||||
this.emitString(value);
|
this.emitString(value);
|
||||||
} else if (j$.isSpy(value)) {
|
} else if (j$.isSpy(value)) {
|
||||||
this.emitScalar('spy on ' + value.and.identity);
|
this.emitScalar('spy on ' + value.and.identity);
|
||||||
|
|||||||
@@ -5,6 +5,14 @@ describe('PrettyPrinter', function() {
|
|||||||
expect(pp("som' string")).toEqual("'som' string'");
|
expect(pp("som' string")).toEqual("'som' string'");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('stringifies empty string primitives and objects recognizably', function() {
|
||||||
|
const pp = jasmineUnderTest.makePrettyPrinter();
|
||||||
|
expect(pp(new String(''))).toEqual(pp(''));
|
||||||
|
expect(pp(new String(''))).toEqual("''");
|
||||||
|
expect(pp([new String('')])).toEqual(pp(['']));
|
||||||
|
expect(pp([new String('')])).toEqual("[ '' ]");
|
||||||
|
});
|
||||||
|
|
||||||
it('should stringify primitives properly', function() {
|
it('should stringify primitives properly', function() {
|
||||||
var pp = jasmineUnderTest.makePrettyPrinter();
|
var pp = jasmineUnderTest.makePrettyPrinter();
|
||||||
expect(pp(true)).toEqual('true');
|
expect(pp(true)).toEqual('true');
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
|
|||||||
this.emitScalar('<global>');
|
this.emitScalar('<global>');
|
||||||
} else if (value.jasmineToString) {
|
} else if (value.jasmineToString) {
|
||||||
this.emitScalar(value.jasmineToString(this.pp_));
|
this.emitScalar(value.jasmineToString(this.pp_));
|
||||||
} else if (typeof value === 'string') {
|
} else if (j$.isString_(value)) {
|
||||||
this.emitString(value);
|
this.emitString(value);
|
||||||
} else if (j$.isSpy(value)) {
|
} else if (j$.isSpy(value)) {
|
||||||
this.emitScalar('spy on ' + value.and.identity);
|
this.emitScalar('spy on ' + value.and.identity);
|
||||||
|
|||||||
Reference in New Issue
Block a user