Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 1.41 KB

jsonnet.org

File metadata and controls

38 lines (27 loc) · 1.41 KB

Testing Jsonnet

Jsonnet is the primary means to construct configuration files for WCT. It’s job is to build a data structure which can necessarily be very complex. WCT provides various low level Jsonnet functions as well as higher level structure builders. It can be useful to “lock” in expectation to guard against regression in those layers.

Running Jsonnet tests

A Jsonnet test may be compiled with the plain jsonnet command or with the WCT version wcsonnet. By default jsonnet is used. The two differ mostly in their defaults. The jsonnet command does not have the wire-cell-toolkit/cfg/ directory added to its search path - though it does when run as part of the WCT test framework. The wcsonnet will include any paths given in WIRECELL_PATH.

Basic Jsonnet tests

The most simple test is one that tests basic expected compilation without a need to locate additional files. For example:

jsonnet cfg/test/test_wirecell.jsonnet

others require resolving files that are import:

jsonnet -J cfg cfg/test/test_pgraph.jsonnet
wcsonnet cfg/test/test_pgraph.jsonnet

Assertions

Jsonnet provides an assert function. These should be sprinkled liberally throughout Jsonnet test code whenever it is possible to know what some intermediate data structure should be. See test_graph.jsonnet for an example.