From 1646b54a3d68541bf3d75bd0c61506fd7d0f8afc Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Mon, 3 Apr 2023 12:47:28 +0200 Subject: [PATCH] Test genType. --- bsconfig.json | 1 + test/ArrayTests.gen.tsx | 9 ++++++++ test/ArrayTests.mjs | 51 ++++++++++++++++++++++------------------- test/ArrayTests.res | 5 +++- test/TestSuite.mjs | 3 +++ 5 files changed, 44 insertions(+), 25 deletions(-) create mode 100644 test/ArrayTests.gen.tsx diff --git a/bsconfig.json b/bsconfig.json index 43a69503..57f52eba 100644 --- a/bsconfig.json +++ b/bsconfig.json @@ -17,6 +17,7 @@ "module": "es6", "in-source": true }, + "gentypeconfig": {}, "warnings": { "error": "+101" } diff --git a/test/ArrayTests.gen.tsx b/test/ArrayTests.gen.tsx new file mode 100644 index 00000000..2a8bbed4 --- /dev/null +++ b/test/ArrayTests.gen.tsx @@ -0,0 +1,9 @@ +/* TypeScript file generated from ArrayTests.res by genType. */ +/* eslint-disable import/first */ + + +// @ts-ignore: Implicit any on import +import * as ArrayTestsBS__Es6Import from './ArrayTests.mjs'; +const ArrayTestsBS: any = ArrayTestsBS__Es6Import; + +export const a: number[] = ArrayTestsBS.a; diff --git a/test/ArrayTests.mjs b/test/ArrayTests.mjs index 7cc4a4c6..aa1a62e6 100644 --- a/test/ArrayTests.mjs +++ b/test/ArrayTests.mjs @@ -7,15 +7,17 @@ import * as Core__Array from "../src/Core__Array.mjs"; var eq = Caml_obj.equal; +var a = Core__Array.make(6, 7); + Test.run([ [ "ArrayTests.res", - 5, + 8, 20, 26 ], "make" - ], Core__Array.make(6, 7), eq, [ + ], a, eq, [ 7, 7, 7, @@ -27,7 +29,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 8, + 11, 13, 30 ], @@ -47,7 +49,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 14, + 17, 20, 28 ], @@ -70,7 +72,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 15, + 18, 20, 36 ], @@ -80,7 +82,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 18, + 21, 13, 30 ], @@ -108,7 +110,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 24, + 27, 13, 38 ], @@ -123,7 +125,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 31, + 34, 13, 26 ], @@ -146,7 +148,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 36, + 39, 20, 41 ], @@ -156,7 +158,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 39, + 42, 13, 35 ], @@ -184,7 +186,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 45, + 48, 13, 38 ], @@ -199,7 +201,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 51, + 54, 20, 38 ], @@ -219,7 +221,7 @@ var arr = [ Test.run([ [ "ArrayTests.res", - 54, + 57, 13, 38 ], @@ -229,7 +231,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 65, + 68, 13, 24 ], @@ -255,7 +257,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 70, + 73, 20, 42 ], @@ -274,7 +276,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 72, + 75, 13, 32 ], @@ -289,7 +291,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 78, + 81, 20, 30 ], @@ -306,7 +308,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 80, + 83, 13, 34 ], @@ -324,7 +326,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 85, + 88, 20, 41 ], @@ -338,7 +340,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 86, + 89, 20, 38 ], @@ -348,7 +350,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 89, + 92, 13, 22 ], @@ -370,7 +372,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 94, + 97, 20, 40 ], @@ -389,7 +391,7 @@ Test.run([ Test.run([ [ "ArrayTests.res", - 96, + 99, 13, 30 ], @@ -403,5 +405,6 @@ Test.run([ export { eq , + a , } -/* Not a pure module */ +/* a Not a pure module */ diff --git a/test/ArrayTests.res b/test/ArrayTests.res index 40c352f7..1aea8ab7 100644 --- a/test/ArrayTests.res +++ b/test/ArrayTests.res @@ -2,7 +2,10 @@ open RescriptCore let eq = (a, b) => a == b -Test.run(__POS_OF__("make"), Array.make(~length=6, 7), eq, [7, 7, 7, 7, 7, 7]) +@genType +let a = Array.make(~length=6, 7) + +Test.run(__POS_OF__("make"), a, eq, [7, 7, 7, 7, 7, 7]) Test.run( __POS_OF__("fromInitializer"), diff --git a/test/TestSuite.mjs b/test/TestSuite.mjs index 2085495e..b0bb041c 100644 --- a/test/TestSuite.mjs +++ b/test/TestSuite.mjs @@ -27,6 +27,8 @@ var Concurrently = PromiseTest.Concurrently; var panicTest = ErrorTests.panicTest; +var a = ArrayTests.a; + var $$catch = IntTests.$$catch; var eq = ResultTests.eq; @@ -46,6 +48,7 @@ export { Catching , Concurrently , panicTest , + a , $$catch , eq , forEachIfOkCallFunction ,