[Asterisk-code-review] app_assert: Add Assert application (asterisk[master])

N A asteriskteam at digium.com
Sun Oct 24 11:23:17 CDT 2021


Attention is currently required from: Joshua Colp.
N A has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/16629 )

Change subject: app_assert: Add Assert application
......................................................................


Patch Set 2:

(1 comment)

Patchset:

PS1: 
> Most individuals writing dialplan or looking at it would not know what assert() means in C. […]
Okay, well people doing test cases and other testing in the dialplan would use it in a way similar to assert() in C. Serious programmers will know what it is intuitively from the name, I'm not expecting newbies to verify correctness of their dialplan, it's mainly for more complicated environments.
There already are applications like RaiseException(), so this is along the same theme as that.

Test suite was just a thought, but not why I wrote it. Although, the "d" option to Assert makes it not hang up when it encounters a failure, so if it weren't for the AMI bit it still seems like that would be a lot simpler.

FWIW, I tried doing it as you mentioned, using Log/ExecIf/GotoIf/Hangup and it just doesn't scale well. It gets very messy very quickly. My dialplan is tens of thousands of lines long, and it isn't feasible to clutter things up with branching and conditionals everywhere for verifying things are as they should be, so this is a very lightweight and simple way to do that that semantically makes sense in the dialplan, similar to RaiseException(). This makes it cheap and a lot more practical to catch bugs and ensure correctness *before* things go wrong.



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16629
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ia089c2debf608f42f5f87e6c29d50e8ebcc093e5
Gerrit-Change-Number: 16629
Gerrit-PatchSet: 2
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-CC: Joshua Colp <jcolp at sangoma.com>
Gerrit-Attention: Joshua Colp <jcolp at sangoma.com>
Gerrit-Comment-Date: Sun, 24 Oct 2021 16:23:17 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Joshua Colp <jcolp at sangoma.com>
Comment-In-Reply-To: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20211024/7a12e45a/attachment-0001.html>


More information about the asterisk-code-review mailing list