You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: testsuites/lbt-plutus/lbt-plutus-typescript/src/Utils.ts
+23-8Lines changed: 23 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,14 @@ import * as Fs from "node:fs/promises";
4
4
import*asPathfrom"node:path";
5
5
6
6
// WARNING(jaredponn): {@link findGoldens} and {@link fromToGoldenTest} are
7
-
// essentially duplicated code (well minor generalizations) of the same testing functions in
7
+
// essentially duplicated code (well minor generalizations) of the same testing
8
+
// functions in the lbt-prelude testsuite.
8
9
9
10
/**
10
11
/* @param goldenDir: directory for the golden files
11
12
/* @param regexFileFilter: see {@link RegExpFileFilter}.
13
+
*
14
+
/* @returns Tuple of [path to golden file, the resulting "regexFileFilter"ed file]
12
15
*/
13
16
exportasyncfunctionfindGoldens(
14
17
goldenDir: string,
@@ -61,6 +64,13 @@ export class RegExpFileFilter {
61
64
}
62
65
}
63
66
67
+
/**
68
+
* Runs golden tests in the provided `goldenDir` which satisfy the
69
+
* `regexFileFilter` where the test passes if `assertGolden` does not throw an
70
+
* exception. Note that `goldens` is essentially unused and is only used to
71
+
* warn if the number of the TS representation of equivalent HS generated tests
72
+
* match.
73
+
*/
64
74
exportasyncfunctionfromToGoldenTest<A>(
65
75
goldenDir: string,
66
76
regexFileFilter: RegExpFileFilter,
@@ -78,26 +88,31 @@ export async function fromToGoldenTest<A>(
78
88
79
89
if(foundGoldens.length!==goldens.length){
80
90
consterrMsg=
81
-
`lbt-plutus-typescript: warning: expected to find ${goldens.length} golden files for ${regexFileFilter} in ${goldenDir}, but got ${foundGoldens.length}. Forgot to (re)generate the goldens? Or there is a mismatch between the TS goldens and generated Haskell goldens`;
91
+
`lbt-plutus-typescript: warning: expected to find ${goldens.length} golden files for ${regexFileFilter} in ${goldenDir}, but got ${foundGoldens.length}. Forgot to (re)generate the goldens? Or there is a mismatch in the number of TS goldens and generated Haskell goldens`;
82
92
console.warn(errMsg);// TODO(jaredponn): apparently there is a mismatch between the TS goldens
83
-
// and the HS goldens.. The HS script apparently only likes outputting 10
84
-
// golden tests when there are clearly more for things like e.g.
85
-
// PlutusData.
93
+
// and the HS goldens.. The HS script apparently only likes outputting at most 10
94
+
// golden tests when there are clearly more tests (e.g.
95
+
// PlutusData has many more tests than just 10)
86
96
// One day, add this back in the future:
87
97
// ```
88
98
// assert.fail(errMsg)
89
99
// ```
100
+
// Note this doesn't actually effect the correctness of the tests.
0 commit comments