diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2015-11-26 17:02:19 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2015-11-27 17:46:53 +0000 |
commit | 58a3969d885519c426a7c2aebe7f964e93c31cb8 (patch) | |
tree | ed46b767ce61b8173cf023850be90fd477120e4e /test/test-lace.compiler.lua | |
parent | 8474c27d9d3db37616bfd1c95158d03f9efcd2af (diff) | |
download | lace-58a3969d885519c426a7c2aebe7f964e93c31cb8.tar.gz |
lace.builtin: Pass the rule into builtin functions
This added the rule parameter after the exec_context parameter,
by extending the arguments list,
rather than changing the engine to pass the rule back into its callback,
so that user-defined rules aren't broken by getting an unexpected parameter.
Unfortunately this required renumbering all the unit tests' indexes.
Diffstat (limited to 'test/test-lace.compiler.lua')
-rw-r--r-- | test/test-lace.compiler.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/test/test-lace.compiler.lua b/test/test-lace.compiler.lua index 5c2f5c2..9eb7e99 100644 --- a/test/test-lace.compiler.lua +++ b/test/test-lace.compiler.lua @@ -83,9 +83,9 @@ function suite.no_unconditional_action() -- rule 2 should be an unconditional allow with 'Default behaviour' as the reason, -- let's check local r2a = result.rules[2].args - assert(r2a[1] == "allow", "Rule 2 should be an allow") - assert(r2a[2] == "Default behaviour", "Rule 2's reason should be 'Default behaviour'") - assert(#r2a[3] == 0, "Rule 2 should have no conditions") + assert(r2a[2] == "allow", "Rule 2 should be an allow") + assert(r2a[3] == "Default behaviour", "Rule 2's reason should be 'Default behaviour'") + assert(#r2a[4] == 0, "Rule 2 should have no conditions") end function suite.no_unconditional_action_default_deny() @@ -99,9 +99,9 @@ function suite.no_unconditional_action_default_deny() -- rule 3 should be an unconditional deny with 'Default behaviour' as the reason, -- let's check local r3a = result.rules[3].args - assert(r3a[1] == "deny", "Rule 3 should be a deny, despite last rule behind a deny") - assert(r3a[2] == "Default behaviour", "Rule 3's reason should be 'Default behaviour'") - assert(#r3a[3] == 0, "Rule 2 should have no conditions") + assert(r3a[2] == "deny", "Rule 3 should be a deny, despite last rule behind a deny") + assert(r3a[3] == "Default behaviour", "Rule 3's reason should be 'Default behaviour'") + assert(#r3a[4] == 0, "Rule 3 should have no conditions") end function suite.is_unconditional_action_default_deny() @@ -115,9 +115,9 @@ function suite.is_unconditional_action_default_deny() -- rule 2 should be an unconditional allow with 'stuff' as the reason -- let's check local r2a = result.rules[2].args - assert(r2a[1] == "allow", "Rule 2 should be an allow, despite default being deny") - assert(r2a[2] == "stuff", "Rule 2's reason should be 'stuff'") - assert(#r2a[3] == 0, "Rule 2 should have no conditions") + assert(r2a[2] == "allow", "Rule 2 should be an allow, despite default being deny") + assert(r2a[3] == "stuff", "Rule 2's reason should be 'stuff'") + assert(#r2a[4] == 0, "Rule 2 should have no conditions") end -- Now we set up a more useful context and use that going forward: |