From 82226f71b164ed4d35cab7e1310184bdf167a20c Mon Sep 17 00:00:00 2001 From: Nathan Schneider Date: Tue, 3 Aug 2021 15:48:11 -0600 Subject: [PATCH] Added working test of nested poll function on CLI --- modpol/tests/nested_functions.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 modpol/tests/nested_functions.lua diff --git a/modpol/tests/nested_functions.lua b/modpol/tests/nested_functions.lua new file mode 100644 index 0000000..378cb42 --- /dev/null +++ b/modpol/tests/nested_functions.lua @@ -0,0 +1,24 @@ +dofile("../modpol.lua") + +print('\nRemoving existing orgs') +modpol.orgs.reset() + +print('\nCreating an org called "test_org"') +test_org = modpol.instance:add_org('test_org', 'luke') + +print('\nAdding user "nathan" to test_org') +test_org:add_member('nathan') + +print('\nTrying to remove user "nathan" from empty member list') +test_org:remove_member('nathan') + +print('\nInteractive test poll with nested functions...') +modpol.interactions.text_query( + "nathan","Poll question:", + function(input) + modpol.interactions.binary_poll_user( + "nathan", input, + function(response) + print("Poll successful!") + end) +end)