Merge branch 'set-equality' of https://github.com/alur/jasmine into alur-set-equality

- Merges #1067 from @alur
This commit is contained in:
Gregg Van Hove
2016-09-27 13:35:18 -07:00
5 changed files with 135 additions and 0 deletions

View File

@@ -14,6 +14,25 @@ describe("jasmineUnderTest.pp", function () {
expect(jasmineUnderTest.pp(-0)).toEqual("-0");
});
describe('stringify sets', function() {
if (typeof Set === 'undefined') { return; }
it("should stringify sets properly", function() {
expect(jasmineUnderTest.pp(new Set([1, 2]))).toEqual("Set( 1, 2 )");
});
it("should truncate sets with more elments than jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH", function() {
var originalMaxSize = jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH;
try {
jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH = 2;
expect(jasmineUnderTest.pp(new Set(["a", "b", "c"]))).toEqual("Set( 'a', 'b', ... )");
} finally {
jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH = originalMaxSize;
}
})
});
describe('stringify arrays', function() {
it("should stringify arrays properly", function() {
expect(jasmineUnderTest.pp([1, 2])).toEqual("[ 1, 2 ]");