From 9a51af051ee038d298bf8881591fa2aafe90fb33 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 5 Apr 2018 12:33:15 +0800 Subject: [PATCH] Add tests for import defines --- .../test-cases/configurator/import-define/jbuild | 5 +++++ .../test-cases/configurator/import-define/run.ml | 15 +++++++++++++++ test/blackbox-tests/test-cases/configurator/run.t | 3 +++ 3 files changed, 23 insertions(+) create mode 100644 test/blackbox-tests/test-cases/configurator/import-define/jbuild create mode 100644 test/blackbox-tests/test-cases/configurator/import-define/run.ml diff --git a/test/blackbox-tests/test-cases/configurator/import-define/jbuild b/test/blackbox-tests/test-cases/configurator/import-define/jbuild new file mode 100644 index 000000000000..0f63b54a30c2 --- /dev/null +++ b/test/blackbox-tests/test-cases/configurator/import-define/jbuild @@ -0,0 +1,5 @@ +(jbuild_version 1) + +(executable + ((name run) + (libraries (jbuilder.configurator)))) diff --git a/test/blackbox-tests/test-cases/configurator/import-define/run.ml b/test/blackbox-tests/test-cases/configurator/import-define/run.ml new file mode 100644 index 000000000000..42a9ab20ada7 --- /dev/null +++ b/test/blackbox-tests/test-cases/configurator/import-define/run.ml @@ -0,0 +1,15 @@ +let () = + let module C_define = Configurator.C_define in + Configurator.main ~name:"c_test" (fun t -> + assert ( + C_define.import t + ~includes:["caml/config.h"] + [ "CAML_CONFIG_H", C_define.Type.Switch + ; "Page_log", C_define.Type.Int + ] = + [ "CAML_CONFIG_H", C_define.Value.Switch true + ; "Page_log", Int 12 + ] + ); + print_endline "Successfully import #define's" + ) diff --git a/test/blackbox-tests/test-cases/configurator/run.t b/test/blackbox-tests/test-cases/configurator/run.t index b72a34b92e24..9fbda06e1177 100644 --- a/test/blackbox-tests/test-cases/configurator/run.t +++ b/test/blackbox-tests/test-cases/configurator/run.t @@ -6,3 +6,6 @@ We're able to compile C program sucessfully $ jbuilder exec c_test/run.exe Successfully compiled c program +Importing #define's from code is successful + $ jbuilder exec import-define/run.exe + Successfully import #define's