-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc improvements better docs rename exists to isSomeAnd like Rust changelog
- Loading branch information
Showing
8 changed files
with
192 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Generated by ReScript, PLEASE EDIT WITH CARE | ||
|
||
import * as Test from "./Test.mjs"; | ||
import * as Caml_obj from "rescript/lib/es6/caml_obj.js"; | ||
import * as Core__Option from "../src/Core__Option.mjs"; | ||
|
||
var eq = Caml_obj.equal; | ||
|
||
function isPositive(i) { | ||
return i > 0; | ||
} | ||
|
||
Test.run([ | ||
[ | ||
"OptionTests.res", | ||
12, | ||
13, | ||
47 | ||
], | ||
"isSomeAnd: if None, return false" | ||
], Core__Option.isSomeAnd(undefined, isPositive), eq, false); | ||
|
||
Test.run([ | ||
[ | ||
"OptionTests.res", | ||
19, | ||
13, | ||
55 | ||
], | ||
"isSomeAnd: if Some and true, return true" | ||
], Core__Option.isSomeAnd(1, isPositive), eq, true); | ||
|
||
Test.run([ | ||
[ | ||
"OptionTests.res", | ||
25, | ||
13, | ||
57 | ||
], | ||
"isSomeAnd: if Some and false, return false" | ||
], Core__Option.isSomeAnd(-1, isPositive), eq, false); | ||
|
||
Test.run([ | ||
[ | ||
"OptionTests.res", | ||
31, | ||
20, | ||
52 | ||
], | ||
"isNoneOr: if None, return true" | ||
], Core__Option.isNoneOr(undefined, isPositive), eq, true); | ||
|
||
Test.run([ | ||
[ | ||
"OptionTests.res", | ||
33, | ||
13, | ||
54 | ||
], | ||
"isNoneOr: if Some and true, return true" | ||
], Core__Option.isNoneOr(1, isPositive), eq, true); | ||
|
||
Test.run([ | ||
[ | ||
"OptionTests.res", | ||
39, | ||
13, | ||
56 | ||
], | ||
"isNoneOr: if Some and false, return false" | ||
], Core__Option.isNoneOr(-1, isPositive), eq, false); | ||
|
||
export { | ||
eq , | ||
isPositive , | ||
} | ||
/* Not a pure module */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
open RescriptCore | ||
|
||
let eq = (a, b) => a == b | ||
|
||
// ====================== | ||
// isSomeAnd and isNoneOr | ||
// ====================== | ||
|
||
let isPositive = i => i > 0 | ||
|
||
Test.run( | ||
__POS_OF__("isSomeAnd: if None, return false"), | ||
None->Option.isSomeAnd(isPositive), | ||
eq, | ||
false, | ||
) | ||
|
||
Test.run( | ||
__POS_OF__("isSomeAnd: if Some and true, return true"), | ||
Some(1)->Option.isSomeAnd(isPositive), | ||
eq, | ||
true, | ||
) | ||
Test.run( | ||
__POS_OF__("isSomeAnd: if Some and false, return false"), | ||
Some(-1)->Option.isSomeAnd(isPositive), | ||
eq, | ||
false, | ||
) | ||
|
||
Test.run(__POS_OF__("isNoneOr: if None, return true"), None->Option.isNoneOr(isPositive), eq, true) | ||
Test.run( | ||
__POS_OF__("isNoneOr: if Some and true, return true"), | ||
Some(1)->Option.isNoneOr(isPositive), | ||
eq, | ||
true, | ||
) | ||
Test.run( | ||
__POS_OF__("isNoneOr: if Some and false, return false"), | ||
Some(-1)->Option.isNoneOr(isPositive), | ||
eq, | ||
false, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ include ArrayTests | |
include IntTests | ||
include ResultTests | ||
include TypedArrayTests | ||
include OptionTests |