Skip to content

Commit

Permalink
Put tests side-by-side with main code (#394)
Browse files Browse the repository at this point in the history
* Put tests side-by-side with main code

* Restore grammar tests
  • Loading branch information
mark-wiemer authored Aug 13, 2023
1 parent 273168a commit 1067b16
Show file tree
Hide file tree
Showing 139 changed files with 12 additions and 28 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"pretest": "npm run compile",
"test": "npm run test_grammar_inner && npm run test_unit",
"test_grammar": "npm run compile_grammar && npm run test_grammar_inner",
"test_grammar_inner": "vscode-tmgrammar-snap src/test/suite/grammar/samples/*.{ahk1,ahk2}",
"test_grammar_inner": "vscode-tmgrammar-snap language/samples/*.{ahk1,ahk2}",
"test_unit": "node ./out/test/runTest.js",
"tsc": "tsc --noEmit --skipLibCheck && echo No TSC problems",
"validate": "npm run lint && npm run test",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as assert from 'assert';
import { CodeUtil, getSelectedText } from '../../../common/codeUtil';
import * as vscode from 'vscode';
import { CodeUtil } from './codeUtil';

suite('Code utils', () => {
suite('purify', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getDocument } from '../../utils';
import { getDocument } from '../test/utils';
import * as assert from 'assert';
import * as path from 'path';
import * as vscode from 'vscode';
import { Parser } from '../../../parser/parser';
import { Parser } from '../parser/parser';

suite('Parser', () => {
suite('detectVariableByLine', () => {
Expand Down Expand Up @@ -81,11 +81,7 @@ suite('Parser', () => {
__dirname,
'..',
'..',
'..',
'..',
'src',
'test',
'suite',
'parser',
'samples',
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as vscode from 'vscode';
import { assert } from 'chai';
import { provideCompletionItemsInner } from '../../../../providers/completionProvider';
import { provideCompletionItemsInner } from './completionProvider';

// tests for completionItemsForMethod
suite('completionProvider', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// TODO move to providers/formatting/formattingProvider.test.ts
import { getDocument } from '../../utils';
import { getDocument } from '../test/utils';
import * as assert from 'assert';
import * as fs from 'fs-extra';
import * as path from 'path';
import * as vscode from 'vscode';
import {
FormatProvider,
internalFormat,
} from '../../../providers/formattingProvider';
import { FormatOptions } from '../../../providers/formattingProvider.types';
} from '../providers/formattingProvider';
import { FormatOptions } from '../providers/formattingProvider.types';

const inFilenameSuffix = '.in.ahk';
const outFilenameSuffix = '.out.ahk';
Expand Down Expand Up @@ -111,12 +110,8 @@ const filesParentPath = path.join(
__dirname,
'..',
'..',
'..',
'..',
'src',
'test',
'suite',
'format',
'providers',
'samples',
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
purify,
removeEmptyLines,
trimExtraSpaces,
} from '../../../../providers/formattingProvider.utils';
} from './formattingProvider.utils';

suite('FormattingProvider utils', () => {
// Default formatting options
Expand Down Expand Up @@ -1063,14 +1063,8 @@ suite('FormattingProvider utils', () => {
__dirname,
'..',
'..',
'..',
'..',
'..',
'src',
'test',
'suite',
'providers',
'formatting',
'samples',
);

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as assert from 'assert';
import { makeCompileCommand } from '../../../service/runnerService';
import { makeCompileCommand } from './runnerService';

suite('runnerService', () => {
suite('makeCompileCommand', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/test/suite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function run(): Promise<void> {
(mocha as any).color();
mocha.timeout(0);

const testsRoot = path.resolve(__dirname, '..');
const testsRoot = path.resolve(__dirname, '../..');

return new Promise((c, e) => {
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
Expand Down

0 comments on commit 1067b16

Please sign in to comment.