mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Updates Jasmine version.
This commit is contained in:
parent
df7afcf004
commit
0a700fa29d
25 changed files with 876 additions and 3803 deletions
|
@ -1,4 +1,4 @@
|
|||
/* globals expect, it, describe, beforeEach, isArray, StringStream,
|
||||
/* globals jasmine, expect, it, describe, beforeEach, isArray, StringStream,
|
||||
PostScriptParser, PostScriptLexer, PostScriptEvaluator,
|
||||
PostScriptCompiler*/
|
||||
|
||||
|
@ -6,31 +6,42 @@
|
|||
|
||||
describe('function', function() {
|
||||
beforeEach(function() {
|
||||
this.addMatchers({
|
||||
toMatchArray: function(expected) {
|
||||
var actual = this.actual;
|
||||
if (actual.length !== expected.length) {
|
||||
return false;
|
||||
}
|
||||
for (var i = 0; i < expected.length; i++) {
|
||||
var a = actual[i], b = expected[i];
|
||||
if (isArray(b)) {
|
||||
if (a.length !== b.length) {
|
||||
return false;
|
||||
jasmine.addMatchers({
|
||||
toMatchArray: function(util, customEqualityTesters) {
|
||||
return {
|
||||
compare: function (actual, expected) {
|
||||
var result = {};
|
||||
if (actual.length !== expected.length) {
|
||||
result.pass = false;
|
||||
result.message = 'Array length: ' + actual.length +
|
||||
', expected: ' + expected.length;
|
||||
return result;
|
||||
}
|
||||
for (var j = 0; j < a.length; j++) {
|
||||
var suba = a[j], subb = b[j];
|
||||
if (suba !== subb) {
|
||||
return false;
|
||||
result.pass = true;
|
||||
for (var i = 0; i < expected.length; i++) {
|
||||
var a = actual[i], b = expected[i];
|
||||
if (isArray(b)) {
|
||||
if (a.length !== b.length) {
|
||||
result.pass = false;
|
||||
break;
|
||||
}
|
||||
for (var j = 0; j < a.length; j++) {
|
||||
var suba = a[j], subb = b[j];
|
||||
if (suba !== subb) {
|
||||
result.pass = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (a !== b) {
|
||||
result.pass = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (a !== b) {
|
||||
return false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue