Merge pull request #1040 from kkujala/refactor

Add Unit tests for RefSet.
This commit is contained in:
notmasteryet 2012-01-08 15:13:40 -08:00
commit f8f17231e6
2 changed files with 19 additions and 2 deletions

View File

@ -118,7 +118,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var self = this;
var xref = this.xref;
var handler = this.handler;
var uniquePrefix = this.uniquePrefix;
var uniquePrefix = this.uniquePrefix || '';
function insertDependency(depList) {
fnArray.push('dependency');
@ -235,7 +235,6 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
}, handler, xref, resources, image, inline);
}
uniquePrefix = uniquePrefix || '';
if (!queue.argsArray) {
queue.argsArray = [];
}

View File

@ -127,5 +127,23 @@ describe('obj', function() {
expect(ref.gen).toEqual(storedGen);
});
});
describe('RefSet', function() {
it('should have a stored value', function() {
var ref = new Ref(4, 2);
var refset = new RefSet();
refset.put(ref);
expect(refset.has(ref)).toBeTruthy();
});
it('should not have an unknown value', function() {
var ref = new Ref(4, 2);
var refset = new RefSet();
expect(refset.has(ref)).toBeFalsy();
refset.put(ref);
var anotherRef = new Ref(2, 4);
expect(refset.has(anotherRef)).toBeFalsy();
});
});
});