{"route":"/en-US-v0.13.1/reference/foundations/assert/","title":"Assert","description":"Documentation for the `assert` function.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"example","name":"Example","children":[]},{"id":"parameters","name":"Parameters","children":[{"id":"parameters-condition","name":"condition","children":[]},{"id":"parameters-message","name":"message","children":[]}]},{"id":"definitions","name":"Definitions","children":[{"id":"definitions-eq","name":"Assert Equal","children":[{"id":"definitions-eq-left","name":"left","children":[]},{"id":"definitions-eq-right","name":"right","children":[]},{"id":"definitions-eq-message","name":"message","children":[]}]},{"id":"definitions-ne","name":"Assert Not Equal","children":[{"id":"definitions-ne-left","name":"left","children":[]},{"id":"definitions-ne-right","name":"right","children":[]},{"id":"definitions-ne-message","name":"message","children":[]}]}]}],"body":{"kind":"func","content":{"path":[],"name":"assert","title":"Assert","keywords":[],"oneliner":"Ensures that a condition is fulfilled.","element":false,"contextual":false,"deprecation":null,"details":"<p>Ensures that a condition is fulfilled.</p>\n<p>Fails with an error if the condition is not fulfilled. Does not\nproduce any output in the document.</p>\n<p>If you wish to test equality between two values, see\n<a href=\"/en-US-v0.13.1/reference/foundations/assert/#definitions-eq\"><code>assert.eq</code></a> and <a href=\"/en-US-v0.13.1/reference/foundations/assert/#definitions-ne\"><code>assert.ne</code></a>.</p>\n<h2 id=\"example\">Example</h2>\n<pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">assert</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">1</span> <span class=\"typ-op\">&lt;</span> <span class=\"typ-num\">2</span><span class=\"typ-punct\">,</span> message<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;math broke&quot;</span><span class=\"typ-punct\">)</span>\n</code></pre>","example":null,"self":false,"params":[{"name":"condition","details":"<p>The condition that must be true for the assertion to pass.</p>","example":null,"types":["bool"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"message","details":"<p>The error message when the assertion fails.</p>","example":null,"types":["str"],"strings":[],"default":null,"positional":false,"named":true,"required":false,"variadic":false,"settable":false}],"returns":[],"scope":[{"path":["assert"],"name":"eq","title":"Assert Equal","keywords":[],"oneliner":"Ensures that two values are equal.","element":false,"contextual":false,"deprecation":null,"details":"<p>Ensures that two values are equal.</p>\n<p>Fails with an error if the first value is not equal to the second. Does not\nproduce any output in the document.</p>","example":"<pre><code><span class=\"typ-pol\">#</span><span class=\"typ-pol\">assert</span><span class=\"typ-punct\">.</span><span class=\"typ-func\">eq</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">10</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">10</span><span class=\"typ-punct\">)</span>\n</code></pre>","self":false,"params":[{"name":"left","details":"<p>The first value to compare.</p>","example":null,"types":["any"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"right","details":"<p>The second value to compare.</p>","example":null,"types":["any"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"message","details":"<p>An optional message to display on error instead of the representations\nof the compared values.</p>","example":null,"types":["str"],"strings":[],"default":null,"positional":false,"named":true,"required":false,"variadic":false,"settable":false}],"returns":[],"scope":[]},{"path":["assert"],"name":"ne","title":"Assert Not Equal","keywords":[],"oneliner":"Ensures that two values are not equal.","element":false,"contextual":false,"deprecation":null,"details":"<p>Ensures that two values are not equal.</p>\n<p>Fails with an error if the first value is equal to the second. Does not\nproduce any output in the document.</p>","example":"<pre><code><span class=\"typ-pol\">#</span><span class=\"typ-pol\">assert</span><span class=\"typ-punct\">.</span><span class=\"typ-func\">ne</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">3</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">4</span><span class=\"typ-punct\">)</span>\n</code></pre>","self":false,"params":[{"name":"left","details":"<p>The first value to compare.</p>","example":null,"types":["any"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"right","details":"<p>The second value to compare.</p>","example":null,"types":["any"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"message","details":"<p>An optional message to display on error instead of the representations\nof the compared values.</p>","example":null,"types":["str"],"strings":[],"default":null,"positional":false,"named":true,"required":false,"variadic":false,"settable":false}],"returns":[],"scope":[]}]}}}