Add tests for import defines

This commit is contained in:
Rudi Grinberg 2018-04-05 12:33:15 +08:00
parent fb8d400165
commit 148835967e
3 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,5 @@
(jbuild_version 1)
(executable
((name run)
(libraries (jbuilder.configurator))))

View File

@ -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"
)

View File

@ -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