Skip to content

Commit 3500728

Browse files
cknittaspeddro
andauthored
Add docstring tests (rescript-lang#7219)
Co-authored-by: Pedro Castro <aspeddro@gmail.com>
1 parent bc4b7f4 commit 3500728

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2006
-601
lines changed

CHANGELOG.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
1313
# 12.0.0-alpha.7 (Unreleased)
1414

15+
#### :nail_care: Polish
16+
17+
- Add all standard CSS properties to `JsxDOMStyle`. https://github.com/rescript-lang/rescript/pull/7205
18+
1519
#### :house: Internal
1620

1721
- AST cleanup: use inline record for Pexp_fun. https://github.com/rescript-lang/rescript/pull/7213
1822
- Add support for "dot completion everywhere" (Ported from https://github.com/rescript-lang/rescript-vscode/pull/1054). https://github.com/rescript-lang/rescript/pull/7226
19-
20-
#### :nail_care: Polish
21-
22-
- Add all standard CSS properties to `JsxDOMStyle`. https://github.com/rescript-lang/rescript/pull/7205
23+
- Add assertions to stdlib docstring examples. Extract examples into Mocha tests, compile and run the tests in CI. https://github.com/rescript-lang/rescript/pull/7219
2324

2425
# 12.0.0-alpha.6
2526

biome.json

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"tests/tests/**",
2626
"tests/tools_tests/**",
2727
"tests/analysis_tests/**",
28+
"tests/docstring_tests/**",
2829
"analysis/examples/**",
2930
"analysis/reanalyze/examples/**",
3031
"lib/**",

lib/es6/Pervasives.js

+17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22

33
import * as $$Error from "./Error.js";
4+
import * as Primitive_object from "./Primitive_object.js";
45
import * as Primitive_exceptions from "./Primitive_exceptions.js";
56

67
function failwith(s) {
@@ -116,6 +117,21 @@ function $at(l1, l2) {
116117
}
117118
}
118119

120+
function assertEqual(a, b) {
121+
if (!Primitive_object.notequal(a, b)) {
122+
return;
123+
}
124+
throw {
125+
RE_EXN_ID: "Assert_failure",
126+
_1: [
127+
"Pervasives.res",
128+
596,
129+
4
130+
],
131+
Error: new Error()
132+
};
133+
}
134+
119135
let max_int = 2147483647;
120136

121137
let infinity = Infinity;
@@ -151,5 +167,6 @@ export {
151167
int_of_string_opt,
152168
$at,
153169
panic,
170+
assertEqual,
154171
}
155172
/* No side effect */

lib/js/Pervasives.js

+17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
let $$Error = require("./Error.js");
4+
let Primitive_object = require("./Primitive_object.js");
45
let Primitive_exceptions = require("./Primitive_exceptions.js");
56

67
function failwith(s) {
@@ -116,6 +117,21 @@ function $at(l1, l2) {
116117
}
117118
}
118119

120+
function assertEqual(a, b) {
121+
if (!Primitive_object.notequal(a, b)) {
122+
return;
123+
}
124+
throw {
125+
RE_EXN_ID: "Assert_failure",
126+
_1: [
127+
"Pervasives.res",
128+
596,
129+
4
130+
],
131+
Error: new Error()
132+
};
133+
}
134+
119135
let max_int = 2147483647;
120136

121137
let infinity = Infinity;
@@ -150,4 +166,5 @@ exports.bool_of_string_opt = bool_of_string_opt;
150166
exports.int_of_string_opt = int_of_string_opt;
151167
exports.$at = $at;
152168
exports.panic = panic;
169+
exports.assertEqual = assertEqual;
153170
/* No side effect */

0 commit comments

Comments
 (0)