From bba85e1fcd9b622ae3194eeaa199c0a07f1e7ee5 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 21 Jan 2025 13:52:08 +0000 Subject: [PATCH] tests: Factor out additional env vars mechanism Make the mechanism more general, so that other tests can now specify overrides for various defaults, if needed. This replicates what GLib does: https://gitlab.gnome.org/GNOME/glib/-/blob/main/glib/tests/meson.build#L475. It introduces no functional changes in how the current set of tests run. Signed-off-by: Philip Withnall Part-of: --- tests/meson.build | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/tests/meson.build b/tests/meson.build index 5395e03ab..7a09f3b83 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -19,29 +19,30 @@ unit_testenv.append('GI_TYPELIB_PATH', gvc_typelib_path, separator: ':') unit_testenv.append('GI_TYPELIB_PATH', shell_typelib_path, separator: ':') unit_testenv.append('GI_TYPELIB_PATH', st_typelib_path, separator: ':') -unit_tests = [ - 'breakManager', - 'extensionUtils', - 'highlighter', - 'injectionManager', - 'insertSorted', - 'jsParse', - 'markup', - 'params', - 'signalTracker', - 'timeLimitsManager', - 'url', - 'versionCompare', -] +unit_tests = { + 'breakManager': {}, + 'extensionUtils': {}, + 'highlighter': {}, + 'injectionManager': {}, + 'insertSorted': {}, + 'jsParse': {}, + 'markup': {}, + 'params': {}, + 'signalTracker': {}, + 'timeLimitsManager': { + # The time limits tests hard-code UTC to keep the code brief, so must be + # run in UTC + 'env': { 'TZ': 'UTC' }, + }, + 'url': {}, + 'versionCompare': {}, +} -foreach test : unit_tests +foreach test, extra_args : unit_tests local_test_env = unit_testenv - - # The time limits tests hard-code UTC to keep the code brief, so must be run - # in UTC - if test == 'timeLimitsManager' - local_test_env.set('TZ', 'UTC') - endif + foreach var, value : extra_args.get('env', {}) + local_test_env.append(var, value) + endforeach test(test, jasmine, args: [