Skip to content
agershun edited this page Dec 28, 2014 · 6 revisions

ASSERT

Throws error if result of last operation is not equal to value (Alasql uses equalDeep() function for comparision)

    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 | object

For 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.

Clone this wiki locally