changeset 14010:ed210f6b1d00 13.0

tests: util.roles: Don't error when loading but not running tests For example, when filtering tests by tag, the file will be executed but the tests won't, leading to 'roles' being nil (the first test loads the library).
author Matthew Wild <mwild1@gmail.com>
date Fri, 12 Dec 2025 11:31:04 +0000
parents 5ad86978ae78
children f77911437539
files spec/util_roles_spec.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/spec/util_roles_spec.lua	Fri Dec 05 17:53:10 2025 +0100
+++ b/spec/util_roles_spec.lua	Fri Dec 12 11:31:04 2025 +0000
@@ -80,8 +80,8 @@
 				assert.truthy(grandchild_role:may("inherited-permission"));
 			end);
 			describe("supports ordered inheritance from multiple roles", function ()
-				local parent_role = roles.new();
-				local final_role = roles.new({
+				local parent_role = roles and roles.new();
+				local final_role = roles and roles.new({
 					-- Yes, the names are getting confusing.
 					-- btw, test_role is inherited through child_role.
 					inherits = { parent_role, child_role };