You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Tom Alexander e54e20d254
Add a test case for casting booleans to numbers.
4 years ago
permanently_disabled_test_cases Add a template to dump the parameters to a custom helper. 4 years ago
test_cases Add a test case for casting booleans to numbers. 4 years ago Initial attempt at docker compliance tests. 4 years ago
dustjs_shim.js Add a template to dump the parameters to a custom helper. 4 years ago
run_compliance_suite.bash Add a script to run a single test to make development easier since I often want to focus on one test at a time. 4 years ago
run_dockerized_compliance_suite.bash Support passing args to the dockerized test runner 4 years ago
run_single_test.bash minor cleanup. 4 years ago

Compliance Tests

These tests run my implementation of LinkedIn's Dust and the official implementation of LinkedIn's DustJS as compares the output to ensure they match.

Running in Docker

Go to the root directory of this repository where there is a Dockerfile and run:

docker build -t duster . && docker run --rm -i -t duster

This command will run through the test cases in js/test_cases, comparing the output of the official LinkedIn DustJS implementation against the output of the duster implementation. If there are any differences, it will flag the test as a failure.

The tests have a structure of:

└── hello_world
    ├── input1.json
    ├── input2.json
    ├── main.dust
    └── partial.dust

The folder name hello_world is the name of the test group. For each test group there must be a file named main.dust. This file will be the top-level template that gets rendered. All other *.dust files will get registered into the dust rendering context as partials, with the same name as their file excluding the file extension. For example, main.dust could invoke partial.dust with {>partial/}. Each *.json file is a separate context that will be passed into the dust renderer, making each *.json file form a test inside the test group.

Running Manually


If you want to invoke the LinkedIn DustJS manually, the dustjs_shim expects the json context to be passed in over stdin, and a list of templates to be passed in as arguments, with the first argument serving as the main template. An example invocation from this folder would therefore be:

npm install dustjs-linkedin
cat test_cases/hello_world/input1.json | node dustjs_shim.js test_cases/hello_world/main.dust

Unlike the docker variant, there is no requirement for the template to be named main.dust since it will render the first argument as the main template. Running the same test case through the duster implementation would be:

npm install dustjs-linkedin
cat test_cases/hello_world/input1.json | ../target/debug/duster-cli test_cases/hello_world/main.dust


If you instead would like to run the entire compliance test suite manually outside of docker, you can run:

npm install dustjs-linkedin
(cd .. && cargo build)