[asterisk-commits] mjordan: testsuite/asterisk/trunk r3742 - /asterisk/trunk/tests/dialplan/conf...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 2 15:55:19 CDT 2013


Author: mjordan
Date: Thu May  2 15:55:17 2013
New Revision: 3742

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3742
Log:
Add a little GoSub snippet to the dialplan test

This nests 100 calls of GoSub and verifies that a variable
gets passed through the stack.

Modified:
    asterisk/trunk/tests/dialplan/configs/ast1/extensions.conf

Modified: asterisk/trunk/tests/dialplan/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/dialplan/configs/ast1/extensions.conf?view=diff&rev=3742&r1=3741&r2=3742
==============================================================================
--- asterisk/trunk/tests/dialplan/configs/ast1/extensions.conf (original)
+++ asterisk/trunk/tests/dialplan/configs/ast1/extensions.conf Thu May  2 15:55:17 2013
@@ -68,6 +68,9 @@
 	same => n,ExecIf($[${TestCounter} = 13]?Goto(aes,start,1))
 	same => n,ExecIf($[${TestCounter} = 14]?Goto(len,start,1))
 
+	' GoSub testing
+	same => n,ExecIf($[${TestCounter} = 24]?Goto(gosubtest,start,1))
+
 	; ---------------------------------------------------------------
 	; NOTE: Add additional dialplan tests before the
 	;       Goto(result_pass,1) statement
@@ -259,6 +262,26 @@
 	same => n,Goto(test,start,top)
 
 ; ------------------------------------------------------------------
+; GoSub, Return, LOCAL, LOCAL_PEEK
+; ------------------------------------------------------------------
+
+[gosubtest]
+exten => start,1,NoOp()
+	same => n,Set(GoSubCounter=1)
+	same => n,Gosub(gosubtest,subroutine,1(${GoSubCounter}))
+	same => n,GotoIf($[${GOSUB_RETVAL}=1]?test,start,top)
+	same => n,Goto(test,result_fail,1)
+
+exten => subroutine,1,NoOp()
+	same => n,Set(LocalCounter=${LOCAL(ARG1)})
+	same => n,Set(LocalCounter=${INC(LocalCounter)})
+	same => n,GotoIf($[${LocalCounter}=100]?return:continue)
+	same => n(return),Return(1)
+	same => n(continue),Gosub(1(${LocalCounter}))
+	same => n,GotoIf($[${GOSUB_RETVAL}=1]?return)
+	same => n,Return(0)
+
+; ------------------------------------------------------------------
 ; REPLACE()
 ; ------------------------------------------------------------------
 




More information about the asterisk-commits mailing list