4.76. kink/test/COLLECT_FROM_FILE

Collects tests from files.

Example:

:TEST.require_from('kink/test/')
:COLLECT_FROM_FILE.require_from('kink/test/')

:Tests <- TEST.collect_in{
  # Loads tests in test/kink/**/*_test.kn
  COLLECT_FROM_FILE.under('test/kink/')

  # Loads tests in ad-hoc.kn
  COLLECT_FROM_FILE.under('ad-hoc.kn')
}

Tests.each{(:T) T.run }

COLLECT_FROM_FILE is used by TEST_TOOL to load tests.

4.76.1. COLLECT_FROM_FILE.under(Path)

`under` collects tests under the path.

Preconditions:

• `under` must be called within invocation of TEST.collect_in.

• `Path` must be a str.

If `Path` is the path of file, `under` reads and compiles the file, and runs the program.

If `Path` is the path of a directory, `under` reads, compiles, and runs all the files named as *_test.kn under the directory and its subdirectories recursively. The name pattern matching is done case-insensitively. Thus, for example, a file named FOO_TEST.KN is also run.

`under` reads program files by UTF-8 charset.

In case of an IO error, or a compile error, `under` raises an exception. If a test program raises an exception, `under` justs propagates it.