Special case printing -0
Use the 1/x trick to determine if a value is -0 and special case the printing of it. [closes #496]
This commit is contained in:
@@ -1354,6 +1354,8 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
this.emitScalar('undefined');
|
||||
} else if (value === null) {
|
||||
this.emitScalar('null');
|
||||
} else if (value === 0 && 1/value === -Infinity) {
|
||||
this.emitScalar('-0');
|
||||
} else if (value === j$.getGlobal()) {
|
||||
this.emitScalar('<global>');
|
||||
} else if (value.jasmineToString) {
|
||||
|
||||
@@ -11,6 +11,7 @@ describe("j$.pp", function () {
|
||||
expect(j$.pp(jasmine.undefined)).toEqual("undefined");
|
||||
expect(j$.pp(3)).toEqual("3");
|
||||
expect(j$.pp(-3.14)).toEqual("-3.14");
|
||||
expect(j$.pp(-0)).toEqual("-0");
|
||||
});
|
||||
|
||||
it("should stringify arrays properly", function() {
|
||||
|
||||
@@ -11,6 +11,8 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
this.emitScalar('undefined');
|
||||
} else if (value === null) {
|
||||
this.emitScalar('null');
|
||||
} else if (value === 0 && 1/value === -Infinity) {
|
||||
this.emitScalar('-0');
|
||||
} else if (value === j$.getGlobal()) {
|
||||
this.emitScalar('<global>');
|
||||
} else if (value.jasmineToString) {
|
||||
|
||||
Reference in New Issue
Block a user