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