test/

directory
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2022 License: MIT

README

This directory contains integration tests for corgi files.

How to Run the Tests

Since corgi templates are compiled to Go functions, you must first run the preparation tests, which will generate the functions then used in the "real" tests.

All preparation tests have the prepare_integration_test build tag.

After generating, you may then run the integration test using the integration_test build tag.

You may also use the test.sh script, which will automatically build corgi, run the tests, and then will delete the generated functions.

When test.sh is run and a test fails, it will retain all generated functions to make debugging easier. To then delete the generated files, run rm_generated_files.sh.

Test Coverage

Because lexer, parser, linker, and writer are not tested individually, but all through the integration tests found in here, in order to obtain the test coverage of corgi, you must run the integration tests with the -coverpkg flag.

You may also run the codecov.sh utility script, which will print the current coverage of the preparation and integration tests to the terminal.

Optionally, you may also specify an -html flag to open a browser with a generated HTML report, for the preparation test.

Lastly, you may also specify the -coverprofile flag to generate to coverage profiles, prepare_coverage.txt and integration_coverage.txt, that contain coverage information for the preparation and integration tests, respectively.

-html and -coverprofile are mutually exclusive.

Directories

Path Synopsis
internal
compile
Package compile provides an utility function to compile files in preparation tests.
Package compile provides an utility function to compile files in preparation tests.
extra
Package extra provides variables, constants, types, and function to be imported by corgi files.
Package extra provides variables, constants, types, and function to be imported by corgi files.
outcheck
Package outcheck provides a utility to check if the output of a template function matches a file.
Package outcheck provides a utility to check if the output of a template function matches a file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL