index Zimbu documentation

MODULE TEST @public

summary

     

Methods for running tests and checking for success.

string  previousFileName @public 
int  testCount @public 
int  failCount @public 
int  fileTestCount @public 
int  fileFailCount @public 
 
reportFile() @public 
fail(msg) @public  Logs error msg always.
true(actual, msg) @public  Logs an error when actual is FALSE. Adds msg to the error message if it is present and not NIL.
false(actual, msg) @public  Logs an error when actual is TRUE. Adds msg to the error message if it is present and not NIL.
notNil<Tp>(p, msg) @public  Logs an error when p is NIL Adds msg to the error message if it is present and not NIL.
isNil<Tp>(p, msg) @public  Logs an error when p is not NIL Adds msg to the error message if it is present and not NIL.
notEmpty(p, msg) @public  Logs an error when p is an empty string. Adds msg to the error message if it is present and not NIL.
equal(expected, actual, msg) @public  Logs an error when expected and actual are not equal. Adds msg to the error message if it is present and not NIL.
equal(expected, actual, msg) @public  Logs an error when expected and actual are not equal. Adds msg to the error message if it is present and not NIL.
equal(expected, actual, msg) @public  Logs an error when expected and actual are not equal. Adds msg to the error message if it is present and not NIL.
equal(expected, actual, msg) @public  Logs an error when expected and actual are not equal. Adds msg to the error message if it is present and not NIL.
equal(expected, actual, msg) @public  Logs an error when expected and actual are not equal. Adds msg to the error message if it is present and not NIL.
equal(expected, actual, msg) @public  Logs an error when expected and actual are not equal. Adds msg to the error message if it is present and not NIL.
equal(expected, actual, msg) @public  Logs an error when expected and actual are not equal. Adds msg to the error message if it is present and not NIL.
equal(expected, actual, msg) @public  Logs an error when expected and actual are not equal. Adds msg to the error message if it is present and not NIL.
equal(expected, actual, msg) @public  Verify that expected and actual are equal. Adds msg to the error message if it is present and not NIL.
contains(expected, actual, msg) @public  Verify that expected is present somewhere in actual. Adds msg to the error message if it is present and not NIL.
shortDiff(expected, actual) string, string @public  Returns a short summary of the difference between expected and actual.
inRange(n, min, max, msg) @public  Logs an error when n < min and when n > max. Adds msg to the error message if it is present and not NIL.
 

members (alphabetically)

     

int failCount @public

int fileFailCount @public

int fileTestCount @public

string previousFileName @public

int testCount @public

PROC contains(string expected, string actual, string msg) @public

     

Verify that expected is present somewhere in actual. Adds msg to the error message if it is present and not NIL.

PROC equal(int expected, int actual, string msg) @public

     

Logs an error when expected and actual are not equal. Adds msg to the error message if it is present and not NIL.

PROC equal(nat expected, nat actual, string msg) @public

     

Logs an error when expected and actual are not equal. Adds msg to the error message if it is present and not NIL.

PROC equal(string expected, string actual, string msg) @public

     

Logs an error when expected and actual are not equal. Adds msg to the error message if it is present and not NIL.

PROC equal(byteString expected, byteString actual, string msg) @public

     

Logs an error when expected and actual are not equal. Adds msg to the error message if it is present and not NIL.

PROC equal(varString expected, varString actual, string msg) @public

     

Logs an error when expected and actual are not equal. Adds msg to the error message if it is present and not NIL.

PROC equal(varByteString expected, varByteString actual, string msg) @public

     

Logs an error when expected and actual are not equal. Adds msg to the error message if it is present and not NIL.

PROC equal(bool expected, bool actual, string msg) @public

     

Logs an error when expected and actual are not equal. Adds msg to the error message if it is present and not NIL.

PROC equal(status expected, status actual, string msg) @public

     

Logs an error when expected and actual are not equal. Adds msg to the error message if it is present and not NIL.

PROC equal(dyn expected, dyn actual, string msg) @public

     

Verify that expected and actual are equal. Adds msg to the error message if it is present and not NIL.

Both the types and the values must be equal.

PROC fail(string msg) @public

     

Logs error msg always.

Example:

    TEST.fail("should not be reached")

PROC false(bool actual, string msg) @public

     

Logs an error when actual is TRUE. Adds msg to the error message if it is present and not NIL.

Examples:

    TEST.false(value > 0)
    TEST.false(hasWord())
    TEST.false(hasWord(), "word should not be there")

PROC inRange(int n, int min, int max, string msg) @public

     

Logs an error when n < min and when n > max. Adds msg to the error message if it is present and not NIL.

PROC isNil<Tp>(Tp p, string msg) @public

     

Logs an error when p is not NIL Adds msg to the error message if it is present and not NIL.

PROC notEmpty(string p, string msg) @public

     

Logs an error when p is an empty string. Adds msg to the error message if it is present and not NIL.

Also checks for a NIL value of p.

PROC notNil<Tp>(Tp p, string msg) @public

     

Logs an error when p is NIL Adds msg to the error message if it is present and not NIL.

PROC reportFile() @public

FUNC shortDiff(string expected, string actual) string, string @public

     

Returns a short summary of the difference between expected and actual.

Square brackets are inserted to indicate the difference between the strings. Text longer than 10 characters is truncated and "..." is put in place of the removed text.

When expected or actual is NIL then the string "NIL" is returned and the other string shortened to about 20 characters.

PROC true(bool actual, string msg) @public

     

Logs an error when actual is FALSE. Adds msg to the error message if it is present and not NIL.

Examples:

    TEST.true(value > 0)
    TEST.true(hasWord())
    TEST.true(hasWord(), "word should be there")

license

      Copyright 2015 Bram Moolenaar All Rights Reserved.

      Licensed under the Apache License, Version 2.0. See the LICENSE file or obtain a copy at: http://www.apache.org/licenses/LICENSE-2.0