OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Library providing basic test framework functionality. | 6 * @fileoverview Library providing basic test framework functionality. |
7 */ | 7 */ |
8 | 8 |
9 /** | 9 /** |
10 * Namespace for |Test|. | 10 * Namespace for |Test|. |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 * @return {String} Call signature. | 725 * @return {String} Call signature. |
726 * @private | 726 * @private |
727 */ | 727 */ |
728 getCall_: function(caller) { | 728 getCall_: function(caller) { |
729 var stackInfo = this.getCallerInfo_(caller); | 729 var stackInfo = this.getCallerInfo_(caller); |
730 var count = | 730 var count = |
731 this.counts_[stackInfo.callerCallerString][stackInfo.callerName]; | 731 this.counts_[stackInfo.callerCallerString][stackInfo.callerName]; |
732 | 732 |
733 // Allow pattern to match multiple lines for text wrapping. | 733 // Allow pattern to match multiple lines for text wrapping. |
734 var callerRegExp = | 734 var callerRegExp = |
735 new RegExp(stackInfo.callerName + '\\((.|\\n)*?\\);', 'g'); | 735 new RegExp(stackInfo.callerName + '\\((.|\\n|\\r)*?\\);', 'g'); |
736 | 736 |
737 // Find all matches allowing wrap around such as when a helper function | 737 // Find all matches allowing wrap around such as when a helper function |
738 // calls assert/expect calls and that helper function is called multiple | 738 // calls assert/expect calls and that helper function is called multiple |
739 // times. | 739 // times. |
740 var matches = stackInfo.callerCallerString.match(callerRegExp); | 740 var matches = stackInfo.callerCallerString.match(callerRegExp); |
741 var match = matches[(count - 1) % matches.length]; | 741 var match = matches[(count - 1) % matches.length]; |
742 | 742 |
743 // Chop off the trailing ';'. | 743 // Chop off the trailing ';'. |
744 return match.substring(0, match.length-1); | 744 return match.substring(0, match.length-1); |
745 }, | 745 }, |
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1756 exports.TEST = TEST; | 1756 exports.TEST = TEST; |
1757 exports.TEST_F = TEST_F; | 1757 exports.TEST_F = TEST_F; |
1758 exports.RUNTIME_TEST_F = TEST_F; | 1758 exports.RUNTIME_TEST_F = TEST_F; |
1759 exports.GEN = GEN; | 1759 exports.GEN = GEN; |
1760 exports.GEN_INCLUDE = GEN_INCLUDE; | 1760 exports.GEN_INCLUDE = GEN_INCLUDE; |
1761 exports.WhenTestDone = WhenTestDone; | 1761 exports.WhenTestDone = WhenTestDone; |
1762 | 1762 |
1763 // Import the Mock4JS helpers. | 1763 // Import the Mock4JS helpers. |
1764 Mock4JS.addMockSupport(exports); | 1764 Mock4JS.addMockSupport(exports); |
1765 })(this); | 1765 })(this); |
OLD | NEW |