[asterisk-commits] mjordan: testsuite/asterisk/trunk r5196 - /asterisk/trunk/tests/pbx/dialplan/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 27 08:59:03 CDT 2014


Author: mjordan
Date: Fri Jun 27 08:58:58 2014
New Revision: 5196

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5196
Log:
pbx/dialplan: Add While/ContinueWhile/ExitWhile and Exec/TryExec tests

This patch enhances the existing dialplan test to cover the While/ContinueWhile
/ExitWhile dialplan applications, as well as the Exec/TryExec dialplan
applications.

Review: https://reviewboard.asterisk.org/r/3682/

ASTERISK-23854 #close
Reported by: Matt Jordan
patches:
  rb3682.patch uploaded by tcambron (License 6611) 

ASTERISK-23890 #close
Reported by: Matt Jordan
patches:
  rb3682.patch uploaded by tcambron (License 6611)

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

Modified: asterisk/trunk/tests/pbx/dialplan/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/dialplan/configs/ast1/extensions.conf?view=diff&rev=5196&r1=5195&r2=5196
==============================================================================
--- asterisk/trunk/tests/pbx/dialplan/configs/ast1/extensions.conf (original)
+++ asterisk/trunk/tests/pbx/dialplan/configs/ast1/extensions.conf Fri Jun 27 08:58:58 2014
@@ -68,8 +68,18 @@
 	same => n,ExecIf($[${TestCounter} = 13]?Goto(aes,start,1))
 	same => n,ExecIf($[${TestCounter} = 14]?Goto(len,start,1))
 
-	' GoSub testing
+	; GoSub testing
 	same => n,ExecIf($[${TestCounter} = 24]?Goto(gosubtest,start,1))
+
+	; While loop testing
+	same => n,ExecIf($[${TestCounter} = 25]?Goto(whiletest,continue_while,1))
+	same => n,ExecIf($[${TestCounter} = 26]?Goto(whiletest,exit_while,1))
+	same => n,ExecIf($[${TestCounter} = 27]?Goto(whiletest,while,1))
+
+	; Exec/TryExec testing
+	same => n,ExecIf($[${TestCounter} = 28]?Goto(exectests,exec,1))
+	same => n,ExecIf($[${TestCounter} = 29]?Goto(exectests,try_noapp,1))
+	same => n,ExecIf($[${TestCounter} = 30]?Goto(exectests,try_pass,1))
 
 	; ---------------------------------------------------------------
 	; NOTE: Add additional dialplan tests before the
@@ -325,3 +335,48 @@
 ; While / ExitWhile
 ; ------------------------------------------------------------------
 
+[whiletest]
+exten => continue_while,1,NoOp()
+	same => n,Set(Count=0)
+	same => n,While($[${Count} < 15])
+	same => n,Set(Count=${INC(Count)})
+	same => n,ContinueWhile()
+	same => n,Log(ERROR, Execution continued past ContinueWhile)
+	same => n,Goto(test,result_fail,1)
+	same => n,EndWhile()
+	same => n,GotoIf($[${Count} != 15]?test,result_fail,1:test,start,top)
+
+exten => exit_while,1,NoOp()
+	same => n,Set(Count=0)
+	same => n,While($[${Count} < 15])
+	same => n,Set(Count=${INC(Count)})
+	same => n,ExitWhile()
+	same => n,Log(ERROR, Execution continued past ExitWhile)
+	same => n,Goto(test,result_fail,1)
+	same => n,EndWhile()
+	same => n,GotoIf($[${Count} != 1]?test,result_fail,1:test,start,top)
+
+exten => while,1,NoOp()
+	same => n,Set(Count=0)
+	same => n,While($[${Count} < 15])
+	same => n,Set(Count=${INC(Count)})
+	same => n,EndWhile()
+	same => n,GotoIf($[${Count} != 15]?test,result_fail,1:test,start,top)
+
+; ------------------------------------------------------------------
+; Exec / TryExec
+; ------------------------------------------------------------------
+
+[exectests]
+exten => exec,1,NoOp()
+	same => n,Set(Check=0)
+	same => n,Exec(GotoIf($[${Check} = 0]?test,start,top:test,result_fail,1))
+
+exten => try_noapp,1,NoOp()
+	same => n,TryExec(NoSuchApp())
+	same => n,GotoIf($[${TRYSTATUS} = NOAPP]?test,start,top:test,result_fail,1)
+
+exten => try_pass,1,NoOp()
+	same => n,TryExec(GotoIF(false_arg))
+	same => n,GotoIf($[${TRYSTATUS} != SUCCESS]?test,result_fail,1:test,start,top)
+




More information about the asterisk-commits mailing list