This document describes usage of the unit testing framework for uim
for developers.


* Abstract

  The unit tests for *.scm written for uim are in test/. They are run
  directly by uim-sh, using the SRFI-64 compatible unit testing
  framework of SigScheme (subprojects/sigscheme/lib/unittest.scm).

  Each test file is run by a separate uim-sh process with the
  following environment variables, so that the tests use the scm
  files and plugins in the source and build trees:

  - LIBUIM_SYSTEM_SCM_FILES: subprojects/sigscheme/lib
  - LIBUIM_SCM_FILES: scm
  - LIBUIM_PLUGIN_LIB_DIR: the directory that has the built plugins
  - LIBUIM_VANILLA: 1 to load neither the user configuration nor the
    IM modules on start up


* Usage

  Autotools:

    $ ./configure
    $ make
    $ make check

  Meson:

    $ meson setup build
    $ meson compile -C build
    $ meson test -C build

  Tests are enabled by default. They can be disabled by
  --disable-tests (Autotools) or -Dtests=disabled (Meson).


* Writing tests

  1) Copy test/test-template.scm to test/test-foo.scm

  2) Write tests as described in test/test-template.scm. Each test
     file is run in one uim-sh process, so make each test-begin block
     independent from the side effects of the other blocks.

  3) Add test-foo.scm to uim_tests in test/Makefile.am and to the
     list in test/meson.build. Tests that are expected to fail are
     also added to uim_xfail_tests in test/Makefile.am and marked as
     true in test/meson.build.
