Skip to content

Commit 28a8aa1

Browse files
committed
Rename fn and mod to testFunction and testModule
1 parent e904013 commit 28a8aa1

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

test/unit/classDecorator.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as util from "../util";
22
import { TSTLErrors } from "../../src/TSTLErrors";
33

44
test("Class decorator with no parameters", () => {
5-
util.fn`
5+
util.testFunction`
66
function SetBool<T extends { new(...args: any[]): {} }>(constructor: T) {
77
return class extends constructor {
88
decoratorBool = true;
@@ -20,7 +20,7 @@ test("Class decorator with no parameters", () => {
2020
});
2121

2222
test("Class decorator with parameters", () => {
23-
util.fn`
23+
util.testFunction`
2424
function SetNum(numArg: number) {
2525
return <T extends new(...args: any[]) => {}>(constructor: T) => {
2626
return class extends constructor {
@@ -40,7 +40,7 @@ test("Class decorator with parameters", () => {
4040
});
4141

4242
test("Class decorator with variable parameters", () => {
43-
util.fn`
43+
util.testFunction`
4444
function SetNumbers(...numArgs: number[]) {
4545
return <T extends new(...args: any[]) => {}>(constructor: T) => {
4646
return class extends constructor {
@@ -64,7 +64,7 @@ test("Class decorator with variable parameters", () => {
6464
});
6565

6666
test("Multiple class decorators", () => {
67-
util.fn`
67+
util.testFunction`
6868
function SetTen<T extends { new(...args: any[]): {} }>(constructor: T) {
6969
return class extends constructor {
7070
decoratorTen = 10;
@@ -92,7 +92,7 @@ test("Multiple class decorators", () => {
9292
});
9393

9494
test("Class decorator with inheritance", () => {
95-
util.fn`
95+
util.testFunction`
9696
function SetTen<T extends { new(...args: any[]): {} }>(constructor: T) {
9797
return class extends constructor {
9898
decoratorTen = 10;
@@ -122,7 +122,7 @@ test("Class decorator with inheritance", () => {
122122
});
123123

124124
test("Class decorators are applied in order and executed in reverse order", () => {
125-
util.fn`
125+
util.testFunction`
126126
const order = [];
127127
128128
function SetString(stringArg: string) {
@@ -168,7 +168,7 @@ test("Throws error if decorator function has void context", () => {
168168
});
169169

170170
test("Exported class decorator", () => {
171-
util.mod`
171+
util.testModule`
172172
function decorator<T extends any>(c: T): T {
173173
c.bar = "foobar";
174174
return c;

test/unit/loops.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ test.each([{ inp: [0, 1, 2, 3], expected: [1, 2, 3, 4] }])("forNoCondition (%p)"
171171
});
172172

173173
test("forNoPostExpression (%p)", () => {
174-
util.fn`
174+
util.testFunction`
175175
let arrTest = [0, 1, 2, 3];
176176
let i = 0;
177177
for (;;) {
@@ -197,7 +197,7 @@ test.each([
197197
{ inp: [0, 1, 2, 3], header: "let i = arrTest.length - 1; i >= 0; i -= 2" },
198198
{ inp: [0, 1, 2, 3], header: "let i = arrTest.length - 1; i > 0; i -= 2" },
199199
])("forheader (%p)", ({ inp, header }) => {
200-
util.fn`
200+
util.testFunction`
201201
let arrTest = ${JSON.stringify(inp)};
202202
for (${header}) {
203203
arrTest[i] = arrTest[i] + 1;
@@ -207,7 +207,7 @@ test.each([
207207
});
208208

209209
test("for scope", () => {
210-
util.fn`
210+
util.testFunction`
211211
let i = 42;
212212
for (let i = 0; i < 10; ++i) {}
213213
return i;

test/unit/require.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ test.each([
7474
])(
7575
"require paths root from --baseUrl or --rootDir (%p)",
7676
({ filePath, usedPath, expectedPath, options, throwsError }) => {
77-
const builder = util.mod`
77+
const builder = util.testModule`
7878
import * as module from "${usedPath}";
7979
module;
8080
`;
@@ -97,7 +97,7 @@ test.each([
9797
test.each([{ comment: "", expectedPath: "src.fake" }, { comment: "/** @noResolution */", expectedPath: "fake" }])(
9898
"noResolution on ambient modules causes no path alterations (%p)",
9999
({ comment, expectedPath }) => {
100-
const builder = util.mod`
100+
const builder = util.testModule`
101101
import * as fake from "fake";
102102
fake;
103103
`;

test/util.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -455,14 +455,14 @@ const templateFromValue = (valueOrTemplate: any): TemplateStringsArray =>
455455
? Object.assign([valueOrTemplate], { raw: [valueOrTemplate] })
456456
: valueOrTemplate;
457457

458-
export function fn(value: string): FunctionTestBuilder;
459-
export function fn(template: TemplateStringsArray, ...substitutions: any[]): FunctionTestBuilder;
460-
export function fn(valueOrTemplate: any, ...substitutions: any[]): FunctionTestBuilder {
458+
export function testFunction(value: string): FunctionTestBuilder;
459+
export function testFunction(template: TemplateStringsArray, ...substitutions: any[]): FunctionTestBuilder;
460+
export function testFunction(valueOrTemplate: any, ...substitutions: any[]): FunctionTestBuilder {
461461
return new FunctionTestBuilder(templateFromValue(valueOrTemplate), substitutions);
462462
}
463463

464-
export function mod(value: string): ModuleTestBuilder;
465-
export function mod(template: TemplateStringsArray, ...substitutions: any[]): ModuleTestBuilder;
466-
export function mod(valueOrTemplate: any, ...substitutions: any[]): ModuleTestBuilder {
464+
export function testModule(value: string): ModuleTestBuilder;
465+
export function testModule(template: TemplateStringsArray, ...substitutions: any[]): ModuleTestBuilder;
466+
export function testModule(valueOrTemplate: any, ...substitutions: any[]): ModuleTestBuilder {
467467
return new ModuleTestBuilder(templateFromValue(valueOrTemplate), substitutions);
468468
}

0 commit comments

Comments
 (0)