Skip to content

Instantly share code, notes, and snippets.

@ducaale
Created October 3, 2020 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ducaale/7e45415002ea858cb827627d476f1e9f to your computer and use it in GitHub Desktop.
Save ducaale/7e45415002ea858cb827627d476f1e9f to your computer and use it in GitHub Desktop.
PPXes I would like to see in OCaml/Reasonml
let add = (a, b) => a + b;
// modules with test attribute will be stripped from source in production mode
// running `esy test` should find and run all the functions inside test modules
[@test]
module Test {
[@desciption "1 + 1 is equal to 2"]
let test_1 = () => {
Assert.areEqual(2, add(1, 1));
}
[@description "2 + 2 is equal to 4"]
let test_2 = () => {
Assert.are_equal(4, add(2, 2));
}
};
// this will behave as python's `if __name__ == "__main__":`
[@entry_point]
let main = () => {
let a = 5;
a + 1;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment