Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

Commit d4df5d4

Browse files
12wrigjashicks
authored andcommitted
RELNOTES: Fix edge-case in TestCase autodiscovery.
PiperOrigin-RevId: 329396478
1 parent fb4ad0e commit d4df5d4

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

closure/goog/testing/testcase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ goog.testing.TestCase.prototype.addTestObj_ = function(obj, name, objChain) {
14351435
var fullTestName = name + (testName && name ? '_' : '') + testName;
14361436
if (goog.isFunction(testProperty)) {
14371437
this.addNewTest(fullTestName, testProperty, obj, objChain);
1438-
} else if (goog.isObject(testProperty)) {
1438+
} else if (goog.isObject(testProperty) && !Array.isArray(testProperty)) {
14391439
// To prevent infinite loops.
14401440
if (!goog.array.contains(objChain, testProperty)) {
14411441
goog.asserts.assertObject(testProperty);

closure/goog/testing/testcase_test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,20 @@ goog.global.mockTestName = function() {
179179
return failGoogPromise();
180180
};
181181

182+
/**
183+
* A variable with the same autodiscovery prefix, used by
184+
* `testInitializeTestCase`. TestCase does not support auto-discovering tests
185+
* within Arrays, either as functions added to the array object or as a value
186+
* within the array (as it never recurses into the content of the array).
187+
*/
188+
goog.global.mockTestNameValues = ['hello', 'world'];
189+
/**
190+
* @return {!GoogPromise<?>}
191+
*/
192+
goog.global.mockTestNameValues.mockTestNameTestShouldNotBeRun = function() {
193+
return failGoogPromise();
194+
};
195+
182196
testSuite({
183197
setUp() {
184198
events = [];

0 commit comments

Comments
 (0)