Skip to content

Commit 2beeebb

Browse files
Add type 'Macros', Move tests with macros below standard tests
1 parent df4c368 commit 2beeebb

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

types/base.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,9 @@ export interface Macro<I, E, T> {
124124
(t: T, input: I, expected: E): void;
125125
title? (providedTitle: string, input: I, expected: E): string;
126126
}
127+
export type Macros<I, E, T> = Macro<I, E, T> | Macro<I, E, T>[];
127128

128129
export function test(name: string, run: ContextualTest): void;
129130
export function test(run: ContextualTest): void;
130-
export function test<I, E> (run: Macro<I, E, ContextualTestContext> | Macro<I, E, ContextualTestContext>[], input: I, expected: E): void;
131-
export function test<I, E> (name: string, run: Macro<I, E, ContextualTestContext> | Macro<I, E, ContextualTestContext>[], input: I, expected: E): void;
131+
export function test<I, E> (name: string, run: Macros<I, E, ContextualTestContext>, input: I, expected: E): void;
132+
export function test<I, E> (run: Macros<I, E, ContextualTestContext>, input: I, expected: E): void;

types/make.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ function generatePrefixed(prefix) {
5151
output += '\t' + writeFunction(part, 'name: string', 'void');
5252
} else {
5353
const type = testType(parts);
54-
output += '\t' + writeFunction(part + '<I, E>', 'implementation: Macro<I, E, ' + type + 'Context>, input: I, expected: E');
55-
output += '\t' + writeFunction(part + '<I, E>', 'name: string, implementation: Macro<I, E, ' + type + 'Context>, input: I, expected: E');
5654
output += '\t' + writeFunction(part, 'name: string, implementation: ' + type);
5755
output += '\t' + writeFunction(part, 'implementation: ' + type);
56+
output += '\t' + writeFunction(part + '<I, E>', 'name: string, implementation: Macros<I, E, ' + type + 'Context>, input: I, expected: E');
57+
output += '\t' + writeFunction(part + '<I, E>', 'implementation: Macros<I, E, ' + type + 'Context>, input: I, expected: E');
5858
}
5959
}
6060

0 commit comments

Comments
 (0)