- 
                Notifications
    You must be signed in to change notification settings 
- Fork 689
Assert
        Mathias Rangel Wulff edited this page Jun 13, 2015 
        ·
        6 revisions
      
    Throws a javascript error if result of last operation is not equal to value (AlaSQL uses equalDeep() function for comparision)
Syntax:
    ASSERT [message,] value;For example:
    alasql('ASSERT 1');
    alasql('ASSERT “Wrong Value”, @[{a:1,b:”Odessa”}]');You can use AlaSQL ASSERT operator to test results of previous operation:
    ASSERT string | number | boolean | array | objectFor example:
    CREATE TABLE one (a INT);
    ASSERT 1;
    INSERT INTO one VALUES (1),(2),(3);
    ASSERT 3;
    SELECT * FROM one ORDER BY a DESC;
    ASSERT [{a:3},{a:2},{a:1}];ASSERT statement uses regular JSON notation for the object.
© 2014-2024, Andrey Gershun & Mathias Rangel Wulff
Please help improve the documentation by opening a PR on the wiki repo