Skip to content

Commit

Permalink
fixing commenting
Browse files Browse the repository at this point in the history
  • Loading branch information
eleanorjboyd committed Sep 28, 2023
1 parent 610507c commit 0468200
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/client/testing/testController/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,18 +328,10 @@ export function createEOTPayload(executionBool: boolean): EOTTestPayload {
* @returns A tuple where the first item is the parent test name and the second item is the subtest section or `testName` if no subtest section exists.
*/
export function splitTestNameWithRegex(testName: string): [string, string] {
// The regex pattern has three main components:
// 1. ^(.*?): Matches the beginning of the string and captures everything until the last opening bracket or parenthesis. This captures the parent test name.
// 2. (?:...|...): A non-capturing group containing two patterns separated by an OR (|).
// - \(([^)]+)\): Matches an opening parenthesis, captures everything inside it until the closing parenthesis. This captures the subtest inside parenthesis.
// - \[([^]]+)\]: Matches an opening square bracket, captures everything inside it until the closing square bracket. This captures the subtest inside square brackets.
// 3. ?$: The question mark indicates the preceding non-capturing group is optional. The dollar sign matches the end of the string.
const regex = /^(.*?) ([\[(].*[\])])$/;
const match = testName.match(regex);
// const m2 = regex.exec(testName);
// console.log('m2', m2);
// If a match is found, return the parent test name and the subtest (whichever was captured between parenthesis or square brackets).
// Otherwise, return the entire testName for the parent and entire testName for the subtest.
const regex = /^(.*?) ([\[(].*[\])])$/;
const match = testName.match(regex);
if (match) {
return [match[1].trim(), match[2] || match[3] || testName];
}
Expand Down

0 comments on commit 0468200

Please sign in to comment.