• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/tests/custom/03_stdlib/42_assert

  1 The `assert()` function raises an exception using the second argument as
  2 message when the first argument value is not truish.
  3 
  4 Throws an exception if the first argument value is not truish.
  5 
  6 Returns the value of the first argument.
  7 
  8 -- Testcase --
  9 {%
 10         let x = assert(123, "This should not trigger");
 11         printf("x = %d\n", x);
 12 
 13         let y = assert(false, "This should trigger");
 14         printf("y = %d\n", y);
 15 %}
 16 -- End --
 17 
 18 -- Expect stdout --
 19 x = 123
 20 -- End --
 21 
 22 -- Expect stderr --
 23 This should trigger
 24 In line 5, byte 45:
 25 
 26  `    let y = assert(false, "This should trigger");`
 27   Near here -------------------------------------^
 28 
 29 
 30 -- End --

This page was automatically generated by LXR 0.3.1.  •  OpenWrt