Add unit files to lint, fix lint errors.
This commit is contained in:
parent
1089c30b56
commit
971f35d165
2
Makefile
2
Makefile
@ -129,7 +129,7 @@ browser-test:
|
|||||||
#
|
#
|
||||||
# <http://code.google.com/closure/utilities/docs/linter_howto.html>
|
# <http://code.google.com/closure/utilities/docs/linter_howto.html>
|
||||||
SRC_DIRS := . src utils web test examples/helloworld extensions/firefox \
|
SRC_DIRS := . src utils web test examples/helloworld extensions/firefox \
|
||||||
extensions/firefox/components extensions/chrome
|
extensions/firefox/components extensions/chrome test/unit
|
||||||
GJSLINT_FILES = $(foreach DIR,$(SRC_DIRS),$(wildcard $(DIR)/*.js))
|
GJSLINT_FILES = $(foreach DIR,$(SRC_DIRS),$(wildcard $(DIR)/*.js))
|
||||||
lint:
|
lint:
|
||||||
gjslint --nojsdoc $(GJSLINT_FILES)
|
gjslint --nojsdoc $(GJSLINT_FILES)
|
||||||
|
@ -336,15 +336,16 @@ var PDFFunction = (function PDFFunctionClosure() {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
constructPostScript: function pdfFunctionConstructPostScript(fn, dict, xref) {
|
constructPostScript: function pdfFunctionConstructPostScript(fn, dict,
|
||||||
|
xref) {
|
||||||
var domain = dict.get('Domain');
|
var domain = dict.get('Domain');
|
||||||
var range = dict.get('Range');
|
var range = dict.get('Range');
|
||||||
|
|
||||||
if (!domain)
|
if (!domain)
|
||||||
error('No domain.');
|
error('No domain.');
|
||||||
|
|
||||||
if(!range)
|
if (!range)
|
||||||
error('No range.')
|
error('No range.');
|
||||||
|
|
||||||
var lexer = new PostScriptLexer(fn);
|
var lexer = new PostScriptLexer(fn);
|
||||||
var parser = new PostScriptParser(lexer);
|
var parser = new PostScriptParser(lexer);
|
||||||
@ -399,7 +400,7 @@ var FunctionCache = (function FunctionCache() {
|
|||||||
}
|
}
|
||||||
FunctionCache.prototype = {
|
FunctionCache.prototype = {
|
||||||
has: function(key) {
|
has: function(key) {
|
||||||
return key in this.cache
|
return key in this.cache;
|
||||||
},
|
},
|
||||||
get: function(key) {
|
get: function(key) {
|
||||||
return this.cache[key];
|
return this.cache[key];
|
||||||
@ -446,8 +447,8 @@ var PostScriptStack = (function PostScriptStack() {
|
|||||||
// algorithm from http://jsfromhell.com/array/rotate
|
// algorithm from http://jsfromhell.com/array/rotate
|
||||||
var l = a.length, p = (Math.abs(p) >= l && (p %= l),
|
var l = a.length, p = (Math.abs(p) >= l && (p %= l),
|
||||||
p < 0 && (p += l), p), i, x;
|
p < 0 && (p += l), p), i, x;
|
||||||
for(; p; p = (Math.ceil(l / p) - 1) * p - l + (l = p))
|
for (; p; p = (Math.ceil(l / p) - 1) * p - l + (l = p))
|
||||||
for(i = l; i > p; x = a[--i], a[i] = a[i - p], a[i - p] = x);
|
for (i = l; i > p; x = a[--i], a[i] = a[i - p], a[i - p] = x);
|
||||||
this.stack = this.stack.concat(a);
|
this.stack = this.stack.concat(a);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -677,12 +678,12 @@ var PostScriptEvaluator = (function PostScriptEvaluator() {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error('Unknown operator ' + operator);
|
error('Unknown operator ' + operator);
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return stack.stack;
|
return stack.stack;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
return PostScriptEvaluator;
|
return PostScriptEvaluator;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@ -741,7 +742,7 @@ var PostScriptParser = (function PostScriptParser() {
|
|||||||
// The true block is right after the 'if' so it just falls through on
|
// The true block is right after the 'if' so it just falls through on
|
||||||
// true else it jumps and skips the true block.
|
// true else it jumps and skips the true block.
|
||||||
condition.push('jz', this.code.length);
|
condition.push('jz', this.code.length);
|
||||||
} else if(this.accept(PostScriptTokenTypes.LBRACE)) {
|
} else if (this.accept(PostScriptTokenTypes.LBRACE)) {
|
||||||
var jump = [];
|
var jump = [];
|
||||||
this.code.push(jump);
|
this.code.push(jump);
|
||||||
var endOfTrue = this.code.length;
|
var endOfTrue = this.code.length;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
describe('function', function() {
|
describe('function', function() {
|
||||||
beforeEach(function () {
|
beforeEach(function() {
|
||||||
this.addMatchers({
|
this.addMatchers({
|
||||||
toMatchArray: function(expected) {
|
toMatchArray: function(expected) {
|
||||||
var actual = this.actual;
|
var actual = this.actual;
|
||||||
@ -18,7 +18,7 @@ describe('function', function() {
|
|||||||
for (var j = 0; j < a.length; j++) {
|
for (var j = 0; j < a.length; j++) {
|
||||||
var suba = a[j], subb = b[j];
|
var suba = a[j], subb = b[j];
|
||||||
if (suba !== subb)
|
if (suba !== subb)
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (a !== b)
|
if (a !== b)
|
||||||
@ -85,7 +85,7 @@ describe('function', function() {
|
|||||||
['jz', 3],
|
['jz', 3],
|
||||||
['push', 99],
|
['push', 99],
|
||||||
['j', 4],
|
['j', 4],
|
||||||
['push', 44],
|
['push', 44]
|
||||||
];
|
];
|
||||||
expect(program).toMatchArray(expectedProgram);
|
expect(program).toMatchArray(expectedProgram);
|
||||||
});
|
});
|
||||||
@ -102,7 +102,6 @@ describe('function', function() {
|
|||||||
var code = parser.parse();
|
var code = parser.parse();
|
||||||
var evaluator = new PostScriptEvaluator(code);
|
var evaluator = new PostScriptEvaluator(code);
|
||||||
var output = evaluator.execute();
|
var output = evaluator.execute();
|
||||||
console.log(output);
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
it('pushes stack', function() {
|
it('pushes stack', function() {
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
describe("obj", function() {
|
describe('obj', function() {
|
||||||
|
|
||||||
describe("Name", function() {
|
describe('Name', function() {
|
||||||
it("should retain the given name", function() {
|
it('should retain the given name', function() {
|
||||||
var givenName = "Font";
|
var givenName = 'Font';
|
||||||
var name = new Name(givenName);
|
var name = new Name(givenName);
|
||||||
expect(name.name).toEqual(givenName);
|
expect(name.name).toEqual(givenName);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user