performance tweak
This commit is contained in:
parent
243fe526ac
commit
84a87d423c
@ -33,6 +33,7 @@ jasmine.Spec.prototype.fail = (e) ->
|
|||||||
message: e.message,
|
message: e.message,
|
||||||
lineNumber: "~" + String(e.line),
|
lineNumber: "~" + String(e.line),
|
||||||
sourceURL: realFilename
|
sourceURL: realFilename
|
||||||
|
}
|
||||||
|
|
||||||
expectationResult = new jasmine.ExpectationResult({
|
expectationResult = new jasmine.ExpectationResult({
|
||||||
passed: false,
|
passed: false,
|
||||||
@ -56,18 +57,26 @@ if !jasmine.WaitsBlock.prototype._execute
|
|||||||
|
|
||||||
jasmine.NestedResults.prototype.addResult_ = jasmine.NestedResults.prototype.addResult
|
jasmine.NestedResults.prototype.addResult_ = jasmine.NestedResults.prototype.addResult
|
||||||
|
|
||||||
|
jasmine.NestedResults.ParsedFunctions = []
|
||||||
|
|
||||||
jasmine.NestedResults.prototype.addResult = (result) ->
|
jasmine.NestedResults.prototype.addResult = (result) ->
|
||||||
result.expectations = []
|
result.expectations = []
|
||||||
# always three up?
|
# always three up?
|
||||||
lineCount = 0
|
lineCount = 0
|
||||||
for line in arguments.callee.caller.caller.caller.toString().split("\n")
|
|
||||||
line = line.replace(/^\s*/, '').replace(/\s*$/, '')
|
functionSignature = arguments.callee.caller.caller.caller.toString()
|
||||||
if line.match(/^\s*expect/)
|
if !jasmine.NestedResults.ParsedFunctions[functionSignature]
|
||||||
result.expectations.push(line)
|
lines = []
|
||||||
lineCount += 1
|
for line in functionSignature.split("\n")
|
||||||
|
if line.match(/^\s*expect/)
|
||||||
|
line = line.replace(/^\s*/, '').replace(/\s*$/, '')
|
||||||
|
lines.push(line)
|
||||||
|
lineCount += 1
|
||||||
|
jasmine.NestedResults.ParsedFunctions[functionSignature] = lines
|
||||||
|
result.expectations = jasmine.NestedResults.ParsedFunctions[functionSignature]
|
||||||
|
|
||||||
this.addResult_(result)
|
this.addResult_(result)
|
||||||
}
|
|
||||||
|
|
||||||
jasmine.ExpectationResult.prototype.line = ->
|
jasmine.ExpectationResult.prototype.line = ->
|
||||||
if @expectations && @lineNumber then @expectations[@lineNumber] else ''
|
if @expectations && @lineNumber then @expectations[@lineNumber] else ''
|
||||||
|
@ -61,19 +61,26 @@
|
|||||||
jasmine.WaitsBlock.prototype.execute = pauseAndRun;
|
jasmine.WaitsBlock.prototype.execute = pauseAndRun;
|
||||||
jasmine.WaitsForBlock.prototype.execute = pauseAndRun;
|
jasmine.WaitsForBlock.prototype.execute = pauseAndRun;
|
||||||
jasmine.NestedResults.prototype.addResult_ = jasmine.NestedResults.prototype.addResult;
|
jasmine.NestedResults.prototype.addResult_ = jasmine.NestedResults.prototype.addResult;
|
||||||
|
jasmine.NestedResults.ParsedFunctions = [];
|
||||||
jasmine.NestedResults.prototype.addResult = function(result) {
|
jasmine.NestedResults.prototype.addResult = function(result) {
|
||||||
var line, lineCount, _i, _len, _ref;
|
var functionSignature, line, lineCount, lines, _i, _len, _ref;
|
||||||
result.expectations = [];
|
result.expectations = [];
|
||||||
lineCount = 0;
|
lineCount = 0;
|
||||||
_ref = arguments.callee.caller.caller.caller.toString().split("\n");
|
functionSignature = arguments.callee.caller.caller.caller.toString();
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
if (!jasmine.NestedResults.ParsedFunctions[functionSignature]) {
|
||||||
line = _ref[_i];
|
lines = [];
|
||||||
line = line.replace(/^\s*/, '').replace(/\s*$/, '');
|
_ref = functionSignature.split("\n");
|
||||||
if (line.match(/^\s*expect/)) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
result.expectations.push(line);
|
line = _ref[_i];
|
||||||
|
if (line.match(/^\s*expect/)) {
|
||||||
|
line = line.replace(/^\s*/, '').replace(/\s*$/, '');
|
||||||
|
lines.push(line);
|
||||||
|
}
|
||||||
|
lineCount += 1;
|
||||||
}
|
}
|
||||||
lineCount += 1;
|
jasmine.NestedResults.ParsedFunctions[functionSignature] = lines;
|
||||||
}
|
}
|
||||||
|
result.expectations = jasmine.NestedResults.ParsedFunctions[functionSignature];
|
||||||
return this.addResult_(result);
|
return this.addResult_(result);
|
||||||
};
|
};
|
||||||
jasmine.ExpectationResult.prototype.line = function() {
|
jasmine.ExpectationResult.prototype.line = function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user