Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

#### :house: Internal

- Forward-port integer range pattern regression coverage from v12 to v13. https://github.com/rescript-lang/rescript/pull/8718
- Remove the unused `res.iflet` encoding of `if let`, which the parser always rejects with a syntax error suggesting a `switch`. The error is unchanged. https://github.com/rescript-lang/rescript/pull/8741
- Represent variant spread patterns (`...t`) with a dedicated `Ppat_variant_spread` parsetree node instead of `Ppat_type` with a `res.patVariantSpread` attribute, which remains only in the PPX wire representation. https://github.com/rescript-lang/rescript/pull/8742
- Remove the obsolete `res.ternary` and `JSX` attributes from the formatter's internal attribute filters and merge the filters into one. https://github.com/rescript-lang/rescript/pull/8740
Expand Down
36 changes: 36 additions & 0 deletions tests/tests/src/or_pattern_int_range_test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Generated by ReScript, PLEASE EDIT WITH CARE

import * as Mocha from "mocha";
import * as Test_utils from "./test_utils.mjs";

function isRetriable(error) {
let match = error.status;
return !(match > 504 || match < 502);
}

Mocha.describe("Or_pattern_int_range_test", () => {
Mocha.test("int range on record field", () => Test_utils.eq("File \"or_pattern_int_range_test.res\", line 15, characters 6-13", [
404,
500,
501,
502,
503,
504,
505
].map(status => isRetriable({
status: status
})), [
false,
false,
false,
true,
true,
true,
false
]));
});

export {
isRetriable,
}
/* Not a pure module */
20 changes: 20 additions & 0 deletions tests/tests/src/or_pattern_int_range_test.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
open Mocha
open Test_utils

type response = {status: int}

let isRetriable = error =>
switch error {
| {status: 502 | 503 | 504} => true
| _ => false
}

describe(__MODULE__, () => {
test("int range on record field", () => {
eq(
__LOC__,
[404, 500, 501, 502, 503, 504, 505]->Array.map(status => isRetriable({status: status})),
[false, false, false, true, true, true, false],
)
})
})
Loading