Skip to content

Commit

Permalink
fix SingleCase case
Browse files Browse the repository at this point in the history
  • Loading branch information
kainino0x committed Aug 10, 2023
1 parent ae9356f commit 328f1f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/common/internal/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { assert, now } from '../util/util.js';

import { TestFileLoader } from './file_loader.js';
import { TestParamsRW } from './params_utils.js';
import { compareQueries, Ordering } from './query/compare.js';
import { comparePublicParamsPaths, compareQueries, Ordering } from './query/compare.js';
import {
TestQuery,
TestQueryMultiCase,
Expand Down Expand Up @@ -360,6 +360,14 @@ export async function loadTreeForQuery(
for (const c of t.iterate(paramsFilter)) {
// iterate() guarantees c's query is equal to or a subset of queryToLoad.

if (queryToLoad instanceof TestQuerySingleCase) {
// A subset is OK if it's TestQueryMultiCase, but for SingleCase it must match exactly.
const ordering = comparePublicParamsPaths(c.id.params, queryToLoad.params);
if (ordering !== Ordering.Equal) {
continue;
}
}

// Leaf for case is suite:a,b:c,d:x=1;y=2
addLeafForCase(subtreeL2, c, isCollapsible);
foundCase = true;
Expand Down
1 change: 1 addition & 0 deletions src/unittests/loaders_and_trees.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ g.test('case').fn(async t => {
t.shouldReject('Error', t.load('suite1:baz:zed,:*'));

t.shouldReject('Error', t.load('suite1:baz:zed:'));
t.shouldReject('Error', t.load('suite1:baz:zed:a=1'));
t.shouldReject('Error', t.load('suite1:baz:zed:a=1;b=2*'));
t.shouldReject('Error', t.load('suite1:baz:zed:a=1;b=2;'));
t.shouldReject('SyntaxError', t.load('suite1:baz:zed:a=1;b=2,')); // tries to parse '2,' as JSON
Expand Down

0 comments on commit 328f1f6

Please sign in to comment.