<commit_before>import { strict as assert } from "assert";
import { Outline as lspOutline } from "../../../shared/analysis/lsp/custom_protocol";
import { Outline as asOutline } from "../../../shared/analysis_server_types";
import { fsPath } from "../../../shared/utils/fs";
import { TestOutlineVisitor } from "../../../shared/utils/outline_das";
import { LspTestOutlineVisitor } from "../../../shared/utils/outline_lsp";
import { activate, extApi, getPackages, helloWorldTestMainFile, logger, waitForResult } from "../../helpers";

describe("test_outline_visitor", () => {

	before("get packages", () => getPackages());
	beforeEach("activate and wait for outline", async () => {
		await activate(helloWorldTestMainFile);
		await waitForResult(() => !!extApi.fileTracker.getOutlineFor(helloWorldTestMainFile));
	});

	it("reads the correct groups and tests", () => {
		const outline = extApi.fileTracker.getOutlineFor(helloWorldTestMainFile) as asOutline | undefined;
		if (!outline)
			throw new Error(`Did not get outline for ${helloWorldTestMainFile}`);

		const visitor = extApi.isLsp ? new LspTestOutlineVisitor(logger, fsPath(helloWorldTestMainFile)) : new TestOutlineVisitor(logger);
		visitor.visit(outline as asOutline & lspOutline); // TODO: Remove when we don't have two outlines

		assert.equal(visitor.tests.length, 7);
		assert.equal(visitor.tests[0].isGroup, true);
		assert.equal(visitor.tests[0].fullName, "String");
		assert.equal(visitor.tests[1].isGroup, false);
		assert.equal(visitor.tests[1].fullName, "String .split() splits the string on the delimiter");
		assert.equal(visitor.tests[2].isGroup, false);
		assert.equal(visitor.tests[2].fullName, "String .split() splits the string on the delimiter 2");
		assert.equal(visitor.tests[3].isGroup, false);
		assert.equal(visitor.tests[3].fullName, "String .trim() removes surrounding whitespace");

		assert.equal(visitor.tests[4].isGroup, true);
		assert.equal(visitor.tests[4].fullName, "int");
		assert.equal(visitor.tests[5].isGroup, false);
		assert.equal(visitor.tests[5].fullName, "int .remainder() returns the remainder of division");
		assert.equal(visitor.tests[6].isGroup, false);
		assert.equal(visitor.tests[6].fullName, "int .toRadixString() returns a hex string");
	});
});<commit_msg>Fix test broken by new tests in test file<commit_after>import { strict as assert } from "assert";
import { Outline as lspOutline } from "../../../shared/analysis/lsp/custom_protocol";
import { Outline as asOutline } from "../../../shared/analysis_server_types";
import { fsPath } from "../../../shared/utils/fs";
import { TestOutlineVisitor } from "../../../shared/utils/outline_das";
import { LspTestOutlineVisitor } from "../../../shared/utils/outline_lsp";
import { activate, extApi, getPackages, helloWorldTestMainFile, logger, waitForResult } from "../../helpers";

describe("test_outline_visitor", () => {

	before("get packages", () => getPackages());
	beforeEach("activate and wait for outline", async () => {
		await activate(helloWorldTestMainFile);
		await waitForResult(() => !!extApi.fileTracker.getOutlineFor(helloWorldTestMainFile));
	});

	it("reads the correct groups and tests", () => {
		const outline = extApi.fileTracker.getOutlineFor(helloWorldTestMainFile) as asOutline | undefined;
		if (!outline)
			throw new Error(`Did not get outline for ${helloWorldTestMainFile}`);

		const visitor = extApi.isLsp ? new LspTestOutlineVisitor(logger, fsPath(helloWorldTestMainFile)) : new TestOutlineVisitor(logger);
		visitor.visit(outline as asOutline & lspOutline); // TODO: Remove when we don't have two outlines

		assert.equal(visitor.tests.length, 10);
		assert.equal(visitor.tests[0].isGroup, true);
		assert.equal(visitor.tests[0].fullName, "String");
		assert.equal(visitor.tests[1].isGroup, false);
		assert.equal(visitor.tests[1].fullName, "String .split() splits the string on the delimiter");
		assert.equal(visitor.tests[2].isGroup, false);
		assert.equal(visitor.tests[2].fullName, "String .split() splits the string on the delimiter 2");
		assert.equal(visitor.tests[3].isGroup, false);
		assert.equal(visitor.tests[3].fullName, "String .trim() removes surrounding whitespace");

		assert.equal(visitor.tests[4].isGroup, true);
		assert.equal(visitor.tests[4].fullName, "int");
		assert.equal(visitor.tests[5].isGroup, false);
		assert.equal(visitor.tests[5].fullName, "int .remainder() returns the remainder of division");
		assert.equal(visitor.tests[6].isGroup, false);
		assert.equal(visitor.tests[6].fullName, "int .toRadixString() returns a hex string");

		assert.equal(visitor.tests[7].isGroup, true);
		assert.equal(visitor.tests[7].fullName, "greater than");
		assert.equal(visitor.tests[8].isGroup, false);
		assert.equal(visitor.tests[8].fullName, "greater than without quotes List<String>");
		assert.equal(visitor.tests[9].isGroup, false);
		assert.equal(visitor.tests[9].fullName, `greater than with quotes ">= foo"`);
	});
});
{'fraction_non_alphanumeric': 0.16275303643724695, 'fraction_numerical': 0.007894736842105263, 'mean_word_length': 5.222921914357682, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7052282', 'n_tokens_mistral': 1620, 'n_tokens_neox': 1552, 'n_words': 341}