Skip to content

Commit b339573

Browse files
aspeddrocknitt
authored andcommitted
order output
1 parent 92fc1ce commit b339573

File tree

4 files changed

+27685
-27674
lines changed

4 files changed

+27685
-27674
lines changed

tests/docstrings_examples/DocTest.res

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ let extractExamples = async () => {
155155

156156
let main = async () => {
157157
let examples = await extractExamples()
158+
examples->Array.sort((a, b) =>
159+
String.length(a.id) > String.length(b.id) ? Ordering.fromInt(1) : Ordering.fromInt(-1)
160+
)
158161
let testsContent =
159162
examples
160163
->Array.filterMap(example => {

tests/docstrings_examples/DocTest.res.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as List from "rescript/lib/es6/List.js";
88
import * as Path from "path";
99
import * as $$Array from "rescript/lib/es6/Array.js";
1010
import * as $$Error from "rescript/lib/es6/Error.js";
11+
import * as Ordering from "rescript/lib/es6/Ordering.js";
1112
import * as Belt_List from "rescript/lib/es6/Belt_List.js";
1213
import * as ArrayUtils from "./ArrayUtils.res.mjs";
1314
import * as Belt_Array from "rescript/lib/es6/Belt_Array.js";
@@ -214,6 +215,13 @@ async function extractExamples() {
214215

215216
async function main() {
216217
let examples = await extractExamples();
218+
examples.sort((a, b) => {
219+
if (a.id.length > b.id.length) {
220+
return Ordering.fromInt(1);
221+
} else {
222+
return Ordering.fromInt(-1);
223+
}
224+
});
217225
let testsContent = $$Array.filterMap(examples, example => {
218226
let codeExamples = getCodeBlocks(example);
219227
let ignore = ignoreRuntimeTests.includes(example.id);

0 commit comments

Comments
 (0)