Просмотр исходного кода

Refs #989 Fixed a bug where SingleValueAccumulator wouldn't allow construction with no arguments

http://source.rd.rcg.local/trac/eagle6/changeset/1305/Eagle6_SVN
Adam Bell 13 лет назад
Родитель
Сommit
e9d64d9ed8

+ 1 - 1
lib/pipeline/accumulators/SingleValueAccumulator.js

@@ -9,7 +9,7 @@ var AccumulatorSingleValue = module.exports = (function(){
      */
      */
 
 
 	var klass = module.exports = function AccumulatorSingleValue(value){
 	var klass = module.exports = function AccumulatorSingleValue(value){
-		if(arguments.length !== 1 ) throw new Error("expects a single value");
+		if(arguments.length > 1 ) throw new Error("expects a single value");
 		this.value = value;
 		this.value = value;
 		base.call(this);
 		base.call(this);
 	}, Accumulator = require("./Accumulator"), base = Accumulator, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 	}, Accumulator = require("./Accumulator"), base = Accumulator, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});

+ 7 - 5
test/lib/pipeline/accumulators/SingleValueAccumulator.js

@@ -8,6 +8,13 @@ module.exports = {
 
 
 		"constructor()": {
 		"constructor()": {
 
 
+	
+			"should not throw Error when constructing with no args": function testConstructor(){
+				assert.doesNotThrow(function(){
+					new SingleValueAccumulator();
+				});
+			},
+
 			"should not throw Error when constructing with 1 arg": function testConstructor(){
 			"should not throw Error when constructing with 1 arg": function testConstructor(){
 				assert.doesNotThrow(function(){
 				assert.doesNotThrow(function(){
 					new SingleValueAccumulator(null);
 					new SingleValueAccumulator(null);
@@ -17,11 +24,6 @@ module.exports = {
 				assert.throws(function(){
 				assert.throws(function(){
 					new SingleValueAccumulator(null, null);
 					new SingleValueAccumulator(null, null);
 				});
 				});
-			},
-			"should throw Error when constructing with < 1 arg": function testConstructor(){
-				assert.throws(function(){
-					new SingleValueAccumulator();
-				});
 			}
 			}
 		},
 		},