diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-10-02 21:49:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-02 21:49:29 +0300 |
commit | e6395c6f44fb0fcf2d388dcf3aca8ee22c6d32f2 (patch) | |
tree | 8c5dcc0052cc54c7ae57947359aac59e7d444268 /test cases | |
parent | 829d7bf6f9c696b526c9c0f99635634389dd1b5d (diff) | |
parent | c4b885bfd18cda9578409fa67d986151b32e7afd (diff) | |
download | meson-e6395c6f44fb0fcf2d388dcf3aca8ee22c6d32f2.zip meson-e6395c6f44fb0fcf2d388dcf3aca8ee22c6d32f2.tar.gz meson-e6395c6f44fb0fcf2d388dcf3aca8ee22c6d32f2.tar.bz2 |
Merge pull request #4051 from GoaLitiuM/d-debug
D: Add conditional debug compilation flags
Diffstat (limited to 'test cases')
-rw-r--r-- | test cases/d/9 features/app.d | 24 | ||||
-rw-r--r-- | test cases/d/9 features/meson.build | 62 |
2 files changed, 85 insertions, 1 deletions
diff --git a/test cases/d/9 features/app.d b/test cases/d/9 features/app.d index 6b43bf0..05c56ca 100644 --- a/test cases/d/9 features/app.d +++ b/test cases/d/9 features/app.d @@ -41,6 +41,30 @@ void main (string[] args) exit (1); } } + + version (With_VersionInteger) + version(3) exit(0); + + version (With_Debug) + debug exit(0); + + version (With_DebugInteger) + debug(3) exit(0); + + version (With_DebugIdentifier) + debug(DebugIdentifier) exit(0); + + version (With_DebugAll) { + int dbg = 0; + debug dbg++; + debug(2) dbg++; + debug(3) dbg++; + debug(4) dbg++; + debug(DebugIdentifier) dbg++; + + if (dbg == 5) + exit(0); + } // we fail here exit (1); diff --git a/test cases/d/9 features/meson.build b/test cases/d/9 features/meson.build index 694e488..06f0341 100644 --- a/test cases/d/9 features/meson.build +++ b/test cases/d/9 features/meson.build @@ -1,4 +1,4 @@ -project('D Features', 'd') +project('D Features', 'd', default_options : ['debug=false']) # ONLY FOR BACKWARDS COMPATIBILITY. # DO NOT DO THIS IN NEW CODE! @@ -44,3 +44,63 @@ e_test = executable('dapp_test', d_unittest: true ) test('dapp_test', e_test) + +# test version level +e_version_int = executable('dapp_version_int', + test_src, + d_import_dirs: [data_dir], + d_module_versions: ['With_VersionInteger', 3], +) +test('dapp_version_int_t', e_version_int, args: ['debug']) + +# test version level failure +e_version_int_fail = executable('dapp_version_int_fail', + test_src, + d_import_dirs: [data_dir], + d_module_versions: ['With_VersionInteger', 2], +) +test('dapp_version_int_t_fail', e_version_int_fail, args: ['debug'], should_fail: true) + +# test debug conditions: disabled +e_no_debug = executable('dapp_no_debug', + test_src, + d_import_dirs: [data_dir], + d_module_versions: ['With_Debug'], +) +test('dapp_no_debug_t_fail', e_no_debug, args: ['debug'], should_fail: true) + +# test debug conditions: enabled +e_debug = executable('dapp_debug', + test_src, + d_import_dirs: [data_dir], + d_module_versions: ['With_Debug'], + d_debug: 1, +) +test('dapp_debug_t', e_debug, args: ['debug']) + +# test debug conditions: integer +e_debug_int = executable('dapp_debug_int', + test_src, + d_import_dirs: [data_dir], + d_module_versions: ['With_DebugInteger'], + d_debug: 3, +) +test('dapp_debug_int_t', e_debug_int, args: ['debug']) + +# test debug conditions: identifier +e_debug_ident = executable('dapp_debug_ident', + test_src, + d_import_dirs: [data_dir], + d_module_versions: ['With_DebugIdentifier'], + d_debug: 'DebugIdentifier', +) +test('dapp_debug_ident_t', e_debug_ident, args: ['debug']) + +# test with all debug conditions at once, and with redundant values +e_debug_all = executable('dapp_debug_all', + test_src, + d_import_dirs: [data_dir], + d_module_versions: ['With_DebugAll'], + d_debug: ['4', 'DebugIdentifier', 2, 'DebugIdentifierUnused'], +) +test('dapp_debug_all_t', e_debug_all, args: ['debug']) |