From 640b680050836ddda6217eff1d70b860162e869a Mon Sep 17 00:00:00 2001 From: Pierre Chambart Date: Fri, 18 Mar 2016 12:20:56 +0100 Subject: [PATCH] Add test of for record evaluation order --- .../basic-more/record_evaluation_order.ml | 30 +++++++++++++++++++ .../record_evaluation_order.reference | 14 +++++++++ 2 files changed, 44 insertions(+) create mode 100644 testsuite/tests/basic-more/record_evaluation_order.ml create mode 100644 testsuite/tests/basic-more/record_evaluation_order.reference diff --git a/testsuite/tests/basic-more/record_evaluation_order.ml b/testsuite/tests/basic-more/record_evaluation_order.ml new file mode 100644 index 000000000..9eb67dc90 --- /dev/null +++ b/testsuite/tests/basic-more/record_evaluation_order.ml @@ -0,0 +1,30 @@ + +type r = + { a : unit; + b : int; + c : char; + d : float; } + +let r1 = + { + c = (print_endline "c1"; 'c'); + a = print_endline "a1"; + d = (print_endline "d1"; 1.); + b = (print_endline "b1"; 2); + } + +let r2 = + { + b = (print_endline "b2"; 2); + d = (print_endline "d2"; 1.); + a = print_endline "a2"; + c = (print_endline "c2"; 'c'); + } + +let r3 = + { (print_endline "default"; r1) with + d = (print_endline "d3"; 1.); + c = (print_endline "c3"; 'c'); + a = print_endline "a3"; + } + diff --git a/testsuite/tests/basic-more/record_evaluation_order.reference b/testsuite/tests/basic-more/record_evaluation_order.reference new file mode 100644 index 000000000..5fb68d8e0 --- /dev/null +++ b/testsuite/tests/basic-more/record_evaluation_order.reference @@ -0,0 +1,14 @@ +d1 +c1 +b1 +a1 +d2 +c2 +b2 +a2 +default +d3 +c3 +a3 + +All tests succeeded.