Quantcast
Channel: OCaml - Topics tagged dune
Viewing all articles
Browse latest Browse all 545

Dune Cram tests with several file outputs

$
0
0

I want to test a script that produces 10 different files, and I wonder if Cram tests would be feasible, or if I should use something else.

My Cram test is basically $ run_script.exe <options>. It produces 10 different textual outputs, in predefined files. In theory I could add lines to my Cram test such as $ cat output1.txt, $ cat output2.json, etc, but I think it’s not a proper usage of the tool. Also, I’d like to avoid mixing all of the file contents in a single .t file.

I suppose I could copy the outputs produced in the sandboxed directory to the test directory and add them as oracles. So, for instance, manually do touch oracles/output1.txt, touch oracles/output2.json, etc, before running the test, and then add commands such as $ diff oracles/output1.txt output1.txt, etc, to the .t file. Is this proper usage of Cram tests? And is there a better way to do it?

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 545

Trending Articles